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

fix(tree): adjust both number and hash when removing persisted blocks from memory #11133

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

fgimenez
Copy link
Member

On TreeState::remove_until we only update the block number when the finalized num is ahead of the upper bound.

// If the finalized num is ahead of the upper bound, and exists, we need to instead ensure
// that the only blocks removed, are canonical blocks less than the upper bound
// finalized_num.take_if(|finalized| *finalized > upper_bound);
let finalized_num_hash = finalized_num_hash.map(|mut finalized| {
finalized.number = finalized.number.min(upper_bound);
debug!(target: "engine::tree", ?finalized, "Adjusted upper bound");
finalized
});

We should update the hash too, it is used later in prune_finalized_sidechains

@fgimenez fgimenez added C-bug An unexpected or incorrect behavior A-engine Related to the engine implementation labels Sep 23, 2024
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

ahh this makes sense

@fgimenez fgimenez enabled auto-merge September 23, 2024 16:38
@fgimenez fgimenez added this pull request to the merge queue Sep 23, 2024
Merged via the queue into paradigmxyz:main with commit fc12639 Sep 23, 2024
35 checks passed
@fgimenez fgimenez deleted the fgimenez/fix-removal-target-block branch September 23, 2024 17:10
0xForerunner pushed a commit to 0xForerunner/reth that referenced this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-engine Related to the engine implementation C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants