Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/runtimes-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"header": "substrate/HEADER-APACHE2",
"template": "substrate/.maintain/frame-weight-template.hbs",
"bench_features": "runtime-benchmarks",
"bench_flags": "--exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage,pallet_election_provider_multi_block,pallet_election_provider_multi_block::signed,pallet_election_provider_multi_block::unsigned,pallet_election_provider_multi_block::verifier",
"bench_flags": "--exclude-pallets=pallet_xcm,pallet_xcm_benchmarks::fungible,pallet_xcm_benchmarks::generic,pallet_nomination_pools,pallet_remark,pallet_transaction_storage",
"uri": null,
"is_relay": false
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: script
run: forklift cargo run --locked --release -p staging-node-cli --bin substrate-node --features runtime-benchmarks --quiet -- benchmark pallet --chain dev --pallet "*" --exclude-pallets=pallet_election_provider_multi_block,pallet_election_provider_multi_block::signed,pallet_election_provider_multi_block::unsigned,pallet_election_provider_multi_block::verifier --extrinsic "*" --steps 2 --repeat 1 --quiet
run: forklift cargo run --locked --release -p staging-node-cli --bin substrate-node --features runtime-benchmarks --quiet -- benchmark pallet --chain dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1 --quiet

# cf https://github.com/paritytech/polkadot-sdk/issues/1652
test-syscalls:
Expand Down
66 changes: 0 additions & 66 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,6 @@ members = [
"substrate/frame/core-fellowship",
"substrate/frame/delegated-staking",
"substrate/frame/democracy",
"substrate/frame/election-provider-multi-block",
"substrate/frame/election-provider-multi-phase",
"substrate/frame/election-provider-multi-phase/test-staking-e2e",
"substrate/frame/election-provider-support",
Expand Down Expand Up @@ -421,8 +420,6 @@ members = [
"substrate/frame/session/benchmarking",
"substrate/frame/society",
"substrate/frame/staking",
"substrate/frame/staking/ah-client",
"substrate/frame/staking/rc-client",
"substrate/frame/staking/reward-curve",
"substrate/frame/staking/reward-fn",
"substrate/frame/staking/runtime-api",
Expand Down Expand Up @@ -1003,8 +1000,6 @@ pallet-session-benchmarking = { path = "substrate/frame/session/benchmarking", d
pallet-skip-feeless-payment = { path = "substrate/frame/transaction-payment/skip-feeless-payment", default-features = false }
pallet-society = { path = "substrate/frame/society", default-features = false }
pallet-staking = { path = "substrate/frame/staking", default-features = false }
pallet-staking-ah-client = { path = "substrate/frame/staking/ah-client", default-features = false }
pallet-staking-rc-client = { path = "substrate/frame/staking/rc-client", default-features = false }
pallet-staking-reward-curve = { path = "substrate/frame/staking/reward-curve", default-features = false }
pallet-staking-reward-fn = { path = "substrate/frame/staking/reward-fn", default-features = false }
pallet-staking-runtime-api = { path = "substrate/frame/staking/runtime-api", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_babe::AuthorityId as BabeId;
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
use sp_core::storage::Storage;
use sp_runtime::{BoundedVec, Perbill};
use sp_runtime::Perbill;

// Polkadot
use polkadot_primitives::{AssignmentId, ValidatorId};
Expand Down Expand Up @@ -87,13 +87,7 @@ pub fn genesis() -> Storage {
.iter()
.map(|x| (x.0.clone(), x.1.clone(), STASH, pallet_staking::StakerStatus::Validator))
.collect(),
invulnerables: BoundedVec::try_from(
validators::initial_authorities()
.iter()
.map(|x| x.0.clone())
.collect::<Vec<_>>(),
)
.expect("Limit for staking invulnerables must be less than initial authorities."),
invulnerables: validators::initial_authorities().iter().map(|x| x.0.clone()).collect(),
force_era: pallet_staking::Forcing::ForceNone,
slash_reward_fraction: Perbill::from_percent(10),
..Default::default()
Expand Down
2 changes: 1 addition & 1 deletion polkadot/runtime/common/src/try_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ where

let all_stakers = Ledger::<T>::iter().map(|(ctrl, l)| (ctrl, l.stash)).collect::<BTreeSet<_>>();
let mut all_exposed = BTreeSet::new();
ErasStakersPaged::<T>::iter().for_each(|((_era, val, _page), expo)| {
ErasStakers::<T>::iter().for_each(|(_, val, expo)| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be reverted.

Suggested change
ErasStakers::<T>::iter().for_each(|(_, val, expo)| {
ErasStakersPaged::<T>::iter().for_each(|((_era, val, _page), expo)| {

all_exposed.insert(val);
all_exposed.extend(expo.others.iter().map(|ie| ie.who.clone()))
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,8 @@ where

pallet_session::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());
initializer::Pallet::<T>::on_initialize(BlockNumberFor::<T>::one());

// skip sessions until the new validator set is enacted
while pallet_session::Pallet::<T>::validators().len() < n as usize {
// initialize stakers in pallet_staking. This is suboptimal, but an easy way to avoid this
// being an infinite loop.
pallet_staking::Pallet::<T>::populate_staking_election_testing_benchmarking_only().unwrap();
pallet_session::Pallet::<T>::rotate_session();
}
initializer::Pallet::<T>::on_finalize(BlockNumberFor::<T>::one());
Expand Down
12 changes: 5 additions & 7 deletions polkadot/runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ use polkadot_runtime_common::{
use polkadot_runtime_parachains::reward_points::RewardValidatorsWithEraPoints;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_beefy::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
use sp_core::{ConstBool, ConstU32, OpaqueMetadata};
use sp_core::{ConstU32, OpaqueMetadata};
use sp_mmr_primitives as mmr;
use sp_runtime::{
curve::PiecewiseLinear,
Expand Down Expand Up @@ -323,8 +323,8 @@ impl pallet_session::Config for Runtime {
}

impl pallet_session::historical::Config for Runtime {
type FullIdentification = ();
type FullIdentificationOf = pallet_staking::NullIdentity;
type FullIdentification = pallet_staking::Exposure<AccountId, Balance>;
type FullIdentificationOf = pallet_staking::ExposureOf<Runtime>;
}

pallet_staking_reward_curve::build! {
Expand All @@ -349,7 +349,7 @@ parameter_types! {
pub const MaxExposurePageSize: u32 = 64;
pub const MaxNominators: u32 = 256;
pub const MaxAuthorities: u32 = 100_000;
pub const OnChainMaxWinners: u32 = MaxAuthorities::get();
pub const OnChainMaxWinners: u32 = u32::MAX;
// Unbounded number of election targets and voters.
pub ElectionBoundsOnChain: ElectionBounds = ElectionBoundsBuilder::default().build();
}
Expand All @@ -362,9 +362,7 @@ impl onchain::Config for OnChainSeqPhragmen {
type DataProvider = Staking;
type WeightInfo = ();
type Bounds = ElectionBoundsOnChain;
type MaxWinnersPerPage = OnChainMaxWinners;
type MaxBackersPerWinner = ConstU32<{ u32::MAX }>;
type Sort = ConstBool<true>;
type MaxWinners = OnChainMaxWinners;
}

/// Upper limit on the number of NPOS nominations.
Expand Down
12 changes: 3 additions & 9 deletions polkadot/runtime/westend/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use sp_consensus_grandpa::AuthorityId as GrandpaId;
use sp_core::{crypto::get_public_from_string_or_panic, sr25519};
use sp_genesis_builder::PresetId;
use sp_keyring::Sr25519Keyring;
use sp_runtime::{BoundedVec, Perbill};
use sp_runtime::Perbill;
use westend_runtime_constants::currency::UNITS as WND;

/// Helper function to generate stash, controller and session key from seed
Expand Down Expand Up @@ -202,10 +202,7 @@ fn westend_testnet_genesis(
.iter()
.map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::<AccountId>::Validator))
.collect::<Vec<_>>(),
invulnerables: BoundedVec::try_from(
initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>()
)
.expect("Too many invulnerable validators: upper limit is MaxInvulnerables from pallet staking config"),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
force_era: Forcing::NotForcing,
slash_reward_fraction: Perbill::from_percent(10),
},
Expand Down Expand Up @@ -376,10 +373,7 @@ fn westend_staging_testnet_config_genesis() -> serde_json::Value {
.iter()
.map(|x| (x.0.clone(), x.0.clone(), STASH, StakerStatus::<AccountId>::Validator))
.collect::<Vec<_>>(),
invulnerables: BoundedVec::try_from(
initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>()
)
.expect("Too many invulnerable validators: upper limit is MaxInvulnerables from pallet staking config"),
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
force_era: Forcing::ForceNone,
slash_reward_fraction: Perbill::from_percent(10),
},
Expand Down
22 changes: 6 additions & 16 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ use sp_consensus_beefy::{
ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature},
mmr::{BeefyDataProvider, MmrLeafVersion},
};
use sp_core::{ConstBool, ConstU8, OpaqueMetadata, RuntimeDebug, H256};
use sp_core::{ConstU8, OpaqueMetadata, RuntimeDebug, H256};
use sp_runtime::{
generic, impl_opaque_keys,
traits::{
Expand Down Expand Up @@ -586,10 +586,7 @@ parameter_types! {
ElectionBoundsBuilder::default().voters_count(MaxElectingVoters::get().into()).build();
// Maximum winners that can be chosen as active validators
pub const MaxActiveValidators: u32 = 1000;
// One page only, fill the whole page with the `MaxActiveValidators`.
pub const MaxWinnersPerPage: u32 = MaxActiveValidators::get();
// Unbonded, thus the max backers per winner maps to the max electing voters limit.
pub const MaxBackersPerWinner: u32 = MaxElectingVoters::get();

}

frame_election_provider_support::generate_solution_type!(
Expand All @@ -604,14 +601,12 @@ frame_election_provider_support::generate_solution_type!(

pub struct OnChainSeqPhragmen;
impl onchain::Config for OnChainSeqPhragmen {
type Sort = ConstBool<true>;
type System = Runtime;
type Solver = SequentialPhragmen<AccountId, OnChainAccuracy>;
type DataProvider = Staking;
type WeightInfo = weights::frame_election_provider_support::WeightInfo<Runtime>;
type MaxWinners = MaxActiveValidators;
type Bounds = ElectionBounds;
type MaxBackersPerWinner = MaxBackersPerWinner;
type MaxWinnersPerPage = MaxWinnersPerPage;
}

impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
Expand All @@ -624,8 +619,7 @@ impl pallet_election_provider_multi_phase::MinerConfig for Runtime {
as
frame_election_provider_support::ElectionDataProvider
>::MaxVotesPerVoter;
type MaxBackersPerWinner = MaxBackersPerWinner;
type MaxWinners = MaxWinnersPerPage;
type MaxWinners = MaxActiveValidators;

// The unsigned submissions have to respect the weight of the submit_unsigned call, thus their
// weight estimate function is wired to this call's weight.
Expand Down Expand Up @@ -659,8 +653,6 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type BetterSignedThreshold = ();
type OffchainRepeat = OffchainRepeat;
type MinerTxPriority = NposSolutionPriority;
type MaxWinners = MaxWinnersPerPage;
type MaxBackersPerWinner = MaxBackersPerWinner;
type DataProvider = Staking;
#[cfg(any(feature = "fast-runtime", feature = "runtime-benchmarks"))]
type Fallback = onchain::OnChainExecution<OnChainSeqPhragmen>;
Expand All @@ -669,8 +661,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
AccountId,
BlockNumber,
Staking,
MaxWinnersPerPage,
MaxBackersPerWinner,
MaxActiveValidators,
)>;
type GovernanceFallback = onchain::OnChainExecution<OnChainSeqPhragmen>;
type Solver = SequentialPhragmen<
Expand All @@ -681,6 +672,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
type BenchmarkingConfig = polkadot_runtime_common::elections::BenchmarkConfig;
type ForceOrigin = EnsureRoot<AccountId>;
type WeightInfo = weights::pallet_election_provider_multi_phase::WeightInfo<Self>;
type MaxWinners = MaxActiveValidators;
type ElectionBounds = ElectionBounds;
}

Expand Down Expand Up @@ -762,7 +754,6 @@ impl pallet_staking::Config for Runtime {
type GenesisElectionProvider = onchain::OnChainExecution<OnChainSeqPhragmen>;
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type MaxValidatorSet = MaxActiveValidators;
type NominationsQuota = pallet_staking::FixedNominationsQuota<{ MaxNominations::get() }>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type HistoryDepth = frame_support::traits::ConstU32<84>;
Expand Down Expand Up @@ -1874,7 +1865,6 @@ pub mod migrations {
parachains_shared::migration::MigrateToV1<Runtime>,
parachains_scheduler::migration::MigrateV2ToV3<Runtime>,
pallet_staking::migrations::v16::MigrateV15ToV16<Runtime>,
pallet_staking::migrations::v17::MigrateV16ToV17<Runtime>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we have already upgraded westend to V17.. you can check in the chain state.

What did this migration do? We need to see if any special consideration is needed for it or not.

pallet_session::migrations::v1::MigrateV0ToV1<
Runtime,
pallet_staking::migrations::v17::MigrateDisabledToSession<Runtime>,
Expand Down
Loading
Loading