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

feat!: [Comet v0.38 Integration] Vote Extensions #15766

Merged
merged 36 commits into from
Apr 19, 2023

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Apr 9, 2023

Description

  • Implementation of supporting vote extensions
  • Rename runTx IOTA -> execMode
  • Implement ValidateVoteExtensions helper
  • Update Comet header created/passed in PrepareProposal and ProcessProposal
  • Move ABCI defaults and helpers to abci_utils.go

ref: #12272


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)

@alexanderbez alexanderbez changed the title [Comet v0.38 Integration] Vote Extensions feat!: [Comet v0.38 Integration] Vote Extensions Apr 10, 2023
baseapp/abci.go Fixed Show fixed Hide fixed
baseapp/abci.go Fixed Show fixed Hide fixed
@alexanderbez alexanderbez marked this pull request as ready for review April 11, 2023 16:08
@alexanderbez alexanderbez requested a review from a team as a code owner April 11, 2023 16:08
@github-actions
Copy link
Contributor

@alexanderbez your pull request is missing a changelog!

baseapp/abci.go Fixed Show fixed Hide fixed
baseapp/abci.go Fixed Show fixed Hide fixed
Comment on lines +544 to +551
// Since the application can get access to FinalizeBlock state and write to it,
// we must be sure to reset it in case ProcessProposal timeouts and is called
// again in a subsequent round. However, we only want to do this after we've
// processed the first block, as we want to avoid overwriting the finalizeState
// after state changes during InitChain.
if req.Height > app.initialHeight {
app.setState(execModeFinalize, header)
}
Copy link
Member

Choose a reason for hiding this comment

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

Okay, now I get what you meant the other day. So it's not possible that ProcessProposal gets called more than once during the first block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So it's not possible that ProcessProposal gets called more than once during the first block?

It is possible. Why does that matter? This conditional is irrelevant to the round number in the first block.

Copy link
Member

Choose a reason for hiding this comment

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

Then I'm not so sure I understood you the other day lol. In other words, why this wouldn't cause an issue? I understand that we would be having multiple writes to state without discarding what was done in the previous processProposal.

1. InitChain writes to FinalizeState
2. ProcessProposal writes to FinalizeState
3. ProcessProposal gets called again and writes to FinalizeState

So step 3 would be seeing the results of steps 1+2, but I think it should only be seeing results of step 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not the full correct understanding of what's happening. What is actually happening is, in the context of the first block:

1. InitChain writes to FinalizeState
2. ProcessProposal writes to a CACHED copy of FinalizeState
3. If ProcessProposal from (2) times out, (2) is called again

So step (3) would be a on a fresh cached copy of FinalizeState from step (1).

The big caveat here though is that a chain should NOT write to FinalizeState on the first block. I'll update the godoc. This isn't a concern really though because vote extensions can be used until at least the block after the 1st block.

Copy link
Member

Choose a reason for hiding this comment

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

Ahh thanks for taking the time to explain me, I was a bit too worried 😅

baseapp/abci.go Outdated Show resolved Hide resolved
Copy link
Member

@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.

Any chance we can get the newly added items instantiated in new baseapp or a way to set them?

// If vote extensions are not enabled, as a safety precaution, we return an
// error.
cp := app.GetConsensusParams(app.voteExtensionState.ctx)
if cp.Abci != nil && cp.Abci.VoteExtensionsEnableHeight <= 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need a consensus module migration here? Or can we capture this somehow so we don't forget

Copy link
Contributor Author

@alexanderbez alexanderbez Apr 15, 2023

Choose a reason for hiding this comment

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

An app would have to set the VoteExtensionsEnableHeight in it's upgrade handler, yes. I dont think this is something we can do for them. That being said, you mean should we set default values in x/consensus? If so, yeah I think we can do that.

baseapp/abci_utils.go Show resolved Hide resolved
@alexanderbez
Copy link
Contributor Author

Any chance we can get the newly added items instantiated in new baseapp or a way to set them?

Mhh what do you mean exactly? What are the newly added items?

Copy link
Member

@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.

Lgtm

@alexanderbez alexanderbez merged commit ff6ee2a into bez/feature/abci-2.0-base Apr 19, 2023
@alexanderbez alexanderbez deleted the bez/abci++_vote_ext branch April 19, 2023 18:00
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.

4 participants