difftreelog
fix(app-promo) benchmarks
in: master
2 files changed
pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -65,7 +65,7 @@
let staker = account::<T::AccountId>("staker", index, SEED);
<T as Config>::Currency::make_free_balance_be(&staker, Perbill::from_rational(1u32, 2) * BalanceOf::<T>::max_value());
PromototionPallet::<T>::stake(RawOrigin::Signed(staker.clone()).into(), Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get())?;
- PromototionPallet::<T>::unstake_all(RawOrigin::Signed(staker.clone()).into()).map_err(|e| e.error)?;
+ PromototionPallet::<T>::unstake_all(RawOrigin::Signed(staker.clone()).into())?;
Result::<(), sp_runtime::DispatchError>::Ok(())
})?;
let block_number = <frame_system::Pallet<T>>::current_block_number() + T::PendingInterval::get();
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: 2023-02-14, 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_all() -> Weight;42 fn unstake_partial() -> Weight;43 fn sponsor_collection() -> Weight;44 fn stop_sponsoring_collection() -> Weight;45 fn sponsor_contract() -> Weight;46 fn stop_sponsoring_contract() -> Weight;47}4849/// Weights for pallet_app_promotion using the Substrate node and recommended hardware.50pub struct SubstrateWeight<T>(PhantomData<T>);51impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {52 // Storage: AppPromotion PendingUnstake (r:1 w:0)53 // Storage: Balances Locks (r:1 w:1)54 // Storage: System Account (r:1 w:1)55 fn on_initialize(b: u32, ) -> Weight {56 Weight::from_ref_time(2_562_275 as u64)57 // Standard Error: 21_95058 .saturating_add(Weight::from_ref_time(7_177_129 as u64).saturating_mul(b as u64))59 .saturating_add(T::DbWeight::get().reads(1 as u64))60 .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(b as u64)))61 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(b as u64)))62 }63 // Storage: AppPromotion Admin (r:0 w:1)64 fn set_admin_address() -> Weight {65 Weight::from_ref_time(6_146_000 as u64)66 .saturating_add(T::DbWeight::get().writes(1 as u64))67 }68 // Storage: AppPromotion Admin (r:1 w:0)69 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)70 // Storage: ParachainSystem ValidationData (r:1 w:0)71 // Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)72 // Storage: AppPromotion Staked (r:11 w:10)73 // Storage: System Account (r:2 w:2)74 // Storage: Balances Locks (r:1 w:1)75 // Storage: AppPromotion TotalStaked (r:1 w:1)76 fn payout_stakers(b: u32, ) -> Weight {77 Weight::from_ref_time(64_035_000 as u64)78 // Standard Error: 19_43479 .saturating_add(Weight::from_ref_time(47_251_111 as u64).saturating_mul(b as u64))80 .saturating_add(T::DbWeight::get().reads(7 as u64))81 .saturating_add(T::DbWeight::get().reads((12 as u64).saturating_mul(b as u64)))82 .saturating_add(T::DbWeight::get().writes(3 as u64))83 .saturating_add(T::DbWeight::get().writes((12 as u64).saturating_mul(b as u64)))84 }85 // Storage: AppPromotion StakesPerAccount (r:1 w:1)86 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)87 // Storage: System Account (r:1 w:1)88 // Storage: Balances Locks (r:1 w:1)89 // Storage: ParachainSystem ValidationData (r:1 w:0)90 // Storage: AppPromotion Staked (r:1 w:1)91 // Storage: AppPromotion TotalStaked (r:1 w:1)92 fn stake() -> Weight {93 Weight::from_ref_time(18_078_000 as u64)94 .saturating_add(T::DbWeight::get().reads(7 as u64))95 .saturating_add(T::DbWeight::get().writes(5 as u64))96 }97 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)98 // Storage: AppPromotion PendingUnstake (r:1 w:1)99 // Storage: AppPromotion Staked (r:11 w:10)100 // Storage: AppPromotion TotalStaked (r:1 w:1)101 // Storage: AppPromotion StakesPerAccount (r:0 w:1)102 fn unstake_all() -> Weight {103 Weight::from_ref_time(45_038_000 as u64)104 .saturating_add(T::DbWeight::get().reads(14 as u64))105 .saturating_add(T::DbWeight::get().writes(13 as u64))106 }107 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)108 // Storage: AppPromotion PendingUnstake (r:1 w:1)109 // Storage: AppPromotion Staked (r:11 w:10)110 // Storage: AppPromotion TotalStaked (r:1 w:1)111 // Storage: AppPromotion StakesPerAccount (r:1 w:1)112 fn unstake_partial() -> Weight {113 Weight::from_ref_time(48_863_000 as u64)114 .saturating_add(T::DbWeight::get().reads(15 as u64))115 .saturating_add(T::DbWeight::get().writes(13 as u64))116 }117 // Storage: AppPromotion Admin (r:1 w:0)118 // Storage: Common CollectionById (r:1 w:1)119 fn sponsor_collection() -> Weight {120 Weight::from_ref_time(14_808_000 as u64)121 .saturating_add(T::DbWeight::get().reads(2 as u64))122 .saturating_add(T::DbWeight::get().writes(1 as u64))123 }124 // Storage: AppPromotion Admin (r:1 w:0)125 // Storage: Common CollectionById (r:1 w:1)126 fn stop_sponsoring_collection() -> Weight {127 Weight::from_ref_time(14_587_000 as u64)128 .saturating_add(T::DbWeight::get().reads(2 as u64))129 .saturating_add(T::DbWeight::get().writes(1 as u64))130 }131 // Storage: AppPromotion Admin (r:1 w:0)132 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)133 fn sponsor_contract() -> Weight {134 Weight::from_ref_time(11_791_000 as u64)135 .saturating_add(T::DbWeight::get().reads(1 as u64))136 .saturating_add(T::DbWeight::get().writes(1 as u64))137 }138 // Storage: AppPromotion Admin (r:1 w:0)139 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)140 fn stop_sponsoring_contract() -> Weight {141 Weight::from_ref_time(13_576_000 as u64)142 .saturating_add(T::DbWeight::get().reads(2 as u64))143 .saturating_add(T::DbWeight::get().writes(1 as u64))144 }145}146147// For backwards compatibility and tests148impl WeightInfo for () {149 // Storage: AppPromotion PendingUnstake (r:1 w:0)150 // Storage: Balances Locks (r:1 w:1)151 // Storage: System Account (r:1 w:1)152 fn on_initialize(b: u32, ) -> Weight {153 Weight::from_ref_time(2_562_275 as u64)154 // Standard Error: 21_950155 .saturating_add(Weight::from_ref_time(7_177_129 as u64).saturating_mul(b as u64))156 .saturating_add(RocksDbWeight::get().reads(1 as u64))157 .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(b as u64)))158 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(b as u64)))159 }160 // Storage: AppPromotion Admin (r:0 w:1)161 fn set_admin_address() -> Weight {162 Weight::from_ref_time(6_146_000 as u64)163 .saturating_add(RocksDbWeight::get().writes(1 as u64))164 }165 // Storage: AppPromotion Admin (r:1 w:0)166 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)167 // Storage: ParachainSystem ValidationData (r:1 w:0)168 // Storage: AppPromotion PreviousCalculatedRecord (r:1 w:1)169 // Storage: AppPromotion Staked (r:11 w:10)170 // Storage: System Account (r:2 w:2)171 // Storage: Balances Locks (r:1 w:1)172 // Storage: AppPromotion TotalStaked (r:1 w:1)173 fn payout_stakers(b: u32, ) -> Weight {174 Weight::from_ref_time(64_035_000 as u64)175 // Standard Error: 19_434176 .saturating_add(Weight::from_ref_time(47_251_111 as u64).saturating_mul(b as u64))177 .saturating_add(RocksDbWeight::get().reads(7 as u64))178 .saturating_add(RocksDbWeight::get().reads((12 as u64).saturating_mul(b as u64)))179 .saturating_add(RocksDbWeight::get().writes(3 as u64))180 .saturating_add(RocksDbWeight::get().writes((12 as u64).saturating_mul(b as u64)))181 }182 // Storage: AppPromotion StakesPerAccount (r:1 w:1)183 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)184 // Storage: System Account (r:1 w:1)185 // Storage: Balances Locks (r:1 w:1)186 // Storage: ParachainSystem ValidationData (r:1 w:0)187 // Storage: AppPromotion Staked (r:1 w:1)188 // Storage: AppPromotion TotalStaked (r:1 w:1)189 fn stake() -> Weight {190 Weight::from_ref_time(18_078_000 as u64)191 .saturating_add(RocksDbWeight::get().reads(7 as u64))192 .saturating_add(RocksDbWeight::get().writes(5 as u64))193 }194 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)195 // Storage: AppPromotion PendingUnstake (r:1 w:1)196 // Storage: AppPromotion Staked (r:11 w:10)197 // Storage: AppPromotion TotalStaked (r:1 w:1)198 // Storage: AppPromotion StakesPerAccount (r:0 w:1)199 fn unstake_all() -> Weight {200 Weight::from_ref_time(45_038_000 as u64)201 .saturating_add(RocksDbWeight::get().reads(14 as u64))202 .saturating_add(RocksDbWeight::get().writes(13 as u64))203 }204 // Storage: Configuration AppPromomotionConfigurationOverride (r:1 w:0)205 // Storage: AppPromotion PendingUnstake (r:1 w:1)206 // Storage: AppPromotion Staked (r:11 w:10)207 // Storage: AppPromotion TotalStaked (r:1 w:1)208 // Storage: AppPromotion StakesPerAccount (r:1 w:1)209 fn unstake_partial() -> Weight {210 Weight::from_ref_time(48_863_000 as u64)211 .saturating_add(RocksDbWeight::get().reads(15 as u64))212 .saturating_add(RocksDbWeight::get().writes(13 as u64))213 }214 // Storage: AppPromotion Admin (r:1 w:0)215 // Storage: Common CollectionById (r:1 w:1)216 fn sponsor_collection() -> Weight {217 Weight::from_ref_time(14_808_000 as u64)218 .saturating_add(RocksDbWeight::get().reads(2 as u64))219 .saturating_add(RocksDbWeight::get().writes(1 as u64))220 }221 // Storage: AppPromotion Admin (r:1 w:0)222 // Storage: Common CollectionById (r:1 w:1)223 fn stop_sponsoring_collection() -> Weight {224 Weight::from_ref_time(14_587_000 as u64)225 .saturating_add(RocksDbWeight::get().reads(2 as u64))226 .saturating_add(RocksDbWeight::get().writes(1 as u64))227 }228 // Storage: AppPromotion Admin (r:1 w:0)229 // Storage: EvmContractHelpers Sponsoring (r:0 w:1)230 fn sponsor_contract() -> Weight {231 Weight::from_ref_time(11_791_000 as u64)232 .saturating_add(RocksDbWeight::get().reads(1 as u64))233 .saturating_add(RocksDbWeight::get().writes(1 as u64))234 }235 // Storage: AppPromotion Admin (r:1 w:0)236 // Storage: EvmContractHelpers Sponsoring (r:1 w:1)237 fn stop_sponsoring_contract() -> Weight {238 Weight::from_ref_time(13_576_000 as u64)239 .saturating_add(RocksDbWeight::get().reads(2 as u64))240 .saturating_add(RocksDbWeight::get().writes(1 as u64))241 }242}