mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 14:41:02 +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:
@@ -43,7 +43,7 @@ use frame_support::{
|
||||
weights::{constants::WEIGHT_PER_SECOND, Weight},
|
||||
};
|
||||
use frame_system::limits;
|
||||
use primitives::v2::{AssignmentId, BlockNumber, ValidatorId};
|
||||
use primitives::v2::{AssignmentId, Balance, BlockNumber, ValidatorId};
|
||||
use sp_runtime::{FixedPointNumber, Perbill, Perquintill};
|
||||
use static_assertions::const_assert;
|
||||
|
||||
@@ -215,6 +215,23 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
|
||||
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
|
||||
/// 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_.
|
||||
|
||||
Reference in New Issue
Block a user