Stake tracker improvements (migration and try-state checks OK in Polkadot) (#4673)
Changes in the migration code introduced in this PR: - Migration removes duplicate nominations in all nominators, if they exist (changes by calling `fn do_add_nominator` with dedup nominations) - Migration removes all the non active validator nominations to avoid adding dangling nominations (changes by calling `fn do_add_nominator` if necessary) - Migration iterates through all `Nominators` map first and through all the `Validators` map to insert all the validators that are not nominated to the target list (with self-stake only). - Moves stake-tracker related try-state checks to the staking pallet (no try-state checks in the stake-tracker pallet anymore). - Runs benchmarks for MMB migration step with bench bot. The migration code has been validated against the Polkadot using the externalities tests in [polkadot/runtime/westend/src/lib.rs](https://github.com/paritytech/polkadot-sdk/pull/4436/files/46a80f14 #diff-5264d812f7aadfc486efffd3322b11c8dee5e8ddf2e77e0a9e70b573f3d2afdd). Upon running the migrations, we ensure that: - All validators have been added to the target list with their correct approvals score (as per the try-state checks). - All nominations are "cleaned" (see def. of clean above) - Try-state checks related to stake-tracker and approvals pass. Note: Same as https://github.com/paritytech/polkadot-sdk/pull/4436 but with a non-messed up git history. Merging into `gpestana/stake-tracker_integration`. --------- Co-authored-by: Ankan <[email protected]> Co-authored-by: command-bot <>
parent
80895adc
Please register or sign in to comment