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

Properly handle deep reorgs in engine experimental #10398

Closed
fgimenez opened this issue Aug 20, 2024 · 2 comments
Closed

Properly handle deep reorgs in engine experimental #10398

fgimenez opened this issue Aug 20, 2024 · 2 comments
Labels
C-enhancement New feature or request S-needs-triage This issue needs to be labelled S-stale This issue/PR is stale and will close with no further activity

Comments

@fgimenez
Copy link
Member

fgimenez commented Aug 20, 2024

Describe the feature

In the new version of the engine developed here #8742 we remove disk writes from the hot path by adding an in-memory data structure that keeps track of the most recent blocks. We need to give this data structure a concrete size to balance the increase in performance by keeping this part of the state in memory with the amount of memory required to do so. At some point, the engine will flush to disk the in-memory state persisting it in static files.

When a reorg happens, it is usually handled very efficiently in the in-memory part of the state. The problem arises when the depth of the reorg exceeds the size of the in-memory data structure, we are returning an error but instead, we should properly handle it and update the in-memory and on-disk parts of the state accordingly.

This is also problematic just by creating a fork starting on a block not present in memory.

This issue has been brought up by executing hive tests against a reth instance with enabled --engine.experimental flag. By default, the number of blocks kept in memory by the engine is 2 and the tests that are failing are exercising reorgs of depth 9 or 10, for instance Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P9 (Cancun) (reth) defined here https://github.com/ethereum/hive/blob/f47eebb89be85cee2c9d3fd2d0afbe209ad3e77e/simulators/ethereum/engine/suites/engine/invalid_ancestor.go

Additional context

No response

@fgimenez fgimenez added C-enhancement New feature or request S-needs-triage This issue needs to be labelled labels Aug 20, 2024
Copy link
Contributor

This issue is stale because it has been open for 21 days with no activity.

@github-actions github-actions bot added the S-stale This issue/PR is stale and will close with no further activity label Sep 12, 2024
@mattsse
Copy link
Collaborator

mattsse commented Sep 12, 2024

closing this because this is now supported

@mattsse mattsse closed this as completed Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement New feature or request S-needs-triage This issue needs to be labelled S-stale This issue/PR is stale and will close with no further activity
Projects
Archived in project
Development

No branches or pull requests

2 participants