-
Notifications
You must be signed in to change notification settings - Fork 170
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
epoching/checkpointing: fuzz test for validators with zero voting power #276
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.
Very nice!
@@ -19,6 +20,82 @@ import ( | |||
"github.com/tendermint/tendermint/crypto/ed25519" | |||
) | |||
|
|||
// FuzzWrappedCreateValidator_InsufficientTokens tests adding new validators with zero voting power | |||
// It ensures that validators with zero voting power (i.e., with tokens fewer than sdk.DefaultPowerReduction) | |||
// are unbonded, thus are not included in the validator |
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.
// are unbonded, thus are not included in the validator | |
// are unbonded, thus are not included in the validator set |
require.Equal(t, uint64(1), epoch.EpochNumber) | ||
|
||
n := rand.Intn(3) + 1 | ||
addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(100000000)) |
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 we specify sdk.DefaultPowerReduction
here instead of the literal?
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 the amount of tokens for each genesis account rather than that for each validator, so it should be some large values.
Fixes #275
This PR provides a fuzz test ensuring validators with zero voting power are unbonded and are not included in the validator set. In the reported issue, the validator has only
100000
tokens, while 1 voting power takes at leastsdk.DefaultPowerReduction
(1000000) tokens. Thus the behaviour is in fact expected.During debugging, I also fixed some TODOs on moving stuff from epoching to checkpointing.