From 6e4e9339776c878273c1df01844caaa86037c32d 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 +- bridges/modules/beefy/src/lib.rs | 2 +- bridges/modules/beefy/src/mock.rs | 2 +- bridges/modules/grandpa/src/mock.rs | 2 +- bridges/modules/grandpa/src/weights.rs | 26 +++---- bridges/modules/messages/src/mock.rs | 6 +- bridges/modules/messages/src/weights.rs | 74 +++++++++---------- bridges/modules/parachains/src/mock.rs | 2 +- bridges/modules/parachains/src/weights.rs | 34 +++++---- bridges/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 +- .../messages/src/message_race_delivery.rs | 16 ++-- 14 files changed, 99 insertions(+), 93 deletions(-) diff --git a/bridges/bin/runtime-common/src/refund_relayer_extension.rs b/bridges/bin/runtime-common/src/refund_relayer_extension.rs index 0a61f4fdd023f..7be97f19ad2ab 100644 --- a/bridges/bin/runtime-common/src/refund_relayer_extension.rs +++ b/bridges/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/bridges/modules/beefy/src/lib.rs b/bridges/modules/beefy/src/lib.rs index e05a4119463dc..a717acfe914fd 100644 --- a/bridges/modules/beefy/src/lib.rs +++ b/bridges/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/bridges/modules/beefy/src/mock.rs b/bridges/modules/beefy/src/mock.rs index 212c6c5d434bf..551800090f7d5 100644 --- a/bridges/modules/beefy/src/mock.rs +++ b/bridges/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/bridges/modules/grandpa/src/mock.rs b/bridges/modules/grandpa/src/mock.rs index f0ae2583529d5..acedfc3582c24 100644 --- a/bridges/modules/grandpa/src/mock.rs +++ b/bridges/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/bridges/modules/grandpa/src/weights.rs b/bridges/modules/grandpa/src/weights.rs index 8896674c0112f..089aee8b56951 100644 --- a/bridges/modules/grandpa/src/weights.rs +++ b/bridges/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/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index 084262c790532..a31ee2b940134 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/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/bridges/modules/messages/src/weights.rs b/bridges/modules/messages/src/weights.rs index 8a85c8e6b2d25..4b2e5b48ee256 100644 --- a/bridges/modules/messages/src/weights.rs +++ b/bridges/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/bridges/modules/parachains/src/mock.rs b/bridges/modules/parachains/src/mock.rs index aabcdcdd364ce..83d347018e45e 100644 --- a/bridges/modules/parachains/src/mock.rs +++ b/bridges/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/bridges/modules/parachains/src/weights.rs b/bridges/modules/parachains/src/weights.rs index cce2febcf4f0a..54a835cbc8738 100644 --- a/bridges/modules/parachains/src/weights.rs +++ b/bridges/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/bridges/modules/relayers/src/weights.rs b/bridges/modules/relayers/src/weights.rs index 5b6a70854e149..1f111aaf1367d 100644 --- a/bridges/modules/relayers/src/weights.rs +++ b/bridges/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/bridges/modules/shift-session-manager/src/lib.rs b/bridges/modules/shift-session-manager/src/lib.rs index dce6005ab549d..63656c81eed16 100644 --- a/bridges/modules/shift-session-manager/src/lib.rs +++ b/bridges/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/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs b/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs index 3a05cb48b3b87..cbdd36c2e4ae3 100644 --- a/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs +++ b/bridges/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/bridges/relays/messages/src/message_lane_loop.rs b/bridges/relays/messages/src/message_lane_loop.rs index 2903435dda5b8..0533e51d5db47 100644 --- a/bridges/relays/messages/src/message_lane_loop.rs +++ b/bridges/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/bridges/relays/messages/src/message_race_delivery.rs b/bridges/relays/messages/src/message_race_delivery.rs index 8b8e690ec4a2e..d25a2413b0db1 100644 --- a/bridges/relays/messages/src/message_race_delivery.rs +++ b/bridges/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(),