Skip to content
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 22 commits into from
Jun 30, 2023
Merged

fix(baseapp): audit changes #16596

merged 22 commits into from
Jun 30, 2023

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Jun 16, 2023

audit issue: #16474

Changes

  • Return error during ExtendVote and VerifyVoteExtension if the request height is earlier than VoteExtensionsEnableHeight (see comments in this pr).
  • Added hash to header info in ExtendVote
  • Increased baseapp test coverage from 61.5% to 66.8%
  • Added instructions on how to enable vote extensions in Upgrading.md

Related PRs: #16713

TODO: figure out what to do when ABCI is not set in consensus params. I suppose we default to "not enable vote extensions" Vote extensions are disabled by default if consensusParams.Abci == nil or if VoteExtensionsEnableHeight == 0.

SetStreamingService was removed at #14207 should it get added to changelog?

Double check test:

  • TestABCI_MultiListener_StateChanges (commented out lines, that I'm not sure how to solve)

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@facundomedica facundomedica added the backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release label Jun 16, 2023
Comment on lines -561 to +563
if cp.Abci != nil && cp.Abci.VoteExtensionsEnableHeight <= 0 {

extsEnabled := cp.Abci != nil && req.Height >= cp.Abci.VoteExtensionsEnableHeight && cp.Abci.VoteExtensionsEnableHeight != 0
if !extsEnabled {
Copy link
Member Author

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)

@@ -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,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this given that it might be needed

The header hash of the proposed block that the vote extension is to refer to.

Comment on lines -612 to +617
if cp.Abci != nil && cp.Abci.VoteExtensionsEnableHeight <= 0 {

extsEnabled := cp.Abci != nil && req.Height >= cp.Abci.VoteExtensionsEnableHeight && cp.Abci.VoteExtensionsEnableHeight != 0
if !extsEnabled {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See lines 561-ish

@facundomedica facundomedica changed the title refactor: baseapp audit changes fix(baseapp): audit changes Jun 27, 2023
@facundomedica facundomedica marked this pull request as ready for review June 29, 2023 09:43
@facundomedica facundomedica requested a review from a team as a code owner June 29, 2023 09:43
@github-prbot github-prbot requested review from a team and samricotta and removed request for a team June 29, 2023 09:43
UPGRADING.md Outdated Show resolved Hide resolved
UPGRADING.md Outdated Show resolved Hide resolved
@facundomedica facundomedica added this pull request to the merge queue Jun 30, 2023
Merged via the queue into main with commit b93081d Jun 30, 2023
47 of 49 checks passed
@facundomedica facundomedica deleted the facu/050baseapp-audit branch June 30, 2023 07:31
mergify bot pushed a commit that referenced this pull request Jun 30, 2023
Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com>
(cherry picked from commit b93081d)

# Conflicts:
#	CHANGELOG.md
julienrbrt added a commit that referenced this pull request Jun 30, 2023
Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com>
Co-authored-by: Facundo Medica <facundomedica@gmail.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/v0.50.x PR scheduled for inclusion in the v0.50's next stable release C:baseapp T: Audit Type: Build
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants