Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Migrate to Weight::from_parts #6794

Merged
merged 4 commits into from
Mar 2, 2023
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
369 changes: 183 additions & 186 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions runtime/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ mod tests {
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: limits::BlockWeights = limits::BlockWeights::builder()
.base_block(Weight::from_ref_time(10))
.base_block(Weight::from_parts(10, 0))
.for_class(DispatchClass::all(), |weight| {
weight.base_extrinsic = Weight::from_ref_time(100);
weight.base_extrinsic = Weight::from_parts(100, 0);
})
.for_class(DispatchClass::non_mandatory(), |weight| {
weight.max_total = Some(Weight::from_parts(1024, u64::MAX));
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/src/purchase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub mod pallet {
///
/// Origin must match the `ValidityOrigin`.
#[pallet::call_index(0)]
#[pallet::weight(Weight::from_ref_time(200_000_000) + T::DbWeight::get().reads_writes(4, 1))]
#[pallet::weight(Weight::from_parts(200_000_000, 0) + T::DbWeight::get().reads_writes(4, 1))]
pub fn create_account(
origin: OriginFor<T>,
who: T::AccountId,
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/constants/src/weights/block_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ parameter_types! {
/// 95th: 9_411_822
/// 75th: 9_272_878
pub const BlockExecutionWeight: Weight =
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(9_246_456));
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(9_246_456), 0);
}

#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion runtime/kusama/constants/src/weights/extrinsic_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ parameter_types! {
/// 95th: 105_257
/// 75th: 104_647
pub const ExtrinsicBaseWeight: Weight =
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(104_517));
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(104_517), 0);
}

#[cfg(test)]
Expand Down
26 changes: 13 additions & 13 deletions runtime/kusama/src/weights/frame_benchmarking_baseline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,53 +51,53 @@ impl<T: frame_system::Config> frame_benchmarking::baseline::WeightInfo for Weigh
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 169 nanoseconds.
Weight::from_ref_time(211_793)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(211_793, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
fn subtraction(_i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 172 nanoseconds.
Weight::from_ref_time(210_656)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(210_656, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
fn multiplication(_i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 173 nanoseconds.
Weight::from_ref_time(216_851)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(216_851, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 1000000]`.
fn division(_i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 171 nanoseconds.
Weight::from_ref_time(210_747)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(210_747, 0)
.saturating_add(Weight::from_parts(0, 0))
}
fn hashing() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 24_801_107 nanoseconds.
Weight::from_ref_time(25_036_984_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(25_036_984_000, 0)
.saturating_add(Weight::from_parts(0, 0))
}
/// The range of component `i` is `[0, 100]`.
fn sr25519_verification(i: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 197 nanoseconds.
Weight::from_ref_time(220_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(220_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 18_400
.saturating_add(Weight::from_ref_time(47_299_555).saturating_mul(i.into()))
.saturating_add(Weight::from_parts(47_299_555, 0).saturating_mul(i.into()))
}
}
16 changes: 8 additions & 8 deletions runtime/kusama/src/weights/frame_election_provider_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 6_256_446 nanoseconds.
Weight::from_ref_time(6_327_881_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(6_327_881_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 140_664
.saturating_add(Weight::from_ref_time(5_840_511).saturating_mul(v.into()))
.saturating_add(Weight::from_parts(5_840_511, 0).saturating_mul(v.into()))
// Standard Error: 14_381_047
.saturating_add(Weight::from_ref_time(1_543_872_437).saturating_mul(d.into()))
.saturating_add(Weight::from_parts(1_543_872_437, 0).saturating_mul(d.into()))
}
/// The range of component `v` is `[1000, 2000]`.
/// The range of component `t` is `[500, 1000]`.
Expand All @@ -68,11 +68,11 @@ impl<T: frame_system::Config> frame_election_provider_support::WeightInfo for We
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_822_640 nanoseconds.
Weight::from_ref_time(4_870_840_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(4_870_840_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 150_173
.saturating_add(Weight::from_ref_time(5_687_544).saturating_mul(v.into()))
.saturating_add(Weight::from_parts(5_687_544, 0).saturating_mul(v.into()))
// Standard Error: 15_353_175
.saturating_add(Weight::from_ref_time(1_784_144_004).saturating_mul(d.into()))
.saturating_add(Weight::from_parts(1_784_144_004, 0).saturating_mul(d.into()))
}
}
36 changes: 18 additions & 18 deletions runtime/kusama/src/weights/frame_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_917 nanoseconds.
Weight::from_ref_time(1_973_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(1_973_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 0
.saturating_add(Weight::from_ref_time(370).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(370, 0).saturating_mul(b.into()))
}
/// The range of component `b` is `[0, 3932160]`.
fn remark_with_event(b: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_274 nanoseconds.
Weight::from_ref_time(7_405_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(7_405_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 0
.saturating_add(Weight::from_ref_time(1_731).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(1_731, 0).saturating_mul(b.into()))
}
/// Storage: System Digest (r:1 w:1)
/// Proof Skipped: System Digest (max_values: Some(1), max_size: None, mode: Measured)
Expand All @@ -76,8 +76,8 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Measured: `0`
// Estimated: `495`
// Minimum execution time: 3_833 nanoseconds.
Weight::from_ref_time(3_995_000)
.saturating_add(Weight::from_proof_size(495))
Weight::from_parts(3_995_000, 0)
.saturating_add(Weight::from_parts(0, 495))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(2))
}
Expand All @@ -89,10 +89,10 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_820 nanoseconds.
Weight::from_ref_time(1_857_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(1_857_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 1_965
.saturating_add(Weight::from_ref_time(676_171).saturating_mul(i.into()))
.saturating_add(Weight::from_parts(676_171, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
Expand All @@ -103,10 +103,10 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 1_856 nanoseconds.
Weight::from_ref_time(1_919_000)
.saturating_add(Weight::from_proof_size(0))
Weight::from_parts(1_919_000, 0)
.saturating_add(Weight::from_parts(0, 0))
// Standard Error: 850
.saturating_add(Weight::from_ref_time(484_572).saturating_mul(i.into()))
.saturating_add(Weight::from_parts(484_572, 0).saturating_mul(i.into()))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(i.into())))
}
/// Storage: Skipped Metadata (r:0 w:0)
Expand All @@ -117,12 +117,12 @@ impl<T: frame_system::Config> frame_system::WeightInfo for WeightInfo<T> {
// Measured: `120 + p * (69 ±0)`
// Estimated: `121 + p * (70 ±0)`
// Minimum execution time: 3_847 nanoseconds.
Weight::from_ref_time(3_930_000)
.saturating_add(Weight::from_proof_size(121))
Weight::from_parts(3_930_000, 0)
.saturating_add(Weight::from_parts(0, 121))
// Standard Error: 1_032
.saturating_add(Weight::from_ref_time(1_006_925).saturating_mul(p.into()))
.saturating_add(Weight::from_parts(1_006_925, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(p.into())))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into())))
.saturating_add(Weight::from_proof_size(70).saturating_mul(p.into()))
.saturating_add(Weight::from_parts(0, 70).saturating_mul(p.into()))
}
}
12 changes: 6 additions & 6 deletions runtime/kusama/src/weights/pallet_bags_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Measured: `1846`
// Estimated: `19186`
// Minimum execution time: 59_681 nanoseconds.
Weight::from_ref_time(60_540_000)
.saturating_add(Weight::from_proof_size(19186))
Weight::from_parts(60_540_000, 0)
.saturating_add(Weight::from_parts(0, 19186))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -76,8 +76,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Measured: `1740`
// Estimated: `19114`
// Minimum execution time: 58_266 nanoseconds.
Weight::from_ref_time(59_035_000)
.saturating_add(Weight::from_proof_size(19114))
Weight::from_parts(59_035_000, 0)
.saturating_add(Weight::from_parts(0, 19114))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -96,8 +96,8 @@ impl<T: frame_system::Config> pallet_bags_list::WeightInfo for WeightInfo<T> {
// Measured: `2081`
// Estimated: `25798`
// Minimum execution time: 65_043 nanoseconds.
Weight::from_ref_time(65_583_000)
.saturating_add(Weight::from_proof_size(25798))
Weight::from_parts(65_583_000, 0)
.saturating_add(Weight::from_parts(0, 25798))
.saturating_add(T::DbWeight::get().reads(10))
.saturating_add(T::DbWeight::get().writes(6))
}
Expand Down
14 changes: 7 additions & 7 deletions runtime/kusama/src/weights/pallet_balances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,49 +47,49 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
// Minimum execution time: 40_902 nanoseconds.
Weight::from_ref_time(41_638_000 as u64)
Weight::from_parts(41_638_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
// Minimum execution time: 30_093 nanoseconds.
Weight::from_ref_time(30_732_000 as u64)
Weight::from_parts(30_732_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
// Minimum execution time: 23_901 nanoseconds.
Weight::from_ref_time(24_238_000 as u64)
Weight::from_parts(24_238_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
// Minimum execution time: 26_402 nanoseconds.
Weight::from_ref_time(27_026_000 as u64)
Weight::from_parts(27_026_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
// Minimum execution time: 40_328 nanoseconds.
Weight::from_ref_time(41_242_000 as u64)
Weight::from_parts(41_242_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
// Minimum execution time: 35_401 nanoseconds.
Weight::from_ref_time(36_122_000 as u64)
Weight::from_parts(36_122_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
// Minimum execution time: 20_178 nanoseconds.
Weight::from_ref_time(20_435_000 as u64)
Weight::from_parts(20_435_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1887`
// Estimated: `8288`
// Minimum execution time: 52_484 nanoseconds.
Weight::from_ref_time(53_580_000)
.saturating_add(Weight::from_proof_size(8288))
Weight::from_parts(53_580_000, 0)
.saturating_add(Weight::from_parts(0, 8288))
.saturating_add(T::DbWeight::get().reads(4))
.saturating_add(T::DbWeight::get().writes(4))
}
Expand All @@ -70,8 +70,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1713`
// Estimated: `7777`
// Minimum execution time: 36_900 nanoseconds.
Weight::from_ref_time(37_642_000)
.saturating_add(Weight::from_proof_size(7777))
Weight::from_parts(37_642_000, 0)
.saturating_add(Weight::from_parts(0, 7777))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
Expand All @@ -84,8 +84,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1363`
// Estimated: `3098`
// Minimum execution time: 24_647 nanoseconds.
Weight::from_ref_time(24_978_000)
.saturating_add(Weight::from_proof_size(3098))
Weight::from_parts(24_978_000, 0)
.saturating_add(Weight::from_parts(0, 3098))
.saturating_add(T::DbWeight::get().reads(2))
.saturating_add(T::DbWeight::get().writes(2))
}
Expand All @@ -100,8 +100,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1921`
// Estimated: `5701`
// Minimum execution time: 34_307 nanoseconds.
Weight::from_ref_time(34_814_000)
.saturating_add(Weight::from_proof_size(5701))
Weight::from_parts(34_814_000, 0)
.saturating_add(Weight::from_parts(0, 5701))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
Expand All @@ -116,8 +116,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1883`
// Estimated: `10891`
// Minimum execution time: 50_665 nanoseconds.
Weight::from_ref_time(51_270_000)
.saturating_add(Weight::from_proof_size(10891))
Weight::from_parts(51_270_000, 0)
.saturating_add(Weight::from_parts(0, 10891))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -130,8 +130,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1885`
// Estimated: `7777`
// Minimum execution time: 47_045 nanoseconds.
Weight::from_ref_time(47_702_000)
.saturating_add(Weight::from_proof_size(7777))
Weight::from_parts(47_702_000, 0)
.saturating_add(Weight::from_parts(0, 7777))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(3))
}
Expand All @@ -142,8 +142,8 @@ impl<T: frame_system::Config> pallet_balances::WeightInfo for WeightInfo<T> {
// Measured: `1361`
// Estimated: `2587`
// Minimum execution time: 23_366 nanoseconds.
Weight::from_ref_time(23_786_000)
.saturating_add(Weight::from_proof_size(2587))
Weight::from_parts(23_786_000, 0)
.saturating_add(Weight::from_parts(0, 2587))
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
Expand Down
Loading