diff --git a/pallets/inflation/src/benchmarking.rs b/pallets/inflation/src/benchmarking.rs index 5093268e4..2739d1628 100644 --- a/pallets/inflation/src/benchmarking.rs +++ b/pallets/inflation/src/benchmarking.rs @@ -42,6 +42,7 @@ fn initial_config() { adjustable_stakers_part: Perquintill::from_percent(35), bonus_part: Perquintill::from_percent(12), ideal_staking_rate: Perquintill::from_percent(50), + decay_rate: Perquintill::from_percent(99), }; assert!(params.is_valid()); @@ -59,6 +60,8 @@ fn initial_config() { adjustable_staker_reward_pool_per_era: 99999 * UNIT, bonus_reward_pool_per_period: 123987 * UNIT, ideal_staking_rate: Perquintill::from_percent(50), + decay_rate: Perquintill::from_percent(99), + decay_factor: Perquintill::one(), }; InflationParams::::put(params); @@ -144,7 +147,9 @@ mod benchmarks { Pallet::::on_finalize(block); } - assert_eq!(ActiveInflationConfig::::get(), init_config); + let mut expected_config = init_config.clone(); + expected_config.decay_factor = init_config.decay_factor * init_config.decay_rate; + assert_eq!(ActiveInflationConfig::::get(), expected_config); // The 'sane' assumption is that at least something will be issued for treasury & collators assert!(T::Currency::total_issuance() > init_issuance); diff --git a/pallets/inflation/src/lib.rs b/pallets/inflation/src/lib.rs index 4aacfad3d..30e2a8858 100644 --- a/pallets/inflation/src/lib.rs +++ b/pallets/inflation/src/lib.rs @@ -137,7 +137,7 @@ pub mod pallet { use super::*; /// The current storage version. - pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1); + pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(2); #[pallet::pallet] #[pallet::storage_version(STORAGE_VERSION)] @@ -211,7 +211,8 @@ pub mod pallet { assert!(self.params.is_valid()); let starting_era = 1; - let config = Pallet::::recalculate_inflation(starting_era); + let starting_decay_factor = Perquintill::one(); + let config = Pallet::::recalculate_inflation(starting_era, starting_decay_factor); ActiveInflationConfig::::put(config); InflationParams::::put(self.params); @@ -221,13 +222,22 @@ pub mod pallet { #[pallet::hooks] impl Hooks> for Pallet { fn on_initialize(_now: BlockNumberFor) -> Weight { - Self::payout_block_rewards(); + let mut weight = T::DbWeight::get().reads(1); + let mut config = ActiveInflationConfig::::get(); + + if config.decay_rate != Perquintill::one() { + config.decay_factor = config.decay_factor * config.decay_rate; + ActiveInflationConfig::::put(config); + weight = weight.saturating_add(T::DbWeight::get().writes(1)); + } + + Self::payout_block_rewards(&config); // Benchmarks won't account for the whitelisted storage access so this needs to be added manually. - // - // ActiveInflationConfig - 1 DB read // DoRecalculation - 1 DB read - ::DbWeight::get().reads(2) + weight = weight.saturating_add(::DbWeight::get().reads(1)); + + weight } fn on_finalize(_now: BlockNumberFor) { @@ -238,7 +248,8 @@ pub mod pallet { // // This should be done as late as possible, to ensure all operations that modify issuance are done. if let Some(next_era) = DoRecalculation::::get() { - let config = Self::recalculate_inflation(next_era); + let decay_factor = ActiveInflationConfig::::get().decay_factor; + let config = Self::recalculate_inflation(next_era, decay_factor); ActiveInflationConfig::::put(config.clone()); DoRecalculation::::kill(); @@ -294,8 +305,8 @@ pub mod pallet { ) -> DispatchResult { ensure_root(origin)?; - let config = Self::recalculate_inflation(next_era); - + let decay_factor = ActiveInflationConfig::::get().decay_factor; + let config = Self::recalculate_inflation(next_era, decay_factor); ActiveInflationConfig::::put(config.clone()); Self::deposit_event(Event::::ForcedInflationRecalculation { config }); @@ -331,25 +342,25 @@ pub mod pallet { } impl Pallet { - /// Payout block rewards to the beneficiaries. - /// - /// Return the total amount issued. - fn payout_block_rewards() -> Balance { - let config = ActiveInflationConfig::::get(); + /// Payout block rewards to the beneficiaries applying the decay factor. + fn payout_block_rewards(config: &InflationConfiguration) { + let collator_rewards = config.decay_factor * config.collator_reward_per_block; + let treasury_rewards = config.decay_factor * config.treasury_reward_per_block; - let collator_amount = T::Currency::issue(config.collator_reward_per_block); - let treasury_amount = T::Currency::issue(config.treasury_reward_per_block); + let collator_amount = T::Currency::issue(collator_rewards); + let treasury_amount = T::Currency::issue(treasury_rewards); T::PayoutPerBlock::collators(collator_amount); T::PayoutPerBlock::treasury(treasury_amount); - - config.collator_reward_per_block + config.treasury_reward_per_block } /// Recalculates the inflation based on the current total issuance & inflation parameters. /// /// Returns the new inflation configuration. - pub(crate) fn recalculate_inflation(next_era: EraNumber) -> InflationConfiguration { + pub(crate) fn recalculate_inflation( + next_era: EraNumber, + decay_factor: Perquintill, + ) -> InflationConfiguration { // Calculate max emission based on the current total issuance. let params = InflationParams::::get(); let total_issuance = T::Currency::total_issuance(); @@ -358,7 +369,7 @@ pub mod pallet { let recalculation_era = next_era.saturating_add(T::CycleConfiguration::eras_per_cycle()); - Self::new_config(recalculation_era, max_emission) + Self::new_config(recalculation_era, max_emission, decay_factor) } /// Re-adjust the existing inflation configuration using the current inflation parameters. @@ -411,13 +422,14 @@ pub mod pallet { .saturating_add(bonus_reward_pool); // 4. Calculate new inflation configuration - Self::new_config(config.recalculation_era, max_emission) + Self::new_config(config.recalculation_era, max_emission, config.decay_factor) } // Calculate new inflation configuration, based on the provided `max_emission`. fn new_config( recalculation_era: EraNumber, max_emission: Balance, + decay_factor: Perquintill, ) -> InflationConfiguration { let params = InflationParams::::get(); @@ -478,6 +490,8 @@ pub mod pallet { adjustable_staker_reward_pool_per_era, bonus_reward_pool_per_period, ideal_staking_rate: params.ideal_staking_rate, + decay_rate: params.decay_rate, + decay_factor, }; new_inflation_config.sanity_check(); @@ -512,15 +526,18 @@ pub mod pallet { let adjustment_factor = staked_ratio / config.ideal_staking_rate; let adjustable_part = adjustment_factor * config.adjustable_staker_reward_pool_per_era; - let staker_reward_pool = config - .base_staker_reward_pool_per_era - .saturating_add(adjustable_part); + let staker_reward_pool = config.decay_factor + * config + .base_staker_reward_pool_per_era + .saturating_add(adjustable_part); + let dapp_reward_pool = config.decay_factor * config.dapp_reward_pool_per_era; - (staker_reward_pool, config.dapp_reward_pool_per_era) + (staker_reward_pool, dapp_reward_pool) } fn bonus_reward_pool() -> Balance { - ActiveInflationConfig::::get().bonus_reward_pool_per_period + let config = ActiveInflationConfig::::get(); + config.decay_factor * config.bonus_reward_pool_per_period } fn payout_reward(account: &T::AccountId, reward: Balance) -> Result<(), ()> { @@ -571,6 +588,14 @@ pub struct InflationConfiguration { /// Used to derive exact amount of adjustable staker rewards. #[codec(compact)] pub ideal_staking_rate: Perquintill, + /// Per-block decay rate applied to the decay factor. + /// A value of `Perquintill::one()` means no decay. + #[codec(compact)] + pub decay_rate: Perquintill, + /// Compounded decay multiplied into rewards when they are actually paid. + /// A value of `Perquintill::one()` means no decay. + #[codec(compact)] + pub decay_factor: Perquintill, } impl InflationConfiguration { @@ -643,6 +668,10 @@ pub struct InflationParameters { /// Used to derive exact amount of adjustable staker rewards. #[codec(compact)] pub ideal_staking_rate: Perquintill, + /// Per-block decay rate applied to all reward pools and per-block rewards. + /// A value of `Perquintill::one()` means no decay. + #[codec(compact)] + pub decay_rate: Perquintill, } impl InflationParameters { @@ -682,6 +711,13 @@ impl Default for InflationParameters { adjustable_stakers_part: Perquintill::from_percent(35), bonus_part: Perquintill::from_percent(12), ideal_staking_rate: Perquintill::from_percent(50), + + // Use non-default decay rate when benchmarking to measure decay calculation + #[cfg(feature = "runtime-benchmarks")] + decay_rate: Perquintill::from_percent(99), + + #[cfg(not(feature = "runtime-benchmarks"))] + decay_rate: Perquintill::one(), } } } diff --git a/pallets/inflation/src/migration.rs b/pallets/inflation/src/migration.rs index 100b75a16..e09cf7f64 100644 --- a/pallets/inflation/src/migration.rs +++ b/pallets/inflation/src/migration.rs @@ -18,22 +18,287 @@ use super::*; use frame_support::pallet_prelude::Weight; -use frame_support::traits::OnRuntimeUpgrade; - -/// Half block reward for collators and treasury -pub struct AdjustBlockRewardMigration(core::marker::PhantomData); - -impl OnRuntimeUpgrade for AdjustBlockRewardMigration { - fn on_runtime_upgrade() -> Weight { - log::info!("🚚 migrated to async backing, adjust reward per block"); - ActiveInflationConfig::::mutate_exists(|maybe| { - if let Some(config) = maybe { - config.collator_reward_per_block = - config.collator_reward_per_block.saturating_div(2); - config.treasury_reward_per_block = - config.treasury_reward_per_block.saturating_div(2); +use frame_support::traits::UncheckedOnRuntimeUpgrade; + +#[cfg(feature = "try-runtime")] +use sp_std::vec::Vec; + +#[cfg(feature = "try-runtime")] +use sp_runtime::TryRuntimeError; + +/// Exports for versioned migration `type`s for this pallet. +pub mod versioned_migrations { + use super::*; + + /// Migration V1 to V2 wrapped in a [`frame_support::migrations::VersionedMigration`], ensuring + /// the migration is only performed when on-chain version is 1. + pub type V1ToV2 = frame_support::migrations::VersionedMigration< + 1, + 2, + v2::VersionMigrateV1ToV2, + Pallet, + ::DbWeight, + >; +} + +mod v2 { + use super::*; + use crate::migration::v1::{ + InflationConfiguration as InflationConfigurationV1, + InflationParameters as InflationParametersV1, + }; + + pub struct VersionMigrateV1ToV2( + PhantomData<(T, DecayRate, DecayFactor)>, + ); + + impl, DecayFactor: Get> + UncheckedOnRuntimeUpgrade for VersionMigrateV1ToV2 + { + fn on_runtime_upgrade() -> Weight { + let decay_rate = DecayRate::get(); + let decay_factor = DecayFactor::get(); + + // Add the _decay_rate_ to the inflation params + let result = + InflationParams::::translate::(|maybe_old_params| { + match maybe_old_params { + Some(old_params) => Some(InflationParameters { + max_inflation_rate: old_params.max_inflation_rate, + treasury_part: old_params.treasury_part, + collators_part: old_params.collators_part, + dapps_part: old_params.dapps_part, + base_stakers_part: old_params.base_stakers_part, + adjustable_stakers_part: old_params.adjustable_stakers_part, + bonus_part: old_params.bonus_part, + ideal_staking_rate: old_params.ideal_staking_rate, + decay_rate, + }), + _ => None, + } + }); + + if result.is_err() { + log::error!("Failed to translate InflationParams from previous V1 type to current V2 type. Check InflationParametersV1 decoding."); + return T::DbWeight::get().reads_writes(1, 0); + } + + // Add the _decay_rate_ and _decay_factor_ to the active config + let result = ActiveInflationConfig::::translate::( + |maybe_old_config| match maybe_old_config { + Some(old_config) => Some(InflationConfiguration { + recalculation_era: old_config.recalculation_era, + issuance_safety_cap: old_config.issuance_safety_cap, + collator_reward_per_block: old_config.collator_reward_per_block, + treasury_reward_per_block: old_config.treasury_reward_per_block, + dapp_reward_pool_per_era: old_config.dapp_reward_pool_per_era, + base_staker_reward_pool_per_era: old_config.base_staker_reward_pool_per_era, + adjustable_staker_reward_pool_per_era: old_config + .adjustable_staker_reward_pool_per_era, + bonus_reward_pool_per_period: old_config.bonus_reward_pool_per_period, + ideal_staking_rate: old_config.ideal_staking_rate, + decay_rate, + decay_factor, + }), + _ => None, + }, + ); + + if result.is_err() { + log::error!("Failed to translate InflationConfiguration from previous V1 type to current V2 type. Check InflationConfigurationV1 decoding."); + return T::DbWeight::get().reads_writes(2, 1); } - }); - T::DbWeight::get().reads_writes(1, 1) + + T::DbWeight::get().reads_writes(2, 2) + } + + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, TryRuntimeError> { + let old_config = v1::ActiveInflationConfig::::get().ok_or_else(|| { + TryRuntimeError::Other( + "pallet-inflation::migration::v2: No old config found for ActiveInflationConfig", + ) + })?; + + let old_params = v1::InflationParams::::get().ok_or_else(|| { + TryRuntimeError::Other( + "pallet-inflation::migration::v2: No old params found for InflationParams", + ) + })?; + Ok((old_config, old_params).encode()) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(data: Vec) -> Result<(), TryRuntimeError> { + // Decode the old values + let (old_config, old_params): (InflationConfigurationV1, InflationParametersV1) = + Decode::decode(&mut &data[..]).map_err(|_| { + TryRuntimeError::Other( + "pallet-inflation::migration::v2: Failed to decode old values", + ) + })?; + + // Get the new values + let new_config = ActiveInflationConfig::::get(); + let new_params = InflationParams::::get(); + + // Verify that new params and new config are valid + assert!(new_params.is_valid()); + new_config.sanity_check(); + + // Verify active config remain unchanged + assert_eq!( + old_config.recalculation_era, new_config.recalculation_era, + "pallet-inflation::migration::v2: Recalculation Era has changed" + ); + assert_eq!( + old_config.issuance_safety_cap, new_config.issuance_safety_cap, + "pallet-inflation::migration::v2: Issuance Safety Cap has changed" + ); + assert_eq!( + old_config.collator_reward_per_block, new_config.collator_reward_per_block, + "pallet-inflation::migration::v2: Collator Reward Per Block has changed" + ); + assert_eq!( + old_config.treasury_reward_per_block, new_config.treasury_reward_per_block, + "pallet-inflation::migration::v2: Treasury Reward Per Block has changed" + ); + assert_eq!( + old_config.dapp_reward_pool_per_era, new_config.dapp_reward_pool_per_era, + "pallet-inflation::migration::v2: Dapp Reward Per Era has changed" + ); + assert_eq!( + old_config.base_staker_reward_pool_per_era, + new_config.base_staker_reward_pool_per_era, + "pallet-inflation::migration::v2: Staker Reward Pool Per Era has changed" + ); + assert_eq!( + old_config.adjustable_staker_reward_pool_per_era, new_config.adjustable_staker_reward_pool_per_era, + "pallet-inflation::migration::v2: Adjustable Staker Reward Pool Per Era has changed" + ); + assert_eq!( + old_config.bonus_reward_pool_per_period, new_config.bonus_reward_pool_per_period, + "pallet-inflation::migration::v2: Bonus Reward Pool Per Period has changed" + ); + assert_eq!( + old_config.ideal_staking_rate, new_config.ideal_staking_rate, + "pallet-inflation::migration::v2: Ideal staking rate has changed in config" + ); + + // Verify parameters remain unchanged + assert_eq!( + old_params.max_inflation_rate, new_params.max_inflation_rate, + "pallet-inflation::migration::v2: Max inflation rate has changed" + ); + assert_eq!( + old_params.treasury_part, new_params.treasury_part, + "pallet-inflation::migration::v2: Treasury part has changed" + ); + assert_eq!( + old_params.collators_part, new_params.collators_part, + "pallet-inflation::migration::v2: Collator part has changed" + ); + assert_eq!( + old_params.dapps_part, new_params.dapps_part, + "pallet-inflation::migration::v2: Dapps part has changed" + ); + assert_eq!( + old_params.base_stakers_part, new_params.base_stakers_part, + "pallet-inflation::migration::v2: Base staker part has changed" + ); + assert_eq!( + old_params.adjustable_stakers_part, new_params.adjustable_stakers_part, + "pallet-inflation::migration::v2: Adjustable staker part has changed" + ); + assert_eq!( + old_params.bonus_part, new_params.bonus_part, + "pallet-inflation::migration::v2: Bonus staker part has changed" + ); + assert_eq!( + old_params.ideal_staking_rate, new_params.ideal_staking_rate, + "pallet-inflation::migration::v2: Ideal staking rate has changed in params" + ); + + // Verify correct decay rate is initialized + let expected_decay_rate = DecayRate::get(); + assert_eq!( + expected_decay_rate, new_params.decay_rate, + "pallet-inflation::migration::v2: No correct decay rate in params" + ); + assert_eq!( + expected_decay_rate, new_config.decay_rate, + "pallet-inflation::migration::v2: No correct decay rate in config" + ); + + // Verify correct decay factor is initialized + let expected_decay_factor = DecayFactor::get(); + assert_eq!( + expected_decay_factor, new_config.decay_factor, + "pallet-inflation::migration::v2: No correct decay factor in config" + ); + + // Verify storage version has been updated + ensure!( + Pallet::::on_chain_storage_version() >= 2, + "pallet-inflation::migration::v2: Wrong storage version." + ); + + Ok(()) + } } } + +mod v1 { + use super::*; + use frame_support::storage_alias; + + #[derive(Encode, Decode)] + pub struct InflationConfiguration { + #[codec(compact)] + pub recalculation_era: EraNumber, + #[codec(compact)] + pub issuance_safety_cap: Balance, + #[codec(compact)] + pub collator_reward_per_block: Balance, + #[codec(compact)] + pub treasury_reward_per_block: Balance, + #[codec(compact)] + pub dapp_reward_pool_per_era: Balance, + #[codec(compact)] + pub base_staker_reward_pool_per_era: Balance, + #[codec(compact)] + pub adjustable_staker_reward_pool_per_era: Balance, + #[codec(compact)] + pub bonus_reward_pool_per_period: Balance, + #[codec(compact)] + pub ideal_staking_rate: Perquintill, + } + + #[derive(Encode, Decode)] + pub struct InflationParameters { + #[codec(compact)] + pub max_inflation_rate: Perquintill, + #[codec(compact)] + pub treasury_part: Perquintill, + #[codec(compact)] + pub collators_part: Perquintill, + #[codec(compact)] + pub dapps_part: Perquintill, + #[codec(compact)] + pub base_stakers_part: Perquintill, + #[codec(compact)] + pub adjustable_stakers_part: Perquintill, + #[codec(compact)] + pub bonus_part: Perquintill, + #[codec(compact)] + pub ideal_staking_rate: Perquintill, + } + + /// v1 type for [`crate::ActiveInflationConfig`] + #[storage_alias] + pub type ActiveInflationConfig = StorageValue, InflationConfiguration>; + + /// v1 type for [`crate::InflationParams`] + #[storage_alias] + pub type InflationParams = StorageValue, InflationParameters>; +} diff --git a/pallets/inflation/src/mock.rs b/pallets/inflation/src/mock.rs index aef229c85..faff40744 100644 --- a/pallets/inflation/src/mock.rs +++ b/pallets/inflation/src/mock.rs @@ -42,6 +42,7 @@ pub const INIT_PARAMS: InflationParameters = InflationParameters { adjustable_stakers_part: Perquintill::from_percent(35), bonus_part: Perquintill::from_percent(12), ideal_staking_rate: Perquintill::from_percent(50), + decay_rate: Perquintill::one(), }; type Block = frame_system::mocking::MockBlockU32; @@ -135,7 +136,7 @@ impl ExternalityBuilder { ext.execute_with(|| { // Set initial pallet inflation values InflationParams::::put(INIT_PARAMS); - let config = Inflation::recalculate_inflation(1); + let config = Inflation::recalculate_inflation(1, Perquintill::one()); ActiveInflationConfig::::put(config); System::set_block_number(1); @@ -165,3 +166,26 @@ macro_rules! lenient_balance_assert_eq { ); }}; } + +#[macro_export] +macro_rules! lenient_perquintill_assert_eq { + ($x:expr, $y:expr) => {{ + use sp_runtime::Permill; + + let x_num: u128 = $x.deconstruct().into(); // Perquintill → u128 (0..=1e18) + let y_num: u128 = $y.deconstruct().into(); + + let ratio = if x_num > y_num { + Permill::from_rational(y_num, x_num) + } else { + Permill::from_rational(x_num, y_num) + }; + + let threshold = Permill::from_rational(999_u32, 1000); // ≥ 99.9% + assert!( + ratio >= threshold, + "Ratio of {:?} indicates a significant difference between {:?} and {:?} (expected >= {:?})", + ratio, $x, $y, threshold, + ); + }}; +} diff --git a/pallets/inflation/src/tests.rs b/pallets/inflation/src/tests.rs index 48465afbc..42ef2b0f3 100644 --- a/pallets/inflation/src/tests.rs +++ b/pallets/inflation/src/tests.rs @@ -21,7 +21,7 @@ use frame_support::{assert_noop, assert_ok, assert_storage_noop, traits::Hooks}; use mock::*; use sp_runtime::{ traits::{AccountIdConversion, BadOrigin, Zero}, - Perquintill, + Perquintill, Saturating, }; #[test] @@ -34,6 +34,7 @@ fn force_set_inflation_params_work() { ExternalityBuilder::build().execute_with(|| { let mut new_params = InflationParams::::get(); new_params.max_inflation_rate = Perquintill::from_percent(20); + new_params.decay_rate = Perquintill::from_percent(99); assert_ne!(new_params, InflationParams::::get(), "Sanity check"); // Execute call, ensure it works @@ -279,7 +280,8 @@ fn inflation_recalculation_works() { let now = System::block_number(); // Calculate new config - let new_config = Inflation::recalculate_inflation(now); + let decay_factor = Perquintill::one(); + let new_config = Inflation::recalculate_inflation(now, decay_factor); let max_emission = params.max_inflation_rate * total_issuance; // Verify basics are ok @@ -287,6 +289,10 @@ fn inflation_recalculation_works() { new_config.recalculation_era, now + ::CycleConfiguration::eras_per_cycle() ); + assert_eq!( + new_config.decay_factor, decay_factor, + "Default decay factor expected." + ); // Verify collator rewards are as expected assert!( @@ -497,3 +503,151 @@ fn test_genesis_build() { assert!(ActiveInflationConfig::::get().recalculation_era > 0); }) } + +#[test] +fn on_initialize_decay_and_payout_works() { + ExternalityBuilder::build().execute_with(|| { + // no decay + ActiveInflationConfig::::mutate(|config| { + config.decay_factor = Perquintill::one(); + config.decay_rate = Perquintill::one(); + config.collator_reward_per_block = 10; + config.treasury_reward_per_block = 6; + }); + + let base_rewards = 10 + 6; + let issuance_before = Balances::total_issuance(); + Inflation::on_initialize(1); + let issuance_after = Balances::total_issuance(); + let paid_out = issuance_after - issuance_before; + assert_eq!(paid_out, base_rewards, "Full payout expected"); + + // 50% decay + let decay_factor = Perquintill::one(); + let decay_rate = Perquintill::from_percent(50); + ActiveInflationConfig::::mutate(|config| { + config.decay_rate = decay_rate; + }); + + let initial_issuance = Balances::total_issuance(); + Inflation::on_initialize(1); + let issuance_now = Balances::total_issuance(); + let paid_out = issuance_now - initial_issuance; + let expected_factor = decay_factor.saturating_mul(decay_rate); + let expected_paid_out = expected_factor * base_rewards; + lenient_balance_assert_eq!(paid_out, expected_paid_out); + + // Config checks + let cfg = ActiveInflationConfig::::get(); + assert_eq!(cfg.decay_factor, expected_factor); + assert_eq!(cfg.decay_rate, decay_rate); + assert_eq!(cfg.collator_reward_per_block, 10); + assert_eq!(cfg.treasury_reward_per_block, 6); + }); +} + +// Test that the recalculation uses the original max_emission, not the decayed values +#[test] +fn force_readjust_config_with_decay_works() { + ExternalityBuilder::build().execute_with(|| { + let params = InflationParams::::get(); + let init_total_issuance = Balances::total_issuance(); + let original_max_emission = params.max_inflation_rate * init_total_issuance; + + // Prerequisite: Set decay and run a few blocks to decay the config + let decay_rate = Perquintill::from_percent(99); + ActiveInflationConfig::::mutate(|config| { + config.decay_rate = decay_rate; + }); + let blocks_to_run = 500; + for _ in 0..blocks_to_run { + Inflation::on_initialize(1); + } + let expected_factor = decay_rate.saturating_pow(blocks_to_run); + + assert_ok!(Inflation::force_readjust_config(RuntimeOrigin::root())); + + let new_config = ActiveInflationConfig::::get(); + lenient_perquintill_assert_eq!(new_config.decay_factor, expected_factor); + + // New config is based on original max emission since the decay factor is applied on payouts + let new_max_emission_from_config = new_config.collator_reward_per_block + * Balance::from(::CycleConfiguration::blocks_per_cycle()) + + new_config.treasury_reward_per_block + * Balance::from(::CycleConfiguration::blocks_per_cycle()) + + new_config.dapp_reward_pool_per_era + * Balance::from( + ::CycleConfiguration::build_and_earn_eras_per_cycle(), + ) + + new_config.base_staker_reward_pool_per_era + * Balance::from( + ::CycleConfiguration::build_and_earn_eras_per_cycle(), + ) + + new_config.adjustable_staker_reward_pool_per_era + * Balance::from( + ::CycleConfiguration::build_and_earn_eras_per_cycle(), + ) + + new_config.bonus_reward_pool_per_period + * Balance::from(::CycleConfiguration::periods_per_cycle()); + + lenient_balance_assert_eq!(original_max_emission, new_max_emission_from_config); + }) +} + +#[test] +fn force_update_decay_rate_and_reset_factor_works() { + ExternalityBuilder::build().execute_with(|| { + // 1. Initial setup with 90% decay rate + let initial_decay = Perquintill::from_percent(90); + let initial_factor = Perquintill::one(); + ActiveInflationConfig::::mutate(|config| { + config.decay_factor = Perquintill::one(); + config.decay_rate = initial_decay; + config.collator_reward_per_block = 100; + config.treasury_reward_per_block = 50; + }); + + let base_rewards = 100 + 50; + Inflation::on_initialize(1); + + let cfg = ActiveInflationConfig::::get(); + let expected_factor = initial_factor.saturating_mul(initial_decay); + assert_eq!(cfg.decay_rate, initial_decay); + assert_eq!(cfg.decay_factor, expected_factor); + + // 2. Root forced changes + // Force-set inflation params to remove decay rate = 100% + let new_decay_rate = Perquintill::one(); + let params = InflationParams::::get(); + assert_ok!(Inflation::force_set_inflation_params( + RuntimeOrigin::root(), + InflationParameters { + decay_rate: new_decay_rate, + ..params + } + )); + + // Force readjust config + assert_ok!(Inflation::force_readjust_config(RuntimeOrigin::root())); + + // Check updates + let cfg_after = ActiveInflationConfig::::get(); + assert_eq!( + cfg_after.decay_rate, new_decay_rate, + "Decay rate should be reset to default" + ); + + // Prepare same base rewards + ActiveInflationConfig::::mutate(|config| { + config.collator_reward_per_block = 100; + config.treasury_reward_per_block = 50; + }); + + let issuance_before = Balances::total_issuance(); + Inflation::on_initialize(1); + let issuance_now = Balances::total_issuance(); + let paid_out = issuance_now - issuance_before; + let expected_paid_out = expected_factor * base_rewards; // decay factor is preserved + lenient_balance_assert_eq!(paid_out, expected_paid_out); + }); +} diff --git a/runtime/astar/src/lib.rs b/runtime/astar/src/lib.rs index 357beab9d..51eab118e 100644 --- a/runtime/astar/src/lib.rs +++ b/runtime/astar/src/lib.rs @@ -1726,8 +1726,14 @@ pub type Executive = frame_executive::Executive< /// __NOTE:__ THE ORDER IS IMPORTANT. pub type Migrations = (Unreleased, Permanent); +parameter_types! { + pub const DecayRate: Perquintill = Perquintill::one(); + pub const DecayFactor: Perquintill = Perquintill::one(); +} + /// Unreleased migrations. Add new ones here: -pub type Unreleased = (); +pub type Unreleased = + (pallet_inflation::migration::versioned_migrations::V1ToV2,); /// Migrations/checks that do not need to be versioned and can run on every upgrade. pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion,); diff --git a/runtime/astar/src/weights/pallet_dapp_staking.rs b/runtime/astar/src/weights/pallet_dapp_staking.rs index f56d535cd..e87e29bd6 100644 --- a/runtime/astar/src/weights/pallet_dapp_staking.rs +++ b/runtime/astar/src/weights/pallet_dapp_staking.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_dapp_staking` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("astar-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=astar-dev +// --runtime=./target/release/wbuild/astar-runtime/astar_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_dapp_staking // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/astar-dev/dapp_staking_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/astar/runtime/dapp_staking_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,8 +56,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_468_000 picoseconds. - Weight::from_parts(7_616_000, 0) + // Minimum execution time: 7_797_000 picoseconds. + Weight::from_parts(7_952_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `DappStaking::IntegratedDApps` (r:1 w:1) @@ -69,8 +70,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `3086` - // Minimum execution time: 14_674_000 picoseconds. - Weight::from_parts(15_013_000, 0) + // Minimum execution time: 15_231_000 picoseconds. + Weight::from_parts(15_497_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -81,8 +82,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 13_159_000 picoseconds. - Weight::from_parts(13_488_000, 0) + // Minimum execution time: 13_286_000 picoseconds. + Weight::from_parts(13_671_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -93,8 +94,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 13_043_000 picoseconds. - Weight::from_parts(13_358_000, 0) + // Minimum execution time: 13_359_000 picoseconds. + Weight::from_parts(13_615_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +110,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 18_390_000 picoseconds. - Weight::from_parts(18_647_000, 0) + // Minimum execution time: 18_668_000 picoseconds. + Weight::from_parts(19_056_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -129,8 +130,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `138` // Estimated: `4764` - // Minimum execution time: 34_174_000 picoseconds. - Weight::from_parts(34_702_000, 0) + // Minimum execution time: 35_796_000 picoseconds. + Weight::from_parts(55_675_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -147,8 +148,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `158` // Estimated: `4764` - // Minimum execution time: 34_534_000 picoseconds. - Weight::from_parts(34_999_000, 0) + // Minimum execution time: 36_646_000 picoseconds. + Weight::from_parts(37_117_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -165,8 +166,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `158` // Estimated: `4764` - // Minimum execution time: 32_089_000 picoseconds. - Weight::from_parts(32_414_000, 0) + // Minimum execution time: 33_487_000 picoseconds. + Weight::from_parts(33_971_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -184,11 +185,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `190` // Estimated: `4764` - // Minimum execution time: 33_841_000 picoseconds. - Weight::from_parts(35_369_342, 0) + // Minimum execution time: 35_823_000 picoseconds. + Weight::from_parts(37_343_242, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 2_995 - .saturating_add(Weight::from_parts(105_222, 0).saturating_mul(x.into())) + // Standard Error: 2_630 + .saturating_add(Weight::from_parts(95_982, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -204,8 +205,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `200` // Estimated: `4764` - // Minimum execution time: 32_296_000 picoseconds. - Weight::from_parts(32_604_000, 0) + // Minimum execution time: 32_726_000 picoseconds. + Weight::from_parts(33_458_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -228,8 +229,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `274` // Estimated: `4764` - // Minimum execution time: 47_348_000 picoseconds. - Weight::from_parts(48_042_000, 0) + // Minimum execution time: 48_131_000 picoseconds. + Weight::from_parts(48_946_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -252,8 +253,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `459` // Estimated: `4764` - // Minimum execution time: 51_877_000 picoseconds. - Weight::from_parts(52_509_000, 0) + // Minimum execution time: 53_610_000 picoseconds. + Weight::from_parts(53_979_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -273,11 +274,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `541` // Estimated: `4764` - // Minimum execution time: 51_249_000 picoseconds. - Weight::from_parts(50_724_180, 0) + // Minimum execution time: 54_109_000 picoseconds. + Weight::from_parts(52_736_689, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 4_218 - .saturating_add(Weight::from_parts(1_760_955, 0).saturating_mul(x.into())) + // Standard Error: 4_297 + .saturating_add(Weight::from_parts(2_208_246, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -294,11 +295,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `519` // Estimated: `4764` - // Minimum execution time: 48_700_000 picoseconds. - Weight::from_parts(47_855_220, 0) + // Minimum execution time: 51_242_000 picoseconds. + Weight::from_parts(50_340_177, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 3_170 - .saturating_add(Weight::from_parts(1_764_097, 0).saturating_mul(x.into())) + // Standard Error: 3_267 + .saturating_add(Weight::from_parts(2_162_040, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,8 +313,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `275` // Estimated: `3775` - // Minimum execution time: 40_398_000 picoseconds. - Weight::from_parts(40_865_000, 0) + // Minimum execution time: 43_371_000 picoseconds. + Weight::from_parts(43_755_000, 0) .saturating_add(Weight::from_parts(0, 3775)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -326,8 +327,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `2672` // Estimated: `5113` - // Minimum execution time: 59_455_000 picoseconds. - Weight::from_parts(60_919_000, 0) + // Minimum execution time: 64_769_000 picoseconds. + Weight::from_parts(66_724_000, 0) .saturating_add(Weight::from_parts(0, 5113)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -348,8 +349,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `322` // Estimated: `4764` - // Minimum execution time: 41_868_000 picoseconds. - Weight::from_parts(42_523_000, 0) + // Minimum execution time: 43_668_000 picoseconds. + Weight::from_parts(44_073_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) @@ -367,11 +368,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `257 + x * (73 ±0)` // Estimated: `4764 + x * (2653 ±0)` - // Minimum execution time: 41_585_000 picoseconds. - Weight::from_parts(37_120_124, 0) + // Minimum execution time: 43_879_000 picoseconds. + Weight::from_parts(39_614_228, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 15_779 - .saturating_add(Weight::from_parts(5_714_250, 0).saturating_mul(x.into())) + // Standard Error: 10_569 + .saturating_add(Weight::from_parts(5_901_871, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -384,8 +385,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `1486` - // Minimum execution time: 10_743_000 picoseconds. - Weight::from_parts(10_914_000, 0) + // Minimum execution time: 10_973_000 picoseconds. + Weight::from_parts(11_181_000, 0) .saturating_add(Weight::from_parts(0, 1486)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -407,8 +408,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `553` // Estimated: `6296` - // Minimum execution time: 80_418_000 picoseconds. - Weight::from_parts(81_214_000, 0) + // Minimum execution time: 84_975_000 picoseconds. + Weight::from_parts(85_927_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(10)) .saturating_add(T::DbWeight::get().writes(7)) @@ -431,8 +432,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `419` // Estimated: `6296` - // Minimum execution time: 71_293_000 picoseconds. - Weight::from_parts(72_397_000, 0) + // Minimum execution time: 75_026_000 picoseconds. + Weight::from_parts(76_181_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(6)) @@ -451,8 +452,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `224` // Estimated: `4254` - // Minimum execution time: 27_708_000 picoseconds. - Weight::from_parts(28_294_000, 0) + // Minimum execution time: 29_055_000 picoseconds. + Weight::from_parts(29_654_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -477,8 +478,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `731` // Estimated: `4254` - // Minimum execution time: 48_216_000 picoseconds. - Weight::from_parts(49_369_000, 0) + // Minimum execution time: 51_069_000 picoseconds. + Weight::from_parts(52_195_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -499,8 +500,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `276` // Estimated: `4254` - // Minimum execution time: 31_669_000 picoseconds. - Weight::from_parts(32_286_000, 0) + // Minimum execution time: 33_282_000 picoseconds. + Weight::from_parts(33_637_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -514,11 +515,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97 + x * (32 ±0)` // Estimated: `3061 + x * (2071 ±0)` - // Minimum execution time: 7_840_000 picoseconds. - Weight::from_parts(8_489_969, 0) + // Minimum execution time: 7_701_000 picoseconds. + Weight::from_parts(8_973_665, 0) .saturating_add(Weight::from_parts(0, 3061)) - // Standard Error: 3_615 - .saturating_add(Weight::from_parts(2_864_132, 0).saturating_mul(x.into())) + // Standard Error: 3_160 + .saturating_add(Weight::from_parts(2_859_658, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(Weight::from_parts(0, 2071).saturating_mul(x.into())) @@ -533,8 +534,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `293` // Estimated: `4254` - // Minimum execution time: 10_027_000 picoseconds. - Weight::from_parts(10_243_000, 0) + // Minimum execution time: 9_591_000 picoseconds. + Weight::from_parts(9_867_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -545,8 +546,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `76` // Estimated: `6560` - // Minimum execution time: 15_086_000 picoseconds. - Weight::from_parts(15_409_000, 0) + // Minimum execution time: 17_906_000 picoseconds. + Weight::from_parts(18_288_000, 0) .saturating_add(Weight::from_parts(0, 6560)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -557,8 +558,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_907_000 picoseconds. - Weight::from_parts(9_103_000, 0) + // Minimum execution time: 8_974_000 picoseconds. + Weight::from_parts(9_305_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/astar/src/weights/pallet_inflation.rs b/runtime/astar/src/weights/pallet_inflation.rs index 24a8716ea..a8bf38d21 100644 --- a/runtime/astar/src/weights/pallet_inflation.rs +++ b/runtime/astar/src/weights/pallet_inflation.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_inflation` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("astar-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=astar-dev +// --runtime=./target/release/wbuild/astar-runtime/astar_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_inflation // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/astar-dev/inflation_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/astar/runtime/inflation_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,47 +53,47 @@ use core::marker::PhantomData; pub struct SubstrateWeight(PhantomData); impl pallet_inflation::WeightInfo for SubstrateWeight { /// Storage: `Inflation::InflationParams` (r:0 w:1) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_set_inflation_params() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_105_000 picoseconds. - Weight::from_parts(7_302_000, 0) + // Minimum execution time: 7_648_000 picoseconds. + Weight::from_parts(7_874_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_inflation_recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_698_000 picoseconds. - Weight::from_parts(11_904_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 13_350_000 picoseconds. + Weight::from_parts(13_756_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_readjust_config() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_801_000 picoseconds. - Weight::from_parts(12_007_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 12_005_000 picoseconds. + Weight::from_parts(12_335_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `58` - // Estimated: `1549` - // Minimum execution time: 11_324_000 picoseconds. - Weight::from_parts(11_612_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `67` + // Estimated: `1557` + // Minimum execution time: 12_463_000 picoseconds. + Weight::from_parts(12_871_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `System::Account` (r:2 w:2) @@ -101,8 +102,8 @@ impl pallet_inflation::WeightInfo for SubstrateWeight serde_json::Value { adjustable_stakers_part: Perquintill::from_percent(35), bonus_part: Perquintill::from_percent(12), ideal_staking_rate: Perquintill::from_percent(50), + decay_rate: Perquintill::one(), }, ..Default::default() }, diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index b95c61e7c..24b72b08e 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -1748,8 +1748,14 @@ pub type Executive = frame_executive::Executive< /// __NOTE:__ THE ORDER IS IMPORTANT. pub type Migrations = (Unreleased, Permanent); +parameter_types! { + pub const DecayRate: Perquintill = Perquintill::one(); + pub const DecayFactor: Perquintill = Perquintill::one(); +} + /// Unreleased migrations. Add new ones here: -pub type Unreleased = (); +pub type Unreleased = + (pallet_inflation::migration::versioned_migrations::V1ToV2,); /// Migrations/checks that do not need to be versioned and can run on every upgrade. pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion,); diff --git a/runtime/shibuya/src/weights/pallet_dapp_staking.rs b/runtime/shibuya/src/weights/pallet_dapp_staking.rs index 30e234ba5..6581b19c6 100644 --- a/runtime/shibuya/src/weights/pallet_dapp_staking.rs +++ b/runtime/shibuya/src/weights/pallet_dapp_staking.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_dapp_staking` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shibuya-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shibuya-dev +// --runtime=./target/release/wbuild/shibuya-runtime/shibuya_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_dapp_staking // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shibuya-dev/dapp_staking_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shibuya/runtime/dapp_staking_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,8 +56,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_682_000 picoseconds. - Weight::from_parts(7_923_000, 0) + // Minimum execution time: 7_650_000 picoseconds. + Weight::from_parts(7_931_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `DappStaking::IntegratedDApps` (r:1 w:1) @@ -69,8 +70,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `3086` - // Minimum execution time: 14_706_000 picoseconds. - Weight::from_parts(14_903_000, 0) + // Minimum execution time: 15_650_000 picoseconds. + Weight::from_parts(16_066_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -81,8 +82,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 13_386_000 picoseconds. - Weight::from_parts(13_843_000, 0) + // Minimum execution time: 13_573_000 picoseconds. + Weight::from_parts(13_901_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -93,8 +94,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 13_405_000 picoseconds. - Weight::from_parts(13_725_000, 0) + // Minimum execution time: 13_322_000 picoseconds. + Weight::from_parts(13_624_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +110,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 18_253_000 picoseconds. - Weight::from_parts(18_552_000, 0) + // Minimum execution time: 18_709_000 picoseconds. + Weight::from_parts(18_963_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -129,8 +130,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `138` // Estimated: `4764` - // Minimum execution time: 33_516_000 picoseconds. - Weight::from_parts(34_133_000, 0) + // Minimum execution time: 35_781_000 picoseconds. + Weight::from_parts(36_327_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -147,8 +148,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `156` // Estimated: `4764` - // Minimum execution time: 36_557_000 picoseconds. - Weight::from_parts(36_975_000, 0) + // Minimum execution time: 36_355_000 picoseconds. + Weight::from_parts(36_733_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -165,8 +166,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `156` // Estimated: `4764` - // Minimum execution time: 33_614_000 picoseconds. - Weight::from_parts(34_017_000, 0) + // Minimum execution time: 33_348_000 picoseconds. + Weight::from_parts(33_791_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -184,11 +185,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `187` // Estimated: `4764` - // Minimum execution time: 34_353_000 picoseconds. - Weight::from_parts(35_674_309, 0) + // Minimum execution time: 35_979_000 picoseconds. + Weight::from_parts(37_335_232, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 5_966 - .saturating_add(Weight::from_parts(149_024, 0).saturating_mul(x.into())) + // Standard Error: 7_086 + .saturating_add(Weight::from_parts(136_207, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -204,8 +205,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `182` // Estimated: `4764` - // Minimum execution time: 31_811_000 picoseconds. - Weight::from_parts(32_305_000, 0) + // Minimum execution time: 33_088_000 picoseconds. + Weight::from_parts(33_637_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -228,8 +229,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `272` // Estimated: `4764` - // Minimum execution time: 45_488_000 picoseconds. - Weight::from_parts(46_526_000, 0) + // Minimum execution time: 47_985_000 picoseconds. + Weight::from_parts(48_544_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -252,8 +253,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `453` // Estimated: `4764` - // Minimum execution time: 50_603_000 picoseconds. - Weight::from_parts(51_258_000, 0) + // Minimum execution time: 52_914_000 picoseconds. + Weight::from_parts(53_576_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -273,11 +274,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `522` // Estimated: `4764` - // Minimum execution time: 50_301_000 picoseconds. - Weight::from_parts(49_241_290, 0) + // Minimum execution time: 53_091_000 picoseconds. + Weight::from_parts(52_120_973, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 5_013 - .saturating_add(Weight::from_parts(2_059_319, 0).saturating_mul(x.into())) + // Standard Error: 3_984 + .saturating_add(Weight::from_parts(2_211_392, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -294,11 +295,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `501` // Estimated: `4764` - // Minimum execution time: 47_317_000 picoseconds. - Weight::from_parts(46_451_465, 0) + // Minimum execution time: 50_362_000 picoseconds. + Weight::from_parts(49_328_219, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 3_817 - .saturating_add(Weight::from_parts(2_051_530, 0).saturating_mul(x.into())) + // Standard Error: 5_317 + .saturating_add(Weight::from_parts(2_226_904, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,8 +313,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `271` // Estimated: `3775` - // Minimum execution time: 39_976_000 picoseconds. - Weight::from_parts(40_606_000, 0) + // Minimum execution time: 42_934_000 picoseconds. + Weight::from_parts(43_324_000, 0) .saturating_add(Weight::from_parts(0, 3775)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -326,8 +327,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `2672` // Estimated: `5113` - // Minimum execution time: 60_846_000 picoseconds. - Weight::from_parts(61_907_000, 0) + // Minimum execution time: 63_164_000 picoseconds. + Weight::from_parts(64_920_000, 0) .saturating_add(Weight::from_parts(0, 5113)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -348,8 +349,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `317` // Estimated: `4764` - // Minimum execution time: 41_735_000 picoseconds. - Weight::from_parts(42_212_000, 0) + // Minimum execution time: 42_779_000 picoseconds. + Weight::from_parts(43_477_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) @@ -367,11 +368,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `255 + x * (73 ±0)` // Estimated: `4764 + x * (2653 ±0)` - // Minimum execution time: 41_539_000 picoseconds. - Weight::from_parts(37_759_943, 0) + // Minimum execution time: 43_226_000 picoseconds. + Weight::from_parts(38_422_585, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 15_669 - .saturating_add(Weight::from_parts(5_743_836, 0).saturating_mul(x.into())) + // Standard Error: 9_560 + .saturating_add(Weight::from_parts(5_955_589, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -384,8 +385,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `1486` - // Minimum execution time: 10_644_000 picoseconds. - Weight::from_parts(10_857_000, 0) + // Minimum execution time: 10_670_000 picoseconds. + Weight::from_parts(10_816_000, 0) .saturating_add(Weight::from_parts(0, 1486)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -407,8 +408,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `547` // Estimated: `6296` - // Minimum execution time: 79_870_000 picoseconds. - Weight::from_parts(80_650_000, 0) + // Minimum execution time: 82_826_000 picoseconds. + Weight::from_parts(83_669_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(10)) .saturating_add(T::DbWeight::get().writes(7)) @@ -431,8 +432,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `414` // Estimated: `6296` - // Minimum execution time: 73_043_000 picoseconds. - Weight::from_parts(73_729_000, 0) + // Minimum execution time: 74_264_000 picoseconds. + Weight::from_parts(75_227_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(6)) @@ -451,8 +452,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `224` // Estimated: `4254` - // Minimum execution time: 27_832_000 picoseconds. - Weight::from_parts(28_409_000, 0) + // Minimum execution time: 28_552_000 picoseconds. + Weight::from_parts(29_038_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -477,8 +478,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `539` // Estimated: `4254` - // Minimum execution time: 46_063_000 picoseconds. - Weight::from_parts(46_781_000, 0) + // Minimum execution time: 47_463_000 picoseconds. + Weight::from_parts(48_516_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -499,8 +500,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `278` // Estimated: `4254` - // Minimum execution time: 32_370_000 picoseconds. - Weight::from_parts(32_963_000, 0) + // Minimum execution time: 32_991_000 picoseconds. + Weight::from_parts(33_671_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -514,11 +515,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97 + x * (32 ±0)` // Estimated: `3061 + x * (2071 ±0)` - // Minimum execution time: 7_480_000 picoseconds. - Weight::from_parts(9_035_040, 0) + // Minimum execution time: 7_810_000 picoseconds. + Weight::from_parts(8_540_897, 0) .saturating_add(Weight::from_parts(0, 3061)) - // Standard Error: 17_973 - .saturating_add(Weight::from_parts(2_916_779, 0).saturating_mul(x.into())) + // Standard Error: 3_315 + .saturating_add(Weight::from_parts(2_836_919, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(Weight::from_parts(0, 2071).saturating_mul(x.into())) @@ -533,8 +534,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `293` // Estimated: `4254` - // Minimum execution time: 9_418_000 picoseconds. - Weight::from_parts(9_681_000, 0) + // Minimum execution time: 9_538_000 picoseconds. + Weight::from_parts(9_692_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -545,8 +546,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `76` // Estimated: `6560` - // Minimum execution time: 15_232_000 picoseconds. - Weight::from_parts(15_485_000, 0) + // Minimum execution time: 18_601_000 picoseconds. + Weight::from_parts(18_915_000, 0) .saturating_add(Weight::from_parts(0, 6560)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -557,8 +558,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_622_000 picoseconds. - Weight::from_parts(8_907_000, 0) + // Minimum execution time: 9_019_000 picoseconds. + Weight::from_parts(9_230_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/shibuya/src/weights/pallet_inflation.rs b/runtime/shibuya/src/weights/pallet_inflation.rs index a36603870..279549273 100644 --- a/runtime/shibuya/src/weights/pallet_inflation.rs +++ b/runtime/shibuya/src/weights/pallet_inflation.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_inflation` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shibuya-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shibuya-dev +// --runtime=./target/release/wbuild/shibuya-runtime/shibuya_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_inflation // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shibuya-dev/inflation_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shibuya/runtime/inflation_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,47 +53,47 @@ use core::marker::PhantomData; pub struct SubstrateWeight(PhantomData); impl pallet_inflation::WeightInfo for SubstrateWeight { /// Storage: `Inflation::InflationParams` (r:0 w:1) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_set_inflation_params() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_580_000 picoseconds. - Weight::from_parts(7_712_000, 0) + // Minimum execution time: 7_524_000 picoseconds. + Weight::from_parts(7_657_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_inflation_recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_788_000 picoseconds. - Weight::from_parts(11_919_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 12_991_000 picoseconds. + Weight::from_parts(13_324_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_readjust_config() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_952_000 picoseconds. - Weight::from_parts(12_212_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 11_755_000 picoseconds. + Weight::from_parts(12_110_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `58` - // Estimated: `1549` - // Minimum execution time: 11_377_000 picoseconds. - Weight::from_parts(11_758_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `67` + // Estimated: `1557` + // Minimum execution time: 12_355_000 picoseconds. + Weight::from_parts(12_717_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `System::Account` (r:2 w:2) @@ -101,8 +102,8 @@ impl pallet_inflation::WeightInfo for SubstrateWeight,); /// Migrations/checks that do not need to be versioned and can run on every upgrade. pub type Permanent = (pallet_xcm::migration::MigrateToLatestXcmVersion,); diff --git a/runtime/shiden/src/weights/pallet_dapp_staking.rs b/runtime/shiden/src/weights/pallet_dapp_staking.rs index 4d472d59c..b246f4a10 100644 --- a/runtime/shiden/src/weights/pallet_dapp_staking.rs +++ b/runtime/shiden/src/weights/pallet_dapp_staking.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_dapp_staking` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shiden-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shiden-dev +// --runtime=./target/release/wbuild/shiden-runtime/shiden_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_dapp_staking // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shiden-dev/dapp_staking_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shiden/runtime/dapp_staking_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -55,8 +56,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_427_000 picoseconds. - Weight::from_parts(7_564_000, 0) + // Minimum execution time: 7_827_000 picoseconds. + Weight::from_parts(8_041_000, 0) .saturating_add(Weight::from_parts(0, 0)) } /// Storage: `DappStaking::IntegratedDApps` (r:1 w:1) @@ -69,8 +70,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `3086` - // Minimum execution time: 14_584_000 picoseconds. - Weight::from_parts(14_931_000, 0) + // Minimum execution time: 15_303_000 picoseconds. + Weight::from_parts(15_582_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(3)) @@ -81,8 +82,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 13_209_000 picoseconds. - Weight::from_parts(13_494_000, 0) + // Minimum execution time: 13_655_000 picoseconds. + Weight::from_parts(13_905_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -93,8 +94,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 12_893_000 picoseconds. - Weight::from_parts(13_351_000, 0) + // Minimum execution time: 13_409_000 picoseconds. + Weight::from_parts(13_688_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(1)) .saturating_add(T::DbWeight::get().writes(1)) @@ -109,8 +110,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97` // Estimated: `3086` - // Minimum execution time: 17_768_000 picoseconds. - Weight::from_parts(18_137_000, 0) + // Minimum execution time: 18_616_000 picoseconds. + Weight::from_parts(19_008_000, 0) .saturating_add(Weight::from_parts(0, 3086)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -129,8 +130,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `138` // Estimated: `4764` - // Minimum execution time: 32_686_000 picoseconds. - Weight::from_parts(33_375_000, 0) + // Minimum execution time: 35_627_000 picoseconds. + Weight::from_parts(36_277_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -147,8 +148,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `158` // Estimated: `4764` - // Minimum execution time: 34_428_000 picoseconds. - Weight::from_parts(35_296_000, 0) + // Minimum execution time: 36_461_000 picoseconds. + Weight::from_parts(36_822_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -165,8 +166,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `158` // Estimated: `4764` - // Minimum execution time: 31_970_000 picoseconds. - Weight::from_parts(32_497_000, 0) + // Minimum execution time: 33_290_000 picoseconds. + Weight::from_parts(33_712_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -184,11 +185,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `191` // Estimated: `4764` - // Minimum execution time: 33_774_000 picoseconds. - Weight::from_parts(34_991_849, 0) + // Minimum execution time: 35_914_000 picoseconds. + Weight::from_parts(37_376_598, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 2_998 - .saturating_add(Weight::from_parts(97_300, 0).saturating_mul(x.into())) + // Standard Error: 2_823 + .saturating_add(Weight::from_parts(83_351, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) } @@ -204,8 +205,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `200` // Estimated: `4764` - // Minimum execution time: 31_170_000 picoseconds. - Weight::from_parts(31_822_000, 0) + // Minimum execution time: 32_972_000 picoseconds. + Weight::from_parts(33_387_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(3)) @@ -228,8 +229,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `274` // Estimated: `4764` - // Minimum execution time: 46_334_000 picoseconds. - Weight::from_parts(47_255_000, 0) + // Minimum execution time: 47_846_000 picoseconds. + Weight::from_parts(48_516_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -252,8 +253,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `459` // Estimated: `4764` - // Minimum execution time: 52_417_000 picoseconds. - Weight::from_parts(53_251_000, 0) + // Minimum execution time: 52_948_000 picoseconds. + Weight::from_parts(54_030_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(5)) @@ -273,11 +274,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `542` // Estimated: `4764` - // Minimum execution time: 51_862_000 picoseconds. - Weight::from_parts(51_325_687, 0) + // Minimum execution time: 54_197_000 picoseconds. + Weight::from_parts(53_031_059, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 5_223 - .saturating_add(Weight::from_parts(1_827_447, 0).saturating_mul(x.into())) + // Standard Error: 5_504 + .saturating_add(Weight::from_parts(2_188_676, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -294,11 +295,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `519` // Estimated: `4764` - // Minimum execution time: 48_996_000 picoseconds. - Weight::from_parts(48_616_861, 0) + // Minimum execution time: 51_576_000 picoseconds. + Weight::from_parts(50_311_714, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 5_229 - .saturating_add(Weight::from_parts(1_791_103, 0).saturating_mul(x.into())) + // Standard Error: 4_411 + .saturating_add(Weight::from_parts(2_169_357, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().writes(2)) } @@ -312,8 +313,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `276` // Estimated: `3775` - // Minimum execution time: 39_745_000 picoseconds. - Weight::from_parts(40_327_000, 0) + // Minimum execution time: 42_129_000 picoseconds. + Weight::from_parts(42_579_000, 0) .saturating_add(Weight::from_parts(0, 3775)) .saturating_add(T::DbWeight::get().reads(3)) .saturating_add(T::DbWeight::get().writes(2)) @@ -326,8 +327,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `2672` // Estimated: `5113` - // Minimum execution time: 59_330_000 picoseconds. - Weight::from_parts(60_311_000, 0) + // Minimum execution time: 62_905_000 picoseconds. + Weight::from_parts(65_541_000, 0) .saturating_add(Weight::from_parts(0, 5113)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -348,8 +349,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `322` // Estimated: `4764` - // Minimum execution time: 40_766_000 picoseconds. - Weight::from_parts(41_268_000, 0) + // Minimum execution time: 42_820_000 picoseconds. + Weight::from_parts(43_567_000, 0) .saturating_add(Weight::from_parts(0, 4764)) .saturating_add(T::DbWeight::get().reads(6)) .saturating_add(T::DbWeight::get().writes(4)) @@ -367,11 +368,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `256 + x * (73 ±0)` // Estimated: `4764 + x * (2653 ±0)` - // Minimum execution time: 41_028_000 picoseconds. - Weight::from_parts(36_920_481, 0) + // Minimum execution time: 43_408_000 picoseconds. + Weight::from_parts(39_435_930, 0) .saturating_add(Weight::from_parts(0, 4764)) - // Standard Error: 13_746 - .saturating_add(Weight::from_parts(5_698_076, 0).saturating_mul(x.into())) + // Standard Error: 10_231 + .saturating_add(Weight::from_parts(5_639_060, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(4)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(T::DbWeight::get().writes(2)) @@ -384,8 +385,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `1486` - // Minimum execution time: 10_310_000 picoseconds. - Weight::from_parts(10_470_000, 0) + // Minimum execution time: 10_986_000 picoseconds. + Weight::from_parts(11_271_000, 0) .saturating_add(Weight::from_parts(0, 1486)) .saturating_add(T::DbWeight::get().reads(1)) } @@ -407,8 +408,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `553` // Estimated: `6296` - // Minimum execution time: 78_939_000 picoseconds. - Weight::from_parts(79_772_000, 0) + // Minimum execution time: 82_932_000 picoseconds. + Weight::from_parts(84_033_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(10)) .saturating_add(T::DbWeight::get().writes(7)) @@ -431,8 +432,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `419` // Estimated: `6296` - // Minimum execution time: 71_220_000 picoseconds. - Weight::from_parts(72_774_000, 0) + // Minimum execution time: 74_863_000 picoseconds. + Weight::from_parts(75_614_000, 0) .saturating_add(Weight::from_parts(0, 6296)) .saturating_add(T::DbWeight::get().reads(9)) .saturating_add(T::DbWeight::get().writes(6)) @@ -451,8 +452,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `224` // Estimated: `4254` - // Minimum execution time: 26_596_000 picoseconds. - Weight::from_parts(27_443_000, 0) + // Minimum execution time: 28_581_000 picoseconds. + Weight::from_parts(29_073_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(3)) @@ -477,8 +478,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `764` // Estimated: `4254` - // Minimum execution time: 47_007_000 picoseconds. - Weight::from_parts(48_423_000, 0) + // Minimum execution time: 49_980_000 picoseconds. + Weight::from_parts(50_891_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(7)) .saturating_add(T::DbWeight::get().writes(7)) @@ -499,8 +500,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `278` // Estimated: `4254` - // Minimum execution time: 30_851_000 picoseconds. - Weight::from_parts(31_613_000, 0) + // Minimum execution time: 33_088_000 picoseconds. + Weight::from_parts(33_687_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(5)) .saturating_add(T::DbWeight::get().writes(4)) @@ -514,11 +515,11 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `97 + x * (32 ±0)` // Estimated: `3061 + x * (2071 ±0)` - // Minimum execution time: 7_622_000 picoseconds. - Weight::from_parts(8_152_071, 0) + // Minimum execution time: 7_654_000 picoseconds. + Weight::from_parts(9_062_972, 0) .saturating_add(Weight::from_parts(0, 3061)) - // Standard Error: 3_676 - .saturating_add(Weight::from_parts(2_863_646, 0).saturating_mul(x.into())) + // Standard Error: 2_941 + .saturating_add(Weight::from_parts(2_801_555, 0).saturating_mul(x.into())) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(x.into()))) .saturating_add(Weight::from_parts(0, 2071).saturating_mul(x.into())) @@ -533,8 +534,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `293` // Estimated: `4254` - // Minimum execution time: 9_766_000 picoseconds. - Weight::from_parts(9_956_000, 0) + // Minimum execution time: 9_386_000 picoseconds. + Weight::from_parts(9_628_000, 0) .saturating_add(Weight::from_parts(0, 4254)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(3)) @@ -545,8 +546,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `76` // Estimated: `6560` - // Minimum execution time: 14_625_000 picoseconds. - Weight::from_parts(15_172_000, 0) + // Minimum execution time: 17_703_000 picoseconds. + Weight::from_parts(18_159_000, 0) .saturating_add(Weight::from_parts(0, 6560)) .saturating_add(T::DbWeight::get().reads(2)) .saturating_add(T::DbWeight::get().writes(1)) @@ -557,8 +558,8 @@ impl pallet_dapp_staking::WeightInfo for SubstrateWeigh // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 8_440_000 picoseconds. - Weight::from_parts(8_564_000, 0) + // Minimum execution time: 8_988_000 picoseconds. + Weight::from_parts(9_199_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } diff --git a/runtime/shiden/src/weights/pallet_inflation.rs b/runtime/shiden/src/weights/pallet_inflation.rs index 73d7d3bd8..d45173b6c 100644 --- a/runtime/shiden/src/weights/pallet_inflation.rs +++ b/runtime/shiden/src/weights/pallet_inflation.rs @@ -19,25 +19,26 @@ //! Autogenerated weights for `pallet_inflation` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 46.1.0 -//! DATE: 2025-05-04, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2025-09-18, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` //! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("shiden-dev")`, DB CACHE: 1024 +//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024 // Executed Command: -// ./target/release/astar-collator +// frame-omni-bencher +// v1 // benchmark // pallet -// --chain=shiden-dev +// --runtime=./target/release/wbuild/shiden-runtime/shiden_runtime.compact.compressed.wasm // --steps=50 // --repeat=20 // --pallet=pallet_inflation // --extrinsic=* // --wasm-execution=compiled // --heap-pages=4096 -// --output=./benchmark-results/shiden-dev/inflation_weights.rs -// --template=./scripts/templates/weight-template.hbs +// --output=./benchmark-results/shiden/runtime/inflation_weights.rs +// --template=./scripts/templates/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -52,47 +53,47 @@ use core::marker::PhantomData; pub struct SubstrateWeight(PhantomData); impl pallet_inflation::WeightInfo for SubstrateWeight { /// Storage: `Inflation::InflationParams` (r:0 w:1) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_set_inflation_params() -> Weight { // Proof Size summary in bytes: // Measured: `0` // Estimated: `0` - // Minimum execution time: 7_441_000 picoseconds. - Weight::from_parts(7_623_000, 0) + // Minimum execution time: 8_107_000 picoseconds. + Weight::from_parts(8_177_000, 0) .saturating_add(Weight::from_parts(0, 0)) .saturating_add(T::DbWeight::get().writes(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_inflation_recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_613_000 picoseconds. - Weight::from_parts(11_761_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 13_324_000 picoseconds. + Weight::from_parts(13_625_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn force_readjust_config() -> Weight { // Proof Size summary in bytes: - // Measured: `40` - // Estimated: `1549` - // Minimum execution time: 11_769_000 picoseconds. - Weight::from_parts(11_929_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `49` + // Estimated: `1557` + // Minimum execution time: 12_348_000 picoseconds. + Weight::from_parts(12_590_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `Inflation::InflationParams` (r:1 w:0) - /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(64), added: 559, mode: `MaxEncodedLen`) + /// Proof: `Inflation::InflationParams` (`max_values`: Some(1), `max_size`: Some(72), added: 567, mode: `MaxEncodedLen`) fn recalculation() -> Weight { // Proof Size summary in bytes: - // Measured: `58` - // Estimated: `1549` - // Minimum execution time: 11_312_000 picoseconds. - Weight::from_parts(11_734_000, 0) - .saturating_add(Weight::from_parts(0, 1549)) + // Measured: `67` + // Estimated: `1557` + // Minimum execution time: 12_610_000 picoseconds. + Weight::from_parts(12_930_000, 0) + .saturating_add(Weight::from_parts(0, 1557)) .saturating_add(T::DbWeight::get().reads(1)) } /// Storage: `System::Account` (r:2 w:2) @@ -101,8 +102,8 @@ impl pallet_inflation::WeightInfo for SubstrateWeight::get(); + config.decay_rate = Perquintill::zero(); + pallet_inflation::ActiveInflationConfig::::put(config.clone()); + + let issuance_before = Balances::total_issuance(); + + // Advance eras on a block by block basis until subperiod is Voting again for bonus reward payouts + assert_ok!(DappStaking::force(RuntimeOrigin::root(), ForcingType::Era)); + run_for_blocks(1); + assert_eq!( + ActiveProtocolState::::get().subperiod(), + Subperiod::BuildAndEarn, + "Sanity check." + ); + while ActiveProtocolState::::get().subperiod() != Subperiod::Voting { + assert_ok!(DappStaking::force(RuntimeOrigin::root(), ForcingType::Era)); + run_for_blocks(1); + } + + let decay_factor = pallet_inflation::ActiveInflationConfig::::get().decay_factor; + assert_eq!( + decay_factor, + Perquintill::zero(), + "Decay factor must be zero" + ); + + let issuance_after = Balances::total_issuance(); + assert_eq!( + issuance_before, issuance_after, + "No rewards should be minted" + ); + }); +}