Skip to content

fix(baseapp): audit changes#16596

Merged
facundomedica merged 22 commits into
mainfrom
facu/050baseapp-audit
Jun 30, 2023
Merged

fix(baseapp): audit changes#16596
facundomedica merged 22 commits into
mainfrom
facu/050baseapp-audit

Conversation

@facundomedica

@facundomedica facundomedica commented Jun 16, 2023

Copy link
Copy Markdown
Contributor

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)

Comment thread baseapp/abci.go
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
Copy Markdown
Contributor 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)

Comment thread baseapp/abci.go
WithHeaderInfo(coreheader.Info{
ChainID: app.chainID,
Height: req.Height,
Hash: req.Hash,

Copy link
Copy Markdown
Contributor 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 thread baseapp/abci.go
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
Copy Markdown
Contributor 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 June 29, 2023 09:43
@ghost ghost requested review from a team and samricotta and removed request for a team June 29, 2023 09:43
@ghost ghost requested a review from testinginprod June 29, 2023 09:43
Comment thread UPGRADING.md Outdated
Comment thread UPGRADING.md Outdated
@facundomedica facundomedica enabled auto-merge June 30, 2023 07:14
@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
@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>
@faddat faddat mentioned this pull request Nov 8, 2024
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants