mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
Add nomination pools to Polkadot runtime (#5582)
* Add nomination poools to Polkadot runtime * fmt + spellcheck * cargo run --quiet --profile=production --features runtime-benchmarks -- benchmark pallet --chain=polkadot-dev --steps=50 --repeat=20 --pallet=pallet_nomination_pools --extrinsic=* --execution=wasm --wasm-execution=compiled --header=./file_header.txt --output=./runtime/polkadot/src/weights/ * fiux * ".git/.scripts/bench-bot.sh" runtime polkadot-dev pallet_nomination_pools * ".git/.scripts/fmt.sh" 1 * Update runtime/polkadot/src/lib.rs Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * fix * fmt * Update runtime/polkadot/src/lib.rs Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
Generated
+2
@@ -6957,6 +6957,8 @@ dependencies = [
|
|||||||
"pallet-indices",
|
"pallet-indices",
|
||||||
"pallet-membership",
|
"pallet-membership",
|
||||||
"pallet-multisig",
|
"pallet-multisig",
|
||||||
|
"pallet-nomination-pools",
|
||||||
|
"pallet-nomination-pools-benchmarking",
|
||||||
"pallet-offences",
|
"pallet-offences",
|
||||||
"pallet-offences-benchmarking",
|
"pallet-offences-benchmarking",
|
||||||
"pallet-preimage",
|
"pallet-preimage",
|
||||||
|
|||||||
@@ -386,6 +386,7 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
|
|||||||
},
|
},
|
||||||
paras: Default::default(),
|
paras: Default::default(),
|
||||||
xcm_pallet: Default::default(),
|
xcm_pallet: Default::default(),
|
||||||
|
nomination_pools: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1369,6 +1370,7 @@ pub fn polkadot_testnet_genesis(
|
|||||||
},
|
},
|
||||||
paras: Default::default(),
|
paras: Default::default(),
|
||||||
xcm_pallet: Default::default(),
|
xcm_pallet: Default::default(),
|
||||||
|
nomination_pools: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ use frame_support::{
|
|||||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
||||||
};
|
};
|
||||||
use frame_system::limits;
|
use frame_system::limits;
|
||||||
use primitives::v2::{AssignmentId, BlockNumber, ValidatorId};
|
use primitives::v2::{AssignmentId, Balance, BlockNumber, ValidatorId};
|
||||||
use sp_runtime::{FixedPointNumber, Perbill, Perquintill};
|
use sp_runtime::{FixedPointNumber, Perbill, Perquintill};
|
||||||
use static_assertions::const_assert;
|
use static_assertions::const_assert;
|
||||||
|
|
||||||
@@ -215,6 +215,23 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
|
|||||||
type MaxNominators = ConstU32<1000>;
|
type MaxNominators = ConstU32<1000>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Convert a balance to an unsigned 256-bit number, use in nomination pools.
|
||||||
|
pub struct BalanceToU256;
|
||||||
|
impl sp_runtime::traits::Convert<Balance, sp_core::U256> for BalanceToU256 {
|
||||||
|
fn convert(n: Balance) -> sp_core::U256 {
|
||||||
|
n.into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Convert an unsigned 256-bit number to balance, use in nomination pools.
|
||||||
|
pub struct U256ToBalance;
|
||||||
|
impl sp_runtime::traits::Convert<sp_core::U256, Balance> for U256ToBalance {
|
||||||
|
fn convert(n: sp_core::U256) -> Balance {
|
||||||
|
use frame_support::traits::Defensive;
|
||||||
|
n.try_into().defensive_unwrap_or(Balance::MAX)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Macro to set a value (e.g. when using the `parameter_types` macro) to either a production value
|
/// Macro to set a value (e.g. when using the `parameter_types` macro) to either a production value
|
||||||
/// or to an environment variable or testing value (in case the `fast-runtime` feature is selected).
|
/// or to an environment variable or testing value (in case the `fast-runtime` feature is selected).
|
||||||
/// Note that the environment variable is evaluated _at compile time_.
|
/// Note that the environment variable is evaluated _at compile time_.
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ use primitives::v2::{
|
|||||||
};
|
};
|
||||||
use runtime_common::{
|
use runtime_common::{
|
||||||
auctions, claims, crowdloan, impl_runtime_weights, impls::DealWithFees, paras_registrar,
|
auctions, claims, crowdloan, impl_runtime_weights, impls::DealWithFees, paras_registrar,
|
||||||
prod_or_fast, slots, BlockHashCount, BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate,
|
prod_or_fast, slots, BalanceToU256, BlockHashCount, BlockLength, CurrencyToVote,
|
||||||
|
SlowAdjustingFeeUpdate, U256ToBalance,
|
||||||
};
|
};
|
||||||
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
|
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
|
||||||
|
|
||||||
@@ -1196,7 +1197,8 @@ impl InstanceFilter<Call> for ProxyType {
|
|||||||
Call::Crowdloan(..) |
|
Call::Crowdloan(..) |
|
||||||
Call::Slots(..) |
|
Call::Slots(..) |
|
||||||
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
||||||
Call::VoterList(..)
|
Call::VoterList(..) |
|
||||||
|
Call::NominationPools(..)
|
||||||
),
|
),
|
||||||
ProxyType::Governance => matches!(
|
ProxyType::Governance => matches!(
|
||||||
c,
|
c,
|
||||||
@@ -1423,20 +1425,6 @@ impl pallet_gilt::Config for Runtime {
|
|||||||
type WeightInfo = weights::pallet_gilt::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_gilt::WeightInfo<Runtime>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BalanceToU256;
|
|
||||||
impl sp_runtime::traits::Convert<Balance, sp_core::U256> for BalanceToU256 {
|
|
||||||
fn convert(n: Balance) -> sp_core::U256 {
|
|
||||||
n.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct U256ToBalance;
|
|
||||||
impl sp_runtime::traits::Convert<sp_core::U256, Balance> for U256ToBalance {
|
|
||||||
fn convert(n: sp_core::U256) -> Balance {
|
|
||||||
use frame_support::traits::Defensive;
|
|
||||||
n.try_into().defensive_unwrap_or(Balance::MAX)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
|
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
|
||||||
pub const MaxPointsToBalance: u8 = 10;
|
pub const MaxPointsToBalance: u8 = 10;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "
|
|||||||
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
|
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
pallet-proxy = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
|
||||||
@@ -79,6 +80,7 @@ frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", b
|
|||||||
pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
|
pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, optional = true }
|
||||||
hex-literal = { version = "0.3.4", optional = true }
|
hex-literal = { version = "0.3.4", optional = true }
|
||||||
|
|
||||||
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
|
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
|
||||||
@@ -143,6 +145,7 @@ std = [
|
|||||||
"pallet-indices/std",
|
"pallet-indices/std",
|
||||||
"pallet-membership/std",
|
"pallet-membership/std",
|
||||||
"pallet-multisig/std",
|
"pallet-multisig/std",
|
||||||
|
"pallet-nomination-pools/std",
|
||||||
"pallet-offences/std",
|
"pallet-offences/std",
|
||||||
"pallet-preimage/std",
|
"pallet-preimage/std",
|
||||||
"pallet-proxy/std",
|
"pallet-proxy/std",
|
||||||
@@ -196,6 +199,8 @@ runtime-benchmarks = [
|
|||||||
"pallet-indices/runtime-benchmarks",
|
"pallet-indices/runtime-benchmarks",
|
||||||
"pallet-membership/runtime-benchmarks",
|
"pallet-membership/runtime-benchmarks",
|
||||||
"pallet-multisig/runtime-benchmarks",
|
"pallet-multisig/runtime-benchmarks",
|
||||||
|
"pallet-nomination-pools/runtime-benchmarks",
|
||||||
|
"pallet-nomination-pools-benchmarking",
|
||||||
"pallet-preimage/runtime-benchmarks",
|
"pallet-preimage/runtime-benchmarks",
|
||||||
"pallet-proxy/runtime-benchmarks",
|
"pallet-proxy/runtime-benchmarks",
|
||||||
"pallet-scheduler/runtime-benchmarks",
|
"pallet-scheduler/runtime-benchmarks",
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ use sp_runtime::{
|
|||||||
OpaqueKeys, SaturatedConversion, Verify,
|
OpaqueKeys, SaturatedConversion, Verify,
|
||||||
},
|
},
|
||||||
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
|
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
|
||||||
ApplyExtrinsicResult, KeyTypeId, Perbill, Percent, Permill,
|
ApplyExtrinsicResult, FixedU128, KeyTypeId, Perbill, Percent, Permill,
|
||||||
};
|
};
|
||||||
use sp_staking::SessionIndex;
|
use sp_staking::SessionIndex;
|
||||||
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
|
use sp_std::{cmp::Ordering, collections::btree_map::BTreeMap, prelude::*};
|
||||||
@@ -183,7 +183,8 @@ impl Contains<Call> for BaseFilter {
|
|||||||
Call::Auctions(_) |
|
Call::Auctions(_) |
|
||||||
Call::Crowdloan(_) |
|
Call::Crowdloan(_) |
|
||||||
Call::VoterList(_) |
|
Call::VoterList(_) |
|
||||||
Call::XcmPallet(_) => true,
|
Call::XcmPallet(_) |
|
||||||
|
Call::NominationPools(_) => true,
|
||||||
// All pallets are allowed, but exhaustive match is defensive
|
// All pallets are allowed, but exhaustive match is defensive
|
||||||
// in the case of adding new pallets.
|
// in the case of adding new pallets.
|
||||||
}
|
}
|
||||||
@@ -613,7 +614,7 @@ impl pallet_staking::Config for Runtime {
|
|||||||
type VoterList = VoterList;
|
type VoterList = VoterList;
|
||||||
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
|
||||||
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
|
||||||
type OnStakerSlash = ();
|
type OnStakerSlash = NominationPools;
|
||||||
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
|
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1180,7 +1181,8 @@ impl InstanceFilter<Call> for ProxyType {
|
|||||||
Call::Crowdloan(..) |
|
Call::Crowdloan(..) |
|
||||||
Call::Slots(..) |
|
Call::Slots(..) |
|
||||||
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
|
||||||
Call::VoterList(..)
|
Call::VoterList(..) |
|
||||||
|
Call::NominationPools(..)
|
||||||
),
|
),
|
||||||
ProxyType::Governance => matches!(
|
ProxyType::Governance => matches!(
|
||||||
c,
|
c,
|
||||||
@@ -1389,6 +1391,53 @@ impl auctions::Config for Runtime {
|
|||||||
type WeightInfo = weights::runtime_common_auctions::WeightInfo<Runtime>;
|
type WeightInfo = weights::runtime_common_auctions::WeightInfo<Runtime>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
|
||||||
|
// Allow pools that got slashed up to 90% to remain operational.
|
||||||
|
pub const MaxPointsToBalance: u8 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl pallet_nomination_pools::Config for Runtime {
|
||||||
|
type Event = Event;
|
||||||
|
type Currency = Balances;
|
||||||
|
type CurrencyBalance = Balance;
|
||||||
|
type RewardCounter = FixedU128;
|
||||||
|
type BalanceToU256 = runtime_common::BalanceToU256;
|
||||||
|
type U256ToBalance = runtime_common::U256ToBalance;
|
||||||
|
type StakingInterface = Staking;
|
||||||
|
type PostUnbondingPoolsWindow = frame_support::traits::ConstU32<4>;
|
||||||
|
type MaxMetadataLen = frame_support::traits::ConstU32<256>;
|
||||||
|
// we use the same number of allowed unlocking chunks as with staking.
|
||||||
|
type MaxUnbonding = <Self as pallet_staking::Config>::MaxUnlockingChunks;
|
||||||
|
type PalletId = PoolsPalletId;
|
||||||
|
type MaxPointsToBalance = MaxPointsToBalance;
|
||||||
|
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct InitiateNominationPools;
|
||||||
|
impl frame_support::traits::OnRuntimeUpgrade for InitiateNominationPools {
|
||||||
|
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||||
|
// we use one as an indicator if this has already been set.
|
||||||
|
if pallet_nomination_pools::MaxPools::<Runtime>::get().is_none() {
|
||||||
|
// 5 DOT to join a pool.
|
||||||
|
pallet_nomination_pools::MinJoinBond::<Runtime>::put(5 * UNITS);
|
||||||
|
// 100 DOT to create a pool.
|
||||||
|
pallet_nomination_pools::MinCreateBond::<Runtime>::put(100 * UNITS);
|
||||||
|
|
||||||
|
// Initialize with limits for now.
|
||||||
|
pallet_nomination_pools::MaxPools::<Runtime>::put(0);
|
||||||
|
pallet_nomination_pools::MaxPoolMembersPerPool::<Runtime>::put(0);
|
||||||
|
pallet_nomination_pools::MaxPoolMembers::<Runtime>::put(0);
|
||||||
|
|
||||||
|
log::info!(target: "runtime::polkadot", "pools config initiated 🎉");
|
||||||
|
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(1, 5)
|
||||||
|
} else {
|
||||||
|
log::info!(target: "runtime::polkadot", "pools config already initiated 😏");
|
||||||
|
<Runtime as frame_system::Config>::DbWeight::get().reads(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime where
|
||||||
Block = Block,
|
Block = Block,
|
||||||
@@ -1458,6 +1507,9 @@ construct_runtime! {
|
|||||||
// Provides a semi-sorted list of nominators for staking.
|
// Provides a semi-sorted list of nominators for staking.
|
||||||
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 37,
|
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 37,
|
||||||
|
|
||||||
|
// nomination pools: extension to staking.
|
||||||
|
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 39,
|
||||||
|
|
||||||
// Parachains pallets. Start indices at 50 to leave room.
|
// Parachains pallets. Start indices at 50 to leave room.
|
||||||
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 50,
|
||||||
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
|
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 51,
|
||||||
@@ -1515,7 +1567,7 @@ pub type Executive = frame_executive::Executive<
|
|||||||
frame_system::ChainContext<Runtime>,
|
frame_system::ChainContext<Runtime>,
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithSystem,
|
AllPalletsWithSystem,
|
||||||
pallet_staking::migrations::v10::MigrateToV10<Runtime>,
|
(pallet_staking::migrations::v10::MigrateToV10<Runtime>, InitiateNominationPools),
|
||||||
>;
|
>;
|
||||||
/// The payload being signed in transactions.
|
/// The payload being signed in transactions.
|
||||||
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
pub type SignedPayload = generic::SignedPayload<Call, SignedExtra>;
|
||||||
@@ -1558,6 +1610,7 @@ mod benches {
|
|||||||
[pallet_indices, Indices]
|
[pallet_indices, Indices]
|
||||||
[pallet_membership, TechnicalMembership]
|
[pallet_membership, TechnicalMembership]
|
||||||
[pallet_multisig, Multisig]
|
[pallet_multisig, Multisig]
|
||||||
|
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
|
||||||
[pallet_offences, OffencesBench::<Runtime>]
|
[pallet_offences, OffencesBench::<Runtime>]
|
||||||
[pallet_preimage, Preimage]
|
[pallet_preimage, Preimage]
|
||||||
[pallet_proxy, Proxy]
|
[pallet_proxy, Proxy]
|
||||||
@@ -1938,6 +1991,7 @@ sp_api::impl_runtime_apis! {
|
|||||||
use pallet_session_benchmarking::Pallet as SessionBench;
|
use pallet_session_benchmarking::Pallet as SessionBench;
|
||||||
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
||||||
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
|
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
|
||||||
|
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
use frame_benchmarking::baseline::Pallet as Baseline;
|
use frame_benchmarking::baseline::Pallet as Baseline;
|
||||||
|
|
||||||
@@ -1960,6 +2014,7 @@ sp_api::impl_runtime_apis! {
|
|||||||
use pallet_session_benchmarking::Pallet as SessionBench;
|
use pallet_session_benchmarking::Pallet as SessionBench;
|
||||||
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
use pallet_offences_benchmarking::Pallet as OffencesBench;
|
||||||
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
|
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
|
||||||
|
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
|
||||||
use frame_system_benchmarking::Pallet as SystemBench;
|
use frame_system_benchmarking::Pallet as SystemBench;
|
||||||
use frame_benchmarking::baseline::Pallet as Baseline;
|
use frame_benchmarking::baseline::Pallet as Baseline;
|
||||||
|
|
||||||
@@ -1968,6 +2023,7 @@ sp_api::impl_runtime_apis! {
|
|||||||
impl pallet_election_provider_support_benchmarking::Config for Runtime {}
|
impl pallet_election_provider_support_benchmarking::Config for Runtime {}
|
||||||
impl frame_system_benchmarking::Config for Runtime {}
|
impl frame_system_benchmarking::Config for Runtime {}
|
||||||
impl frame_benchmarking::baseline::Config for Runtime {}
|
impl frame_benchmarking::baseline::Config for Runtime {}
|
||||||
|
impl pallet_nomination_pools_benchmarking::Config for Runtime {}
|
||||||
|
|
||||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||||
// Block Number
|
// Block Number
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ pub mod pallet_im_online;
|
|||||||
pub mod pallet_indices;
|
pub mod pallet_indices;
|
||||||
pub mod pallet_membership;
|
pub mod pallet_membership;
|
||||||
pub mod pallet_multisig;
|
pub mod pallet_multisig;
|
||||||
|
pub mod pallet_nomination_pools;
|
||||||
pub mod pallet_preimage;
|
pub mod pallet_preimage;
|
||||||
pub mod pallet_proxy;
|
pub mod pallet_proxy;
|
||||||
pub mod pallet_scheduler;
|
pub mod pallet_scheduler;
|
||||||
|
|||||||
@@ -0,0 +1,271 @@
|
|||||||
|
// Copyright 2017-2022 Parity Technologies (UK) Ltd.
|
||||||
|
// This file is part of Polkadot.
|
||||||
|
|
||||||
|
// Polkadot is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
|
||||||
|
// Polkadot is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//! Autogenerated weights for `pallet_nomination_pools`
|
||||||
|
//!
|
||||||
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||||
|
//! DATE: 2022-08-02, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||||
|
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
|
||||||
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("polkadot-dev"), DB CACHE: 1024
|
||||||
|
|
||||||
|
// Executed Command:
|
||||||
|
// /home/benchbot/cargo_target_dir/production/polkadot
|
||||||
|
// benchmark
|
||||||
|
// pallet
|
||||||
|
// --steps=50
|
||||||
|
// --repeat=20
|
||||||
|
// --extrinsic=*
|
||||||
|
// --execution=wasm
|
||||||
|
// --wasm-execution=compiled
|
||||||
|
// --heap-pages=4096
|
||||||
|
// --pallet=pallet_nomination_pools
|
||||||
|
// --chain=polkadot-dev
|
||||||
|
// --header=./file_header.txt
|
||||||
|
// --output=./runtime/polkadot/src/weights/pallet_nomination_pools.rs
|
||||||
|
|
||||||
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
#![allow(unused_parens)]
|
||||||
|
#![allow(unused_imports)]
|
||||||
|
|
||||||
|
use frame_support::{traits::Get, weights::Weight};
|
||||||
|
use sp_std::marker::PhantomData;
|
||||||
|
|
||||||
|
/// Weight functions for `pallet_nomination_pools`.
|
||||||
|
pub struct WeightInfo<T>(PhantomData<T>);
|
||||||
|
impl<T: frame_system::Config> pallet_nomination_pools::WeightInfo for WeightInfo<T> {
|
||||||
|
// Storage: NominationPools MinJoinBond (r:1 w:0)
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: System Account (r:2 w:1)
|
||||||
|
// Storage: NominationPools MaxPoolMembersPerPool (r:1 w:0)
|
||||||
|
// Storage: NominationPools MaxPoolMembers (r:1 w:0)
|
||||||
|
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
|
||||||
|
// Storage: Staking Bonded (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: VoterList ListNodes (r:3 w:3)
|
||||||
|
// Storage: VoterList ListBags (r:2 w:2)
|
||||||
|
fn join() -> Weight {
|
||||||
|
(118_410_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(17 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: System Account (r:3 w:2)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Staking Bonded (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: VoterList ListNodes (r:3 w:3)
|
||||||
|
// Storage: VoterList ListBags (r:2 w:2)
|
||||||
|
fn bond_extra_transfer() -> Weight {
|
||||||
|
(110_847_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(14 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: System Account (r:3 w:3)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Staking Bonded (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: VoterList ListNodes (r:2 w:2)
|
||||||
|
// Storage: VoterList ListBags (r:2 w:2)
|
||||||
|
fn bond_extra_reward() -> Weight {
|
||||||
|
(117_431_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(13 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(12 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:1)
|
||||||
|
fn claim_payout() -> Weight {
|
||||||
|
(46_087_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(4 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: System Account (r:2 w:1)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: Staking Nominators (r:1 w:0)
|
||||||
|
// Storage: Staking MinNominatorBond (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: VoterList ListNodes (r:3 w:3)
|
||||||
|
// Storage: Staking Bonded (r:1 w:0)
|
||||||
|
// Storage: VoterList ListBags (r:2 w:2)
|
||||||
|
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
|
||||||
|
fn unbond() -> Weight {
|
||||||
|
(116_969_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(18 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(13 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:0)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
/// The range of component `s` is `[0, 100]`.
|
||||||
|
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
|
||||||
|
(37_619_000 as Weight)
|
||||||
|
// Standard Error: 0
|
||||||
|
.saturating_add((28_000 as Weight).saturating_mul(s as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(4 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: System Account (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
|
||||||
|
/// The range of component `s` is `[0, 100]`.
|
||||||
|
fn withdraw_unbonded_update(s: u32, ) -> Weight {
|
||||||
|
(73_374_000 as Weight)
|
||||||
|
// Standard Error: 0
|
||||||
|
.saturating_add((35_000 as Weight).saturating_mul(s as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(7 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Staking Bonded (r:1 w:1)
|
||||||
|
// Storage: Staking SlashingSpans (r:1 w:0)
|
||||||
|
// Storage: Staking Validators (r:1 w:0)
|
||||||
|
// Storage: Staking Nominators (r:1 w:0)
|
||||||
|
// Storage: System Account (r:2 w:2)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools ReversePoolIdLookup (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForReversePoolIdLookup (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForRewardPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForBondedPools (r:1 w:1)
|
||||||
|
// Storage: Staking Payee (r:0 w:1)
|
||||||
|
/// The range of component `s` is `[0, 100]`.
|
||||||
|
fn withdraw_unbonded_kill(s: u32, ) -> Weight {
|
||||||
|
(128_477_000 as Weight)
|
||||||
|
// Standard Error: 1_000
|
||||||
|
.saturating_add((11_000 as Weight).saturating_mul(s as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(19 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(16 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: Staking MinNominatorBond (r:1 w:0)
|
||||||
|
// Storage: NominationPools MinCreateBond (r:1 w:0)
|
||||||
|
// Storage: NominationPools MinJoinBond (r:1 w:0)
|
||||||
|
// Storage: NominationPools MaxPools (r:1 w:0)
|
||||||
|
// Storage: NominationPools CounterForBondedPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools PoolMembers (r:1 w:1)
|
||||||
|
// Storage: NominationPools LastPoolId (r:1 w:1)
|
||||||
|
// Storage: NominationPools MaxPoolMembersPerPool (r:1 w:0)
|
||||||
|
// Storage: NominationPools MaxPoolMembers (r:1 w:0)
|
||||||
|
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
|
||||||
|
// Storage: System Account (r:2 w:2)
|
||||||
|
// Storage: Staking Ledger (r:1 w:1)
|
||||||
|
// Storage: Staking Bonded (r:1 w:1)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: Staking HistoryDepth (r:1 w:0)
|
||||||
|
// Storage: Balances Locks (r:1 w:1)
|
||||||
|
// Storage: NominationPools RewardPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForRewardPools (r:1 w:1)
|
||||||
|
// Storage: NominationPools ReversePoolIdLookup (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForReversePoolIdLookup (r:1 w:1)
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: Staking Payee (r:0 w:1)
|
||||||
|
fn create() -> Weight {
|
||||||
|
(118_156_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(22 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(15 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:0)
|
||||||
|
// Storage: Staking Ledger (r:1 w:0)
|
||||||
|
// Storage: Staking MinNominatorBond (r:1 w:0)
|
||||||
|
// Storage: Staking Nominators (r:1 w:1)
|
||||||
|
// Storage: Staking MaxNominatorsCount (r:1 w:0)
|
||||||
|
// Storage: Staking Validators (r:2 w:0)
|
||||||
|
// Storage: Staking CurrentEra (r:1 w:0)
|
||||||
|
// Storage: Staking Bonded (r:1 w:0)
|
||||||
|
// Storage: VoterList ListNodes (r:1 w:1)
|
||||||
|
// Storage: VoterList ListBags (r:1 w:1)
|
||||||
|
// Storage: VoterList CounterForListNodes (r:1 w:1)
|
||||||
|
// Storage: Staking CounterForNominators (r:1 w:1)
|
||||||
|
/// The range of component `n` is `[1, 16]`.
|
||||||
|
fn nominate(n: u32, ) -> Weight {
|
||||||
|
(47_219_000 as Weight)
|
||||||
|
// Standard Error: 10_000
|
||||||
|
.saturating_add((2_107_000 as Weight).saturating_mul(n as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(12 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
// Storage: Staking Ledger (r:1 w:0)
|
||||||
|
fn set_state() -> Weight {
|
||||||
|
(23_730_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(2 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:0)
|
||||||
|
// Storage: NominationPools Metadata (r:1 w:1)
|
||||||
|
// Storage: NominationPools CounterForMetadata (r:1 w:1)
|
||||||
|
/// The range of component `n` is `[1, 256]`.
|
||||||
|
fn set_metadata(n: u32, ) -> Weight {
|
||||||
|
(13_082_000 as Weight)
|
||||||
|
// Standard Error: 0
|
||||||
|
.saturating_add((1_000 as Weight).saturating_mul(n as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().reads(3 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(2 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools MinJoinBond (r:0 w:1)
|
||||||
|
// Storage: NominationPools MaxPoolMembers (r:0 w:1)
|
||||||
|
// Storage: NominationPools MaxPoolMembersPerPool (r:0 w:1)
|
||||||
|
// Storage: NominationPools MinCreateBond (r:0 w:1)
|
||||||
|
// Storage: NominationPools MaxPools (r:0 w:1)
|
||||||
|
fn set_configs() -> Weight {
|
||||||
|
(6_135_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:1)
|
||||||
|
fn update_roles() -> Weight {
|
||||||
|
(20_373_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
||||||
|
}
|
||||||
|
// Storage: NominationPools BondedPools (r:1 w:0)
|
||||||
|
// Storage: Staking Ledger (r:1 w:0)
|
||||||
|
// Storage: Staking Validators (r:1 w:0)
|
||||||
|
// Storage: Staking Nominators (r:1 w:1)
|
||||||
|
// Storage: Staking CounterForNominators (r:1 w:1)
|
||||||
|
// Storage: VoterList ListNodes (r:1 w:1)
|
||||||
|
// Storage: VoterList ListBags (r:1 w:1)
|
||||||
|
// Storage: VoterList CounterForListNodes (r:1 w:1)
|
||||||
|
fn chill() -> Weight {
|
||||||
|
(45_186_000 as Weight)
|
||||||
|
.saturating_add(T::DbWeight::get().reads(8 as Weight))
|
||||||
|
.saturating_add(T::DbWeight::get().writes(5 as Weight))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,8 +44,8 @@ use primitives::v2::{
|
|||||||
};
|
};
|
||||||
use runtime_common::{
|
use runtime_common::{
|
||||||
assigned_slots, auctions, crowdloan, elections::OnChainAccuracy, impl_runtime_weights,
|
assigned_slots, auctions, crowdloan, elections::OnChainAccuracy, impl_runtime_weights,
|
||||||
impls::ToAuthor, paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BlockHashCount,
|
impls::ToAuthor, paras_registrar, paras_sudo_wrapper, prod_or_fast, slots, BalanceToU256,
|
||||||
BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate,
|
BlockHashCount, BlockLength, CurrencyToVote, SlowAdjustingFeeUpdate, U256ToBalance,
|
||||||
};
|
};
|
||||||
use runtime_parachains::{
|
use runtime_parachains::{
|
||||||
configuration as parachains_configuration, disputes as parachains_disputes,
|
configuration as parachains_configuration, disputes as parachains_disputes,
|
||||||
@@ -1015,20 +1015,6 @@ impl auctions::Config for Runtime {
|
|||||||
type WeightInfo = weights::runtime_common_auctions::WeightInfo<Runtime>;
|
type WeightInfo = weights::runtime_common_auctions::WeightInfo<Runtime>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BalanceToU256;
|
|
||||||
impl sp_runtime::traits::Convert<Balance, sp_core::U256> for BalanceToU256 {
|
|
||||||
fn convert(n: Balance) -> sp_core::U256 {
|
|
||||||
n.into()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub struct U256ToBalance;
|
|
||||||
impl sp_runtime::traits::Convert<sp_core::U256, Balance> for U256ToBalance {
|
|
||||||
fn convert(n: sp_core::U256) -> Balance {
|
|
||||||
use frame_support::traits::Defensive;
|
|
||||||
n.try_into().defensive_unwrap_or(Balance::MAX)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
|
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
|
||||||
pub const MaxPointsToBalance: u8 = 10;
|
pub const MaxPointsToBalance: u8 = 10;
|
||||||
|
|||||||
Reference in New Issue
Block a user