Skip to content

op-sync-tester: eth namespace relay#17117

Merged
nonsense merged 16 commits intodevelopfrom
pcw109550/sync-tester-eth-namespace-harden
Aug 20, 2025
Merged

op-sync-tester: eth namespace relay#17117
nonsense merged 16 commits intodevelopfrom
pcw109550/sync-tester-eth-namespace-harden

Conversation

@pcw109550
Copy link
Member

@pcw109550 pcw109550 commented Aug 18, 2025

Description

Fully implement the eth namespace, validating with unit tests.

Adds ReadOnlyELBackend interface to wrap around ethclient.Client, for ensuring we are calling only the read only rpcs and ease of testing.

Sync Tester backend will access the EL through ReadOnlyELBackend, and eth namespace APIs is used to craft the appropriate response.

Generalized the Session state as

type Session struct {
	SessionID string

	// Canonical view of the chain
	CurrentState FCUState

	InitialState FCUState
}

type FCUState struct {
	Latest    uint64
	Safe      uint64
	Finalized uint64
}

To hold the initial fcu state and the current fcu state. eth rpcs will use the current fcu state to decide to relay or not.

Block labels (latest, safe, finalized) is handled.

Tests

Unit test for eth_getBlockReceipts, eth_getBlockByHash, eth_getBlockByNumber added.

Additional context

We need correctness of relay for both eth / engine namespace for proper sync. Worth to validate each namespace using unit tests, and this PR for eth.

Metadata

@pcw109550 pcw109550 requested a review from nonsense August 18, 2025 17:26
@pcw109550 pcw109550 changed the title op-sync-tester: eth namespace harden op-sync-tester: eth namespace relay Aug 18, 2025
@codecov
Copy link

codecov bot commented Aug 19, 2025

Codecov Report

❌ Patch coverage is 7.47664% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 8.23%. Comparing base (f207738) to head (fa49d11).
⚠️ Report is 9 commits behind head on develop.

Files with missing lines Patch % Lines
op-sync-tester/synctester/backend/sync_tester.go 9.87% 73 Missing ⚠️
op-sync-tester/synctester/backend/el_reader.go 0.00% 26 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (f207738) and HEAD (fa49d11). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (f207738) HEAD (fa49d11)
cannon-go-tests-64 2 0
contracts-bedrock-tests 2 0
Additional details and impacted files
@@             Coverage Diff              @@
##           develop   #17117       +/-   ##
============================================
- Coverage    45.71%    8.23%   -37.49%     
============================================
  Files         1478        3     -1475     
  Lines       119947      255   -119692     
============================================
- Hits         54837       21    -54816     
+ Misses       61263      234    -61029     
+ Partials      3847        0     -3847     
Flag Coverage Δ
cannon-go-tests-64 ?
contracts-bedrock-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
op-sync-tester/synctester/backend/backend.go 4.83% <ø> (-50.00%) ⬇️
op-sync-tester/synctester/backend/el_reader.go 0.00% <0.00%> (ø)
op-sync-tester/synctester/backend/sync_tester.go 10.77% <9.87%> (+0.68%) ⬆️

... and 1476 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pcw109550 pcw109550 force-pushed the pcw109550/sync-tester-eth-namespace-harden branch from fa49d11 to 9feeef0 Compare August 19, 2025 09:24
@pcw109550 pcw109550 marked this pull request as ready for review August 19, 2025 14:03
@pcw109550 pcw109550 requested a review from a team as a code owner August 19, 2025 14:03
@nonsense nonsense added this pull request to the merge queue Aug 20, 2025
Merged via the queue into develop with commit a1a200a Aug 20, 2025
66 checks passed
@nonsense nonsense deleted the pcw109550/sync-tester-eth-namespace-harden branch August 20, 2025 09:29
leopoldjoy pushed a commit to leopoldjoy/optimism that referenced this pull request Aug 22, 2025
* op-sync-tester: eth namespace relay

* simplify

* More synctester example configs

* better error handling fore eth_chainId

* safety guard

* read only backend encapsulation

* fix lint

* rename

* refactor sync tester init

* mock rl backend and chainID test

* refactor

* GetBlockByHash tests

* GetBlockByNumber tests

* GetBlockReceipts tests

* consistency

* fix logic error
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.

op-sync-tester: Support eth namespace

2 participants