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

[Feature] Part 1: add TargetList for validator ranking #12034

Merged
merged 43 commits into from
Sep 18, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
64b5c6e
[Feature] Part 1: add TargetList for validator ranking
ruseinov Aug 15, 2022
a6b07a5
remove redundant todo
ruseinov Aug 15, 2022
ec61b29
remove typo
ruseinov Aug 15, 2022
281e5d0
cleanup
ruseinov Aug 15, 2022
73b47cb
implement score
ruseinov Aug 15, 2022
76034bb
more fixes
ruseinov Aug 15, 2022
86631ed
fix thresholds
ruseinov Aug 15, 2022
3a82504
fmt
ruseinov Aug 16, 2022
74b6fba
Remove the stuff that has to come in the next PR, some fixes
ruseinov Aug 16, 2022
8a2fc42
extended balance import
ruseinov Aug 16, 2022
e676398
Change all the references from VoteWeight to Self::Score
ruseinov Aug 16, 2022
7dfbc9b
Add a migration for VoterBagsList
ruseinov Aug 19, 2022
5f4d9a4
fix score
ruseinov Aug 19, 2022
5b2e1f5
add targetList to nomination-pools tests
ruseinov Aug 19, 2022
805349d
fix bench
ruseinov Aug 19, 2022
4329ad2
address review comments
ruseinov Aug 20, 2022
ba11c8a
change get_npos_targets
ruseinov Aug 22, 2022
5286a4f
address more comments
ruseinov Aug 22, 2022
101deee
remove thresholds for the time being
ruseinov Aug 22, 2022
b5109d1
fix instance reference
ruseinov Aug 22, 2022
6f4bf4b
VoterBagsListInstance
ruseinov Aug 22, 2022
0ef8d2c
reus
ruseinov Aug 22, 2022
c03ec08
remove params that are not used yet
ruseinov Aug 23, 2022
1da8bfc
Introduced pre/post upgrade try-runtime checks
ruseinov Aug 24, 2022
223580b
Merge remote-tracking branch 'origin/master' into ru/feature/p1-targe…
Aug 25, 2022
0bde3df
fix
ruseinov Aug 25, 2022
9cb9e01
fixes
ruseinov Aug 25, 2022
4c25988
fix migration
ruseinov Aug 27, 2022
14ce27a
fix migration
ruseinov Aug 27, 2022
67316fb
fix post_upgrade
ruseinov Aug 29, 2022
87b5e0f
change
ruseinov Aug 29, 2022
9dea8f4
Merge remote-tracking branch 'origin/master' into ru/feature/p1-targe…
Sep 12, 2022
03b400c
Master.into()
kianenigma Sep 13, 2022
8f54be5
Fix
kianenigma Sep 13, 2022
39b1cfa
eloquent PhantomData
ruseinov Sep 14, 2022
94efa6e
fix PD
ruseinov Sep 14, 2022
c1547a2
more fixes
ruseinov Sep 14, 2022
194e0e2
Update frame/staking/src/pallet/impls.rs
ruseinov Sep 16, 2022
ed98cca
is_nominator now works
ruseinov Sep 16, 2022
ba0c063
fix test-staking
ruseinov Sep 16, 2022
e6a3871
build fixes
ruseinov Sep 16, 2022
d019f1d
fix remote-tests
ruseinov Sep 17, 2022
93491e2
Apply suggestions from code review
kianenigma Sep 18, 2022
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
26 changes: 22 additions & 4 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,8 @@ impl pallet_staking::Config for Runtime {
type OffendingValidatorsThreshold = OffendingValidatorsThreshold;
type ElectionProvider = ElectionProviderMultiPhase;
type GenesisElectionProvider = onchain::UnboundedExecution<OnChainSeqPhragmen>;
type VoterList = BagsList;
type VoterList = VoterBagsList;
type TargetList = TargetBagsList;
type MaxUnlockingChunks = ConstU32<32>;
type OnStakerSlash = NominationPools;
type WeightInfo = pallet_staking::weights::SubstrateWeight<Runtime>;
Expand Down Expand Up @@ -718,14 +719,30 @@ impl pallet_election_provider_multi_phase::Config for Runtime {

parameter_types! {
pub const BagThresholds: &'static [u64] = &voter_bags::THRESHOLDS;
// TODO: revisit to see if we can generate separate thresholds here
pub const BagThresholdsBalance: &'static [u128] = &voter_bags::THRESHOLDS_BALANCES;
Copy link
Contributor

Choose a reason for hiding this comment

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

not used.

}

impl pallet_bags_list::Config for Runtime {
type VoterBagsListInstance = pallet_bags_list::Instance1;
impl pallet_bags_list::Config<VoterBagsListInstance> for Runtime {
type Event = Event;
/// The voter bags-list is loosely kept up to date, and the real source of truth for the score
/// of each node is the staking pallet.
type ScoreProvider = Staking;
type WeightInfo = pallet_bags_list::weights::SubstrateWeight<Runtime>;
type BagThresholds = BagThresholds;
type Score = VoteWeight;
type WeightInfo = pallet_bags_list::weights::SubstrateWeight<Runtime>;
}

type TargetBagsListInstance = pallet_bags_list::Instance2;
ruseinov marked this conversation as resolved.
Show resolved Hide resolved
impl pallet_bags_list::Config<TargetBagsListInstance> for Runtime {
type Event = Event;
// The bags-list itself will be the source of truth about the approval stakes. This implies that
// staking should keep the approval stakes up to date at all times.
type ScoreProvider = TargetBagsList;
type BagThresholds = BagThresholdsBalance;
type Score = Balance;
type WeightInfo = pallet_bags_list::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1629,7 +1646,8 @@ construct_runtime!(
Gilt: pallet_gilt,
Uniques: pallet_uniques,
TransactionStorage: pallet_transaction_storage,
BagsList: pallet_bags_list,
VoterBagsList: pallet_bags_list::<Instance1>,
TargetBagsList: pallet_bags_list::<Instance2>,
StateTrieMigration: pallet_state_trie_migration,
ChildBounties: pallet_child_bounties,
Referenda: pallet_referenda,
Expand Down
Loading