Skip to content

Update block_cache.rs#748

Open
oooLowNeoNooo wants to merge 1 commit intoa16z:masterfrom
oooLowNeoNooo:fix/block-cache-consistency-check
Open

Update block_cache.rs#748
oooLowNeoNooo wants to merge 1 commit intoa16z:masterfrom
oooLowNeoNooo:fix/block-cache-consistency-check

Conversation

@oooLowNeoNooo
Copy link
Copy Markdown

Problem

The block cache consistency check only compared block numbers without verifying chain continuity. This could allow disconnected blocks to be added when the parent block wasn't in cache.

Solution

Updated the check to verify that new blocks actually continue the chain by validating:

  • The block follows the finalized block (block_number == finalized_number + 1 with matching parent_hash)
  • Or the block follows the latest cached block (block_number == latest_number + 1 with matching parent_hash)

Blocks that don't continue from any known block are now correctly rejected.

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.

1 participant