difftreelog
Merge pull request #810 from UniqueNetwork/fix/app-promotion-benchmarks
in: master
8 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5550,7 +5550,7 @@
[[package]]
name = "pallet-app-promotion"
-version = "0.1.2"
+version = "0.1.3"
dependencies = [
"frame-benchmarking",
"frame-support",
pallets/app-promotion/CHANGELOG.mddiffbeforeafterboth--- a/pallets/app-promotion/CHANGELOG.md
+++ b/pallets/app-promotion/CHANGELOG.md
@@ -4,6 +4,12 @@
<!-- bureaucrate goes here -->
+## [0.1.3] - 2022-12-25
+
+### Fixed
+
+- Benchmarks for `payoutStakers` and `unstake` extrinsics.
+
## [0.1.2] - 2022-12-20
### Fixed
pallets/app-promotion/Cargo.tomldiffbeforeafterboth--- a/pallets/app-promotion/Cargo.toml
+++ b/pallets/app-promotion/Cargo.toml
@@ -9,13 +9,13 @@
license = 'GPLv3'
name = 'pallet-app-promotion'
repository = 'https://github.com/UniqueNetwork/unique-chain'
-version = '0.1.2'
+version = '0.1.3'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
[features]
-default = ['std']
+default = ['std',]
runtime-benchmarks = [
'frame-benchmarking',
'frame-support/runtime-benchmarks',
pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -77,27 +77,36 @@
} : _(RawOrigin::Root, T::CrossAccountId::from_sub(pallet_admin))
payout_stakers{
- let b in 1..101;
+ let b in 1..100;
let pallet_admin = account::<T::AccountId>("admin", 1, SEED);
let share = Perbill::from_rational(1u32, 20);
PromototionPallet::<T>::set_admin_address(RawOrigin::Root.into(), T::CrossAccountId::from_sub(pallet_admin.clone()))?;
<T as Config>::Currency::make_free_balance_be(&pallet_admin, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
+ <T as Config>::Currency::make_free_balance_be(&<T as pallet::Config>::TreasuryAccountId::get(), Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
- let staker: T::AccountId = account("caller", 0, SEED);
- <T as Config>::Currency::make_free_balance_be(&staker, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
let stakers: Vec<T::AccountId> = (0..b).map(|index| account("staker", index, SEED)).collect();
stakers.iter().for_each(|staker| {
<T as Config>::Currency::make_free_balance_be(&staker, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
});
- (0..10).try_for_each(|_| {
+ (1..11).try_for_each(|i| {
+ <frame_system::Pallet<T>>::set_block_number(i.into());
+ T::RelayBlockNumberProvider::set_block_number((2*i).into());
+ assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
+ assert_eq!(T::RelayBlockNumberProvider::current_block_number(), (2*i).into());
stakers.iter()
- .map(|staker| {
- PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())
- }).collect::<Result<Vec<_>, _>>()?;
- <frame_system::Pallet<T>>::finalize();
+ .map(|staker| {
+ PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())
+ }).collect::<Result<Vec<_>, _>>()?;
+
Result::<(), sp_runtime::DispatchError>::Ok(())
})?;
+
+ let stakes = Staked::<T>::iter_prefix((&stakers[0],)).into_iter().collect::<Vec<_>>();
+ assert_eq!(stakes.len(), 10);
+
+ <frame_system::Pallet<T>>::set_block_number(15_000.into());
+ T::RelayBlockNumberProvider::set_block_number(30_000.into());
} : _(RawOrigin::Signed(pallet_admin.clone()), Some(b as u8))
stake {
@@ -110,9 +119,12 @@
let caller = account::<T::AccountId>("caller", 0, SEED);
let share = Perbill::from_rational(1u32, 20);
let _ = <T as Config>::Currency::make_free_balance_be(&caller, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
- (0..10).map(|_| {
+ (1..11).map(|i| {
// used to change block number
- <frame_system::Pallet<T>>::finalize();
+ <frame_system::Pallet<T>>::set_block_number(i.into());
+ T::RelayBlockNumberProvider::set_block_number((2*i).into());
+ assert_eq!(<frame_system::Pallet<T>>::block_number(), i.into());
+ assert_eq!(T::RelayBlockNumberProvider::current_block_number(), (2*i).into());
PromototionPallet::<T>::stake(RawOrigin::Signed(caller.clone()).into(), share * <T as Config>::Currency::total_balance(&caller))
}).collect::<Result<Vec<_>, _>>()?;
pallets/app-promotion/src/weights.rsdiffbeforeafterboth1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_app_promotion4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-09-07, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-app-promotion15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/app-promotion/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(missing_docs)]30#![allow(clippy::unnecessary_cast)]3132use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};33use sp_std::marker::PhantomData;3435/// Weight functions needed for pallet_app_promotion.36pub trait WeightInfo {37 fn on_initialize(b: u32, ) -> Weight;38 fn set_admin_address() -> Weight;39 fn payout_stakers(b: u32, ) -> Weight;40 fn stake() -> Weight;41 fn unstake() -> Weight;42 fn sponsor_collection() -> Weight;43 fn stop_sponsoring_collection() -> Weight;44 fn sponsor_contract() -> Weight;45 fn stop_sponsoring_contract() -> Weight;46}4748/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.49pub struct SubstrateWeight<T>(PhantomData<T>);50impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {51 // Storage: AppPromotion PendingUnstake (r:1 w:0)52 // Storage: System Account (r:1 w:1)53 fn on_initialize(b: u32, ) -> Weight {54 Weight::from_ref_time(2_651_000)55 // Standard Error: 103_00056 .saturating_add(Weight::from_ref_time(6_024_000).saturating_mul(b as u64))57 .saturating_add(T::DbWeight::get().reads(1 as u64))58 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(b as u64)))59 .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(b as u64)))60 }61 // Storage: AppPromotion Admin (r:0 w:1)62 fn set_admin_address() -> Weight {63 Weight::from_ref_time(7_117_000)64 .saturating_add(T::DbWeight::get().writes(1 as u64))65 }66 // Storage: AppPromotion Admin (r:1 w:0)67 // Storage: ParachainSystem ValidationData (r:1 w:0)68 // Storage: AppPromotion NextCalculatedRecord (r:1 w:1)69 // Storage: AppPromotion Staked (r:2 w:0)70 fn payout_stakers(b: u32, ) -> Weight {71 Weight::from_ref_time(9_958_000)72 // Standard Error: 8_00073 .saturating_add(Weight::from_ref_time(4_406_000).saturating_mul(b as u64))74 .saturating_add(T::DbWeight::get().reads(4 as u64))75 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(b as u64)))76 .saturating_add(T::DbWeight::get().writes(1 as u64))77 }78 // Storage: AppPromotion StakesPerAccount (r:1 w:1)79 // Storage: System Account (r:1 w:1)80 // Storage: Balances Locks (r:1 w:1)81 // Storage: ParachainSystem ValidationData (r:1 w:0)82 // Storage: AppPromotion Staked (r:1 w:1)83 // Storage: AppPromotion TotalStaked (r:1 w:1)84 fn stake() -> Weight {85 Weight::from_ref_time(20_574_000)86 .saturating_add(T::DbWeight::get().reads(6 as u64))87 .saturating_add(T::DbWeight::get().writes(5 as u64))88 }89 // Storage: AppPromotion PendingUnstake (r:1 w:1)90 // Storage: AppPromotion Staked (r:2 w:1)91 // Storage: Balances Locks (r:1 w:1)92 // Storage: System Account (r:1 w:1)93 // Storage: AppPromotion TotalStaked (r:1 w:1)94 // Storage: AppPromotion StakesPerAccount (r:0 w:1)95 fn unstake() -> Weight {96 Weight::from_ref_time(31_703_000)97 .saturating_add(T::DbWeight::get().reads(6 as u64))98 .saturating_add(T::DbWeight::get().writes(6 as u64))99 }100 // Storage: AppPromotion Admin (r:1 w:0)101 // Storage: Common CollectionById (r:1 w:1)102 fn sponsor_collection() -> Weight {103 Weight::from_ref_time(12_932_000)104 .saturating_add(T::DbWeight::get().reads(2 as u64))105 .saturating_add(T::DbWeight::get().writes(1 as u64))106 }107 // Storage: AppPromotion Admin (r:1 w:0)108 // Storage: Common CollectionById (r:1 w:1)109 fn stop_sponsoring_collection() -> Weight {110 Weight::from_ref_time(12_453_000)111 .saturating_add(T::DbWeight::get().reads(2 as u64))112 .saturating_add(T::DbWeight::get().writes(1 as u64))113 }114 // Storage: AppPromotion Admin (r:1 w:0)115 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)116 fn sponsor_contract() -> Weight {117 Weight::from_ref_time(11_952_000)118 .saturating_add(T::DbWeight::get().reads(1 as u64))119 .saturating_add(T::DbWeight::get().writes(1 as u64))120 }121 // Storage: AppPromotion Admin (r:1 w:0)122 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)123 fn stop_sponsoring_contract() -> Weight {124 Weight::from_ref_time(12_538_000)125 .saturating_add(T::DbWeight::get().reads(2 as u64))126 .saturating_add(T::DbWeight::get().writes(1 as u64))127 }128}129130// For backwards compatibility and tests131impl WeightInfo for () {132 // Storage: AppPromotion PendingUnstake (r:1 w:0)133 // Storage: System Account (r:1 w:1)134 fn on_initialize(b: u32, ) -> Weight {135 Weight::from_ref_time(2_651_000)136 // Standard Error: 103_000137 .saturating_add(Weight::from_ref_time(6_024_000).saturating_mul(b as u64))138 .saturating_add(RocksDbWeight::get().reads(1 as u64))139 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(b as u64)))140 .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(b as u64)))141 }142 // Storage: AppPromotion Admin (r:0 w:1)143 fn set_admin_address() -> Weight {144 Weight::from_ref_time(7_117_000)145 .saturating_add(RocksDbWeight::get().writes(1 as u64))146 }147 // Storage: AppPromotion Admin (r:1 w:0)148 // Storage: ParachainSystem ValidationData (r:1 w:0)149 // Storage: AppPromotion NextCalculatedRecord (r:1 w:1)150 // Storage: AppPromotion Staked (r:2 w:0)151 fn payout_stakers(b: u32, ) -> Weight {152 Weight::from_ref_time(9_958_000)153 // Standard Error: 8_000154 .saturating_add(Weight::from_ref_time(4_406_000).saturating_mul(b as u64))155 .saturating_add(RocksDbWeight::get().reads(4 as u64))156 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(b as u64)))157 .saturating_add(RocksDbWeight::get().writes(1 as u64))158 }159 // Storage: AppPromotion StakesPerAccount (r:1 w:1)160 // Storage: System Account (r:1 w:1)161 // Storage: Balances Locks (r:1 w:1)162 // Storage: ParachainSystem ValidationData (r:1 w:0)163 // Storage: AppPromotion Staked (r:1 w:1)164 // Storage: AppPromotion TotalStaked (r:1 w:1)165 fn stake() -> Weight {166 Weight::from_ref_time(20_574_000)167 .saturating_add(RocksDbWeight::get().reads(6 as u64))168 .saturating_add(RocksDbWeight::get().writes(5 as u64))169 }170 // Storage: AppPromotion PendingUnstake (r:1 w:1)171 // Storage: AppPromotion Staked (r:2 w:1)172 // Storage: Balances Locks (r:1 w:1)173 // Storage: System Account (r:1 w:1)174 // Storage: AppPromotion TotalStaked (r:1 w:1)175 // Storage: AppPromotion StakesPerAccount (r:0 w:1)176 fn unstake() -> Weight {177 Weight::from_ref_time(31_703_000)178 .saturating_add(RocksDbWeight::get().reads(6 as u64))179 .saturating_add(RocksDbWeight::get().writes(6 as u64))180 }181 // Storage: AppPromotion Admin (r:1 w:0)182 // Storage: Common CollectionById (r:1 w:1)183 fn sponsor_collection() -> Weight {184 Weight::from_ref_time(12_932_000)185 .saturating_add(RocksDbWeight::get().reads(2 as u64))186 .saturating_add(RocksDbWeight::get().writes(1 as u64))187 }188 // Storage: AppPromotion Admin (r:1 w:0)189 // Storage: Common CollectionById (r:1 w:1)190 fn stop_sponsoring_collection() -> Weight {191 Weight::from_ref_time(12_453_000)192 .saturating_add(RocksDbWeight::get().reads(2 as u64))193 .saturating_add(RocksDbWeight::get().writes(1 as u64))194 }195 // Storage: AppPromotion Admin (r:1 w:0)196 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)197 fn sponsor_contract() -> Weight {198 Weight::from_ref_time(11_952_000)199 .saturating_add(RocksDbWeight::get().reads(1 as u64))200 .saturating_add(RocksDbWeight::get().writes(1 as u64))201 }202 // Storage: AppPromotion Admin (r:1 w:0)203 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)204 fn stop_sponsoring_contract() -> Weight {205 Weight::from_ref_time(12_538_000)206 .saturating_add(RocksDbWeight::get().reads(2 as u64))207 .saturating_add(RocksDbWeight::get().writes(1 as u64))208 }209}1// Template adopted from https://github.com/paritytech/substrate/blob/master/.maintain/frame-weight-template.hbs23//! Autogenerated weights for pallet_app_promotion4//!5//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev6//! DATE: 2022-12-25, STEPS: `50`, REPEAT: 80, LOW RANGE: `[]`, HIGH RANGE: `[]`7//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 102489// Executed Command:10// target/release/unique-collator11// benchmark12// pallet13// --pallet14// pallet-app-promotion15// --wasm-execution16// compiled17// --extrinsic18// *19// --template20// .maintain/frame-weight-template.hbs21// --steps=5022// --repeat=8023// --heap-pages=409624// --output=./pallets/app-promotion/src/weights.rs2526#![cfg_attr(rustfmt, rustfmt_skip)]27#![allow(unused_parens)]28#![allow(unused_imports)]29#![allow(missing_docs)]30#![allow(clippy::unnecessary_cast)]3132use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};33use sp_std::marker::PhantomData;3435/// Weight functions needed for pallet_app_promotion.36pub trait WeightInfo {37 fn on_initialize(b: u32, ) -> Weight;38 fn set_admin_address() -> Weight;39 fn payout_stakers(b: u32, ) -> Weight;40 fn stake() -> Weight;41 fn unstake() -> Weight;42 fn sponsor_collection() -> Weight;43 fn stop_sponsoring_collection() -> Weight;44 fn sponsor_contract() -> Weight;45 fn stop_sponsoring_contract() -> Weight;46}4748/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.49pub struct SubstrateWeight<T>(PhantomData<T>);50impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {51 // Storage: AppPromotion PendingUnstake (r:1 w:0)52 // Storage: System Account (r:1 w:1)53 fn on_initialize(b: u32, ) -> Weight {54 Weight::from_ref_time(3_079_948 as u64)55 // Standard Error: 30_37656 .saturating_add(Weight::from_ref_time(6_343_630 as u64).saturating_mul(b as u64))57 .saturating_add(T::DbWeight::get().reads(1 as u64))58 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(b as u64)))59 .saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(b as u64)))60 }61 // Storage: AppPromotion Admin (r:0 w:1)62 fn set_admin_address() -> Weight {63 Weight::from_ref_time(6_653_000 as u64)64 .saturating_add(T::DbWeight::get().writes(1 as u64))65 }66 // Storage: AppPromotion Admin (r:1 w:0)67 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)68 // Storage: ParachainSystem ValidationData (r:1 w:0)69 // Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)70 // Storage: AppPromotion Staked (r:11 w:10)71 // Storage: System Account (r:2 w:2)72 // Storage: Balances Locks (r:1 w:1)73 // Storage: AppPromotion TotalStaked (r:1 w:1)74 fn payout_stakers(b: u32, ) -> Weight {75 Weight::from_ref_time(74_048_000 as u64)76 // Standard Error: 33_22377 .saturating_add(Weight::from_ref_time(57_702_092 as u64).saturating_mul(b as u64))78 .saturating_add(T::DbWeight::get().reads(7 as u64))79 .saturating_add(T::DbWeight::get().reads((12 as u64).saturating_mul(b as u64)))80 .saturating_add(T::DbWeight::get().writes(3 as u64))81 .saturating_add(T::DbWeight::get().writes((12 as u64).saturating_mul(b as u64)))82 }83 // Storage: AppPromotion StakesPerAccount (r:1 w:1)84 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)85 // Storage: System Account (r:1 w:1)86 // Storage: Balances Locks (r:1 w:1)87 // Storage: ParachainSystem ValidationData (r:1 w:0)88 // Storage: AppPromotion Staked (r:1 w:1)89 // Storage: AppPromotion TotalStaked (r:1 w:1)90 fn stake() -> Weight {91 Weight::from_ref_time(20_314_000 as u64)92 .saturating_add(T::DbWeight::get().reads(7 as u64))93 .saturating_add(T::DbWeight::get().writes(5 as u64))94 }95 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)96 // Storage: AppPromotion PendingUnstake (r:1 w:1)97 // Storage: AppPromotion Staked (r:11 w:10)98 // Storage: Balances Locks (r:1 w:1)99 // Storage: System Account (r:1 w:1)100 // Storage: AppPromotion TotalStaked (r:1 w:1)101 // Storage: AppPromotion StakesPerAccount (r:0 w:1)102 fn unstake() -> Weight {103 Weight::from_ref_time(64_582_000 as u64)104 .saturating_add(T::DbWeight::get().reads(16 as u64))105 .saturating_add(T::DbWeight::get().writes(15 as u64))106 }107 // Storage: AppPromotion Admin (r:1 w:0)108 // Storage: Common CollectionById (r:1 w:1)109 fn sponsor_collection() -> Weight {110 Weight::from_ref_time(16_364_000 as u64)111 .saturating_add(T::DbWeight::get().reads(2 as u64))112 .saturating_add(T::DbWeight::get().writes(1 as u64))113 }114 // Storage: AppPromotion Admin (r:1 w:0)115 // Storage: Common CollectionById (r:1 w:1)116 fn stop_sponsoring_collection() -> Weight {117 Weight::from_ref_time(15_710_000 as u64)118 .saturating_add(T::DbWeight::get().reads(2 as u64))119 .saturating_add(T::DbWeight::get().writes(1 as u64))120 }121 // Storage: AppPromotion Admin (r:1 w:0)122 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)123 fn sponsor_contract() -> Weight {124 Weight::from_ref_time(12_669_000 as u64)125 .saturating_add(T::DbWeight::get().reads(1 as u64))126 .saturating_add(T::DbWeight::get().writes(1 as u64))127 }128 // Storage: AppPromotion Admin (r:1 w:0)129 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)130 fn stop_sponsoring_contract() -> Weight {131 Weight::from_ref_time(14_406_000 as u64)132 .saturating_add(T::DbWeight::get().reads(2 as u64))133 .saturating_add(T::DbWeight::get().writes(1 as u64))134 }135}136137// For backwards compatibility and tests138impl WeightInfo for () {139 // Storage: AppPromotion PendingUnstake (r:1 w:0)140 // Storage: System Account (r:1 w:1)141 fn on_initialize(b: u32, ) -> Weight {142 Weight::from_ref_time(3_079_948 as u64)143 // Standard Error: 30_376144 .saturating_add(Weight::from_ref_time(6_343_630 as u64).saturating_mul(b as u64))145 .saturating_add(RocksDbWeight::get().reads(1 as u64))146 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(b as u64)))147 .saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(b as u64)))148 }149 // Storage: AppPromotion Admin (r:0 w:1)150 fn set_admin_address() -> Weight {151 Weight::from_ref_time(6_653_000 as u64)152 .saturating_add(RocksDbWeight::get().writes(1 as u64))153 }154 // Storage: AppPromotion Admin (r:1 w:0)155 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)156 // Storage: ParachainSystem ValidationData (r:1 w:0)157 // Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)158 // Storage: AppPromotion Staked (r:11 w:10)159 // Storage: System Account (r:2 w:2)160 // Storage: Balances Locks (r:1 w:1)161 // Storage: AppPromotion TotalStaked (r:1 w:1)162 fn payout_stakers(b: u32, ) -> Weight {163 Weight::from_ref_time(74_048_000 as u64)164 // Standard Error: 33_223165 .saturating_add(Weight::from_ref_time(57_702_092 as u64).saturating_mul(b as u64))166 .saturating_add(RocksDbWeight::get().reads(7 as u64))167 .saturating_add(RocksDbWeight::get().reads((12 as u64).saturating_mul(b as u64)))168 .saturating_add(RocksDbWeight::get().writes(3 as u64))169 .saturating_add(RocksDbWeight::get().writes((12 as u64).saturating_mul(b as u64)))170 }171 // Storage: AppPromotion StakesPerAccount (r:1 w:1)172 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)173 // Storage: System Account (r:1 w:1)174 // Storage: Balances Locks (r:1 w:1)175 // Storage: ParachainSystem ValidationData (r:1 w:0)176 // Storage: AppPromotion Staked (r:1 w:1)177 // Storage: AppPromotion TotalStaked (r:1 w:1)178 fn stake() -> Weight {179 Weight::from_ref_time(20_314_000 as u64)180 .saturating_add(RocksDbWeight::get().reads(7 as u64))181 .saturating_add(RocksDbWeight::get().writes(5 as u64))182 }183 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)184 // Storage: AppPromotion PendingUnstake (r:1 w:1)185 // Storage: AppPromotion Staked (r:11 w:10)186 // Storage: Balances Locks (r:1 w:1)187 // Storage: System Account (r:1 w:1)188 // Storage: AppPromotion TotalStaked (r:1 w:1)189 // Storage: AppPromotion StakesPerAccount (r:0 w:1)190 fn unstake() -> Weight {191 Weight::from_ref_time(64_582_000 as u64)192 .saturating_add(RocksDbWeight::get().reads(16 as u64))193 .saturating_add(RocksDbWeight::get().writes(15 as u64))194 }195 // Storage: AppPromotion Admin (r:1 w:0)196 // Storage: Common CollectionById (r:1 w:1)197 fn sponsor_collection() -> Weight {198 Weight::from_ref_time(16_364_000 as u64)199 .saturating_add(RocksDbWeight::get().reads(2 as u64))200 .saturating_add(RocksDbWeight::get().writes(1 as u64))201 }202 // Storage: AppPromotion Admin (r:1 w:0)203 // Storage: Common CollectionById (r:1 w:1)204 fn stop_sponsoring_collection() -> Weight {205 Weight::from_ref_time(15_710_000 as u64)206 .saturating_add(RocksDbWeight::get().reads(2 as u64))207 .saturating_add(RocksDbWeight::get().writes(1 as u64))208 }209 // Storage: AppPromotion Admin (r:1 w:0)210 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)211 fn sponsor_contract() -> Weight {212 Weight::from_ref_time(12_669_000 as u64)213 .saturating_add(RocksDbWeight::get().reads(1 as u64))214 .saturating_add(RocksDbWeight::get().writes(1 as u64))215 }216 // Storage: AppPromotion Admin (r:1 w:0)217 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)218 fn stop_sponsoring_contract() -> Weight {219 Weight::from_ref_time(14_406_000 as u64)220 .saturating_add(RocksDbWeight::get().reads(2 as u64))221 .saturating_add(RocksDbWeight::get().writes(1 as u64))222 }223}runtime/common/mod.rsdiffbeforeafterboth--- a/runtime/common/mod.rs
+++ b/runtime/common/mod.rs
@@ -145,6 +145,10 @@
.map(|d| d.relay_parent_number)
.unwrap_or_default()
}
+ #[cfg(feature = "runtime-benchmarks")]
+ fn set_block_number(block: Self::BlockNumber) {
+ cumulus_pallet_parachain_system::RelaychainBlockNumberProvider::<T>::set_block_number(block)
+ }
}
pub(crate) struct CheckInherents;
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -44,6 +44,7 @@
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
'pallet-maintenance/runtime-benchmarks',
+ 'cumulus-pallet-parachain-system/runtime-benchmarks'
]
try-runtime = [
'frame-try-runtime',
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -43,6 +43,7 @@
'sp-runtime/runtime-benchmarks',
'xcm-builder/runtime-benchmarks',
'pallet-maintenance/runtime-benchmarks',
+ 'cumulus-pallet-parachain-system/runtime-benchmarks',
]
try-runtime = [
'frame-try-runtime',