Skip to content

fix(baseapp): ABCI Consensus Failure Fix#16700

Merged
julienrbrt merged 14 commits into
cosmos:mainfrom
davidterpay:terpay/consensus-fix
Jun 28, 2023
Merged

fix(baseapp): ABCI Consensus Failure Fix#16700
julienrbrt merged 14 commits into
cosmos:mainfrom
davidterpay:terpay/consensus-fix

Conversation

@davidterpay
Copy link
Copy Markdown
Contributor

@davidterpay davidterpay commented Jun 26, 2023

Description

In this PR, I fix the issue outlined here #16676. TLDR is that FinalizeBlock must return a response for all transactions included in a proposal, otherwise Comet will trigger a consensus failure.

Closes: #16676

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)

mergify Bot and others added 4 commits June 7, 2023 21:31
cosmos#16448)

Co-authored-by: Jeancarlo Barrios <JeancarloBarrios@users.noreply.github.com>
…) (cosmos#16451)

Co-authored-by: Chill Validation <92176880+chillyvee@users.noreply.github.com>
@davidterpay davidterpay requested a review from a team June 26, 2023 17:21
@ghost ghost requested review from a team, atheeshp and facundomedica and removed request for a team June 26, 2023 17:21
Comment thread baseapp/abci.go
Comment on lines 679 to +688
// vote extensions, so skip those.
txResults := make([]*abci.ExecTxResult, 0, len(req.Txs))
for _, rawTx := range req.Txs {
var response *abci.ExecTxResult

if _, err := app.txDecoder(rawTx); err == nil {
txResults = append(txResults, app.deliverTx(rawTx))
response = app.deliverTx(rawTx)
} else {
// In the case where a transaction included in a block proposal is malformed,
// we still want to return a default response to comet. This is because comet
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Change potentially affects state.

Call sequence:

(*github.com/cosmos/cosmos-sdk/baseapp.BaseApp).FinalizeBlock (baseapp/abci.go:648)

Copy link
Copy Markdown
Contributor

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

can we make this against main, then a bot will backport it

@davidterpay davidterpay changed the base branch from release/v0.50.x to main June 26, 2023 17:44
@davidterpay davidterpay requested a review from julienrbrt as a code owner June 26, 2023 17:44
@github-actions github-actions Bot removed the Type: CI label Jun 26, 2023
@davidterpay
Copy link
Copy Markdown
Contributor Author

@tac0turtle Switched and caught up to main.

Comment thread CHANGELOG.md Outdated
* (x/crypto) [#15258](https://github.com/cosmos/cosmos-sdk/pull/15258) Write keyhash file with permissions 0600 instead of 0555.
* (cli) [#16138](https://github.com/cosmos/cosmos-sdk/pull/16138) Fix snapshot commands panic if snapshot don't exists.
* (x/gov) [#16230](https://github.com/cosmos/cosmos-sdk/pull/16231) Fix: rawlog JSON formatting of proposal_vote option field
* (baseapp) [#16700](https://github.com/cosmos/cosmos-sdk/pull/16700) Fix: Consensus Failure in returning no response to malformed transactions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you move the changelog to unreleased?

Comment thread baseapp/abci.go
@julienrbrt julienrbrt changed the title fix(ABCI): Consensus Failure Fix fix(baseapp): ABCI Consensus Failure Fix Jun 26, 2023
Copy link
Copy Markdown
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

preliminary ACK, thanks @davidterpay!

However, we need to:

  1. Update the changelog entry placement as @julienrbrt pointed out
  2. Add a unit test in abci_test.go that creates and sets proposal handlers that inject VE. Note, we already have VE handlers that do this, you just need to set them.

@davidterpay
Copy link
Copy Markdown
Contributor Author

davidterpay commented Jun 28, 2023

@alexanderbez

Pushed a unit test that

  1. sets up prepare and process proposal to inject and verify a single vote extension
  2. executes a request for both (in order)
  3. executes finalize block smoothly

Comment thread CHANGELOG.md Outdated

## [Unreleased]

* (baseapp) [#16700](https://github.com/cosmos/cosmos-sdk/pull/16700) Fix: Consensus Failure in returning no response to malformed transactions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit, can you place it under the bug fixes category

Copy link
Copy Markdown
Contributor

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

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

lgtm! one nit.

@davidterpay
Copy link
Copy Markdown
Contributor Author

nit fixed 🫡

@julienrbrt julienrbrt enabled auto-merge June 28, 2023 19:20
@julienrbrt julienrbrt added this pull request to the merge queue Jun 28, 2023
Merged via the queue into cosmos:main with commit 078e7cb Jun 28, 2023
mergify Bot pushed a commit that referenced this pull request Jun 28, 2023
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Jeancarlo Barrios <JeancarloBarrios@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
Co-authored-by: Chill Validation <92176880+chillyvee@users.noreply.github.com>
(cherry picked from commit 078e7cb)

# Conflicts:
#	CHANGELOG.md
julienrbrt added a commit that referenced this pull request Jun 28, 2023
Co-authored-by: David Terpay <35130517+davidterpay@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
@alexanderbez
Copy link
Copy Markdown
Contributor

Phenomenal work @davidterpay -- thanks so much 🙏

@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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Consensus Failure in Ignoring Malformed Transactions

4 participants