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: Reorg Support (WIP) #296

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft

feat: Reorg Support (WIP) #296

wants to merge 12 commits into from

Conversation

notlesh
Copy link
Contributor

@notlesh notlesh commented Oct 1, 2024

This PR adds basic support for reverting state during a reorg.

Originally, the goal was to detect reorgs and handle them, but the block import pipeline does not seem like the appropriate place for this detection. So the PR currently adds a fn reorg() which does the logic of reverting the databases to a desired block along with tests around this.

Pull Request type

Feature

What is the current behavior?

I expect reorgs would be dropped currently because a block's parent_header is checked against the tip of the chain and an error is produced if the two don't match.

Resolves: #202 #416

What is the new behavior?

TODO:

Does this introduce a breaking change?

TODO:

@notlesh notlesh added the enhancement New feature or request label Oct 1, 2024
@notlesh notlesh changed the base branch from main to notlesh/add_mc_db_testing_to_fix_tests October 1, 2024 23:09
@notlesh notlesh force-pushed the notlesh/add_mc_db_testing_to_fix_tests branch from 61a00a8 to 75309b7 Compare October 2, 2024 16:19
@notlesh
Copy link
Contributor Author

notlesh commented Oct 2, 2024

As of 1d5184d, I think the Bonsai tries are properly reverted (for a simple case, anyway). There are a number of DB operations that I will need to perform, however, and it's not clear exactly what that is. Any pointer here would be appreciated.

It looks like contract storage changes will need to be explicitly reverted as well. The docs here discuss the rocksdb iterator which could be used to clear out items from block N onward, but we would still want a list of modified keys to avoid touching every storage item in the db.

Are other items (such as ContractToNonces) stored this way?

@notlesh notlesh force-pushed the notlesh/add_mc_db_testing_to_fix_tests branch from 75309b7 to 11f96cc Compare October 4, 2024 21:39
Base automatically changed from notlesh/add_mc_db_testing_to_fix_tests to main October 7, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

feat(reorg): Add support for possible l1 and l2 reorgs
1 participant