-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn staking Power Reduction into an on-chain param #8365
Comments
This change causes a consensus failure: #9447. The current decision is that we'll revert if for now, i.e. won't include it in v0.43. Re-opening as to find a strategy to include this feature in v0.44. |
IMHO keeping this as a tune-able variable is not the worst, although I do agree globals are the root of many evils. Making this an on-chain param would require some non-trivial amount of effort and thought. We attempted it and saw consensus failures which is not surprising because validator power is crucial to validator iteration, specifically during computing and returning validator set updates to Tendermint during If we were to make this on-chain, we'd probably need to utilize hooks and iterate over every single validator and re-compute and update their power based on the new param. |
A middle ground which avoids the global is to make this a keeper member variable rather than a global var. |
So I guess to sync the validator set with tendermint, we better to change the parameter through a message? |
The problem isn't the how to tune the parameter (on-chain gov parameter makes total sense). The reason this was re-opened and non-trivial to solve is because you need to go into the x/staking store and modify all validator powers based on the new parameter value. In the current x/params context, this is pretty much impossible. Once we refactor the way modules handle parameters (i.e. stateful and can execute arbitrary logic before/after the param change), this should become pretty trivial. |
we def need this feature for Evmos, I just realized that the power reduction is hardcoded on the staking module and wanted to know timelines for this feature. cosmos-sdk/x/staking/keeper/params.go Lines 42 to 48 in a660eea
|
it would be relevant to test overflows with |
Feel free to submit a PR @fedekunze. The work is non-trivial. You can't simply make the value a param. In fact, we've already tried. You'll need to execute logic post-param-change that updates all validator powers in state. |
Summary
Background: #7655
Currently, the power reduction variable in the staking module is defaulted to 10^6. While it is possible to change this in the app.go in the codebase, we would like to remove the reliance on global variables throughout the codebase. Instead, the power reduction should be an on-chain param.
Along with better code hygiene, by making PowerReduction an on-chain param instead of code variable, we would be able to update it on a running chain. This could be useful for things like asset redenominations, but also more advanced voting power distributions.
For example, you can use a dynamic PowerReduction to create a "less granular" voting power (i.e. if Validator A has a stake 54 tokens, and validator B has stake 103 tokens, the chain can dynamically set the power reduction to be 50, so validator A has voting power 1, and validator B has voting power 2.). This is useful for things like threshold cryptography and sharding.
For Admin Use
The text was updated successfully, but these errors were encountered: