Skip to content

Commit

Permalink
polkadot-v0.9.20 (#48)
Browse files Browse the repository at this point in the history
* initial commit-nomination pools

* bump spec and impl version
  • Loading branch information
Raj-RR1 authored Oct 30, 2023
1 parent 1a26710 commit efd6c0c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
6 changes: 6 additions & 0 deletions node/cli/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ pub fn testnet_genesis(
current_payout: 95 * DOLLARS,
minting_interval: One::one(),
},
nomination_pools: edgeware_runtime::NominationPoolsConfig {
max_pools: Some(84),
min_join_bond: EDG,
min_create_bond: 100 * EDG,
..Default::default()
},
}
}

Expand Down
4 changes: 4 additions & 0 deletions node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pallet-elections-phragmen = { git = "https://github.com/paritytech/substrate", b
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
pallet-identity = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false }
Expand Down Expand Up @@ -127,6 +128,7 @@ getrandom = { version = "0.2", features = ["js"] }
# used for runtime benchmarking
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false, optional = true }
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.19", default-features = false, optional = true }
pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
hex-literal = "0.3.4"

[build-dependencies]
Expand Down Expand Up @@ -161,6 +163,7 @@ std = [
"frame-executive/std",
"pallet-grandpa/std",
"pallet-identity/std",
"pallet-nomination-pools/std",
"pallet-im-online/std",
"pallet-indices/std",
"pallet-multisig/std",
Expand Down Expand Up @@ -235,4 +238,5 @@ runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-system-benchmarking",
"pallet-nomination-pools-benchmarking",
]
42 changes: 40 additions & 2 deletions node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to equal spec_version. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 53,
impl_version: 53,
spec_version: 54,
impl_version: 54,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
state_version: 53,
Expand Down Expand Up @@ -320,6 +320,7 @@ impl InstanceFilter<Call> for ProxyType {
Call::Balances(..)
| Call::Vesting(pallet_vesting::Call::vested_transfer { .. })
| Call::Indices(pallet_indices::Call::transfer { .. })
| Call::NominationPools(..)
),
ProxyType::Governance => matches!(
c,
Expand Down Expand Up @@ -585,6 +586,7 @@ impl pallet_staking::BenchmarkingConfig for StakingBenchmarkingConfig {
impl pallet_staking::Config for Runtime {
type MaxNominations = MaxNominations;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
type CurrencyToVote = U128CurrencyToVote;
type RewardRemainder = Treasury;
Expand All @@ -608,6 +610,7 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type VoterList = BagsList;
type MaxUnlockingChunks = ConstU32<32>;
type OnStakerSlash = ();
type WeightInfo = pallet_staking::weights::SubstrateWeight<Runtime>;
type BenchmarkingConfig = StakingBenchmarkingConfig;
}
Expand Down Expand Up @@ -1469,6 +1472,37 @@ impl treasury_reward::Config for Runtime {
type Event = Event;
}

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 {
n.try_into().unwrap_or(Balance::MAX)
}
}

parameter_types! {
pub const PoolsPalletId: PalletId = PalletId(*b"py/nopls");
}

impl pallet_nomination_pools::Config for Runtime {
type Event = Event;
type WeightInfo = weights::pallet_nomination_pools::WeightInfo<Self>;
type Currency = Balances;
type BalanceToU256 = BalanceToU256;
type U256ToBalance = U256ToBalance;
type StakingInterface = Staking;
type PostUnbondingPoolsWindow = ConstU32<4>;
type MaxMetadataLen = 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;
}

construct_runtime!(
pub enum Runtime where
Block = Block,
Expand Down Expand Up @@ -1516,6 +1550,7 @@ construct_runtime!(
BaseFee: pallet_base_fee = 41,
BagsList: pallet_bags_list = 42,
Preimage: pallet_preimage = 43,
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 44,
// Referenda: pallet_referenda,
// ConvictionVoting: pallet_conviction_voting,
}
Expand Down Expand Up @@ -2066,6 +2101,7 @@ impl_runtime_apis! {
use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList};
use frame_support::traits::StorageInfoTrait;
use frame_system_benchmarking::Pallet as SystemBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;

let mut list = Vec::<BenchmarkList>::new();

Expand All @@ -2083,7 +2119,9 @@ impl_runtime_apis! {
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};

use frame_system_benchmarking::Pallet as SystemBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;
impl frame_system_benchmarking::Config for Runtime {}
impl pallet_nomination_pools_benchmarking::Config for Runtime {}

let whitelist: Vec<TrackedStorageKey> = vec![
// Block Number
Expand Down

0 comments on commit efd6c0c

Please sign in to comment.