graph: Revert earliest_block off-by-one fix from #6340#6403
Open
dimitrovmaksim wants to merge 1 commit intographprotocol:masterfrom
Open
graph: Revert earliest_block off-by-one fix from #6340#6403dimitrovmaksim wants to merge 1 commit intographprotocol:masterfrom
dimitrovmaksim wants to merge 1 commit intographprotocol:masterfrom
Conversation
The +1 introduced in fa6d677 broke two things for deployments with history_blocks = reorg_threshold + 1: - strategy() returned None (earliest_block == final_block), so pruning silently did nothing even though set_earliest_block had already advanced earliest_block_number in the database - revert_block_ptr then failed for any reorg because earliest_block_number > ptr.number - reorg_threshold Both revert_block_ptr and strategy rely on earliest_block < final_block, which requires reorg_threshold + 2 actual blocks on disk. The old formula (earliest_block = latest_block - history_blocks) keeps history_blocks + 1 blocks, providing exactly that buffer when history_blocks >= reorg_threshold + 1. The copy_nonfinal_entities fix from 46367e7 is preserved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The +1 introduced in fa6d677 broke two things for deployments with history_blocks = reorg_threshold + 1:
Both revert_block_ptr and strategy rely on earliest_block < final_block, which requires reorg_threshold + 2 actual blocks on disk. The old formula (earliest_block = latest_block - history_blocks) keeps history_blocks + 1 blocks, providing exactly that buffer when history_blocks >= reorg_threshold + 1.
The copy_nonfinal_entities fix from 46367e7 is preserved.