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: Add preFinalizeBlockHook to allow VE persistence #16898

Merged
merged 11 commits into from
Jul 14, 2023

Conversation

facundomedica
Copy link
Member

Description

Closes: #16883


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)

@facundomedica facundomedica requested a review from a team as a code owner July 10, 2023 08:21
@github-prbot github-prbot requested review from a team, JeancarloBarrios and atheeshp and removed request for a team July 10, 2023 08:22
@github-actions

This comment has been minimized.

app.logger.Info("InitChain", "initialHeight", req.InitialHeight, "chainID", req.ChainId)

// Set the initial height, which will be used to determine if we are proposing
// or processing the first block or not.
app.initialHeight = req.InitialHeight
if app.initialHeight == 0 { // If initial height is 0, set it to 1
app.initialHeight = 1
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Bringing this from the PR that was reverted in order to make sure that PrepareProposal/ProcessProposal get the right context on the first block.


// GasMeter must be set after we get a context with updated consensus params.
gasMeter := app.getBlockGasMeter(app.finalizeBlockState.ctx)
app.finalizeBlockState.ctx = app.finalizeBlockState.ctx.WithBlockGasMeter(gasMeter)
Copy link
Member Author

Choose a reason for hiding this comment

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

The lines above are to simplify context setting. The stuff done in the else bracket are also done outside of it, so we might as well do it once.

Copy link
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.

Amazing 💯

Changes look great. I think we need to add a section to the building apps doc though.

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.

can we get a e2e test with vote extensions?

@julienrbrt
Copy link
Member

+1 for docs update in this PR.

@facundomedica
Copy link
Member Author

@tac0turtle see here bc261cd

Copy link
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.

Doc changes look good to me. Thanks @facundomedica 👍

@tac0turtle
Copy link
Member

@tac0turtle see here bc261cd

this doesnt look like its testing resync issue, we should also test how this works with state sync, i could see that possibly being an issue.

@alexanderbez
Copy link
Contributor

this doesnt look like its testing resync issue

The major theme here is that VE should be handled when ProcessProposal is NOT called (which happens on replay/catchup). If test(s) bypass calling ProcessProposal and VE are handled successfully, that's a happy path test to me IMO.

@facundomedica I think a test should ensure that ProcessProposal is NOT called and that would be sufficient for me personally.

@tac0turtle
Copy link
Member

we can do it in a separate PR but like you said this is the happy path, we should get better testing on this feature. Many things that we have found thus far would have been caught earlier with better tests

@facundomedica
Copy link
Member Author

@facundomedica I think a test should ensure that ProcessProposal is NOT called and that would be sufficient for me personally.

Most of the tests are not calling ProcessProposal and calling FinalizeBlock right away. That was something I wanted to change before finding this issue (but we might leave as is).

we can do it in a separate PR but like you said this is the happy path, we should get better testing on this feature. Many things that we have found thus far would have been caught earlier with better tests

Agree, but I'm not sure how to test it effectively tbh.

@alexanderbez
Copy link
Contributor

I personally would merge this. We should explore (in a separate issue and PR), more sophisticated and real-world-esque testing of ABCI++ in our E2E test suite.

@alexanderbez alexanderbez enabled auto-merge July 14, 2023 17:25
@alexanderbez alexanderbez added this pull request to the merge queue Jul 14, 2023
Merged via the queue into main with commit 38f1014 Jul 14, 2023
@alexanderbez alexanderbez deleted the facu/fix-ve-persistence branch July 14, 2023 17:46
@julienrbrt
Copy link
Member

@Mergifyio backport release/v0.50.x

@mergify
Copy link
Contributor

mergify bot commented Jul 14, 2023

backport release/v0.50.x

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Jul 14, 2023
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
(cherry picked from commit 38f1014)
alexanderbez pushed a commit that referenced this pull request Jul 14, 2023
@facundomedica facundomedica mentioned this pull request Aug 21, 2023
20 tasks
@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]: VE Persistence Not Reliable on Replay
4 participants