-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[Feature] Part 1: add TargetList for validator ranking #12034
Conversation
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
We sure do, but let's leave that for the end of the work -- for now don't bother with it.
This |
frame/staking/src/lib.rs
Outdated
@@ -685,6 +685,16 @@ pub struct Nominations<T: Config> { | |||
pub suppressed: bool, | |||
} | |||
|
|||
/// An unbounded version of `Nominations`, use for some really wacky hacks. | |||
#[derive(PartialEqNoBound, EqNoBound, Clone, Encode, Decode, RuntimeDebugNoBound, TypeInfo)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed for this PR.
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
The CI pipeline was cancelled due to failure one of the required jobs. |
|
||
let mut targets_iter = T::TargetList::iter(); | ||
while all_targets.len() < max_allowed_len && | ||
targets_seen < (NPOS_MAX_ITERATIONS_COEFFICIENT * max_allowed_len as u32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be worth doing .try_from
rather than as
and then .unwrap_or(u32::MAX)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a good idea!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess same as below - we will see what's possible in P2, the staking code is full of as
, which is not necessarily an excuse, but if this is checked elsewhere - no need to overcomplicate the code just yet.
Thanks so much for the review and those nits, it was helpful for me to go over the codebase again to see if we can indeed assume that u32 never overflows here.
|
||
Self::register_weight(T::WeightInfo::get_npos_targets(validator_count)); | ||
Self::register_weight(T::WeightInfo::get_npos_targets(all_targets.len() as u32)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again here maybe we want to saturate with a try_into?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a good spot, but at the moment it seems unnecessary to complicate things.
We will revisit this upon introduction of the P2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The staking code is pretty new to me but aside from a couple of nits looks good.
bot merge |
Error: "Check reviews" status is not passing for paritytech/polkadot#5930 |
for MigrateToV11<T, P, N> | ||
{ | ||
#[cfg(feature = "try-runtime")] | ||
fn pre_upgrade() -> Result<(), &'static str> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should not compile.
#### Intro Upgrade polkadot from v0.9.27 to v0.9.30 as a checkpoint, then to v0.9.33 (latest version without workspace dependencies) Require ComposableFi/composable-ibc#176 to be merged first. #### Migrations - v0.9.28 - [x] paritytech/polkadot#5582 - Nomination not present in our runtimes - v0.9.29 - [x] paritytech/substrate#12095 - Nomination not present in our runtimes - v0.9.30 - [x] paritytech/substrate#12034 - BagList/Staking not present in our runtimes - [x] paritytech/polkadot#5930 - Nomination/BagList/Staking not present in our runtimes - [x] paritytech/substrate#12230 - Staking not present in our runtimes - [x] paritytech/polkadot#5996 - Staking not present in our runtimes - [x] paritytech/substrate#12083 - Contracts not present in our runtimes Signed-off-by: cor <[email protected]> Co-authored-by: cor <[email protected]>
) * [Feature] Part 1: add TargetList for validator ranking * remove redundant todo * remove typo * cleanup * implement score * more fixes * fix thresholds * fmt * Remove the stuff that has to come in the next PR, some fixes * extended balance import * Change all the references from VoteWeight to Self::Score * Add a migration for VoterBagsList * fix score * add targetList to nomination-pools tests * fix bench * address review comments * change get_npos_targets * address more comments * remove thresholds for the time being * fix instance reference * VoterBagsListInstance * reus * remove params that are not used yet * Introduced pre/post upgrade try-runtime checks * fix * fixes * fix migration * fix migration * fix post_upgrade * change * Fix * eloquent PhantomData * fix PD * more fixes * Update frame/staking/src/pallet/impls.rs Co-authored-by: Squirrel <[email protected]> * is_nominator now works * fix test-staking * build fixes * fix remote-tests * Apply suggestions from code review Co-authored-by: parity-processbot <> Co-authored-by: kianenigma <[email protected]> Co-authored-by: Squirrel <[email protected]> Co-authored-by: Kian Paimani <[email protected]>
This is the first of a series of PRs aimed at reviving #11013
@kianenigma some questions:
VoterList
with anInstance1
- does that mean we have to migrate storage to make sure the list contains what it needs to contain?This seems to introduce all the moving parts without actually touching any of the current business-logic.
polkadot companion: paritytech/polkadot#5930