Skip to content

fix: remove redundant header insertion in extend_blocks and tests#19534

Merged
shekhirin merged 4 commits intoparadigmxyz:mainfrom
phrwlk:fix/mock-provider-extend-blocks-header-dup
Nov 6, 2025
Merged

fix: remove redundant header insertion in extend_blocks and tests#19534
shekhirin merged 4 commits intoparadigmxyz:mainfrom
phrwlk:fix/mock-provider-extend-blocks-header-dup

Conversation

@phrwlk
Copy link
Copy Markdown
Contributor

@phrwlk phrwlk commented Nov 6, 2025

The mock provider’s extend_blocks() called add_header() and then add_block(), but add_block() already inserts the header. This resulted in redundant header insertions (double locking and duplicate HashMap inserts). In tests, persist_blocks() additionally called extend_headers(), effectively causing triple insertion.

Changes:

  • test_utils/mock.rs: extend_blocks() now only calls add_block().
  • engine/tree/tests.rs: removed extend_headers(...) in persist_blocks().

This keeps header insertion centralized in add_block(), aligns extend_* helper semantics with others, reduces unnecessary work, and preserves expected ordering.

Copy link
Copy Markdown
Member

@shekhirin shekhirin left a comment

Choose a reason for hiding this comment

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

Good catch

@github-project-automation github-project-automation bot moved this from Backlog to In Progress in Reth Tracker Nov 6, 2025
@shekhirin shekhirin added the C-test A change that impacts how or what we test label Nov 6, 2025
@shekhirin shekhirin added this pull request to the merge queue Nov 6, 2025
Merged via the queue into paradigmxyz:main with commit 65acaf3 Nov 6, 2025
42 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Reth Tracker Nov 6, 2025
@phrwlk phrwlk deleted the fix/mock-provider-extend-blocks-header-dup branch December 14, 2025 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-test A change that impacts how or what we test

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants