From c9a586490c3399f09519aa6bf6353f089a31edc2 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Thu, 2 Mar 2023 11:21:10 +0300 Subject: [PATCH] get rid of obsolete weight functions (#1926) --- .../src/refund_relayer_extension.rs | 6 +- modules/beefy/src/lib.rs | 2 +- modules/beefy/src/mock.rs | 2 +- modules/grandpa/src/mock.rs | 2 +- modules/grandpa/src/weights.rs | 26 +++---- modules/messages/src/mock.rs | 6 +- modules/messages/src/weights.rs | 74 +++++++++---------- modules/parachains/src/mock.rs | 2 +- modules/parachains/src/weights.rs | 34 +++++---- modules/relayers/src/weights.rs | 10 +-- modules/shift-session-manager/src/lib.rs | 2 +- .../chain-bridge-hub-cumulus/src/lib.rs | 6 +- relays/messages/src/message_lane_loop.rs | 4 +- relays/messages/src/message_race_delivery.rs | 16 ++-- 14 files changed, 99 insertions(+), 93 deletions(-) diff --git a/bin/runtime-common/src/refund_relayer_extension.rs b/bin/runtime-common/src/refund_relayer_extension.rs index 0a61f4fdd023..7be97f19ad2a 100644 --- a/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bin/runtime-common/src/refund_relayer_extension.rs @@ -746,8 +746,9 @@ mod tests { fn dispatch_info() -> DispatchInfo { DispatchInfo { - weight: Weight::from_ref_time( + weight: Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND, + 0, ), class: frame_support::dispatch::DispatchClass::Normal, pays_fee: frame_support::dispatch::Pays::Yes, @@ -1037,8 +1038,9 @@ mod tests { initialize_environment(200, 200, [1u8; 32].into(), 200); let mut dispatch_info = dispatch_info(); - dispatch_info.weight = Weight::from_ref_time( + dispatch_info.weight = Weight::from_parts( frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2, + 0, ); // without any size/weight refund: we expect regular reward diff --git a/modules/beefy/src/lib.rs b/modules/beefy/src/lib.rs index e05a4119463d..a717acfe914f 100644 --- a/modules/beefy/src/lib.rs +++ b/modules/beefy/src/lib.rs @@ -133,7 +133,7 @@ pub mod pallet { fn on_initialize(_n: T::BlockNumber) -> frame_support::weights::Weight { >::mutate(|count| *count = count.saturating_sub(1)); - Weight::from_ref_time(0) + Weight::from_parts(0, 0) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/modules/beefy/src/mock.rs b/modules/beefy/src/mock.rs index 212c6c5d434b..551800090f7d 100644 --- a/modules/beefy/src/mock.rs +++ b/modules/beefy/src/mock.rs @@ -72,7 +72,7 @@ construct_runtime! { } parameter_types! { - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/modules/grandpa/src/mock.rs b/modules/grandpa/src/mock.rs index f0ae2583529d..acedfc3582c2 100644 --- a/modules/grandpa/src/mock.rs +++ b/modules/grandpa/src/mock.rs @@ -54,7 +54,7 @@ construct_runtime! { } parameter_types! { - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/modules/grandpa/src/weights.rs b/modules/grandpa/src/weights.rs index 8896674c0112..089aee8b5695 100644 --- a/modules/grandpa/src/weights.rs +++ b/modules/grandpa/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_grandpa //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -100,12 +100,12 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `394 + p * (60 ±0)` // Estimated: `4745` - // Minimum execution time: 221_810 nanoseconds. - Weight::from_parts(33_157_392, 4745) - // Standard Error: 109_045 - .saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into())) - // Standard Error: 7_754 - .saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into())) + // Minimum execution time: 228_072 nanoseconds. + Weight::from_parts(57_853_228, 4745) + // Standard Error: 149_421 + .saturating_add(Weight::from_parts(36_708_702, 0).saturating_mul(p.into())) + // Standard Error: 10_625 + .saturating_add(Weight::from_parts(1_469_032, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(6_u64)) .saturating_add(T::DbWeight::get().writes(6_u64)) } @@ -155,12 +155,12 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `394 + p * (60 ±0)` // Estimated: `4745` - // Minimum execution time: 221_810 nanoseconds. - Weight::from_parts(33_157_392, 4745) - // Standard Error: 109_045 - .saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into())) - // Standard Error: 7_754 - .saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into())) + // Minimum execution time: 228_072 nanoseconds. + Weight::from_parts(57_853_228, 4745) + // Standard Error: 149_421 + .saturating_add(Weight::from_parts(36_708_702, 0).saturating_mul(p.into())) + // Standard Error: 10_625 + .saturating_add(Weight::from_parts(1_469_032, 0).saturating_mul(v.into())) .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(6_u64)) } diff --git a/modules/messages/src/mock.rs b/modules/messages/src/mock.rs index 084262c79053..a31ee2b94013 100644 --- a/modules/messages/src/mock.rs +++ b/modules/messages/src/mock.rs @@ -89,7 +89,7 @@ frame_support::construct_runtime! { parameter_types! { pub const BlockHashCount: u64 = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } @@ -410,7 +410,7 @@ pub const fn message_payload(id: u64, declared_weight: u64) -> TestPayload { TestPayload { id, reject_by_lane_verifier: false, - declared_weight: Weight::from_ref_time(declared_weight), + declared_weight: Weight::from_parts(declared_weight, 0), dispatch_result: dispatch_result(0), extra: Vec::new(), } @@ -421,7 +421,7 @@ pub const fn dispatch_result( unspent_weight: u64, ) -> MessageDispatchResult { MessageDispatchResult { - unspent_weight: Weight::from_ref_time(unspent_weight), + unspent_weight: Weight::from_parts(unspent_weight, 0), dispatch_level_result: (), } } diff --git a/modules/messages/src/weights.rs b/modules/messages/src/weights.rs index 8a85c8e6b2d2..4b2e5b48ee25 100644 --- a/modules/messages/src/weights.rs +++ b/modules/messages/src/weights.rs @@ -14,10 +14,10 @@ // You should have received a copy of the GNU General Public License // along with Parity Bridges Common. If not, see . -//! Autogenerated weights for pallet_bridge_messages +//! Autogenerated weights for RialtoMessages //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -29,7 +29,7 @@ // --chain=dev // --steps=50 // --repeat=20 -// --pallet=pallet_bridge_messages +// --pallet=RialtoMessages // --extrinsic=* // --execution=wasm // --wasm-execution=Compiled @@ -48,7 +48,7 @@ use frame_support::{ }; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_bridge_messages. +/// Weight functions needed for RialtoMessages. pub trait WeightInfo { fn receive_single_message_proof() -> Weight; fn receive_two_messages_proof() -> Weight; @@ -60,7 +60,7 @@ pub trait WeightInfo { fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight; } -/// Weights for `pallet_bridge_messages` that are generated using one of the Bridge testnets. +/// Weights for `RialtoMessages` that are generated using one of the Bridge testnets. /// /// Those weights are test only and must never be used in production. pub struct BridgeWeight(PhantomData); @@ -88,8 +88,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 48_426 nanoseconds. - Weight::from_parts(50_113_000, 54703) + // Minimum execution time: 48_058 nanoseconds. + Weight::from_parts(50_422_000, 54703) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -116,8 +116,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 59_739 nanoseconds. - Weight::from_parts(61_704_000, 54703) + // Minimum execution time: 59_371 nanoseconds. + Weight::from_parts(61_726_000, 54703) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -144,8 +144,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 53_760 nanoseconds. - Weight::from_parts(55_645_000, 54703) + // Minimum execution time: 53_398 nanoseconds. + Weight::from_parts(54_351_000, 54703) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -167,8 +167,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `618` // Estimated: `54200` - // Minimum execution time: 49_582 nanoseconds. - Weight::from_parts(51_250_000, 54200) + // Minimum execution time: 50_064 nanoseconds. + Weight::from_parts(51_306_000, 54200) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -190,8 +190,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `618` // Estimated: `54200` - // Minimum execution time: 76_418 nanoseconds. - Weight::from_parts(77_877_000, 54200) + // Minimum execution time: 75_403 nanoseconds. + Weight::from_parts(77_006_000, 54200) .saturating_add(T::DbWeight::get().reads(3_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } @@ -218,8 +218,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `579` // Estimated: `5624` - // Minimum execution time: 41_795 nanoseconds. - Weight::from_parts(43_683_000, 5624) + // Minimum execution time: 41_670 nanoseconds. + Weight::from_parts(42_863_000, 5624) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -246,8 +246,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `596` // Estimated: `5624` - // Minimum execution time: 39_946 nanoseconds. - Weight::from_parts(41_509_000, 5624) + // Minimum execution time: 40_928 nanoseconds. + Weight::from_parts(42_165_000, 5624) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -274,8 +274,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `596` // Estimated: `8164` - // Minimum execution time: 42_882 nanoseconds. - Weight::from_parts(44_367_000, 8164) + // Minimum execution time: 44_022 nanoseconds. + Weight::from_parts(44_657_000, 8164) .saturating_add(T::DbWeight::get().reads(5_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -306,8 +306,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 48_426 nanoseconds. - Weight::from_parts(50_113_000, 54703) + // Minimum execution time: 48_058 nanoseconds. + Weight::from_parts(50_422_000, 54703) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -334,8 +334,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 59_739 nanoseconds. - Weight::from_parts(61_704_000, 54703) + // Minimum execution time: 59_371 nanoseconds. + Weight::from_parts(61_726_000, 54703) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -362,8 +362,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `693` // Estimated: `54703` - // Minimum execution time: 53_760 nanoseconds. - Weight::from_parts(55_645_000, 54703) + // Minimum execution time: 53_398 nanoseconds. + Weight::from_parts(54_351_000, 54703) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -385,8 +385,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `618` // Estimated: `54200` - // Minimum execution time: 49_582 nanoseconds. - Weight::from_parts(51_250_000, 54200) + // Minimum execution time: 50_064 nanoseconds. + Weight::from_parts(51_306_000, 54200) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -408,8 +408,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `618` // Estimated: `54200` - // Minimum execution time: 76_418 nanoseconds. - Weight::from_parts(77_877_000, 54200) + // Minimum execution time: 75_403 nanoseconds. + Weight::from_parts(77_006_000, 54200) .saturating_add(RocksDbWeight::get().reads(3_u64)) .saturating_add(RocksDbWeight::get().writes(1_u64)) } @@ -436,8 +436,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `579` // Estimated: `5624` - // Minimum execution time: 41_795 nanoseconds. - Weight::from_parts(43_683_000, 5624) + // Minimum execution time: 41_670 nanoseconds. + Weight::from_parts(42_863_000, 5624) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -464,8 +464,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `596` // Estimated: `5624` - // Minimum execution time: 39_946 nanoseconds. - Weight::from_parts(41_509_000, 5624) + // Minimum execution time: 40_928 nanoseconds. + Weight::from_parts(42_165_000, 5624) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } @@ -492,8 +492,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `596` // Estimated: `8164` - // Minimum execution time: 42_882 nanoseconds. - Weight::from_parts(44_367_000, 8164) + // Minimum execution time: 44_022 nanoseconds. + Weight::from_parts(44_657_000, 8164) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } diff --git a/modules/parachains/src/mock.rs b/modules/parachains/src/mock.rs index aabcdcdd364c..83d347018e45 100644 --- a/modules/parachains/src/mock.rs +++ b/modules/parachains/src/mock.rs @@ -158,7 +158,7 @@ construct_runtime! { parameter_types! { pub const BlockHashCount: TestNumber = 250; - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/modules/parachains/src/weights.rs b/modules/parachains/src/weights.rs index cce2febcf4f0..54a835cbc873 100644 --- a/modules/parachains/src/weights.rs +++ b/modules/parachains/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_parachains //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -86,12 +86,14 @@ impl WeightInfo for BridgeWeight { /// Some(196), added: 1681, mode: MaxEncodedLen) /// /// The range of component `p` is `[1, 2]`. - fn submit_parachain_heads_with_n_parachains(_p: u32) -> Weight { + fn submit_parachain_heads_with_n_parachains(p: u32) -> Weight { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 36_567 nanoseconds. - Weight::from_parts(38_887_022, 4648) + // Minimum execution time: 36_701 nanoseconds. + Weight::from_parts(38_597_828, 4648) + // Standard Error: 190_859 + .saturating_add(Weight::from_parts(60_685, 0).saturating_mul(p.into())) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -123,8 +125,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 37_910 nanoseconds. - Weight::from_parts(38_967_000, 4648) + // Minimum execution time: 38_189 nanoseconds. + Weight::from_parts(39_252_000, 4648) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -156,8 +158,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 62_823 nanoseconds. - Weight::from_parts(64_658_000, 4648) + // Minimum execution time: 62_868 nanoseconds. + Weight::from_parts(63_581_000, 4648) .saturating_add(T::DbWeight::get().reads(4_u64)) .saturating_add(T::DbWeight::get().writes(3_u64)) } @@ -191,12 +193,14 @@ impl WeightInfo for () { /// Some(196), added: 1681, mode: MaxEncodedLen) /// /// The range of component `p` is `[1, 2]`. - fn submit_parachain_heads_with_n_parachains(_p: u32) -> Weight { + fn submit_parachain_heads_with_n_parachains(p: u32) -> Weight { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 36_567 nanoseconds. - Weight::from_parts(38_887_022, 4648) + // Minimum execution time: 36_701 nanoseconds. + Weight::from_parts(38_597_828, 4648) + // Standard Error: 190_859 + .saturating_add(Weight::from_parts(60_685, 0).saturating_mul(p.into())) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -228,8 +232,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 37_910 nanoseconds. - Weight::from_parts(38_967_000, 4648) + // Minimum execution time: 38_189 nanoseconds. + Weight::from_parts(39_252_000, 4648) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } @@ -261,8 +265,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `366` // Estimated: `4648` - // Minimum execution time: 62_823 nanoseconds. - Weight::from_parts(64_658_000, 4648) + // Minimum execution time: 62_868 nanoseconds. + Weight::from_parts(63_581_000, 4648) .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } diff --git a/modules/relayers/src/weights.rs b/modules/relayers/src/weights.rs index 5b6a70854e14..1f111aaf1367 100644 --- a/modules/relayers/src/weights.rs +++ b/modules/relayers/src/weights.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for pallet_bridge_relayers //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-03-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 @@ -71,8 +71,8 @@ impl WeightInfo for BridgeWeight { // Proof Size summary in bytes: // Measured: `275` // Estimated: `5111` - // Minimum execution time: 48_688 nanoseconds. - Weight::from_parts(50_457_000, 5111) + // Minimum execution time: 48_639 nanoseconds. + Weight::from_parts(49_600_000, 5111) .saturating_add(T::DbWeight::get().reads(2_u64)) .saturating_add(T::DbWeight::get().writes(2_u64)) } @@ -93,8 +93,8 @@ impl WeightInfo for () { // Proof Size summary in bytes: // Measured: `275` // Estimated: `5111` - // Minimum execution time: 48_688 nanoseconds. - Weight::from_parts(50_457_000, 5111) + // Minimum execution time: 48_639 nanoseconds. + Weight::from_parts(49_600_000, 5111) .saturating_add(RocksDbWeight::get().reads(2_u64)) .saturating_add(RocksDbWeight::get().writes(2_u64)) } diff --git a/modules/shift-session-manager/src/lib.rs b/modules/shift-session-manager/src/lib.rs index dce6005ab549..63656c81eed1 100644 --- a/modules/shift-session-manager/src/lib.rs +++ b/modules/shift-session-manager/src/lib.rs @@ -152,7 +152,7 @@ mod tests { } parameter_types! { - pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); + pub const MaximumBlockWeight: Weight = Weight::from_parts(1024, 0); pub const MaximumBlockLength: u32 = 2 * 1024; pub const AvailableBlockRatio: Perbill = Perbill::one(); } diff --git a/primitives/chain-bridge-hub-cumulus/src/lib.rs b/primitives/chain-bridge-hub-cumulus/src/lib.rs index 3a05cb48b3b8..cbdd36c2e4ae 100644 --- a/primitives/chain-bridge-hub-cumulus/src/lib.rs +++ b/primitives/chain-bridge-hub-cumulus/src/lib.rs @@ -45,7 +45,7 @@ pub const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); /// time. /// /// This is a copy-paste from the cumulus repo's `parachains-common` crate. -const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_SECOND) +const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_SECOND, 0) .saturating_div(2) .set_proof_size(polkadot_primitives::v2::MAX_POV_SIZE as u64); @@ -62,10 +62,10 @@ parameter_types! { ); /// Importing a block with 0 Extrinsics. - pub const BlockExecutionWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS) + pub const BlockExecutionWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS, 0) .saturating_mul(5_000_000); /// Executing a NO-OP `System::remarks` Extrinsic. - pub const ExtrinsicBaseWeight: Weight = Weight::from_ref_time(constants::WEIGHT_REF_TIME_PER_NANOS) + pub const ExtrinsicBaseWeight: Weight = Weight::from_parts(constants::WEIGHT_REF_TIME_PER_NANOS, 0) .saturating_mul(125_000); pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder() diff --git a/relays/messages/src/message_lane_loop.rs b/relays/messages/src/message_lane_loop.rs index 2903435dda5b..0533e51d5db4 100644 --- a/relays/messages/src/message_lane_loop.rs +++ b/relays/messages/src/message_lane_loop.rs @@ -723,7 +723,7 @@ pub(crate) mod tests { ( nonce, MessageDetails { - dispatch_weight: Weight::from_ref_time(1), + dispatch_weight: Weight::from_parts(1, 0), size: 1, reward: 1, }, @@ -949,7 +949,7 @@ pub(crate) mod tests { max_unrewarded_relayer_entries_at_target: 4, max_unconfirmed_nonces_at_target: 4, max_messages_in_single_batch: 4, - max_messages_weight_in_single_batch: Weight::from_ref_time(4), + max_messages_weight_in_single_batch: Weight::from_parts(4, 0), max_messages_size_in_single_batch: 4, }, }, diff --git a/relays/messages/src/message_race_delivery.rs b/relays/messages/src/message_race_delivery.rs index 8b8e690ec4a2..d25a2413b0db 100644 --- a/relays/messages/src/message_race_delivery.rs +++ b/relays/messages/src/message_race_delivery.rs @@ -588,7 +588,7 @@ mod tests { use super::*; - const DEFAULT_DISPATCH_WEIGHT: Weight = Weight::from_ref_time(1); + const DEFAULT_DISPATCH_WEIGHT: Weight = Weight::from_parts(1, 0); const DEFAULT_SIZE: u32 = 1; type TestRaceState = RaceState; @@ -632,7 +632,7 @@ mod tests { max_unrewarded_relayer_entries_at_target: 4, max_unconfirmed_nonces_at_target: 4, max_messages_in_single_batch: 4, - max_messages_weight_in_single_batch: Weight::from_ref_time(4), + max_messages_weight_in_single_batch: Weight::from_parts(4, 0), max_messages_size_in_single_batch: 4, latest_confirmed_nonces_at_source: vec![(header_id(1), 19)].into_iter().collect(), lane_source_client: TestSourceClient::default(), @@ -671,7 +671,7 @@ mod tests { fn proof_parameters(state_required: bool, weight: u32) -> MessageProofParameters { MessageProofParameters { outbound_state_proof_required: state_required, - dispatch_weight: Weight::from_ref_time(weight as u64), + dispatch_weight: Weight::from_parts(weight as u64, 0), } } @@ -685,7 +685,7 @@ mod tests { ( idx, MessageDetails { - dispatch_weight: Weight::from_ref_time(idx), + dispatch_weight: Weight::from_parts(idx, 0), size: idx as _, reward: idx as _, }, @@ -813,7 +813,7 @@ mod tests { let (state, mut strategy) = prepare_strategy(); // not all queued messages may fit in the batch, because batch has max weight - strategy.max_messages_weight_in_single_batch = Weight::from_ref_time(3); + strategy.max_messages_weight_in_single_batch = Weight::from_parts(3, 0); assert_eq!( strategy.select_nonces_to_deliver(state).await, Some(((20..=22), proof_parameters(false, 3))) @@ -828,7 +828,7 @@ mod tests { // first message doesn't fit in the batch, because it has weight (10) that overflows max // weight (4) strategy.strategy.source_queue_mut()[0].1.get_mut(&20).unwrap().dispatch_weight = - Weight::from_ref_time(10); + Weight::from_parts(10, 0); assert_eq!( strategy.select_nonces_to_deliver(state).await, Some(((20..=20), proof_parameters(false, 10))) @@ -1014,7 +1014,7 @@ mod tests { strategy.max_unrewarded_relayer_entries_at_target = 100; strategy.max_unconfirmed_nonces_at_target = 100; strategy.max_messages_in_single_batch = 5; - strategy.max_messages_weight_in_single_batch = Weight::from_ref_time(100); + strategy.max_messages_weight_in_single_batch = Weight::from_parts(100, 0); strategy.max_messages_size_in_single_batch = 100; state.best_finalized_source_header_id_at_best_target = Some(header_id(2)); @@ -1031,7 +1031,7 @@ mod tests { max_unrewarded_relayer_entries_at_target: 4, max_unconfirmed_nonces_at_target: 4, max_messages_in_single_batch: 4, - max_messages_weight_in_single_batch: Weight::from_ref_time(4), + max_messages_weight_in_single_batch: Weight::from_parts(4, 0), max_messages_size_in_single_batch: 4, latest_confirmed_nonces_at_source: VecDeque::new(), lane_source_client: TestSourceClient::default(),