Skip to content

fix: block history pruning getting stuck#10123

Open
hirako2000 wants to merge 5 commits intoNethermindEth:masterfrom
hirako2000:fix/history-pruning-stuck-10119
Open

fix: block history pruning getting stuck#10123
hirako2000 wants to merge 5 commits intoNethermindEth:masterfrom
hirako2000:fix/history-pruning-stuck-10119

Conversation

@hirako2000
Copy link

@hirako2000 hirako2000 commented Jan 6, 2026

Fixes #10119

Changes

Adds block to history pruner to handle the edge case where some block was already pruned, to move the delete pointer.

Types of changes

What types of changes does your code introduce?

  • Bugfix
  • New feature
  • Breaking change
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

All existing unit tests for HistoryPruner still pass.
Added a test to reproduce the issue.

Running the full tests suites locally yields non deterministic errors, but all appear unrelated to this changeset.

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

Remarks

I suspect far many more than 1 block were skipping pruning if my understanding of the bug is right, it may be that the loop returning the blocks to prune may have stopped at the first already pruned block. Thus potentially causing no more pruning at any subsequent run: stuck on infinite attempt to prune a ghost block. If so Release notes may require an explanation.

@Marchhill Marchhill self-requested a review January 7, 2026 19:34
@hirako2000 hirako2000 marked this pull request as ready for review January 8, 2026 20:42
@hirako2000 hirako2000 changed the title FIx for block history pruning getting stuck fix: block history pruning getting stuck Jan 8, 2026
@flcl42
Copy link
Contributor

flcl42 commented Jan 8, 2026

Could you add a test that would not pass without your fix?

@hirako2000
Copy link
Author

add a test that would not pass without your fix

Yes I have not added any tests that demonstrates the bug.

Looking at it it's also clear there could be a less invasive fix. I'm putting this PR back as a draft until I get my head around this.

My understanding as to why this bug can happen is that the manual pruning likely ran, left block with empty bodies, and the history (rolling pruner) attempts to delete an already pruned block. Still working on it but if a fix needs to be expedited someone else could grab the issue.

@hirako2000 hirako2000 marked this pull request as draft January 9, 2026 16:25
@hirako2000
Copy link
Author

hirako2000 commented Jan 10, 2026

Could you add a test that would not pass without your fix?

I have revisited the fix to be less invasive.
I added a single unit test that reproduce the bug.

Thank you for the input @flcl42 it prompted further thinking.

My understanding of the bug is that it surfaces as edge case scenario, where a manual pruning could have already taken place, conflicting with the history pruner assumptions that block exists if it is to be pruned.

@hirako2000 hirako2000 marked this pull request as ready for review January 10, 2026 14:48
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.

Node is trying to remove one more block (at least in logs)

2 participants