diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c7f75132..51a512f01b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Chain-spec generator: propagate the `on_chain_release_build` feature to the chain-spec generator. Without this the live/genesis chain-specs contain a wrongly-configured WASM blob ([polkadot-fellows/runtimes#450](https://github.com/polkadot-fellows/runtimes/pull/450)). +### Added + +- Polkadot: Make the current inflation formula adjustable ([polkadot-fellows/runtimes#443](https://github.com/polkadot-fellows/runtimes/pull/443)) + ## [1.3.2] 27.08.2024 ### Fixed diff --git a/Cargo.lock b/Cargo.lock index b11a306305..152c89e518 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10072,6 +10072,7 @@ dependencies = [ "frame-system-benchmarking", "frame-system-rpc-runtime-api", "frame-try-runtime", + "hex-literal", "log", "pallet-asset-rate", "pallet-authority-discovery", @@ -10099,6 +10100,7 @@ dependencies = [ "pallet-nomination-pools-runtime-api", "pallet-offences", "pallet-offences-benchmarking", + "pallet-parameters", "pallet-preimage", "pallet-proxy", "pallet-referenda", @@ -10125,6 +10127,7 @@ dependencies = [ "polkadot-runtime-common", "polkadot-runtime-constants", "polkadot-runtime-parachains", + "relay-common", "scale-info", "separator", "serde_json", @@ -10152,6 +10155,7 @@ dependencies = [ "sp-transaction-pool", "sp-trie 36.0.0", "sp-version", + "ss58-registry", "staging-xcm", "staging-xcm-builder", "staging-xcm-executor", diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index aa0b696f0f..37a187396a 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -134,6 +134,9 @@ use kusama_runtime_constants::{ currency::*, fee::*, system_parachain, time::*, TREASURY_PALLET_ID, }; +/// Default logging target. +pub const LOG_TARGET: &str = "runtime::kusama"; + // Genesis preset configurations. pub mod genesis_config_presets; @@ -1919,11 +1922,11 @@ impl Runtime { }; // We assume un-delayed 6h eras. - let era_duration = 6 * HOURS; + let era_duration = 6 * (HOURS as Moment) * MILLISECS_PER_BLOCK; let next_mint = ::EraPayout::era_payout( staked, stake_able_issuance, - era_duration.into(), + era_duration, ); InflationInfo { inflation, next_mint } @@ -3044,17 +3047,17 @@ mod remote_tests { use ss58_registry::TokenRegistry; let token: ss58_registry::Token = TokenRegistry::Ksm.into(); - log::info!(target: "runtime::kusama", "total-staked = {:?}", token.amount(total_staked)); - log::info!(target: "runtime::kusama", "total-issuance = {:?}", token.amount(total_issuance)); - log::info!(target: "runtime::kusama", "staking-rate = {:?}", Perquintill::from_rational(total_staked, total_issuance)); - log::info!(target: "runtime::kusama", "era-duration = {:?}", average_era_duration_millis); - log::info!(target: "runtime::kusama", "min-inflation = {:?}", dynamic_params::inflation::MinInflation::get()); - log::info!(target: "runtime::kusama", "max-inflation = {:?}", dynamic_params::inflation::MaxInflation::get()); - log::info!(target: "runtime::kusama", "falloff = {:?}", dynamic_params::inflation::Falloff::get()); - log::info!(target: "runtime::kusama", "useAuctionSlots = {:?}", dynamic_params::inflation::UseAuctionSlots::get()); - log::info!(target: "runtime::kusama", "idealStake = {:?}", dynamic_params::inflation::IdealStake::get()); - log::info!(target: "runtime::kusama", "maxStakingRewards = {:?}", pallet_staking::MaxStakedRewards::::get()); - log::info!(target: "runtime::kusama", "💰 Inflation ==> staking = {:?} / leftover = {:?}", token.amount(staking), token.amount(leftover)); + log::info!(target: LOG_TARGET, "total-staked = {:?}", token.amount(total_staked)); + log::info!(target: LOG_TARGET, "total-issuance = {:?}", token.amount(total_issuance)); + log::info!(target: LOG_TARGET, "staking-rate = {:?}", Perquintill::from_rational(total_staked, total_issuance)); + log::info!(target: LOG_TARGET, "era-duration = {:?}", average_era_duration_millis); + log::info!(target: LOG_TARGET, "min-inflation = {:?}", dynamic_params::inflation::MinInflation::get()); + log::info!(target: LOG_TARGET, "max-inflation = {:?}", dynamic_params::inflation::MaxInflation::get()); + log::info!(target: LOG_TARGET, "falloff = {:?}", dynamic_params::inflation::Falloff::get()); + log::info!(target: LOG_TARGET, "useAuctionSlots = {:?}", dynamic_params::inflation::UseAuctionSlots::get()); + log::info!(target: LOG_TARGET, "idealStake = {:?}", dynamic_params::inflation::IdealStake::get()); + log::info!(target: LOG_TARGET, "maxStakingRewards = {:?}", pallet_staking::MaxStakedRewards::::get()); + log::info!(target: LOG_TARGET, "💰 Inflation ==> staking = {:?} / leftover = {:?}", token.amount(staking), token.amount(leftover)); }); } diff --git a/relay/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index 159497e65e..e4fe856855 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -62,6 +62,7 @@ pallet-multisig = { workspace = true } pallet-nomination-pools = { workspace = true } pallet-nomination-pools-runtime-api = { workspace = true } pallet-offences = { workspace = true } +pallet-parameters = { workspace = true } pallet-preimage = { workspace = true } pallet-proxy = { workspace = true } pallet-referenda = { workspace = true } @@ -96,6 +97,7 @@ pallet-nomination-pools-benchmarking = { optional = true, workspace = true } polkadot-runtime-common = { workspace = true } runtime-parachains = { workspace = true } polkadot-primitives = { workspace = true } +relay-common = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } @@ -114,6 +116,8 @@ separator = { workspace = true } remote-externalities = { workspace = true } tokio = { features = ["macros"], workspace = true } sp-tracing = { workspace = true } +hex-literal = { workspace = true } +ss58-registry = { workspace = true } [build-dependencies] substrate-wasm-builder = { workspace = true, optional = true } @@ -164,6 +168,7 @@ std = [ "pallet-nomination-pools/std", "pallet-offences-benchmarking?/std", "pallet-offences/std", + "pallet-parameters/std", "pallet-preimage/std", "pallet-proxy/std", "pallet-referenda/std", @@ -187,6 +192,7 @@ std = [ "polkadot-primitives/std", "polkadot-runtime-common/std", "polkadot-runtime-constants/std", + "relay-common/std", "runtime-parachains/std", "scale-info/std", "serde_json/std", @@ -242,6 +248,7 @@ runtime-benchmarks = [ "pallet-nomination-pools/runtime-benchmarks", "pallet-offences-benchmarking/runtime-benchmarks", "pallet-offences/runtime-benchmarks", + "pallet-parameters/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-referenda/runtime-benchmarks", @@ -295,6 +302,7 @@ try-runtime = [ "pallet-multisig/try-runtime", "pallet-nomination-pools/try-runtime", "pallet-offences/try-runtime", + "pallet-parameters/try-runtime", "pallet-preimage/try-runtime", "pallet-proxy/try-runtime", "pallet-referenda/try-runtime", diff --git a/relay/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index f6f587eb91..1a7c8958f7 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -60,6 +60,7 @@ use frame_election_provider_support::{ }; use frame_support::{ construct_runtime, + dynamic_params::{dynamic_pallet_params, dynamic_params}, genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ @@ -88,13 +89,11 @@ use polkadot_primitives::{ }; use sp_core::{OpaqueMetadata, H256}; use sp_runtime::{ - create_runtime_str, - curve::PiecewiseLinear, - generic, impl_opaque_keys, + create_runtime_str, generic, impl_opaque_keys, traits::{ AccountIdConversion, AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, Extrinsic as ExtrinsicT, IdentityLookup, Keccak256, OpaqueKeys, SaturatedConversion, - Verify, + Saturating, Verify, }, transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity}, ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill, RuntimeDebug, @@ -145,6 +144,7 @@ pub mod xcm_config; mod coretime_migration; +/// Default logging target. pub const LOG_TARGET: &str = "runtime::polkadot"; impl_runtime_weights!(polkadot_runtime_constants); @@ -619,20 +619,121 @@ impl pallet_bags_list::Config for Runtime { type Score = sp_npos_elections::VoteWeight; } -// TODO #6469: This shouldn't be static, but a lazily cached value, not built unless needed, and -// re-built in case input parameters have changed. The `ideal_stake` should be determined by the -// amount of parachain slots being bid on: this should be around `(75 - 25.min(slots / 4))%`. -pallet_staking_reward_curve::build! { - const REWARD_CURVE: PiecewiseLinear<'static> = curve!( - min_inflation: 0_025_000, - max_inflation: 0_100_000, - // 3:2:1 staked : parachains : float. - // while there's no parachains, then this is 75% staked : 25% float. - ideal_stake: 0_750_000, - falloff: 0_050_000, - max_piece_count: 40, - test_precision: 0_005_000, - ); +/// Dynamic params that can be adjusted at runtime. +#[dynamic_params(RuntimeParameters, pallet_parameters::Parameters::)] +pub mod dynamic_params { + use super::*; + + /// Parameters used to calculate era payouts, see + /// [`polkadot_runtime_common::impls::EraPayoutParams`]. + #[dynamic_pallet_params] + #[codec(index = 0)] + pub mod inflation { + /// Minimum inflation rate used to calculate era payouts. + #[codec(index = 0)] + pub static MinInflation: Perquintill = Perquintill::from_rational(25u64, 1000); + + /// Maximum inflation rate used to calculate era payouts. + #[codec(index = 1)] + pub static MaxInflation: Perquintill = Perquintill::from_percent(10); + + /// Ideal stake ratio used to calculate era payouts. + #[codec(index = 2)] + pub static IdealStake: Perquintill = Perquintill::from_percent(75); + + /// Falloff used to calculate era payouts. + #[codec(index = 3)] + pub static Falloff: Perquintill = Perquintill::from_percent(5); + + /// Whether to use auction slots or not in the calculation of era payouts, then we subtract + /// `num_auctioned_slots.min(60) / 300` from `ideal_stake`. + /// + /// That is, we assume up to 60 parachains that are leased can reduce the ideal stake by a + /// maximum of 20%. + /// + /// With the move to agile-coretime, this parameter does not make much sense and should + /// generally be set to false. + #[codec(index = 4)] + pub static UseAuctionSlots: bool = true; + } +} + +#[cfg(feature = "runtime-benchmarks")] +impl Default for RuntimeParameters { + fn default() -> Self { + RuntimeParameters::Inflation(dynamic_params::inflation::Parameters::MinInflation( + dynamic_params::inflation::MinInflation, + Some(Perquintill::from_rational(25u64, 1000u64)), + )) + } +} + +/// Defines what origin can modify which dynamic parameters. +pub struct DynamicParameterOrigin; +impl frame_support::traits::EnsureOriginWithArg + for DynamicParameterOrigin +{ + type Success = (); + + fn try_origin( + origin: RuntimeOrigin, + key: &RuntimeParametersKey, + ) -> Result { + use crate::RuntimeParametersKey::*; + + match key { + Inflation(_) => frame_system::ensure_root(origin.clone()), + } + .map_err(|_| origin) + } + + #[cfg(feature = "runtime-benchmarks")] + fn try_successful_origin(_key: &RuntimeParametersKey) -> Result { + // Provide the origin for the parameter returned by `Default`: + Ok(RuntimeOrigin::root()) + } +} + +impl pallet_parameters::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type RuntimeParameters = RuntimeParameters; + type AdminOrigin = DynamicParameterOrigin; + type WeightInfo = weights::pallet_parameters::WeightInfo; +} +/// Defines how much should the inflation be for an era given its duration. +pub struct EraPayout; +impl pallet_staking::EraPayout for EraPayout { + fn era_payout( + total_staked: Balance, + _total_issuance: Balance, + era_duration_millis: u64, + ) -> (Balance, Balance) { + const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; + + let params = relay_common::EraPayoutParams { + total_staked, + total_stakable: Balances::total_issuance(), + ideal_stake: dynamic_params::inflation::IdealStake::get(), + max_annual_inflation: dynamic_params::inflation::MaxInflation::get(), + min_annual_inflation: dynamic_params::inflation::MinInflation::get(), + falloff: dynamic_params::inflation::Falloff::get(), + period_fraction: Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), + legacy_auction_proportion: if dynamic_params::inflation::UseAuctionSlots::get() { + let auctioned_slots = parachains_paras::Parachains::::get() + .into_iter() + // all active para-ids that do not belong to a system chain is the number of + // parachains that we should take into account for inflation. + .filter(|i| *i >= LOWEST_PUBLIC_ID) + .count() as u64; + Some(Perquintill::from_rational(auctioned_slots.min(60), 300u64)) + } else { + None + }, + }; + + log::debug!(target: LOG_TARGET, "params: {:?}", params); + relay_common::relay_era_payout(params) + } } parameter_types! { @@ -650,7 +751,6 @@ parameter_types! { 27, "DOT_SLASH_DEFER_DURATION" ); - pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE; pub const MaxExposurePageSize: u32 = 512; // Note: this is not really correct as Max Nominators is (MaxExposurePageSize * page_count) but // this is an unbounded number. We just set it to a reasonably high value, 1 full page @@ -661,82 +761,6 @@ parameter_types! { pub const MaxNominations: u32 = ::LIMIT as u32; } -/// Custom version of `runtime_commong::era_payout` somewhat tailored for Polkadot's crowdloan -/// unlock history. The only tweak should be -/// -/// ```diff -/// - let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64); -/// + let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 300u64); -/// ``` -/// -/// See . -fn polkadot_era_payout( - total_staked: Balance, - total_stakable: Balance, - max_annual_inflation: Perquintill, - period_fraction: Perquintill, - auctioned_slots: u64, -) -> (Balance, Balance) { - use pallet_staking_reward_fn::compute_inflation; - use sp_runtime::traits::Saturating; - - let min_annual_inflation = Perquintill::from_rational(25u64, 1000u64); - let delta_annual_inflation = max_annual_inflation.saturating_sub(min_annual_inflation); - - // 20% reserved for up to 60 slots. - let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 300u64); - - // Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the - // amount that we expect to be taken up with auctions. - let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion); - - let stake = Perquintill::from_rational(total_staked, total_stakable); - let falloff = Perquintill::from_percent(5); - let adjustment = compute_inflation(stake, ideal_stake, falloff); - let staking_inflation = - min_annual_inflation.saturating_add(delta_annual_inflation * adjustment); - - let max_payout = period_fraction * max_annual_inflation * total_stakable; - let staking_payout = (period_fraction * staking_inflation) * total_stakable; - let rest = max_payout.saturating_sub(staking_payout); - - let other_issuance = total_stakable.saturating_sub(total_staked); - if total_staked > other_issuance { - let _cap_rest = Perquintill::from_rational(other_issuance, total_staked) * staking_payout; - // We don't do anything with this, but if we wanted to, we could introduce a cap on the - // treasury amount with: `rest = rest.min(cap_rest);` - } - (staking_payout, rest) -} - -pub struct EraPayout; -impl pallet_staking::EraPayout for EraPayout { - fn era_payout( - total_staked: Balance, - total_issuance: Balance, - era_duration_millis: u64, - ) -> (Balance, Balance) { - // all para-ids that are not active. - let auctioned_slots = parachains_paras::Parachains::::get() - .into_iter() - // all active para-ids that do not belong to a system chain is the number - // of parachains that we should take into account for inflation. - .filter(|i| *i >= LOWEST_PUBLIC_ID) - .count() as u64; - - const MAX_ANNUAL_INFLATION: Perquintill = Perquintill::from_percent(10); - const MILLISECONDS_PER_YEAR: u64 = 1000 * 3600 * 24 * 36525 / 100; - - polkadot_era_payout( - total_staked, - total_issuance, - MAX_ANNUAL_INFLATION, - Perquintill::from_rational(era_duration_millis, MILLISECONDS_PER_YEAR), - auctioned_slots, - ) - } -} - impl pallet_staking::Config for Runtime { type Currency = Balances; type CurrencyBalance = Balance; @@ -1622,6 +1646,7 @@ construct_runtime! { Referenda: pallet_referenda = 21, Origins: pallet_custom_origins = 22, Whitelist: pallet_whitelist = 23, + Parameters: pallet_parameters = 27, // Claims. Usable initially. Claims: claims = 24, @@ -2107,7 +2132,48 @@ mod benches { ); } +use relay_common::apis::InflationInfo; +impl Runtime { + fn impl_experimental_inflation_info() -> InflationInfo { + use pallet_staking::{ActiveEra, EraPayout, ErasTotalStake}; + let (staked, _start) = ActiveEra::::get() + .map(|ae| (ErasTotalStake::::get(ae.index), ae.start.unwrap_or(0))) + .unwrap_or((0, 0)); + let stake_able_issuance = Balances::total_issuance(); + + let ideal_staking_rate = dynamic_params::inflation::IdealStake::get(); + let inflation = if dynamic_params::inflation::UseAuctionSlots::get() { + let auctioned_slots = parachains_paras::Parachains::::get() + .into_iter() + // all active para-ids that do not belong to a system chain is the number of + // parachains that we should take into account for inflation. + .filter(|i| *i >= LOWEST_PUBLIC_ID) + .count() as u64; + ideal_staking_rate + .saturating_sub(Perquintill::from_rational(auctioned_slots.min(60), 300u64)) + } else { + ideal_staking_rate + }; + + // We assume un-delayed 24h eras. + let era_duration = 24 * (HOURS as Moment) * MILLISECS_PER_BLOCK; + let next_mint = ::EraPayout::era_payout( + staked, + stake_able_issuance, + era_duration, + ); + + InflationInfo { inflation, next_mint } + } +} + sp_api::impl_runtime_apis! { + impl relay_common::apis::Inflation for Runtime { + fn experimental_inflation_prediction_info() -> InflationInfo { + Runtime::impl_experimental_inflation_info() + } + } + impl sp_api::Core for Runtime { fn version() -> RuntimeVersion { VERSION @@ -3417,4 +3483,71 @@ mod remote_tests { polkadot_runtime_common::try_runtime::migrate_all_inactive_nominators::() }); } + + #[tokio::test] + async fn next_inflation() { + use hex_literal::hex; + sp_tracing::try_init_simple(); + let transport: Transport = + var("WS").unwrap_or("wss://rpc.dotters.network/polkadot".to_string()).into(); + let mut ext = Builder::::default() + .mode(Mode::Online(OnlineConfig { + transport, + hashed_prefixes: vec![ + // staking eras total stake + hex!("5f3e4907f716ac89b6347d15ececedcaa141c4fe67c2d11f4a10c6aca7a79a04") + .to_vec(), + ], + hashed_keys: vec![ + // staking active era + hex!("5f3e4907f716ac89b6347d15ececedca487df464e44a534ba6b0cbb32407b587") + .to_vec(), + // balances ti + hex!("c2261276cc9d1f8598ea4b6a74b15c2f57c875e4cff74148e4628f264b974c80") + .to_vec(), + // timestamp now + hex!("f0c365c3cf59d671eb72da0e7a4113c49f1f0515f462cdcf84e0f1d6045dfcbb") + .to_vec(), + // para-ids + hex!("cd710b30bd2eab0352ddcc26417aa1940b76934f4cc08dee01012d059e1b83ee") + .to_vec(), + ], + ..Default::default() + })) + .build() + .await + .unwrap(); + ext.execute_with(|| { + use pallet_staking::EraPayout; + let (total_staked, started) = pallet_staking::ActiveEra::::get() + .map(|ae| { + (pallet_staking::ErasTotalStake::::get(ae.index), ae.start.unwrap()) + }) + .unwrap(); + let total_issuance = Balances::total_issuance(); + let _real_era_duration_millis = + pallet_timestamp::Now::::get().saturating_sub(started); + // 24h in milliseconds + let average_era_duration_millis = 24 * (HOURS as Moment) * MILLISECS_PER_BLOCK; + let (staking, leftover) = ::EraPayout::era_payout( + total_staked, + total_issuance, + average_era_duration_millis.into(), + ); + use ss58_registry::TokenRegistry; + let token: ss58_registry::Token = TokenRegistry::Dot.into(); + + log::info!(target: LOG_TARGET, "total-staked = {:?}", token.amount(total_staked)); + log::info!(target: LOG_TARGET, "total-issuance = {:?}", token.amount(total_issuance)); + log::info!(target: LOG_TARGET, "staking-rate = {:?}", Perquintill::from_rational(total_staked, total_issuance)); + log::info!(target: LOG_TARGET, "era-duration = {:?}", average_era_duration_millis); + log::info!(target: LOG_TARGET, "min-inflation = {:?}", dynamic_params::inflation::MinInflation::get()); + log::info!(target: LOG_TARGET, "max-inflation = {:?}", dynamic_params::inflation::MaxInflation::get()); + log::info!(target: LOG_TARGET, "falloff = {:?}", dynamic_params::inflation::Falloff::get()); + log::info!(target: LOG_TARGET, "useAuctionSlots = {:?}", dynamic_params::inflation::UseAuctionSlots::get()); + log::info!(target: LOG_TARGET, "idealStake = {:?}", dynamic_params::inflation::IdealStake::get()); + log::info!(target: LOG_TARGET, "maxStakingRewards = {:?}", pallet_staking::MaxStakedRewards::::get()); + log::info!(target: LOG_TARGET, "💰 Inflation ==> staking = {:?} / leftover = {:?}", token.amount(staking), token.amount(leftover)); + }); + } } diff --git a/relay/polkadot/src/weights/mod.rs b/relay/polkadot/src/weights/mod.rs index 190b254db2..303bd12451 100644 --- a/relay/polkadot/src/weights/mod.rs +++ b/relay/polkadot/src/weights/mod.rs @@ -29,6 +29,7 @@ pub mod pallet_indices; pub mod pallet_message_queue; pub mod pallet_multisig; pub mod pallet_nomination_pools; +pub mod pallet_parameters; pub mod pallet_preimage; pub mod pallet_proxy; pub mod pallet_referenda; diff --git a/relay/polkadot/src/weights/pallet_parameters.rs b/relay/polkadot/src/weights/pallet_parameters.rs new file mode 100644 index 0000000000..4ecc2b213c --- /dev/null +++ b/relay/polkadot/src/weights/pallet_parameters.rs @@ -0,0 +1,51 @@ +// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md +// for a list of specific contributors. +// SPDX-License-Identifier: Apache-2.0 + +//! Autogenerated weights for `pallet_parameters` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-04-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `runner-anb7yjbi-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("polkadot-dev")`, DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json +// --pallet=pallet_parameters +// --chain=polkadot-dev +// --header=./polkadot/file_header.txt +// --output=./polkadot/runtime/polkadot/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `pallet_parameters`. +pub struct WeightInfo(PhantomData); +impl pallet_parameters::WeightInfo for WeightInfo { + /// Storage: `Parameters::Parameters` (r:1 w:1) + /// Proof: `Parameters::Parameters` (`max_values`: None, `max_size`: Some(28), added: 2503, mode: `MaxEncodedLen`) + fn set_parameter() -> Weight { + // Proof Size summary in bytes: + // Measured: `4` + // Estimated: `3493` + // Minimum execution time: 6_937_000 picoseconds. + Weight::from_parts(7_242_000, 0) + .saturating_add(Weight::from_parts(0, 3493)) + .saturating_add(T::DbWeight::get().reads(1)) + .saturating_add(T::DbWeight::get().writes(1)) + } +}