Skip to content

Commit 9affb5a

Browse files
authored
chore(upgrade): v1.6.0 to v1.7.0 (#2066)
- Upgrade Polkadot-sdk to v.1.7.0. - Update weights to reflect the new version. Notable Changes: - [Allow custom error types in Jsonrpsee](paritytech/polkadot-sdk#1313) For more details, please refer to: [Release Notes](https://github.com/paritytech/polkadot-sdk/releases/tag/polkadot-v1.7.0) #1870
1 parent c8b60fb commit 9affb5a

File tree

46 files changed

+1848
-1806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1848
-1806
lines changed

Cargo.lock

Lines changed: 896 additions & 874 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 99 additions & 99 deletions
Large diffs are not rendered by default.

common/helpers/src/rpc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
use core::result::Result as CoreResult;
22
use jsonrpsee::{
3-
core::{Error as RpcError, RpcResult},
4-
types::error::{CallError, ErrorCode, ErrorObject},
3+
core::RpcResult,
4+
types::error::{ErrorCode, ErrorObject},
55
};
66
use sp_api::ApiError;
77

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

node/service/src/block_sealing.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub fn frequency_dev_sealing(
187187
false => None,
188188
};
189189

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

198198
crate::rpc::create_full(deps, backend.clone()).map_err(Into::into)
199-
}
199+
})
200200
};
201201

202202
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
203-
rpc_builder: Box::new(rpc_extensions_builder),
203+
rpc_builder: rpc_extensions_builder,
204204
client: client.clone(),
205205
transaction_pool: transaction_pool.clone(),
206206
task_manager: &mut task_manager,

node/service/src/rpc/frequency_rpc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use common_primitives::rpc::RpcEvent;
1111
use jsonrpsee::{
1212
core::{async_trait, RpcResult},
1313
proc_macros::rpc,
14-
types::error::{CallError, ErrorObject},
14+
types::error::ErrorObject,
1515
};
1616
use parity_scale_codec::{Codec, Decode, Encode};
1717
use sc_transaction_pool_api::{InPoolTransaction, TransactionPool};
@@ -73,9 +73,9 @@ where
7373
let api = self.client.runtime_api();
7474
let best = self.client.info().best_hash;
7575

76-
let nonce = api.account_nonce(best, account.clone()).map_err(|e| {
77-
CallError::Custom(ErrorObject::owned(1, "Unable to query nonce.", Some(e.to_string())))
78-
})?;
76+
let nonce = api
77+
.account_nonce(best, account.clone())
78+
.map_err(|e| ErrorObject::owned(1, "Unable to query nonce.", Some(e.to_string())))?;
7979
Ok(get_missing_nonces(&*self.pool, account, nonce))
8080
}
8181
}

node/service/src/service.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ fn start_consensus(
505505
proposer,
506506
collator_service,
507507
authoring_duration: Duration::from_millis(1500),
508+
reinitialize: false,
508509
};
509510

510511
let fut =

pallets/capacity/src/tests/mock.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ impl pallet_balances::Config for Test {
6767
type WeightInfo = ();
6868
type FreezeIdentifier = RuntimeFreezeReason;
6969
type MaxFreezes = ConstU32<1>;
70-
type MaxHolds = ConstU32<0>;
7170
type RuntimeHoldReason = ();
7271
type RuntimeFreezeReason = ();
7372
}

pallets/capacity/src/weights.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
//! Autogenerated weights for `pallet_capacity`
33
//!
4-
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
5-
//! DATE: 2024-06-27, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
5+
//! DATE: 2024-07-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
66
//! WORST CASE MAP SIZE: `1000000`
7-
//! HOSTNAME: `ip-10-173-11-138`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
7+
//! HOSTNAME: `ip-10-173-5-189`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
88
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`
99
1010
// Executed Command:
@@ -61,8 +61,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
6161
// Proof Size summary in bytes:
6262
// Measured: `174`
6363
// Estimated: `6249`
64-
// Minimum execution time: 35_780_000 picoseconds.
65-
Weight::from_parts(36_737_000, 6249)
64+
// Minimum execution time: 37_004_000 picoseconds.
65+
Weight::from_parts(37_516_000, 6249)
6666
.saturating_add(T::DbWeight::get().reads(7_u64))
6767
.saturating_add(T::DbWeight::get().writes(4_u64))
6868
}
@@ -78,8 +78,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
7878
// Proof Size summary in bytes:
7979
// Measured: `285`
8080
// Estimated: `6249`
81-
// Minimum execution time: 24_827_000 picoseconds.
82-
Weight::from_parts(25_463_000, 6249)
81+
// Minimum execution time: 25_485_000 picoseconds.
82+
Weight::from_parts(26_449_000, 6249)
8383
.saturating_add(T::DbWeight::get().reads(4_u64))
8484
.saturating_add(T::DbWeight::get().writes(2_u64))
8585
}
@@ -91,8 +91,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
9191
// Proof Size summary in bytes:
9292
// Measured: `0`
9393
// Estimated: `2974`
94-
// Minimum execution time: 2_272_000 picoseconds.
95-
Weight::from_parts(2_384_000, 2974)
94+
// Minimum execution time: 2_327_000 picoseconds.
95+
Weight::from_parts(2_446_000, 2974)
9696
.saturating_add(T::DbWeight::get().reads(2_u64))
9797
.saturating_add(T::DbWeight::get().writes(1_u64))
9898
}
@@ -108,8 +108,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
108108
// Proof Size summary in bytes:
109109
// Measured: `271`
110110
// Estimated: `5071`
111-
// Minimum execution time: 23_943_000 picoseconds.
112-
Weight::from_parts(24_949_000, 5071)
111+
// Minimum execution time: 24_044_000 picoseconds.
112+
Weight::from_parts(25_140_000, 5071)
113113
.saturating_add(T::DbWeight::get().reads(4_u64))
114114
.saturating_add(T::DbWeight::get().writes(4_u64))
115115
}
@@ -119,8 +119,8 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
119119
// Proof Size summary in bytes:
120120
// Measured: `0`
121121
// Estimated: `0`
122-
// Minimum execution time: 4_069_000 picoseconds.
123-
Weight::from_parts(4_348_000, 0)
122+
// Minimum execution time: 4_537_000 picoseconds.
123+
Weight::from_parts(4_889_000, 0)
124124
.saturating_add(T::DbWeight::get().writes(1_u64))
125125
}
126126
}
@@ -145,8 +145,8 @@ impl WeightInfo for () {
145145
// Proof Size summary in bytes:
146146
// Measured: `174`
147147
// Estimated: `6249`
148-
// Minimum execution time: 35_780_000 picoseconds.
149-
Weight::from_parts(36_737_000, 6249)
148+
// Minimum execution time: 37_004_000 picoseconds.
149+
Weight::from_parts(37_516_000, 6249)
150150
.saturating_add(RocksDbWeight::get().reads(7_u64))
151151
.saturating_add(RocksDbWeight::get().writes(4_u64))
152152
}
@@ -162,8 +162,8 @@ impl WeightInfo for () {
162162
// Proof Size summary in bytes:
163163
// Measured: `285`
164164
// Estimated: `6249`
165-
// Minimum execution time: 24_827_000 picoseconds.
166-
Weight::from_parts(25_463_000, 6249)
165+
// Minimum execution time: 25_485_000 picoseconds.
166+
Weight::from_parts(26_449_000, 6249)
167167
.saturating_add(RocksDbWeight::get().reads(4_u64))
168168
.saturating_add(RocksDbWeight::get().writes(2_u64))
169169
}
@@ -175,8 +175,8 @@ impl WeightInfo for () {
175175
// Proof Size summary in bytes:
176176
// Measured: `0`
177177
// Estimated: `2974`
178-
// Minimum execution time: 2_272_000 picoseconds.
179-
Weight::from_parts(2_384_000, 2974)
178+
// Minimum execution time: 2_327_000 picoseconds.
179+
Weight::from_parts(2_446_000, 2974)
180180
.saturating_add(RocksDbWeight::get().reads(2_u64))
181181
.saturating_add(RocksDbWeight::get().writes(1_u64))
182182
}
@@ -192,8 +192,8 @@ impl WeightInfo for () {
192192
// Proof Size summary in bytes:
193193
// Measured: `271`
194194
// Estimated: `5071`
195-
// Minimum execution time: 23_943_000 picoseconds.
196-
Weight::from_parts(24_949_000, 5071)
195+
// Minimum execution time: 24_044_000 picoseconds.
196+
Weight::from_parts(25_140_000, 5071)
197197
.saturating_add(RocksDbWeight::get().reads(4_u64))
198198
.saturating_add(RocksDbWeight::get().writes(4_u64))
199199
}
@@ -203,8 +203,8 @@ impl WeightInfo for () {
203203
// Proof Size summary in bytes:
204204
// Measured: `0`
205205
// Estimated: `0`
206-
// Minimum execution time: 4_069_000 picoseconds.
207-
Weight::from_parts(4_348_000, 0)
206+
// Minimum execution time: 4_537_000 picoseconds.
207+
Weight::from_parts(4_889_000, 0)
208208
.saturating_add(RocksDbWeight::get().writes(1_u64))
209209
}
210210
}

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
use std::{convert::TryInto, sync::Arc};
2121

2222
use jsonrpsee::{
23-
core::{async_trait, Error as JsonRpseeError, RpcResult},
23+
core::{async_trait, RpcResult},
2424
proc_macros::rpc,
25-
types::{
26-
error::{CallError, ErrorCode},
27-
ErrorObject,
28-
},
25+
types::{error::ErrorCode, ErrorObject},
2926
};
3027
use pallet_frequency_tx_payment_runtime_api::{FeeDetails, InclusionFee};
3128
use parity_scale_codec::{Codec, Decode};
@@ -102,27 +99,27 @@ where
10299

103100
let encoded_len = encoded_xt.len() as u32;
104101
let uxt: Block::Extrinsic = Decode::decode(&mut &*encoded_xt).map_err(|e| {
105-
CallError::Custom(ErrorObject::owned(
102+
ErrorObject::owned(
106103
Error::DecodeError.into(),
107104
"Unable to query capacity fee details.",
108105
Some(format!("{:?}", e)),
109-
))
106+
)
110107
})?;
111108
let fee_details = api.compute_capacity_fee(at_hash, uxt, encoded_len).map_err(|e| {
112-
CallError::Custom(ErrorObject::owned(
109+
ErrorObject::owned(
113110
Error::RuntimeError.into(),
114111
"Unable to query capacity fee details.",
115112
Some(format!("{:?}", e)),
116-
))
113+
)
117114
})?;
118115

119116
let try_into_rpc_balance = |value: Balance| {
120117
value.try_into().map_err(|_| {
121-
JsonRpseeError::Call(CallError::Custom(ErrorObject::owned(
118+
ErrorObject::owned(
122119
ErrorCode::InvalidParams.code(),
123120
format!("{} doesn't fit in NumberOrHex representation", value),
124121
None::<()>,
125-
)))
122+
)
126123
})
127124
};
128125

pallets/frequency-tx-payment/src/tests/mock.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ impl pallet_balances::Config for Test {
9595
type FreezeIdentifier = RuntimeFreezeReason;
9696
type RuntimeFreezeReason = ();
9797
type MaxFreezes = ConstU32<1>;
98-
type MaxHolds = ConstU32<0>;
9998
type RuntimeHoldReason = ();
10099
}
101100

pallets/frequency-tx-payment/src/weights.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

22
//! Autogenerated weights for `pallet_frequency_tx_payment`
33
//!
4-
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
5-
//! DATE: 2024-06-27, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
5+
//! DATE: 2024-07-11, STEPS: `20`, REPEAT: `10`, LOW RANGE: `[]`, HIGH RANGE: `[]`
66
//! WORST CASE MAP SIZE: `1000000`
7-
//! HOSTNAME: `ip-10-173-11-138`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
7+
//! HOSTNAME: `ip-10-173-5-189`, CPU: `Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz`
88
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("frequency-bench")`, DB CACHE: `1024`
99
1010
// Executed Command:
@@ -44,18 +44,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
4444
// Proof Size summary in bytes:
4545
// Measured: `0`
4646
// Estimated: `0`
47-
// Minimum execution time: 3_154_000 picoseconds.
48-
Weight::from_parts(3_326_000, 0)
47+
// Minimum execution time: 3_236_000 picoseconds.
48+
Weight::from_parts(3_421_000, 0)
4949
}
5050
/// The range of component `n` is `[0, 10]`.
5151
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
5252
// Proof Size summary in bytes:
5353
// Measured: `0`
5454
// Estimated: `0`
55-
// Minimum execution time: 5_117_000 picoseconds.
56-
Weight::from_parts(6_107_676, 0)
57-
// Standard Error: 11_748
58-
.saturating_add(Weight::from_parts(3_023_884, 0).saturating_mul(n.into()))
55+
// Minimum execution time: 5_256_000 picoseconds.
56+
Weight::from_parts(6_282_904, 0)
57+
// Standard Error: 13_079
58+
.saturating_add(Weight::from_parts(3_083_520, 0).saturating_mul(n.into()))
5959
}
6060
}
6161

@@ -65,18 +65,18 @@ impl WeightInfo for () {
6565
// Proof Size summary in bytes:
6666
// Measured: `0`
6767
// Estimated: `0`
68-
// Minimum execution time: 3_154_000 picoseconds.
69-
Weight::from_parts(3_326_000, 0)
68+
// Minimum execution time: 3_236_000 picoseconds.
69+
Weight::from_parts(3_421_000, 0)
7070
}
7171
/// The range of component `n` is `[0, 10]`.
7272
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
7373
// Proof Size summary in bytes:
7474
// Measured: `0`
7575
// Estimated: `0`
76-
// Minimum execution time: 5_117_000 picoseconds.
77-
Weight::from_parts(6_107_676, 0)
78-
// Standard Error: 11_748
79-
.saturating_add(Weight::from_parts(3_023_884, 0).saturating_mul(n.into()))
76+
// Minimum execution time: 5_256_000 picoseconds.
77+
Weight::from_parts(6_282_904, 0)
78+
// Standard Error: 13_079
79+
.saturating_add(Weight::from_parts(3_083_520, 0).saturating_mul(n.into()))
8080
}
8181
}
8282

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ use common_primitives::{
1717
msa::MessageSourceId,
1818
};
1919
use jsonrpsee::{
20-
core::{async_trait, Error as RpcError, RpcResult},
20+
core::{async_trait, RpcResult},
2121
proc_macros::rpc,
22+
types::{error::ErrorObjectOwned, ErrorObject},
2223
};
2324
use pallet_handles_runtime_api::HandlesRuntimeApi;
2425
use sp_api::ProvideRuntimeApi;
@@ -73,9 +74,13 @@ pub enum HandlesRpcError {
7374
InvalidHandle,
7475
}
7576

76-
impl From<HandlesRpcError> for RpcError {
77+
impl From<HandlesRpcError> for ErrorObjectOwned {
7778
fn from(e: HandlesRpcError) -> Self {
78-
RpcError::Custom(format!("{:?}", e))
79+
let msg = format!("{:?}", e);
80+
81+
match e {
82+
HandlesRpcError::InvalidHandle => ErrorObject::owned(1, msg, None::<()>),
83+
}
7984
}
8085
}
8186

pallets/handles/src/rpc/src/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ sp_api::mock_impl_runtime_apis! {
4343
}
4444
}
4545

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

4848
#[tokio::test]
4949
async fn get_handle_with_non_existent_msa_id_should_return_none() {

0 commit comments

Comments
 (0)