From 8fc04510dd47d4ae876f9a4d9b2a22e4f1edab6f Mon Sep 17 00:00:00 2001 From: Gemma Date: Wed, 15 Jan 2025 11:15:25 -0500 Subject: [PATCH] Fix and migrated benchmarking of vesting. --- pallets/vesting/src/benchmarking.rs | 244 +++++++++----- pallets/vesting/src/mock.rs | 5 + pallets/vesting/src/weights.rs | 483 +++++++++------------------- runtime/bifrost-kusama/src/lib.rs | 1 + 4 files changed, 327 insertions(+), 406 deletions(-) diff --git a/pallets/vesting/src/benchmarking.rs b/pallets/vesting/src/benchmarking.rs index fa8df18163..25a5968262 100644 --- a/pallets/vesting/src/benchmarking.rs +++ b/pallets/vesting/src/benchmarking.rs @@ -20,18 +20,13 @@ #![cfg(feature = "runtime-benchmarks")] -use frame_benchmarking::{account, benchmarks, whitelisted_caller}; -use frame_system::{Pallet as System, RawOrigin}; -use sp_runtime::traits::Bounded; - use super::*; -use crate::Pallet as Vesting; +use frame_benchmarking::v2::*; +use frame_system::RawOrigin; +use sp_runtime::traits::Bounded; const SEED: u32 = 0; -type BalanceOf = - <::Currency as Currency<::AccountId>>::Balance; - fn add_locks(who: &T::AccountId, n: u8) { for id in 0..n { let lock_id = [id; 8]; @@ -41,190 +36,279 @@ fn add_locks(who: &T::AccountId, n: u8) { } } -fn add_vesting_schedule(who: &T::AccountId) -> Result<(), &'static str> { +fn add_vesting_schedule(who: &T::AccountId) -> Result, BenchmarkError> { let locked = 100u32; let per_block = 10u32; let starting_block = 1u32; - System::::set_block_number(0u32.into()); + frame_system::Pallet::::set_block_number(0u32.into()); + Pallet::::init_vesting_start_at(RawOrigin::Root.into(), 0u32.into()) + .map_err(|_| BenchmarkError::Stop("Failed to init vesting start"))?; - Vesting::::init_vesting_start_at(RawOrigin::Root.into(), 0u32.into())?; + Pallet::::add_vesting_schedule(&who, locked.into(), per_block.into(), starting_block.into()) + .map_err(|_| BenchmarkError::Stop("Failed to add vesting schedule"))?; - // Add schedule to avoid `NotVesting` error. - Vesting::::add_vesting_schedule( - &who, - locked.into(), - per_block.into(), - starting_block.into(), - )?; - Ok(()) + Ok(locked.into()) } -benchmarks! { - vest_locked { - let l in 0 .. MaxLocksOf::::get(); +#[benchmarks] +mod benchmarks { + use super::*; - let caller = whitelisted_caller(); + #[benchmark] + fn vest_locked( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { + let caller: T::AccountId = account("seed", 1, 1); T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + add_locks::(&caller, l as u8); add_vesting_schedule::(&caller)?; - // At block zero, everything is vested. - System::::set_block_number(BlockNumberFor::::zero()); + + frame_system::Pallet::::set_block_number(BlockNumberFor::::zero()); assert_eq!( - Vesting::::vesting_balance(&caller), + Pallet::::vesting_balance(&caller), Some(100u32.into()), "Vesting schedule not added", ); - }: vest(RawOrigin::Signed(caller.clone())) - verify { - // Nothing happened since everything is still vested. + + #[extrinsic_call] + vest(RawOrigin::Signed(caller.clone())); + assert_eq!( - Vesting::::vesting_balance(&caller), + Pallet::::vesting_balance(&caller), Some(100u32.into()), "Vesting schedule was removed", ); - } - vest_unlocked { - let l in 0 .. MaxLocksOf::::get(); + Ok(()) + } - let caller = whitelisted_caller(); + #[benchmark] + fn vest_unlocked( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { + let caller: T::AccountId = account("seed", 1, 1); T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + add_locks::(&caller, l as u8); add_vesting_schedule::(&caller)?; - // At block 20, everything is unvested. - System::::set_block_number(20u32.into()); + + frame_system::Pallet::::set_block_number(20u32.into()); assert_eq!( - Vesting::::vesting_balance(&caller), + Pallet::::vesting_balance(&caller), Some(BalanceOf::::zero()), "Vesting schedule still active", ); - }: vest(RawOrigin::Signed(caller.clone())) - verify { - // Vesting schedule is removed! + + #[extrinsic_call] + vest(RawOrigin::Signed(caller.clone())); + assert_eq!( - Vesting::::vesting_balance(&caller), + Pallet::::vesting_balance(&caller), None, "Vesting schedule was not removed", ); - } - vest_other_locked { - let l in 0 .. MaxLocksOf::::get(); + Ok(()) + } + #[benchmark] + fn vest_other_locked( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { let other: T::AccountId = account("other", 0, SEED); let other_lookup: ::Source = T::Lookup::unlookup(other.clone()); T::Currency::make_free_balance_be(&other, BalanceOf::::max_value()); + add_locks::(&other, l as u8); add_vesting_schedule::(&other)?; - // At block zero, everything is vested. - System::::set_block_number(BlockNumberFor::::zero()); + + frame_system::Pallet::::set_block_number(BlockNumberFor::::zero()); assert_eq!( - Vesting::::vesting_balance(&other), + Pallet::::vesting_balance(&other), Some(100u32.into()), "Vesting schedule not added", ); let caller: T::AccountId = whitelisted_caller(); - }: vest_other(RawOrigin::Signed(caller.clone()), other_lookup) - verify { - // Nothing happened since everything is still vested. + + #[extrinsic_call] + vest_other(RawOrigin::Signed(caller), other_lookup); + assert_eq!( - Vesting::::vesting_balance(&other), + Pallet::::vesting_balance(&other), Some(100u32.into()), "Vesting schedule was removed", ); - } - vest_other_unlocked { - let l in 0 .. MaxLocksOf::::get(); + Ok(()) + } + #[benchmark] + fn vest_other_unlocked( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { let other: T::AccountId = account("other", 0, SEED); let other_lookup: ::Source = T::Lookup::unlookup(other.clone()); T::Currency::make_free_balance_be(&other, BalanceOf::::max_value()); + add_locks::(&other, l as u8); add_vesting_schedule::(&other)?; - // At block 20, everything is unvested. - System::::set_block_number(20u32.into()); + + frame_system::Pallet::::set_block_number(20u32.into()); assert_eq!( - Vesting::::vesting_balance(&other), + Pallet::::vesting_balance(&other), Some(BalanceOf::::zero()), "Vesting schedule still active", ); let caller: T::AccountId = whitelisted_caller(); - }: vest_other(RawOrigin::Signed(caller.clone()), other_lookup) - verify { - // Vesting schedule is removed! + + #[extrinsic_call] + vest_other(RawOrigin::Signed(caller), other_lookup); + assert_eq!( - Vesting::::vesting_balance(&other), + Pallet::::vesting_balance(&other), None, "Vesting schedule was not removed", ); - } - vested_transfer { - let l in 0 .. MaxLocksOf::::get(); + Ok(()) + } + #[benchmark] + fn vested_transfer( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { let caller: T::AccountId = whitelisted_caller(); T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); + let target: T::AccountId = account("target", 0, SEED); - let target_lookup: ::Source = T::Lookup::unlookup(target.clone()); + let target_lookup: ::Source = + T::Lookup::unlookup(target.clone()); let transfer_amount = T::MinVestedTransfer::get(); - let vesting_schedule = VestingInfo { locked: transfer_amount, per_block: 10u32.into(), starting_block: 1u32.into(), }; - }: _(RawOrigin::Signed(caller), target_lookup, vesting_schedule) - verify { + + #[extrinsic_call] + _(RawOrigin::Signed(caller), target_lookup, vesting_schedule); + assert_eq!( T::MinVestedTransfer::get(), T::Currency::free_balance(&target), "Transfer didn't happen", ); assert_eq!( - Vesting::::vesting_balance(&target), + Pallet::::vesting_balance(&target), Some(T::MinVestedTransfer::get()), "Lock not created", ); - } - force_vested_transfer { - let l in 0 .. MaxLocksOf::::get(); + Ok(()) + } + #[benchmark] + fn force_vested_transfer( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { let source: T::AccountId = account("source", 0, SEED); - let source_lookup: ::Source = T::Lookup::unlookup(source.clone()); + let source_lookup: ::Source = + T::Lookup::unlookup(source.clone()); T::Currency::make_free_balance_be(&source, BalanceOf::::max_value()); + let target: T::AccountId = account("target", 0, SEED); - let target_lookup: ::Source = T::Lookup::unlookup(target.clone()); + let target_lookup: ::Source = + T::Lookup::unlookup(target.clone()); let transfer_amount = T::MinVestedTransfer::get(); - let vesting_schedule = VestingInfo { locked: transfer_amount, per_block: 10u32.into(), starting_block: 1u32.into(), }; - }: _(RawOrigin::Root, source_lookup, target_lookup, vesting_schedule) - verify { + + #[extrinsic_call] + _( + RawOrigin::Root, + source_lookup, + target_lookup, + vesting_schedule, + ); + assert_eq!( T::MinVestedTransfer::get(), T::Currency::free_balance(&target), "Transfer didn't happen", ); assert_eq!( - Vesting::::vesting_balance(&target), + Pallet::::vesting_balance(&target), Some(T::MinVestedTransfer::get()), "Lock not created", ); + + Ok(()) + } + + #[benchmark] + fn not_unlocking_merge_schedules( + l: Linear<0, { MaxLocksOf::::get() }>, + s: Linear<2, { T::MAX_VESTING_SCHEDULES }>, + ) -> Result<(), BenchmarkError> { + let caller: T::AccountId = account("seed", 1, 1); + + T::Currency::make_free_balance_be(&caller, T::Currency::minimum_balance()); + + add_locks::(&caller, l as u8); + + add_vesting_schedule::(&caller)?; + add_vesting_schedule::(&caller)?; + + assert_eq!( + frame_system::Pallet::::block_number(), + BlockNumberFor::::zero() + ); + assert_eq!( + Pallet::::vesting_balance(&caller), + Some(200u32.into()), + "Vesting balance should equal sum locked of all schedules", + ); + assert_eq!( + Vesting::::get(&caller).unwrap().len(), + 2, + "There should be exactly two vesting schedules" + ); + + #[extrinsic_call] + merge_schedules(RawOrigin::Signed(caller.clone()), 0, 1); + + let schedules = Vesting::::get(&caller).unwrap(); + assert_eq!(schedules.len(), 1, "Schedule count should be 1 after merge"); + + assert_eq!( + Pallet::::vesting_balance(&caller), + Some(200u32.into()), + "Vesting balance should remain the same after merge", + ); + + Ok(()) } impl_benchmark_test_suite!( - Vesting, - crate::mock::ExtBuilder::default().existential_deposit(256).build(), + Pallet, + crate::mock::ExtBuilder::default() + .existential_deposit(256) + .build(), crate::mock::Test, ); } diff --git a/pallets/vesting/src/mock.rs b/pallets/vesting/src/mock.rs index 2ef0de716c..4b2b3e8227 100644 --- a/pallets/vesting/src/mock.rs +++ b/pallets/vesting/src/mock.rs @@ -143,3 +143,8 @@ impl ExtBuilder { ext } } + +#[cfg(feature = "runtime-benchmarks")] +pub fn new_test_ext_benchmark() -> sp_io::TestExternalities { + ExtBuilder::default().build() +} diff --git a/pallets/vesting/src/weights.rs b/pallets/vesting/src/weights.rs index 297e20452b..95f504caba 100644 --- a/pallets/vesting/src/weights.rs +++ b/pallets/vesting/src/weights.rs @@ -15,30 +15,34 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. -//! Autogenerated weights for pallet_vesting +//! Autogenerated weights for bifrost_vesting //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-04-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm2`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 42.0.1 +//! DATE: 2025-01-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `mjl-legion`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` +//! WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-kusama-local"), DB CACHE: 1024 // Executed Command: -// ./target/production/substrate +// target/release/bifrost // benchmark // pallet -// --chain=dev +// --chain=bifrost-kusama-local // --steps=50 // --repeat=20 -// --pallet=pallet_vesting +// --pallet=bifrost-vesting // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./frame/vesting/src/weights.rs -// --header=./HEADER-APACHE2 -// --template=./.maintain/frame-weight-template.hbs +// --output=./pallets/vesting/src/weights.rs +// --template=./weight-template/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -47,7 +51,7 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_vesting. +/// Weight functions needed for bifrost_vesting. pub trait WeightInfo { fn vest_locked(l: u32, s: u32, ) -> Weight; fn vest_unlocked(l: u32, s: u32, ) -> Weight; @@ -59,348 +63,175 @@ pub trait WeightInfo { fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight; } -/// Weights for pallet_vesting using the Substrate node and recommended hardware. -pub struct BifrostWeight(PhantomData); -impl WeightInfo for BifrostWeight { - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_locked(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 36_182_000 picoseconds. - Weight::from_parts(35_159_830, 4764) - // Standard Error: 952 - .saturating_add(Weight::from_parts(63_309, 0).saturating_mul(l.into())) - // Standard Error: 1_694 - .saturating_add(Weight::from_parts(62_244, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_unlocked(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `381 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 39_344_000 picoseconds. - Weight::from_parts(38_921_936, 4764) - // Standard Error: 1_283 - .saturating_add(Weight::from_parts(61_531, 0).saturating_mul(l.into())) - // Standard Error: 2_283 - .saturating_add(Weight::from_parts(36_175, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3_u64)) - .saturating_add(T::DbWeight::get().writes(2_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_other_locked(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 39_461_000 picoseconds. - Weight::from_parts(38_206_465, 4764) - // Standard Error: 743 - .saturating_add(Weight::from_parts(56_973, 0).saturating_mul(l.into())) - // Standard Error: 1_322 - .saturating_add(Weight::from_parts(65_059, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `484 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 42_029_000 picoseconds. - Weight::from_parts(42_153_438, 4764) - // Standard Error: 1_108 - .saturating_add(Weight::from_parts(50_058, 0).saturating_mul(l.into())) - // Standard Error: 1_971 - .saturating_add(Weight::from_parts(32_391, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[0, 27]`. - fn vested_transfer(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `555 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 75_223_000 picoseconds. - Weight::from_parts(76_675_778, 4764) - // Standard Error: 2_534 - .saturating_add(Weight::from_parts(70_731, 0).saturating_mul(l.into())) - // Standard Error: 4_509 - .saturating_add(Weight::from_parts(108_866, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[0, 27]`. - fn force_vested_transfer(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `658 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `6196` - // Minimum execution time: 76_922_000 picoseconds. - Weight::from_parts(78_634_098, 6196) - // Standard Error: 2_099 - .saturating_add(Weight::from_parts(68_218, 0).saturating_mul(l.into())) - // Standard Error: 3_736 - .saturating_add(Weight::from_parts(95_990, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(5_u64)) - .saturating_add(T::DbWeight::get().writes(4_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[2, 28]`. - fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 39_476_000 picoseconds. - Weight::from_parts(38_261_747, 4764) - // Standard Error: 1_794 - .saturating_add(Weight::from_parts(69_639, 0).saturating_mul(l.into())) - // Standard Error: 3_313 - .saturating_add(Weight::from_parts(73_202, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[2, 28]`. - fn unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `482 + l * (25 ±0) + s * (36 ±0)` - // Estimated: `4764` - // Minimum execution time: 43_764_000 picoseconds. - Weight::from_parts(42_679_386, 4764) - // Standard Error: 1_224 - .saturating_add(Weight::from_parts(65_857, 0).saturating_mul(l.into())) - // Standard Error: 2_261 - .saturating_add(Weight::from_parts(70_861, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(4_u64)) - .saturating_add(T::DbWeight::get().writes(3_u64)) - } -} - // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_locked(l: u32, s: u32, ) -> Weight { + /// Storage: `Vesting::Cliff` (r:1 w:0) + /// Proof: `Vesting::Cliff` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. + fn vest_locked(l: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `381 + l * (25 ±0) + s * (36 ±0)` + // Measured: `972 + l * (25 ±0)` // Estimated: `4764` - // Minimum execution time: 36_182_000 picoseconds. - Weight::from_parts(35_159_830, 4764) - // Standard Error: 952 - .saturating_add(Weight::from_parts(63_309, 0).saturating_mul(l.into())) - // Standard Error: 1_694 - .saturating_add(Weight::from_parts(62_244, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + // Minimum execution time: 23_957_000 picoseconds. + Weight::from_parts(28_039_235, 4764) + // Standard Error: 1_989 + .saturating_add(Weight::from_parts(25_516, 0).saturating_mul(l.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. + /// Storage: `Vesting::Cliff` (r:1 w:0) + /// Proof: `Vesting::Cliff` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. fn vest_unlocked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `381 + l * (25 ±0) + s * (36 ±0)` + // Measured: `972 + l * (25 ±0)` // Estimated: `4764` - // Minimum execution time: 39_344_000 picoseconds. - Weight::from_parts(38_921_936, 4764) - // Standard Error: 1_283 - .saturating_add(Weight::from_parts(61_531, 0).saturating_mul(l.into())) - // Standard Error: 2_283 - .saturating_add(Weight::from_parts(36_175, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(3_u64)) - .saturating_add(RocksDbWeight::get().writes(2_u64)) + // Minimum execution time: 24_605_000 picoseconds. + Weight::from_parts(25_363_535, 4764) + // Standard Error: 6_031 + .saturating_add(Weight::from_parts(67_468, 0).saturating_mul(l.into())) + // Standard Error: 11_413 + .saturating_add(Weight::from_parts(54_119, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) + .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. + /// Storage: `Vesting::Cliff` (r:1 w:0) + /// Proof: `Vesting::Cliff` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. fn vest_other_locked(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `484 + l * (25 ±0) + s * (36 ±0)` + // Measured: `1009 + l * (25 ±0)` // Estimated: `4764` - // Minimum execution time: 39_461_000 picoseconds. - Weight::from_parts(38_206_465, 4764) - // Standard Error: 743 - .saturating_add(Weight::from_parts(56_973, 0).saturating_mul(l.into())) - // Standard Error: 1_322 - .saturating_add(Weight::from_parts(65_059, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Minimum execution time: 25_729_000 picoseconds. + Weight::from_parts(27_284_518, 4764) + // Standard Error: 8_232 + .saturating_add(Weight::from_parts(42_821, 0).saturating_mul(l.into())) + // Standard Error: 15_580 + .saturating_add(Weight::from_parts(56_486, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[1, 28]`. - fn vest_other_unlocked(l: u32, s: u32, ) -> Weight { + /// Storage: `Vesting::Cliff` (r:1 w:0) + /// Proof: `Vesting::Cliff` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. + fn vest_other_unlocked(_l: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `484 + l * (25 ±0) + s * (36 ±0)` + // Measured: `1009 + l * (25 ±0)` // Estimated: `4764` - // Minimum execution time: 42_029_000 picoseconds. - Weight::from_parts(42_153_438, 4764) - // Standard Error: 1_108 - .saturating_add(Weight::from_parts(50_058, 0).saturating_mul(l.into())) - // Standard Error: 1_971 - .saturating_add(Weight::from_parts(32_391, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Minimum execution time: 24_827_000 picoseconds. + Weight::from_parts(31_992_769, 4764) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[0, 27]`. - fn vested_transfer(l: u32, s: u32, ) -> Weight { + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. + fn vested_transfer(_l: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `555 + l * (25 ±0) + s * (36 ±0)` + // Measured: `822` // Estimated: `4764` - // Minimum execution time: 75_223_000 picoseconds. - Weight::from_parts(76_675_778, 4764) - // Standard Error: 2_534 - .saturating_add(Weight::from_parts(70_731, 0).saturating_mul(l.into())) - // Standard Error: 4_509 - .saturating_add(Weight::from_parts(108_866, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Minimum execution time: 48_504_000 picoseconds. + Weight::from_parts(57_984_845, 4764) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. - /// The range of component `s` is `[0, 27]`. - fn force_vested_transfer(l: u32, s: u32, ) -> Weight { + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. + /// The range of component `s` is `[2, 28]`. + fn force_vested_transfer(_l: u32, _s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `658 + l * (25 ±0) + s * (36 ±0)` + // Measured: `976` // Estimated: `6196` - // Minimum execution time: 76_922_000 picoseconds. - Weight::from_parts(78_634_098, 6196) - // Standard Error: 2_099 - .saturating_add(Weight::from_parts(68_218, 0).saturating_mul(l.into())) - // Standard Error: 3_736 - .saturating_add(Weight::from_parts(95_990, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Minimum execution time: 49_048_000 picoseconds. + Weight::from_parts(58_628_156, 6196) + .saturating_add(RocksDbWeight::get().reads(6_u64)) .saturating_add(RocksDbWeight::get().writes(4_u64)) } - /// Storage: Vesting Vesting (r:1 w:1) - /// Proof: Vesting Vesting (max_values: None, max_size: Some(1057), added: 3532, mode: MaxEncodedLen) - /// Storage: Balances Locks (r:1 w:1) - /// Proof: Balances Locks (max_values: None, max_size: Some(1299), added: 3774, mode: MaxEncodedLen) - /// Storage: Balances Freezes (r:1 w:0) - /// Proof: Balances Freezes (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// The range of component `l` is `[0, 49]`. + /// Storage: `Vesting::Vesting` (r:1 w:1) + /// Proof: `Vesting::Vesting` (`max_values`: None, `max_size`: Some(1057), added: 3532, mode: `MaxEncodedLen`) + /// Storage: `Vesting::VestingStartAt` (r:1 w:0) + /// Proof: `Vesting::VestingStartAt` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Balances::Locks` (r:1 w:1) + /// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1299), added: 3774, mode: `MaxEncodedLen`) + /// Storage: `Balances::Freezes` (r:1 w:0) + /// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(49), added: 2524, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// The range of component `l` is `[0, 50]`. /// The range of component `s` is `[2, 28]`. fn not_unlocking_merge_schedules(l: u32, s: u32, ) -> Weight { // Proof Size summary in bytes: - // Measured: `482 + l * (25 ±0) + s * (36 ±0)` + // Measured: `1009 + l * (25 ±0)` // Estimated: `4764` - // Minimum execution time: 39_476_000 picoseconds. - Weight::from_parts(38_261_747, 4764) - // Standard Error: 1_794 - .saturating_add(Weight::from_parts(69_639, 0).saturating_mul(l.into())) - // Standard Error: 3_313 - .saturating_add(Weight::from_parts(73_202, 0).saturating_mul(s.into())) - .saturating_add(RocksDbWeight::get().reads(4_u64)) + // Minimum execution time: 24_019_000 picoseconds. + Weight::from_parts(26_190_811, 4764) + // Standard Error: 2_020 + .saturating_add(Weight::from_parts(45_207, 0).saturating_mul(l.into())) + // Standard Error: 3_824 + .saturating_add(Weight::from_parts(26_045, 0).saturating_mul(s.into())) + .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } /// Storage: Vesting Vesting (r:1 w:1) @@ -426,4 +257,4 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(4_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } -} +} \ No newline at end of file diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 197882fd3a..1f880a26ae 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -2066,6 +2066,7 @@ mod benches { [bifrost_vbnc_convert, VBNCConvert] [bifrost_xcm_interface, XcmInterface] // [bifrost_channel_commission, ChannelCommission] + [bifrost_vesting, Vesting] ); }