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

refactor: unify code paths for receipts removal #12887

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

klkvr
Copy link
Collaborator

@klkvr klkvr commented Nov 26, 2024

Unifies code paths for receipts removal which is happening in take_state_above (used by legacy engine and ExecutionStage unwind and in remove_state_above (used by new engine and unwind through cli)

New function DatabaseProvider::remove_receipts_from is introduced which accepts the starting receipt number to remove and StorageLocation and removes receipts from database/static files

This PR also includes a fix for take_state_above which might've returned incorrect receipts data in ExecutionOutcome if receipts were removed from database. It did not account for receipts being pruned or moved to static files.

@mattsse
Copy link
Collaborator

mattsse commented Nov 26, 2024

thread 'stages::execution::tests::sanity_execute_unwind' panicked at crates/stages/stages/src/stages/execution.rs:1069:18:
called Result::unwrap() on an Err value: DatabaseIntegrity(NippyJar("Pruning should be committed before appending or pruning more data"))

@klkvr
Copy link
Collaborator Author

klkvr commented Nov 26, 2024

thread 'stages::execution::tests::sanity_execute_unwind' panicked at crates/stages/stages/src/stages/execution.rs:1069:18:
called Result::unwrap() on an Err value: DatabaseIntegrity(NippyJar("Pruning should be committed before appending or pruning more data"))

fixed in 45dee0e

had to apply similar refactor for ExecutionStage consistency checks as in #12743

  • missing_static_data_error is now reused between body and execution stage
  • prepare_static_file_producer logic moved to ExecutionStage::ensure_consistency and checks the current unwind target like BodyStage::ensure_consistency

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm

@mattsse mattsse added A-db Related to the database A-sdk Related to reth's use as a library labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-db Related to the database A-sdk Related to reth's use as a library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants