-
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
Choose a uniform power calculation method #2513
Comments
This seems good to me. (Presuming we're going with the fixed "Unit" approach, which will be specified by a governance change-able parameter, and is a power of 2. All relevant stake will be determined in integer quantities of Unit, with the integer not exceeding We do need to note and have a plan for the complications which will arise when upgrading the threshold, and how we would have to correctly reward the rewards from delegations/undelegations etc. along with keeping the correct amount slashable. I do think this is a good idea. Then we can get faster computations on the int64's + less on-chain data usage. |
Yeah I could see us migrating to int's all the way around for the power representation of a validator however we will still need to use the decimals for a wide variety of mechanism calculations, we just want to limit its use in the final results (aka withdrawn fees, withdrawn inflation, etc) - like there are many circumstances where folks are continuously accumulating "fractions" of rewards which really add up over blocks - just need to have consideration for this and use decimal in those place appropriately |
This discussion carried over from: #2439 |
At @cwgoes were you planning on doing this soon? was also on my roster but if you want to take on that's also dope. I do not see why GoS should require blocking on this. |
@rigelrozanski At first I thought this was necessary for GoS but upon reflection decided that this method would be annoying since we would have to change the |
Going to go ahead close this as the Dec -> Int PR looks like it close this. |
@rigelrozanski what else is necessary here? |
my understanding - we need to upgrade the "power" so it doesn't overflow int64 which is < than sdk.Int -> thus we want to "scale back" the power calculation used when submitting power to tendermint |
Yes; exactly, this is still an issue (especially as we want to use micro-Atoms). |
k I can take this one, AFAIU these are the requirements for the solution:
AFAICT we do not need to worry about about the effect on delegation power, withdrawn power etc - these are all internal to the SDK and do not involve the tendermint power whatsoever Further thoughts @cwgoes ? |
We can implement that, but I don't know if it's worth the complexity - choosing a constant ratio should provide sufficient precision for long periods of operation (assuming inflation isn't ridiculous, which will be true in most real blockchains) - I think we just need to choose the particulars of Atoms / micro-Atoms, calculate our expected maximum total supply, and choose an appropriate ratio (considering several decades of inflation) - the ratio can easily be changed later with a hard-fork. |
I like the idea, there are some additional considerations to this hard coded approach:
|
This seems to be a pretty serious concern. |
Agreed.
I don't think so, we can just threshold directly based on TM power - https://github.com/cosmos/cosmos-sdk/blob/develop/x/staking/keeper/val_state_change.go#L50.
Yes, that sounds prudent. |
yeah this was my first thought, if you don't meet the threshold for 1 bonded power in tendermint, then you're not considered bonded. That's fine so long as we launch with a some validators who have more than the threshold to start the chain with |
Thoughts on defining the threshold:
Huh........ so if all the atoms after 10 years inflation (repr. as quarks) where put into one account which was the only bonded account then it would still fit into a tendermint power. Extrolating it looks like full inflation would need to exist for about 20 years before this could even begin to be a threat So I think we're actually fine and don't need to implement this? Again if we choose a much smaller denom than 10^9 then this could be an issue but I think we're good for now |
We want a much tighter bound on Tendermint power, because it's added / multiplied in several ways in Tendermint itself (mostly in proposer selection). I think we've decided to bound individual validator power at Otherwise your calculations look fine, so I think dividing by |
Is this is Int32 Spec'd out anywhere on the Tendermint side? lol probably a good idea |
We chose to rename to uatoms as the base unit as 10^-6 @jackzampolin @jaekwon @sunnya97 @cwgoes Which means that the reduction from tokens should be |
Sure, makes sense - ref #3510 - let's double-check that total power will not exceed |
Either full
sdk.Decimal
precision or limited Tendermint power precision, and use that uniformly - in fee distribution, staking, power ranking, etc.ref https://github.com/cosmos/cosmos-sdk/pull/2508/files#r225712555
ref #2439 (comment)
Maybe we should have an even higher threshold for delegation/undelegation/redelegation, in part to mitigate fee distribution DoS risk.
cc @ValarDragon
The text was updated successfully, but these errors were encountered: