-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add Control to Growth of the Staking Pallet #8920
Conversation
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.
Looks overall good so far, but must have another look.
Idea: you can write a pre-migration
function that does no migration, but only ensures that the current counter values are sane. Then we can put this in a runtime's custom migrations to have this auto-checked every now and then.
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 think we can provide a simpler and safe way for nominators to compete as well, based on their staked amount.
- The total limit of nominators should be a storage item that the governance can tweak more easily, without a full-fledged runtime upgrade. The validator count, meh, I care less for that.
Otherwise looks good to me.
@shawntabrizi please update this PR such that:
but don't enforce any bounds yet. You can simply keep the functionality, but set it to Then we can merge this PR asap as it would be simpler. |
fn new_era(v: u32, n: u32, ) -> Weight { | ||
(0 as Weight) | ||
// Standard Error: 1_462_000 | ||
.saturating_add((393_007_000 as Weight).saturating_mul(v as Weight)) | ||
// Standard Error: 73_000 | ||
.saturating_add((72_014_000 as Weight).saturating_mul(n as Weight)) | ||
// Standard Error: 1_146_000 | ||
.saturating_add((362_986_000 as Weight).saturating_mul(v as Weight)) | ||
// Standard Error: 57_000 | ||
.saturating_add((60_216_000 as Weight).saturating_mul(n as Weight)) | ||
.saturating_add(T::DbWeight::get().reads(10 as Weight)) | ||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight))) | ||
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) | ||
.saturating_add(T::DbWeight::get().writes(9 as Weight)) | ||
.saturating_add(T::DbWeight::get().writes(4 as Weight)) |
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.
and this
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 benchmark seems unused @kianenigma
…bstrate into shawntabrizi-staking-count
Regarding me removing the lower bound on min-bond. I realized at this point in the PR (where things changed a bit in the logic) it is not needed, since it is impossible to have less than ED bonded, so this min is enforced anyway. |
bot merge |
Trying merge. |
* start count * track count * add max limit * min bonds for participating * respect min bond when unbonding * revert a bit of u32 * fix merge * more merge fixes * update to `Current*` * add helper functions * Update frame/staking/src/lib.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * fix * minbond as storage * checkpoint * chill_other * better bond tracking * MinBond to MinNominatorBond * better doc * use helper function * oops * simple hard limits to validators / nominators. * better doc * update storage version * fix tests * enable migrations * min bond tests * chill other tests * tests for max cap * check `None` on cap too * benchmarks * Update frame/staking/src/lib.rs * Update frame/staking/src/lib.rs Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * Update frame/staking/src/lib.rs Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * Update frame/staking/src/tests.rs Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * fix benchmark * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs * nits * fix reap_stash benchmark * remove lower bound to min bond Co-authored-by: kianenigma <kian@parity.io> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Parity Bot <admin@parity.io> Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com>
Summarize the contents in paritytech/substrate#8920 #2173
* Update maintain-guides-how-to-chill.md Summarize the contents in paritytech/substrate#8920 #2173 * Added content on Chill other * Update maintain-guides-how-to-chill.md Added suggestions from Danny * Update maintain-guides-how-to-chill.md minor correction
* Bump @octokit/rest from 18.6.7 to 18.6.8 (#2369) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.6.7 to 18.6.8. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](octokit/rest.js@v18.6.7...v18.6.8) --- updated-dependencies: - dependency-name: "@octokit/rest" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump katex from 0.13.11 to 0.13.12 (#2370) Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.13.11 to 0.13.12. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/master/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.13.11...v0.13.12) --- updated-dependencies: - dependency-name: katex dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update dotscanner listing to include Kusama and a tracking attribute (#2372) * Update learn-accounts.md (#2358) * Update learn-accounts.md Added placeholder for content on Soft vs Hard Derivation paths * Update learn-accounts.md Added preliminary information. Might benefit from an infographic or a video explaining derivation paths. Please review and suggest content edits/updates * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update sidebars.js (#2374) Correcting Typo * Modify Secure Validator Setup (#2361) * umodify secure validator setup * update links + edits * edits * edits * Update maintain-guides-how-to-use-polkadot-validator-setup.md * Add Conditional Rendering for chain flag (#2367) * add conditional rendering for chain flag * Update maintain-sync.md * Update Pages to address Stales (#2371) * resolves #2321 * resolves #1844 * resolves #1733 * update simple payouts and prettier (#2363) Co-authored-by: Danny Salman <salman.danny03@hotmail.com> * Bump @octokit/rest from 18.6.8 to 18.7.0 (#2378) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.6.8 to 18.7.0. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](octokit/rest.js@v18.6.8...v18.7.0) --- updated-dependencies: - dependency-name: "@octokit/rest" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump katex from 0.13.12 to 0.13.13 (#2377) Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.13.12 to 0.13.13. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/master/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.13.12...v0.13.13) --- updated-dependencies: - dependency-name: katex dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update maintain-guides-how-to-chill.md (#2375) * Update maintain-guides-how-to-chill.md Summarize the contents in paritytech/substrate#8920 #2173 * Added content on Chill other * Update maintain-guides-how-to-chill.md Added suggestions from Danny * Update maintain-guides-how-to-chill.md minor correction Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dee Evans <deekor88@gmail.com> Co-authored-by: Radha <86818441+DrW3RK@users.noreply.github.com> Co-authored-by: Bill Laboon <laboon@users.noreply.github.com>
* Update maintain-guides-how-to-chill.md Summarize the contents in paritytech/substrate#8920 #2173 * Added content on Chill other * Update maintain-guides-how-to-chill.md Added suggestions from Danny * Update maintain-guides-how-to-chill.md minor correction
* Bump @octokit/rest from 18.6.7 to 18.6.8 (#2369) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.6.7 to 18.6.8. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](octokit/rest.js@v18.6.7...v18.6.8) --- updated-dependencies: - dependency-name: "@octokit/rest" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump katex from 0.13.11 to 0.13.12 (#2370) Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.13.11 to 0.13.12. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/master/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.13.11...v0.13.12) --- updated-dependencies: - dependency-name: katex dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Create greetings.yml * update dotscanner listing to include Kusama and a tracking attribute (#2372) * Update learn-accounts.md (#2358) * Update learn-accounts.md Added placeholder for content on Soft vs Hard Derivation paths * Update learn-accounts.md Added preliminary information. Might benefit from an infographic or a video explaining derivation paths. Please review and suggest content edits/updates * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update docs/learn-accounts.md Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> * Update sidebars.js (#2374) Correcting Typo * Modify Secure Validator Setup (#2361) * umodify secure validator setup * update links + edits * edits * edits * Update maintain-guides-how-to-use-polkadot-validator-setup.md * Add Conditional Rendering for chain flag (#2367) * add conditional rendering for chain flag * Update maintain-sync.md * Update Pages to address Stales (#2371) * resolves #2321 * resolves #1844 * resolves #1733 * update simple payouts and prettier (#2363) Co-authored-by: Danny Salman <salman.danny03@hotmail.com> * Bump @octokit/rest from 18.6.8 to 18.7.0 (#2378) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.6.8 to 18.7.0. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](octokit/rest.js@v18.6.8...v18.7.0) --- updated-dependencies: - dependency-name: "@octokit/rest" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump katex from 0.13.12 to 0.13.13 (#2377) Bumps [katex](https://github.com/KaTeX/KaTeX) from 0.13.12 to 0.13.13. - [Release notes](https://github.com/KaTeX/KaTeX/releases) - [Changelog](https://github.com/KaTeX/KaTeX/blob/master/CHANGELOG.md) - [Commits](KaTeX/KaTeX@v0.13.12...v0.13.13) --- updated-dependencies: - dependency-name: katex dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update maintain-guides-how-to-chill.md (#2375) * Update maintain-guides-how-to-chill.md Summarize the contents in paritytech/substrate#8920 #2173 * Added content on Chill other * Update maintain-guides-how-to-chill.md Added suggestions from Danny * Update maintain-guides-how-to-chill.md minor correction * take out stale check * remove sentry node references (#2383) * see path * Bump @polkadot/keyring from 7.0.2 to 7.0.3 (#2385) Bumps [@polkadot/keyring](https://github.com/polkadot-js/common) from 7.0.2 to 7.0.3. - [Release notes](https://github.com/polkadot-js/common/releases) - [Changelog](https://github.com/polkadot-js/common/blob/master/CHANGELOG.md) - [Commits](polkadot-js/common@v7.0.2...v7.0.3) --- updated-dependencies: - dependency-name: "@polkadot/keyring" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @polkadot/api from 5.1.1 to 5.2.1 (#2386) Bumps [@polkadot/api](https://github.com/polkadot-js/api) from 5.1.1 to 5.2.1. - [Release notes](https://github.com/polkadot-js/api/releases) - [Changelog](https://github.com/polkadot-js/api/blob/master/CHANGELOG.md) - [Commits](polkadot-js/api@v5.1.1...v5.2.1) --- updated-dependencies: - dependency-name: "@polkadot/api" dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump @octokit/rest from 18.7.0 to 18.7.1 (#2387) Bumps [@octokit/rest](https://github.com/octokit/rest.js) from 18.7.0 to 18.7.1. - [Release notes](https://github.com/octokit/rest.js/releases) - [Commits](octokit/rest.js@v18.7.0...v18.7.1) --- updated-dependencies: - dependency-name: "@octokit/rest" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Danny Salman <salman.danny03@hotmail.com> * Update maintain-guides-how-to-use-polkadot-validator * Add Time Delayed Proxies to the wiki (#2116) * Add Time Delayed Proxies to the wiki * Naming fix * Prettify proxy page * Add pretty script * Fix mispelling Co-authored-by: Danny Salman <salman.danny03@hotmail.com> * Update sidebars.js (#2384) * Update sidebars.js Adding a menu item for video tutorials on Polkadot Wiki * Create learn-video-tutorials.md Added key links * Update learn-video-tutorials.md more links updated Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dee Evans <deekor88@gmail.com> Co-authored-by: Radha <86818441+DrW3RK@users.noreply.github.com> Co-authored-by: Bill Laboon <laboon@users.noreply.github.com> Co-authored-by: Jake Hemmerle <jakehemmerle@protonmail.com> Co-authored-by: Emre Surmeli <s.emre.s.8@gmail.com>
This PR attempts to address some of the issues related to scaling the Staking Pallet.
Due to constraints in the runtime, an unbounded and unlimited nominator and validator set is just not possible.
We introduce a few different layers of checks which will provide direct and indirect checks on the size of the staking system:
We introduce a minimum active bond for both validators and nominators.
nominate
orvalidate
, we check that your current active bond meets these requirements.unbond
we also check that your active bond does not drop below these requirements.chill
, at which point they are able tounbond
all their funds.chill_other
extrinsic which is permissionless. This allows any third party user to point to an account where the minimum active bond is not satisfied, and chill that account.We introduce optional hard limits to the number of Validators and Nominators allowed in the staking system.
polkadot companion: paritytech/polkadot#3260