-
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
validator slash event stored by period and height #4654
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.
ACK
@@ -110,6 +110,7 @@ func ExportGenesis(ctx sdk.Context, keeper Keeper) types.GenesisState { | |||
slashes = append(slashes, types.ValidatorSlashEventRecord{ | |||
ValidatorAddress: val, | |||
Height: height, | |||
Period: event.ValidatorPeriod, |
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.
/cc @sabau
} | ||
height := uint64(ctx.BlockHeight()) |
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.
Any reason why all this logic was removed? Was calculating updatedFraction
unnecessary?
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.
yeah I think this design decision was overlooked at inception seeing as the revised code eliminates the need for this complexity. By introducing the period into the validator-slash-record-key the fraction no longer needs to be "flattened" with the other fractions in that height, hence we remove all this flattening logic in this function
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.
Yes, this is better and simpler. Mea culpa. I think originally we were concerned about iteration costs.
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.
utACK
} | ||
height := uint64(ctx.BlockHeight()) |
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.
Yes, this is better and simpler. Mea culpa. I think originally we were concerned about iteration costs.
Followup to fuzzer bug Icarus issue:
ref #4653
The solution (thanks @cwgoes) is to no longer average slash events by height:
Summary of Bug
Running
go test -race -covermode=atomic -coverprofile=769332655.1.profile.out -coverpkg=./... -mod=readonly github.com/cosmos/cosmos-sdk/simapp -run TestFullAppSimulation -SimulationEnabled=true -SimulationNumBlocks=400 -SimulationBlockSize=200 -SimulationGenesis= -SimulationVerbose=false -SimulationCommit=true -SimulationSeed=769332655 -SimulationPeriod=5 -v -timeout 6h
on currentHEAD
(commitac2e765607a64f9dacb475244895ba3e99ec927d
) fails with:Full log: 769332655.log
Version
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry:
clog add [section] [stanza] [message]
rereviewed
Files changed
in the github PR explorerFor Admin Use: