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

Don't persist IBFT2 proposal blocks, just validate them #7631

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

matthew1001
Copy link
Contributor

@matthew1001 matthew1001 commented Sep 17, 2024

PR description

This PR fixes a bug with IBFT2 chains where blocks are persisted at block-proposal time instead of block-import time. With Bonsai DB this causes issues updating the flat DB because if a round change happens the original proposal isn't actually the block that's accepted for that round. Since a flat-DB entry already exists for the proposed (but not accepted) block the imported block isn't actually persisted to the DB leaving the world state corrupted.

I've manually tested this with both BONSAI and FOREST DBs to check that state updates are still persisted correctly by doing the following in both DB modes:

  • Start a node with a fresh DB
  • Deploy a contract, invoke it a few times
  • Stop the node
  • Restart the node
  • Check the sender's transaction count is correct
  • Check the state of the smart contract is correct
  • Re-invoke it a few times to check it continues incrementing from the previous state

Fixed Issue(s)

Fixes #7629

@jframe
Copy link
Contributor

jframe commented Sep 20, 2024

Changes make sense. You're right we shouldn't have been persisting the block during the validation.

@matthew1001 matthew1001 merged commit e721237 into hyperledger:main Sep 20, 2024
41 checks passed
Wolmin pushed a commit to lukso-network/network-besu that referenced this pull request Sep 27, 2024
…7631)

* Don't persist IBFT2 proposal blocks, just validate them

Signed-off-by: Matthew Whitehead <[email protected]>

* Tidy up changelog

Signed-off-by: Matthew Whitehead <[email protected]>

---------

Signed-off-by: Matthew Whitehead <[email protected]>
Signed-off-by: Matt Whitehead <[email protected]>
Signed-off-by: Wolmin <[email protected]>
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.

IBFT2 fails block validation with BONSAI DB
2 participants