Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Backports #5306 #5404 #5405 #5407 for 0.9.20 #5411

Merged
merged 5 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
395 changes: 216 additions & 179 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions node/network/collator-protocol/src/collator_side/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,9 +814,9 @@ where
);
let _ = sender.send(CollationSecondedSignal { statement, relay_parent });
} else {
gum::warn!(
gum::debug!(
target: LOG_TARGET,
?statement,
candidate_hash = ?&statement.payload().candidate_hash(),
?origin,
"received an unexpected `CollationSeconded`: unknown statement",
);
Expand Down
22 changes: 6 additions & 16 deletions node/service/res/rococo.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
nomination_pools: Default::default(),
}
}

Expand Down Expand Up @@ -1505,6 +1506,12 @@ pub fn westend_testnet_genesis(
next_free_para_id: polkadot_primitives::v2::LOWEST_PUBLIC_ID,
},
xcm_pallet: Default::default(),
nomination_pools: westend_runtime::NominationPoolsConfig {
max_pools: Some(128),
min_join_bond: WND,
min_create_bond: 100 * WND,
..Default::default()
},
}
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ type SlashCancelOrigin = EnsureOneOf<
impl pallet_staking::Config for Runtime {
type MaxNominations = MaxNominations;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
type ElectionProvider = ElectionProviderMultiPhase;
Expand All @@ -590,6 +591,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = BagsList;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = ();
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ type SlashCancelOrigin = EnsureOneOf<
impl pallet_staking::Config for Runtime {
type MaxNominations = MaxNominations;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
type RewardRemainder = Treasury;
Expand All @@ -585,6 +586,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = BagsList;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = ();
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

Expand Down
2 changes: 2 additions & 0 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ impl onchain::Config for OnChainSeqPhragmen {
impl pallet_staking::Config for Runtime {
type MaxNominations = frame_support::pallet_prelude::ConstU32<16>;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
type CurrencyToVote = frame_support::traits::U128CurrencyToVote;
type RewardRemainder = ();
Expand All @@ -354,6 +355,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = pallet_staking::UseNominatorsAndValidatorsMap<Runtime>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = ();
type WeightInfo = ();
}

Expand Down
4 changes: 4 additions & 0 deletions runtime/westend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pallet-indices = { git = "https://github.com/paritytech/substrate", default-feat
pallet-membership = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-nicks = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-nomination-pools = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-offences = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-preimage = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "polkadot-v0.9.20" }
Expand All @@ -78,6 +79,7 @@ frame-benchmarking = { git = "https://github.com/paritytech/substrate", default-
frame-try-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
pallet-election-provider-support-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
pallet-nomination-pools-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
pallet-offences-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
pallet-session-benchmarking = { git = "https://github.com/paritytech/substrate", default-features = false, optional = true , branch = "polkadot-v0.9.20" }
hex-literal = { version = "0.3.4", optional = true }
Expand Down Expand Up @@ -139,6 +141,7 @@ std = [
"beefy-primitives/std",
"pallet-multisig/std",
"pallet-nicks/std",
"pallet-nomination-pools/std",
"pallet-offences/std",
"pallet-preimage/std",
"pallet-proxy/std",
Expand Down Expand Up @@ -195,6 +198,7 @@ runtime-benchmarks = [
"pallet-im-online/runtime-benchmarks",
"pallet-indices/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nomination-pools-benchmarking",
"pallet-preimage/runtime-benchmarks",
"pallet-proxy/runtime-benchmarks",
"pallet-scheduler/runtime-benchmarks",
Expand Down
45 changes: 43 additions & 2 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use beefy_primitives::crypto::AuthorityId as BeefyId;
use frame_election_provider_support::{onchain, SequentialPhragmen};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, InstanceFilter, KeyOwnerProofSystem},
traits::{ConstU32, Contains, InstanceFilter, KeyOwnerProofSystem},
weights::ConstantMultiplier,
PalletId,
};
Expand Down Expand Up @@ -454,6 +454,7 @@ parameter_types! {
impl pallet_staking::Config for Runtime {
type MaxNominations = MaxNominations;
type Currency = Balances;
type CurrencyBalance = Balance;
type UnixTime = Timestamp;
type CurrencyToVote = CurrencyToVote;
type RewardRemainder = ();
Expand All @@ -475,6 +476,7 @@ impl pallet_staking::Config for Runtime {
type VoterList = BagsList;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = ();
type WeightInfo = weights::pallet_staking::WeightInfo<Runtime>;
}

Expand Down Expand Up @@ -764,7 +766,8 @@ impl InstanceFilter<Call> for ProxyType {
Call::Crowdloan(..) |
Call::Slots(..) |
Call::Auctions(..) | // Specifically omitting the entire XCM Pallet
Call::BagsList(..)
Call::BagsList(..) |
Call::NominationPools(..)
),
ProxyType::Staking => {
matches!(c, Call::Staking(..) | Call::Session(..) | Call::Utility(..))
Expand Down Expand Up @@ -973,6 +976,37 @@ impl auctions::Config for 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 {
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 @@ -1035,6 +1069,9 @@ construct_runtime! {
// Provides a semi-sorted list of nominators for staking.
BagsList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 25,

// Nomination pools for staking.
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 29,

// Parachains pallets. Start indices at 40 to leave room.
ParachainsOrigin: parachains_origin::{Pallet, Origin} = 41,
Configuration: parachains_configuration::{Pallet, Call, Storage, Config<T>} = 42,
Expand Down Expand Up @@ -1128,6 +1165,7 @@ mod benches {
[pallet_im_online, ImOnline]
[pallet_indices, Indices]
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
[pallet_offences, OffencesBench::<Runtime>]
[pallet_preimage, Preimage]
[pallet_proxy, Proxy]
Expand Down Expand Up @@ -1494,6 +1532,7 @@ sp_api::impl_runtime_apis! {
use pallet_offences_benchmarking::Pallet as OffencesBench;
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
use frame_system_benchmarking::Pallet as SystemBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::<Runtime>;
Expand All @@ -1518,11 +1557,13 @@ sp_api::impl_runtime_apis! {
use pallet_offences_benchmarking::Pallet as OffencesBench;
use pallet_election_provider_support_benchmarking::Pallet as ElectionProviderBench;
use frame_system_benchmarking::Pallet as SystemBench;
use pallet_nomination_pools_benchmarking::Pallet as NominationPoolsBench;

impl pallet_session_benchmarking::Config for Runtime {}
impl pallet_offences_benchmarking::Config for Runtime {}
impl pallet_election_provider_support_benchmarking::Config for Runtime {}
impl frame_system_benchmarking::Config for Runtime {}
impl pallet_nomination_pools_benchmarking::Config for Runtime {}

use xcm::latest::{
AssetId::*, Fungibility::*, Junctions::*, MultiAsset, MultiAssets, MultiLocation,
Expand Down
1 change: 1 addition & 0 deletions runtime/westend/src/weights/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub mod pallet_identity;
pub mod pallet_im_online;
pub mod pallet_indices;
pub mod pallet_multisig;
pub mod pallet_nomination_pools;
pub mod pallet_preimage;
pub mod pallet_proxy;
pub mod pallet_scheduler;
Expand Down
Loading