Sort RewardDelegators when marshaling a validator #1591
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a fix for a regression introduced by #1581.
When a node stores a validator with the new
RewardDelegators
field, its marshaled product is not deterministic because the order of map iteration is not deterministic. As a result, the merkle tree of application.db can differ between nodes, leading to consensus failure.The proposed fix is to sort the keys of
RewardDelegators
by using the stable marshaler.Summary generated by Reviewpad on 15 Jan 24 18:21 UTC
This pull request includes changes to the
nodes.proto
file and a file diff.The changes in the
nodes.proto
file include:stable_marshaler
with a value oftrue
. This option is used to make the order ofRewardDelegators
deterministic.Address
field to include additional options(gogoproto.casttype)
,(gogoproto.moretags)
, and(gogoproto.jsontag)
.PublicKey
field to include additional options(gogoproto.moretags)
and(gogoproto.jsontag)
.jailed
field to include an additional option(gogoproto.jsontag)
.The file diff includes the following changes:
Please let me know if there is anything specific you would like me to focus on.