Fix: align consensus proposer priorities#828
Open
amimart wants to merge 6 commits into
Open
Conversation
xmariachi
previously approved these changes
May 30, 2025
0fbeaab to
9a094f6
Compare
9a094f6 to
86613bf
Compare
xmariachi
approved these changes
Aug 6, 2025
xmariachi
left a comment
Contributor
There was a problem hiding this comment.
rebased, updated changelog
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose of Changes and their Description
Add a new
v0.13.0upgrade containing a reset of validator set proposer priorities to ensure all nodes runs the same.Details
The proposer priorities are stored in comet's state store which is not accessible from the cosmos side of the app so to access it we need to manually open the db, which is not possible at the time the upgrade is performed by the
x/upgrademodule because at this moment the comet node is already created and a system lock is there to prevent any access to the store.To solve this I've introduced a
PreStartupUpgradefunc field in the upgrade type to set a function to be called at application creation but before startup.In the
PreStartupUpgradeimplementation it basically use the configuration given to the app to open cometstate.dbstore and update the last stateNextValidatorsfield, which contains the validator set to use in the next block, and set theProposerPriorityfield to the same value (i.e. the one used for a new validator) on all the validators.Testing
In order to test this locally here's the steps I've followed:
First setup a localnet with 4 validators with the
v0.13.0version staged:Then we need to poison one of the validator by shifting its internal consensus state priorities, I did this by adding the following debug cmd:
It can be run on one of the validators (after being temporarily stopped) with:
After restarting the poisoned node we can observe some logs showing that it is receiving proposals from an unexpected proposer:
Finally we can trigger the upgrade with
UPGRADE=TRUE go test -timeout 15m ./test/integration/ -vand after the upgrade is applied the logs disappears.Are these changes tested and documented?
Unreleasedsection ofCHANGELOG.md?