Skip to content

Set l2_block in try_fetch for pre-Isthmus forks; add reload tests#2994

Merged
rakita merged 2 commits intobluealloy:mainfrom
Snezhkko:fix/op-l1block-set-l2-block-pre-isthmus
Sep 18, 2025
Merged

Set l2_block in try_fetch for pre-Isthmus forks; add reload tests#2994
rakita merged 2 commits intobluealloy:mainfrom
Snezhkko:fix/op-l1block-set-l2-block-pre-isthmus

Conversation

@Snezhkko
Copy link
Contributor

Set l2_block in L1BlockInfo::try_fetch for Bedrock/Regolith and Ecotone (pre-Isthmus) branches to align caching/reload semantics with Isthmus.
Reason: OpHandler checks ctx.chain().l2_block != block_number to decide whether to reload. When l2_block was left at U256::ZERO pre-Isthmus, the handler reloaded on every non-deposit tx within the same block, defeating the intended cache and causing redundant DB fetches.
This change ensures consistent behavior across forks, reduces unnecessary DB reads, and matches the documented intent (“reloaded if not current block”).
Add tests mirroring the Isthmus case to verify reload behavior for Regolith and Ecotone pre-Isthmus:

  • test_reload_l1_block_info_regolith
  • test_reload_l1_block_info_ecotone_pre_isthmus

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 18, 2025

CodSpeed Performance Report

Merging #2994 will improve performances by 3.3%

Comparing Snezhkko:fix/op-l1block-set-l2-block-pre-isthmus (bbb27c4) with main (c7e8c29)

Summary

⚡ 1 improvement
✅ 172 untouched

Benchmarks breakdown

Benchmark BASE HEAD Change
EXTCODECOPY_50 46.2 µs 44.7 µs +3.3%

Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

This makes sense, good find.

@rakita rakita merged commit 372f303 into bluealloy:main Sep 18, 2025
31 checks passed
@github-actions github-actions bot mentioned this pull request Sep 17, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 21, 2026
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.

2 participants