Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(upgrade): v1.6.0 to v1.7.0 #2066

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,770 changes: 896 additions & 874 deletions Cargo.lock

Large diffs are not rendered by default.

198 changes: 99 additions & 99 deletions Cargo.toml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions common/helpers/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use core::result::Result as CoreResult;
use jsonrpsee::{
core::{Error as RpcError, RpcResult},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love removing an as

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂

types::error::{CallError, ErrorCode, ErrorObject},
core::RpcResult,
types::error::{ErrorCode, ErrorObject},
};
use sp_api::ApiError;

/// Converts CoreResult to Result for RPC calls
pub fn map_rpc_result<T>(response: CoreResult<T, ApiError>) -> RpcResult<T> {
match response {
Ok(res) => Ok(res),
Err(e) => Err(RpcError::Call(CallError::Custom(ErrorObject::owned(
Err(e) => Err(ErrorObject::owned(
ErrorCode::ServerError(300).code(), // No real reason for this value
"Api Error",
Some(format!("{:?}", e)),
)))),
)),
}
}

Expand Down
6 changes: 3 additions & 3 deletions node/service/src/block_sealing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ pub fn frequency_dev_sealing(
false => None,
};

move |deny_unsafe, _| {
Box::new(move |deny_unsafe, _| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: transaction_pool.clone(),
Expand All @@ -196,11 +196,11 @@ pub fn frequency_dev_sealing(
};

crate::rpc::create_full(deps, backend.clone()).map_err(Into::into)
}
})
};

sc_service::spawn_tasks(sc_service::SpawnTasksParams {
rpc_builder: Box::new(rpc_extensions_builder),
rpc_builder: rpc_extensions_builder,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
task_manager: &mut task_manager,
Expand Down
8 changes: 4 additions & 4 deletions node/service/src/rpc/frequency_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use common_primitives::rpc::RpcEvent;
use jsonrpsee::{
core::{async_trait, RpcResult},
proc_macros::rpc,
types::error::{CallError, ErrorObject},
types::error::ErrorObject,
};
use parity_scale_codec::{Codec, Decode, Encode};
use sc_transaction_pool_api::{InPoolTransaction, TransactionPool};
Expand Down Expand Up @@ -73,9 +73,9 @@ where
let api = self.client.runtime_api();
let best = self.client.info().best_hash;

let nonce = api.account_nonce(best, account.clone()).map_err(|e| {
CallError::Custom(ErrorObject::owned(1, "Unable to query nonce.", Some(e.to_string())))
})?;
let nonce = api
.account_nonce(best, account.clone())
.map_err(|e| ErrorObject::owned(1, "Unable to query nonce.", Some(e.to_string())))?;
Ok(get_missing_nonces(&*self.pool, account, nonce))
}
}
Expand Down
1 change: 1 addition & 0 deletions node/service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ fn start_consensus(
proposer,
collator_service,
authoring_duration: Duration::from_millis(1500),
reinitialize: false,
};

let fut =
Expand Down
1 change: 0 additions & 1 deletion pallets/capacity/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ impl pallet_balances::Config for Test {
type WeightInfo = ();
type FreezeIdentifier = RuntimeFreezeReason;
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<0>;
type RuntimeHoldReason = ();
type RuntimeFreezeReason = ();
}
Expand Down
46 changes: 23 additions & 23 deletions pallets/capacity/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

//! Autogenerated weights for `pallet_capacity`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-06-27, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-07-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-173-11-138`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! HOSTNAME: `ip-10-173-5-189`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`

// Executed Command:
Expand Down Expand Up @@ -61,8 +61,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6249`
// Minimum execution time: 35_780_000 picoseconds.
Weight::from_parts(36_737_000, 6249)
// Minimum execution time: 37_004_000 picoseconds.
Weight::from_parts(37_516_000, 6249)
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -78,8 +78,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `285`
// Estimated: `6249`
// Minimum execution time: 24_827_000 picoseconds.
Weight::from_parts(25_463_000, 6249)
// Minimum execution time: 25_485_000 picoseconds.
Weight::from_parts(26_449_000, 6249)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(2_u64))
}
Expand All @@ -91,8 +91,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `2974`
// Minimum execution time: 2_272_000 picoseconds.
Weight::from_parts(2_384_000, 2974)
// Minimum execution time: 2_327_000 picoseconds.
Weight::from_parts(2_446_000, 2974)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
}
Expand All @@ -108,8 +108,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `271`
// Estimated: `5071`
// Minimum execution time: 23_943_000 picoseconds.
Weight::from_parts(24_949_000, 5071)
// Minimum execution time: 24_044_000 picoseconds.
Weight::from_parts(25_140_000, 5071)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
}
Expand All @@ -119,8 +119,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_069_000 picoseconds.
Weight::from_parts(4_348_000, 0)
// Minimum execution time: 4_537_000 picoseconds.
Weight::from_parts(4_889_000, 0)
.saturating_add(T::DbWeight::get().writes(1_u64))
}
}
Expand All @@ -145,8 +145,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `174`
// Estimated: `6249`
// Minimum execution time: 35_780_000 picoseconds.
Weight::from_parts(36_737_000, 6249)
// Minimum execution time: 37_004_000 picoseconds.
Weight::from_parts(37_516_000, 6249)
.saturating_add(RocksDbWeight::get().reads(7_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -162,8 +162,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `285`
// Estimated: `6249`
// Minimum execution time: 24_827_000 picoseconds.
Weight::from_parts(25_463_000, 6249)
// Minimum execution time: 25_485_000 picoseconds.
Weight::from_parts(26_449_000, 6249)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(2_u64))
}
Expand All @@ -175,8 +175,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `2974`
// Minimum execution time: 2_272_000 picoseconds.
Weight::from_parts(2_384_000, 2974)
// Minimum execution time: 2_327_000 picoseconds.
Weight::from_parts(2_446_000, 2974)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
Expand All @@ -192,8 +192,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `271`
// Estimated: `5071`
// Minimum execution time: 23_943_000 picoseconds.
Weight::from_parts(24_949_000, 5071)
// Minimum execution time: 24_044_000 picoseconds.
Weight::from_parts(25_140_000, 5071)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().writes(4_u64))
}
Expand All @@ -203,8 +203,8 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_069_000 picoseconds.
Weight::from_parts(4_348_000, 0)
// Minimum execution time: 4_537_000 picoseconds.
Weight::from_parts(4_889_000, 0)
.saturating_add(RocksDbWeight::get().writes(1_u64))
}
}
Expand Down
19 changes: 8 additions & 11 deletions pallets/frequency-tx-payment/src/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
use std::{convert::TryInto, sync::Arc};

use jsonrpsee::{
core::{async_trait, Error as JsonRpseeError, RpcResult},
core::{async_trait, RpcResult},
proc_macros::rpc,
types::{
error::{CallError, ErrorCode},
ErrorObject,
},
types::{error::ErrorCode, ErrorObject},
};
use pallet_frequency_tx_payment_runtime_api::{FeeDetails, InclusionFee};
use parity_scale_codec::{Codec, Decode};
Expand Down Expand Up @@ -102,27 +99,27 @@

let encoded_len = encoded_xt.len() as u32;
let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| {
CallError::Custom(ErrorObject::owned(
ErrorObject::owned(
Error::DecodeError.into(),
"Unable to query capacity fee details.",
Some(format!("{:?}", e)),
))
)
})?;
let fee_details = api.compute_capacity_fee(at_hash, uxt, encoded_len).map_err(|e| {
CallError::Custom(ErrorObject::owned(
ErrorObject::owned(

Check warning on line 109 in pallets/frequency-tx-payment/src/rpc/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/frequency-tx-payment/src/rpc/src/lib.rs#L109

Added line #L109 was not covered by tests
Error::RuntimeError.into(),
"Unable to query capacity fee details.",
Some(format!("{:?}", e)),
))
)
})?;

let try_into_rpc_balance = |value: Balance| {
value.try_into().map_err(|_| {
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
ErrorObject::owned(

Check warning on line 118 in pallets/frequency-tx-payment/src/rpc/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/frequency-tx-payment/src/rpc/src/lib.rs#L118

Added line #L118 was not covered by tests
ErrorCode::InvalidParams.code(),
format!("{} doesn't fit in NumberOrHex representation", value),
None::<()>,
)))
)
})
};

Expand Down
1 change: 0 additions & 1 deletion pallets/frequency-tx-payment/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
type FreezeIdentifier = RuntimeFreezeReason;
type RuntimeFreezeReason = ();
type MaxFreezes = ConstU32<1>;
type MaxHolds = ConstU32<0>;
type RuntimeHoldReason = ();
}

Expand Down
30 changes: 15 additions & 15 deletions pallets/frequency-tx-payment/src/weights.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

//! Autogenerated weights for `pallet_frequency_tx_payment`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2024-06-27, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-07-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `ip-10-173-11-138`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! HOSTNAME: `ip-10-173-5-189`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`

// Executed Command:
Expand Down Expand Up @@ -44,18 +44,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_154_000 picoseconds.
Weight::from_parts(3_326_000, 0)
// Minimum execution time: 3_236_000 picoseconds.
Weight::from_parts(3_421_000, 0)
}
/// The range of component `n` is `[0, 10]`.
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_117_000 picoseconds.
Weight::from_parts(6_107_676, 0)
// Standard Error: 11_748
.saturating_add(Weight::from_parts(3_023_884, 0).saturating_mul(n.into()))
// Minimum execution time: 5_256_000 picoseconds.
Weight::from_parts(6_282_904, 0)
// Standard Error: 13_079
.saturating_add(Weight::from_parts(3_083_520, 0).saturating_mul(n.into()))
}
}

Expand All @@ -65,18 +65,18 @@ impl WeightInfo for () {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_154_000 picoseconds.
Weight::from_parts(3_326_000, 0)
// Minimum execution time: 3_236_000 picoseconds.
Weight::from_parts(3_421_000, 0)
}
/// The range of component `n` is `[0, 10]`.
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_117_000 picoseconds.
Weight::from_parts(6_107_676, 0)
// Standard Error: 11_748
.saturating_add(Weight::from_parts(3_023_884, 0).saturating_mul(n.into()))
// Minimum execution time: 5_256_000 picoseconds.
Weight::from_parts(6_282_904, 0)
// Standard Error: 13_079
.saturating_add(Weight::from_parts(3_083_520, 0).saturating_mul(n.into()))
}
}

Expand Down
11 changes: 8 additions & 3 deletions pallets/handles/src/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
msa::MessageSourceId,
};
use jsonrpsee::{
core::{async_trait, Error as RpcError, RpcResult},
core::{async_trait, RpcResult},
proc_macros::rpc,
types::{error::ErrorObjectOwned, ErrorObject},
};
use pallet_handles_runtime_api::HandlesRuntimeApi;
use sp_api::ProvideRuntimeApi;
Expand Down Expand Up @@ -73,9 +74,13 @@
InvalidHandle,
}

impl From<HandlesRpcError> for RpcError {
impl From<HandlesRpcError> for ErrorObjectOwned {
fn from(e: HandlesRpcError) -> Self {
RpcError::Custom(format!("{:?}", e))
let msg = format!("{:?}", e);

Check warning on line 79 in pallets/handles/src/rpc/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/handles/src/rpc/src/lib.rs#L79

Added line #L79 was not covered by tests

match e {
HandlesRpcError::InvalidHandle => ErrorObject::owned(1, msg, None::<()>),

Check warning on line 82 in pallets/handles/src/rpc/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/handles/src/rpc/src/lib.rs#L82

Added line #L82 was not covered by tests
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/handles/src/rpc/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ sp_api::mock_impl_runtime_apis! {
}
}

type HandleResult = Result<Option<HandleResponse>, jsonrpsee::core::Error>;
type HandleResult = Result<Option<HandleResponse>, jsonrpsee::types::ErrorObjectOwned>;

#[tokio::test]
async fn get_handle_with_non_existent_msa_id_should_return_none() {
Expand Down
Loading