[Substrate Companion] Part 1: add TargetList for validator ranking (#5930)

* [Substrate Companion] Part 1: add TargetList for validator ranking

* fix fmt

* don't change the pallet name

* eloquent migration

* fmt

* fix build

* update deps

* Cargo.lock conflicts resolved

* update deps

* Revert "update deps"

This reverts commit e0b07565854f9c66e5f30cdfe2c0a8f08457c96e.

* fix deps

Co-authored-by: kianenigma <kian@parity.io>
This commit is contained in:
Roman Useinov
2022-09-18 17:00:13 +02:00
committed by GitHub
parent da23abe28a
commit 059ad8a388
5 changed files with 244 additions and 184 deletions
+22 -3
View File
@@ -85,6 +85,8 @@ pub use pallet_balances::Call as BalancesCall;
pub use pallet_election_provider_multi_phase::Call as EPMCall;
#[cfg(feature = "std")]
pub use pallet_staking::StakerStatus;
use pallet_staking::UseValidatorsMap;
use sp_runtime::traits::Get;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
@@ -500,7 +502,8 @@ parameter_types! {
pub const BagThresholds: &'static [u64] = &bag_thresholds::THRESHOLDS;
}
impl pallet_bags_list::Config for Runtime {
type VoterBagsListInstance = pallet_bags_list::Instance1;
impl pallet_bags_list::Config<VoterBagsListInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type ScoreProvider = Staking;
type WeightInfo = weights::pallet_bags_list::WeightInfo<Runtime>;
@@ -611,6 +614,7 @@ impl pallet_staking::Config for Runtime {
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type VoterList = VoterList;
type TargetList = UseValidatorsMap<Self>;
type MaxUnlockingChunks = frame_support::traits::ConstU32<32>;
type BenchmarkingConfig = runtime_common::StakingBenchmarkingConfig;
type OnStakerSlash = NominationPools;
@@ -1380,7 +1384,7 @@ construct_runtime! {
Gilt: pallet_gilt::{Pallet, Call, Storage, Event<T>, Config} = 38,
// Provides a semi-sorted list of nominators for staking.
VoterList: pallet_bags_list::{Pallet, Call, Storage, Event<T>} = 39,
VoterList: pallet_bags_list::<Instance1>::{Pallet, Call, Storage, Event<T>} = 39,
// nomination pools: extension to staking.
NominationPools: pallet_nomination_pools::{Pallet, Call, Storage, Event<T>, Config<T>} = 41,
@@ -1432,6 +1436,14 @@ pub type SignedExtra = (
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
pub struct StakingMigrationV11OldPallet;
impl Get<&'static str> for StakingMigrationV11OldPallet {
fn get() -> &'static str {
"VoterList"
}
}
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;
@@ -1442,7 +1454,14 @@ pub type Executive = frame_executive::Executive<
frame_system::ChainContext<Runtime>,
Runtime,
AllPalletsWithSystem,
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
(
pallet_nomination_pools::migration::v3::MigrateToV3<Runtime>,
pallet_staking::migrations::v11::MigrateToV11<
Runtime,
VoterList,
StakingMigrationV11OldPallet,
>,
),
>;
/// The payload being signed in the transactions.
pub type SignedPayload = generic::SignedPayload<RuntimeCall, SignedExtra>;