8000 Fix deficiency in ABCI interface: `SignedLastBlock` by sergio-mena · Pull Request #540 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix deficiency in ABCI interface: SignedLastBlock #540

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

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

sergio-mena
Copy link
Contributor
@sergio-mena sergio-mena commented Mar 16, 2023

Contributes to #485

Current ABCI 2.0 implementation has VoteInfo and ExtendedVoteInfo to send vote signature information to the application at several points in the interaction:

  • PrepareProposal
  • ProcessProposal
  • FinalizeBlock

The problem with VoteInfo and ExtendedVoteInfo is that they contain a bool, called SignedLastBlock, which collapses several cases: (a) did the sending validator precommit for nil? (b) did it precommit for the decided block? (c) did they not precommit (or no precommit received, absent)?

SignedLastBlock is collapsing cases (a) and (b) into value true of the boolean, hiding potentially useful information to the application.

With vote extensions, this has become a bigger problem, as we are unable to "ensure" from a testing application that the vote extensions are present or absent at the right time. If we (CometBFT team) are unable to test this properly, then real apps may have a very hard time troubleshooting potential problems on the field, due to some info being trapped south of ABCI.

After a discussion with @ebuchman, we have decided to fix this problem, which was already fixed long ago in the block-related protos (see discussion). The conclusion was that this is the right moment, as we are heavily changing ABCI in this release, and it's not certain when we will need to make substantial changes to it in the mid-term.

This PR contains the changes needed in the protobufs and in the code.


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

if len(vote.VoteExtension) != 0 {
return 0, fmt.Errorf("non-empty vote extension at height %d, which has extensions disabled", currentHeight)
return 0, fmt.Errorf("non-empty vote extension at height %d, for a vote with blockID flag %d",
Copy link
Contributor

Choose a reason for hiding this comment

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

Essentially, if this validator had voted correctly, and there is an extension, the flag had to have been Commit?

Copy link
Contributor Author
@sergio-mena sergio-mena Mar 17, 2023

Choose a reason for hiding this comment

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

Exactly:

  • BlockIDFlagAbsent means it didn't precommit so, how come we got a vote extension?
  • BlockIDFlagNil means it precommitted for nil, but nil precommits don't have vote extensions

In both cases the info we get is contradictory, so we should reject it.

Copy link
Contributor Author
@sergio-mena sergio-mena Mar 17, 2023

Choose a reason for hiding this comment

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

Oh, did you mean that we could simplify the condition in line 583 like this?
if vote.BlockIdFlag != cmtproto.BlockIDFlagCommit {

Copy link
Contributor
@jmalicevic jmalicevic left a comment

Choose a reason for hiding this comment

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

Minor comments, otherwise good.

@sergio-mena sergio-mena merged commit 27d2a18 into feature/abci++vef Mar 17, 2023
@sergio-mena sergio-mena deleted the sergio/485-fix-signed-last-block branch March 17, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abci Application blockchain interface
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
0