-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(baseapp): audit changes #16596
Merged
Merged
fix(baseapp): audit changes #16596
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
952c66b
refactor: baseapp audit changes
facundomedica bb27c52
more test fixes
facundomedica 54a8000
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into facu…
facundomedica a7206f0
improve tests
facundomedica 6006adc
improve tests + extendVote
facundomedica d947df1
improve tests
facundomedica df20749
test
facundomedica 90710a5
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into facu…
facundomedica c1117b3
cl++
facundomedica a90066f
more testing
facundomedica adc9fc0
Merge branch 'main' of https://github.com/cosmos/cosmos-sdk into facu…
facundomedica 3bd5cd5
add missing mock
facundomedica 69fe534
lint
facundomedica dff1556
fix check
facundomedica 3751957
fix check again
facundomedica 1abdd3c
rollback change
facundomedica 47af806
update upgrading file
facundomedica 7b5cbb7
improve upgrading doc
facundomedica 4f7946e
Merge branch 'main' into facu/050baseapp-audit
facundomedica d6c79d7
Merge branch 'main' into facu/050baseapp-audit
alexanderbez a905df9
julien suggestions
facundomedica d67ca51
Merge branch 'main' into facu/050baseapp-audit
facundomedica File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -558,7 +558,9 @@ func (app *BaseApp) ExtendVote(_ context.Context, req *abci.RequestExtendVote) ( | |
// If vote extensions are not enabled, as a safety precaution, we return an | ||
// error. | ||
cp := app.GetConsensusParams(app.voteExtensionState.ctx) | ||
if cp.Abci != nil && cp.Abci.VoteExtensionsEnableHeight <= 0 { | ||
|
||
extsEnabled := cp.Abci != nil && req.Height >= cp.Abci.VoteExtensionsEnableHeight && cp.Abci.VoteExtensionsEnableHeight != 0 | ||
if !extsEnabled { | ||
return nil, fmt.Errorf("vote extensions are not enabled; unexpected call to ExtendVote at height %d", req.Height) | ||
} | ||
|
||
|
@@ -571,6 +573,7 @@ func (app *BaseApp) ExtendVote(_ context.Context, req *abci.RequestExtendVote) ( | |
WithHeaderInfo(coreheader.Info{ | ||
ChainID: app.chainID, | ||
Height: req.Height, | ||
Hash: req.Hash, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added this given that it might be needed
|
||
}) | ||
|
||
// add a deferred recover handler in case extendVote panics | ||
|
@@ -609,7 +612,9 @@ func (app *BaseApp) VerifyVoteExtension(req *abci.RequestVerifyVoteExtension) (r | |
// If vote extensions are not enabled, as a safety precaution, we return an | ||
// error. | ||
cp := app.GetConsensusParams(app.voteExtensionState.ctx) | ||
if cp.Abci != nil && cp.Abci.VoteExtensionsEnableHeight <= 0 { | ||
|
||
extsEnabled := cp.Abci != nil && req.Height >= cp.Abci.VoteExtensionsEnableHeight && cp.Abci.VoteExtensionsEnableHeight != 0 | ||
if !extsEnabled { | ||
Comment on lines
-610
to
+615
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See lines 561-ish |
||
return nil, fmt.Errorf("vote extensions are not enabled; unexpected call to VerifyVoteExtension at height %d", req.Height) | ||
} | ||
|
||
|
Oops, something went wrong.
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.
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.
Return error during ExtendVote and VerifyVoteExtension if the request height is earlier than
VoteExtensionsEnableHeight
.Also if
VoteExtensionsEnableHeight == 0
then vote extensions are not enabled (see the default value here)