Deprecate Weight::from_{ref_time, proof_size} (#13475)

* Deprecate Weight::from_{ref_time, proof_size}

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update templates

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use from_parts

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use from_parts

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Dont revert comment 🤦

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_balances

* Update weight files

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* More fixes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Adapt to Master changes

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: command-bot <>
This commit is contained in:
Oliver Tale-Yazdi
2023-03-02 22:28:17 +01:00
committed by GitHub
parent 7981d4aa59
commit 9e56e1acdd
101 changed files with 2695 additions and 2857 deletions
+2 -2
View File
@@ -208,7 +208,7 @@ pub mod pallet {
impl<T: Config> Hooks<T::BlockNumber> for Pallet<T> {
fn on_idle(_: T::BlockNumber, remaining_weight: Weight) -> Weight {
if remaining_weight.any_lt(T::DbWeight::get().reads(2)) {
return Weight::from_ref_time(0)
return Weight::from_parts(0, 0)
}
Self::do_on_idle(remaining_weight)
@@ -356,7 +356,7 @@ pub mod pallet {
/// checked, we don't finish the process.
pub(crate) fn do_on_idle(remaining_weight: Weight) -> Weight {
// any weight that is unaccounted for
let mut unaccounted_weight = Weight::from_ref_time(0);
let mut unaccounted_weight = Weight::from_parts(0, 0);
let eras_to_check_per_block = ErasToCheckPerBlock::<T>::get();
if eras_to_check_per_block.is_zero() {
+5 -3
View File
@@ -228,7 +228,7 @@ mod on_idle {
assert_eq!(Queue::<T>::get(1), Some(Deposit::get()));
// call on_idle with no remaining weight
FastUnstake::on_idle(System::block_number(), Weight::from_ref_time(0));
FastUnstake::on_idle(System::block_number(), Weight::from_parts(0, 0));
// assert nothing changed in Queue and Head
assert_eq!(Head::<T>::get(), None);
@@ -1091,8 +1091,9 @@ mod batched {
#[test]
fn kusama_estimate() {
use crate::WeightInfo;
let block_time = frame_support::weights::Weight::from_ref_time(
let block_time = frame_support::weights::Weight::from_parts(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2,
0,
)
.ref_time() as f32;
let on_idle = crate::weights::SubstrateWeight::<T>::on_idle_check(1000, 64).ref_time() as f32;
@@ -1102,8 +1103,9 @@ fn kusama_estimate() {
#[test]
fn polkadot_estimate() {
use crate::WeightInfo;
let block_time = frame_support::weights::Weight::from_ref_time(
let block_time = frame_support::weights::Weight::from_parts(
frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND * 2,
0,
)
.ref_time() as f32;
let on_idle = crate::weights::SubstrateWeight::<T>::on_idle_check(300, 64).ref_time() as f32;
+16 -16
View File
@@ -75,9 +75,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `b` is `[1, 64]`.
fn on_idle_unstake(b: u32, ) -> Weight {
// Minimum execution time: 92_833 nanoseconds.
Weight::from_ref_time(62_136_346)
Weight::from_parts(62_136_346, 0)
// Standard Error: 25_541
.saturating_add(Weight::from_ref_time(42_904_859).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(42_904_859, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().reads((6_u64).saturating_mul(b.into())))
.saturating_add(T::DbWeight::get().writes(1))
@@ -94,11 +94,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `b` is `[1, 64]`.
fn on_idle_check(v: u32, b: u32, ) -> Weight {
// Minimum execution time: 1_775_293 nanoseconds.
Weight::from_ref_time(1_787_133_000)
Weight::from_parts(1_787_133_000, 0)
// Standard Error: 17_109_142
.saturating_add(Weight::from_ref_time(546_766_552).saturating_mul(v.into()))
.saturating_add(Weight::from_parts(546_766_552, 0).saturating_mul(v.into()))
// Standard Error: 68_455_625
.saturating_add(Weight::from_ref_time(2_135_980_830).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(2_135_980_830, 0).saturating_mul(b.into()))
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(v.into())))
.saturating_add(T::DbWeight::get().writes(1))
@@ -119,7 +119,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: FastUnstake CounterForQueue (r:1 w:1)
fn register_fast_unstake() -> Weight {
// Minimum execution time: 124_849 nanoseconds.
Weight::from_ref_time(128_176_000)
Weight::from_parts(128_176_000, 0)
.saturating_add(T::DbWeight::get().reads(14))
.saturating_add(T::DbWeight::get().writes(9))
}
@@ -130,14 +130,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: FastUnstake CounterForQueue (r:1 w:1)
fn deregister() -> Weight {
// Minimum execution time: 48_246 nanoseconds.
Weight::from_ref_time(49_720_000)
Weight::from_parts(49_720_000, 0)
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(2))
}
// Storage: FastUnstake ErasToCheckPerBlock (r:0 w:1)
fn control() -> Weight {
// Minimum execution time: 4_611 nanoseconds.
Weight::from_ref_time(4_844_000)
Weight::from_parts(4_844_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
}
@@ -161,9 +161,9 @@ impl WeightInfo for () {
/// The range of component `b` is `[1, 64]`.
fn on_idle_unstake(b: u32, ) -> Weight {
// Minimum execution time: 92_833 nanoseconds.
Weight::from_ref_time(62_136_346)
Weight::from_parts(62_136_346, 0)
// Standard Error: 25_541
.saturating_add(Weight::from_ref_time(42_904_859).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(42_904_859, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(6))
.saturating_add(RocksDbWeight::get().reads((6_u64).saturating_mul(b.into())))
.saturating_add(RocksDbWeight::get().writes(1))
@@ -180,11 +180,11 @@ impl WeightInfo for () {
/// The range of component `b` is `[1, 64]`.
fn on_idle_check(v: u32, b: u32, ) -> Weight {
// Minimum execution time: 1_775_293 nanoseconds.
Weight::from_ref_time(1_787_133_000)
Weight::from_parts(1_787_133_000, 0)
// Standard Error: 17_109_142
.saturating_add(Weight::from_ref_time(546_766_552).saturating_mul(v.into()))
.saturating_add(Weight::from_parts(546_766_552, 0).saturating_mul(v.into()))
// Standard Error: 68_455_625
.saturating_add(Weight::from_ref_time(2_135_980_830).saturating_mul(b.into()))
.saturating_add(Weight::from_parts(2_135_980_830, 0).saturating_mul(b.into()))
.saturating_add(RocksDbWeight::get().reads(7))
.saturating_add(RocksDbWeight::get().reads((1_u64).saturating_mul(v.into())))
.saturating_add(RocksDbWeight::get().writes(1))
@@ -205,7 +205,7 @@ impl WeightInfo for () {
// Storage: FastUnstake CounterForQueue (r:1 w:1)
fn register_fast_unstake() -> Weight {
// Minimum execution time: 124_849 nanoseconds.
Weight::from_ref_time(128_176_000)
Weight::from_parts(128_176_000, 0)
.saturating_add(RocksDbWeight::get().reads(14))
.saturating_add(RocksDbWeight::get().writes(9))
}
@@ -216,14 +216,14 @@ impl WeightInfo for () {
// Storage: FastUnstake CounterForQueue (r:1 w:1)
fn deregister() -> Weight {
// Minimum execution time: 48_246 nanoseconds.
Weight::from_ref_time(49_720_000)
Weight::from_parts(49_720_000, 0)
.saturating_add(RocksDbWeight::get().reads(5))
.saturating_add(RocksDbWeight::get().writes(2))
}
// Storage: FastUnstake ErasToCheckPerBlock (r:0 w:1)
fn control() -> Weight {
// Minimum execution time: 4_611 nanoseconds.
Weight::from_ref_time(4_844_000)
Weight::from_parts(4_844_000, 0)
.saturating_add(RocksDbWeight::get().writes(1))
}
}