Skip to content

Vote extension propagation (RFC017) - #9853

Merged
sergio-mena merged 12 commits into
feature/abci++veffrom
sergio/9852-vote-extension-propagation
Dec 8, 2022
Merged

sergio-mena merged 12 commits into
feature/abci++veffrom
sergio/9852-vote-extension-propagation

Conversation

@sergio-mena

@sergio-mena sergio-mena commented Dec 7, 2022 •

Copy link
Copy Markdown
Contributor

Closes #9852

The first commit is a cherry-pick of #8433.
Subsequent commits are fixing the build, and the unit tests

N.B: The changelog will be updated once branch feature/abci++vef is merged back into main


PR checklist

  • Tests written/updated, or no tests needed
  • CHANGELOG_PENDING.md updated, or no changelog entry needed
  • Updated relevant documentation (docs/) and code comments, or no
    documentation updates needed

thanethomson and others added 11 commits December 7, 2022 23:15
* Add protos for ExtendedCommit

Cherry-pick from e73f017 just the
changes to the .proto files, since we have deleted the .intermediate
files.

Signed-off-by: Thane Thomson <[email protected]>

* make proto-gen

Signed-off-by: Thane Thomson <[email protected]>

* BlockStore holds extended commit

Cherry-pick 8d504d4 and fix conflicts.

Signed-off-by: Thane Thomson <[email protected]>

* Reshuffle ExtendedCommit and ExtendedCommitSig

Separate the data structures and functions from their Commit-oriented
counterparts to adhere to the current coding style.

Signed-off-by: Thane Thomson <[email protected]>

* Fix exit condition in blocksync

* Add note to remove TxResult proto

As Sergio pointed out in 3e31aa6, this
proto message can probably be removed. We should do this in a separate
PR.

Signed-off-by: Thane Thomson <[email protected]>

* Lift termination condition into for loop

Signed-off-by: Thane Thomson <[email protected]>

* Enforce vote extension signature requirement

Signed-off-by: Thane Thomson <[email protected]>

* Expand on comment for PeekTwoBlocks for posterity

Signed-off-by: Thane Thomson <[email protected]>

* Isolate TODO more clearly

Signed-off-by: Thane Thomson <[email protected]>

* make mockery

Signed-off-by: Thane Thomson <[email protected]>

* Fix comment

Signed-off-by: Thane Thomson <[email protected]>

* Make panic output from BlockStore.SaveBlock more readable

Signed-off-by: Thane Thomson <[email protected]>

* Add helper methods to ExtendedCommitSig and ExtendedCommit

Signed-off-by: Thane Thomson <[email protected]>

* Fix most tests except TestHandshake*

Signed-off-by: Thane Thomson <[email protected]>

* Fix store prefix collision

Signed-off-by: Thane Thomson <[email protected]>

* Fix TestBlockFetchAtHeight

Signed-off-by: Thane Thomson <[email protected]>

* Remove global state from store tests

Signed-off-by: Thane Thomson <[email protected]>

* Apply suggestions from code review

Co-authored-by: M. J. Fromberger <[email protected]>
Co-authored-by: Sergio Mena <[email protected]>

* blocksync: Just return error

Signed-off-by: Thane Thomson <[email protected]>

* make format

Signed-off-by: Thane Thomson <[email protected]>

* types: Remove unused/commented-out code

Signed-off-by: Thane Thomson <[email protected]>

* blocksync: Change pool AddBlock function signature to return errors

Signed-off-by: Thane Thomson <[email protected]>

* types: Improve legibility of switch statements

Signed-off-by: Thane Thomson <[email protected]>

* blocksync: Expand on extended commit requirement in AddBlock description

Signed-off-by: Thane Thomson <[email protected]>

* blocksync: Return error without also logging it

Signed-off-by: Thane Thomson <[email protected]>

* consensus: Rename short-lived local variable

Signed-off-by: Thane Thomson <[email protected]>

* consensus: Allocate TODO to Sergio

Signed-off-by: Thane Thomson <[email protected]>

* evidence/pool_test: Inline slice construction

Signed-off-by: Thane Thomson <[email protected]>

* state: Rename LoadBlockExtCommit to LoadBlockExtendedCommit

Signed-off-by: Thane Thomson <[email protected]>

* proto: Remove TODO on TxResult

Signed-off-by: Thane Thomson <[email protected]>

* types: Minor format

Signed-off-by: Thane Thomson <[email protected]>

* types: Reformat ExtendedCommitSig.BlockID

Signed-off-by: Thane Thomson <[email protected]>

* types: Remove NewExtendedCommit constructor

Signed-off-by: Thane Thomson <[email protected]>

* types: Remove NewCommit constructor

Signed-off-by: Thane Thomson <[email protected]>

* types: Shorten receiver names for ExtendedCommit

Signed-off-by: Thane Thomson <[email protected]>

* types: Convert ExtendedCommit.Copy to a deep clone

Signed-off-by: Thane Thomson <[email protected]>

* types: Assign TODO to Sergio

Signed-off-by: Thane Thomson <[email protected]>

* types: Fix legibility nits

Signed-off-by: Thane Thomson <[email protected]>

* types: Improve legibility

Signed-off-by: Thane Thomson <[email protected]>

* store/state: Add TODO to move prefixes to common package

Signed-off-by: Thane Thomson <[email protected]>

* Propagate validator info to PrepareProposal

In order to propagate validator voting power through to PrepareProposal,
we need to load the validator set info from the height corresponding to
the extended commit that we're passing through to PrepareProposal as the
"LocalLastCommit".

Signed-off-by: Thane Thomson <[email protected]>

* Rename local var for clarity

Signed-off-by: Thane Thomson <[email protected]>

* Fix TestMaxProposalBlockSize

Signed-off-by: Thane Thomson <[email protected]>

* Rename local var for clarity

Signed-off-by: Thane Thomson <[email protected]>

* Remove debug log

Signed-off-by: Thane Thomson <[email protected]>

* Remove CommigSig.ForBlock helper

Signed-off-by: Thane Thomson <[email protected]>

* Remove CommigSig.Absent helper

Signed-off-by: Thane Thomson <[email protected]>

* Remove ExtendedCommitSig.ForBlock helper

Signed-off-by: Thane Thomson <[email protected]>

* Remove ExtendedCommitSig.Absent helper

Signed-off-by: Thane Thomson <[email protected]>

* There are no extended commits below the initial height

Signed-off-by: Thane Thomson <[email protected]>

* Fix comment grammar

Signed-off-by: Thane Thomson <[email protected]>

* Remove JSON encoding from ExtendedCommit

Signed-off-by: Thane Thomson <[email protected]>

* Embed CommitSig into ExtendedCommitSig instead of duplicating fields

Signed-off-by: Thane Thomson <[email protected]>

* Rename ExtendedCommit vote_extension field to extension for consistency with domain types

Signed-off-by: Thane Thomson <[email protected]>

* blocksync: Panic if we peek a block without an extended commit

Signed-off-by: Thane Thomson <[email protected]>

* Apply suggestions from code review

Co-authored-by: M. J. Fromberger <[email protected]>

* Remove Sergio from TODO

Signed-off-by: Thane Thomson <[email protected]>

* Increase hard-coded vote extension max size to 1MB

Signed-off-by: Thane Thomson <[email protected]>

* state: Remove unnecessary comment

Signed-off-by: Thane Thomson <[email protected]>

* state: Ensure no of commit sigs equals validator set length

Signed-off-by: Thane Thomson <[email protected]>

* make format

Signed-off-by: Thane Thomson <[email protected]>

* types: Minor legibility improvements

Signed-off-by: Thane Thomson <[email protected]>

* Improve legibility

Signed-off-by: Thane Thomson <[email protected]>

* types: Remove unused GetVotes function on VoteSet

Signed-off-by: Thane Thomson <[email protected]>

* Refactor TestMaxProposalBlockSize to construct more realistic extended commit

Signed-off-by: Thane Thomson <[email protected]>

* Refactor buildExtendedCommitInfo to resemble buildLastCommitInfo

Signed-off-by: Thane Thomson <[email protected]>

* Apply suggestions from code review

Co-authored-by: M. J. Fromberger <[email protected]>

* abci++: Disable VerifyVoteExtension call on nil precommits (#8491)

Signed-off-by: Thane Thomson <[email protected]>

* types: Require vote extensions on non-nil precommits and not otherwise

Signed-off-by: Thane Thomson <[email protected]>

* Disable lint

Signed-off-by: Thane Thomson <[email protected]>

* Increase timeout for TestReactorVotingPowerChange to counter flakiness

Signed-off-by: Thane Thomson <[email protected]>

* Only sign and verify vote extensions in non-nil precommits

Signed-off-by: Thane Thomson <[email protected]>

* Revert "Disable lint"

This reverts commit 6fffbf9.

Signed-off-by: Thane Thomson <[email protected]>

* Add missing non-nil check uncovered non-deterministically in TestHandshakeReplayAll

Signed-off-by: Thane Thomson <[email protected]>

* Expand error message for accuracy

Signed-off-by: Thane Thomson <[email protected]>

* Only call ExtendVote when we make non-nil precommits

Signed-off-by: Thane Thomson <[email protected]>

* Revert "Increase timeout for TestReactorVotingPowerChange to counter flakiness"

This reverts commit af51493.

Signed-off-by: Thane Thomson <[email protected]>

* Refactor ValidateBasic for ExtendedCommitSig for legibility

Signed-off-by: Thane Thomson <[email protected]>

Co-authored-by: Sergio Mena <[email protected]>
Co-authored-by: M. J. Fromberger <[email protected]>
@sergio-mena
sergio-mena requested a review from ebuchman as a code owner December 7, 2022 22:26
@sergio-mena
sergio-mena requested a review from a team December 7, 2022 22:26
@sergio-mena sergio-mena self-assigned this Dec 7, 2022

@williambanfield williambanfield left a comment

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.

Did a pass looking at the diff-of-diffs. Looks like a clean cherry-pick.

Comment thread blocksync/reactor.go
// See if there are any blocks to sync.
first, second := bcR.pool.PeekTwoBlocks()
first, second, extCommit := bcR.pool.PeekTwoBlocks()
// bcR.Logger.Info("TrySync peeked", "first", first, "second", second)

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 we remove this commented out code while we're here?

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.

This is done in the upcoming cherry-pick. Bear with me

Comment thread consensus/state_test.go
m.On("VerifyVoteExtension", mock.Anything, mock.Anything).Return(&abci.ResponseVerifyVoteExtension{
Status: abci.ResponseVerifyVoteExtension_ACCEPT,
}, nil)
if !testCase.voteNil {

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.

Looks like there's a comment missing from the hunk here.

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.

Thanks for catching this! Adding it

@sergio-mena
sergio-mena merged commit aeec999 into feature/abci++vef Dec 8, 2022
@sergio-mena
sergio-mena deleted the sergio/9852-vote-extension-propagation branch December 8, 2022 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done/Merged

Development

Successfully merging this pull request may close these issues.

3 participants