forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Tip Node #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Tip Node #5
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
d340a84
docs: add lite mode design document
karlfloersch dd13439
test: add sync tester test runner script
65895da
docs: add comprehensive testing section to lite mode design
a003344
feat(op-node): add lite mode configuration and CLI flags
93e4375
feat(op-node): disable derivation in lite mode
ef2604e
feat(op-node): add LiteModeSync component
b177d39
feat(op-node): integrate LiteModeSync into Driver
aa52865
fix(op-node): fix compilation errors in lite mode integration
6ab4d94
docs(lite-mode): update environment variable names in test documentation
e1ac4b2
feat(devstack): add lite mode support to test infrastructure
aa9c015
fix(devstack): add missing os import for lite mode support
d0b113a
fix(lite-mode): handle missing eth_syncing method gracefully
513f8c2
fix(lite-mode): remove eth_syncing check and fix close panic
1857f2c
feat(lite-mode): fix unsafe head initialization and complete implemen…
dfd2e98
refactor(lite-mode): use FindL2Heads for initialization instead of ma…
4a00e95
feat(lite-mode): add acceptance tests and fix sync issues
f9210f2
refactor(lite-mode): move derivation disable to SyncStep for clarity
250276a
refactor(lite-mode): swap order and move catch-up logic to updateFina…
4554e4d
refactor(lite-mode): simplify safe head sync with backward-walking al…
96138c3
refactor(lite-mode): address review feedback
19eb5ac
feat(lite-mode): optimize block verification with header-only fetches
37a66f1
fix(lite-mode): use event system instead of direct engine calls
9a8d214
refactor(test): separate lite mode into dedicated test function
8a3dd82
refactor(lite-mode): extract block hash lookup into helper function
466b351
refactor(lite-mode): remove redundant warning when block lookup fails
d4b3556
fix(lite-mode): return error when remote safe is behind local finalized
cfaf487
refactor(lite-mode): integrate sync into SyncStep instead of separate…
d53ffc8
fix(lite-mode): use direct engine method calls instead of events and …
2bf330e
fix(lite-mode): wait for L1 finalization before checking L2 finalized
064a4c2
perf(lite-mode): prevent CPU starvation of P2P unsafe block processing
25f08ce
fix(lite-mode): disable challenger in lite mode tests to prevent flakes
311da5f
fix(lite-mode): prevent duplicate block insertions causing reorgs
fb9bb40
chore(lite-mode): remove polling logic and unused documentation
bc73f3a
chore: remove .gitignore from lite_mode tests
913bbc6
refactor: rename lite mode to tip mode throughout codebase
ea139b2
fix: correct tip mode environment variable naming
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
op-acceptance-tests/tests/sync_tester/sync_tester_ext_el/run_test.sh
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #!/bin/bash | ||
| # Script to run the sync tester external EL test | ||
| # This test validates op-node syncing against external execution layer endpoints | ||
|
|
||
| set -e | ||
|
|
||
| # Configuration | ||
| TEST_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| LOG_FILE="${TEST_DIR}/test_run_$(date +%Y%m%d_%H%M%S).log" | ||
| LITE_MODE_RPC="${OP_NODE_LITE_MODE_RPC:-}" | ||
|
|
||
| # Colors for output | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[1;33m' | ||
| NC='\033[0m' # No Color | ||
|
|
||
| echo "==========================================" | ||
| echo "OP Stack Sync Tester - External EL" | ||
| echo "==========================================" | ||
| echo "Test Directory: ${TEST_DIR}" | ||
| echo "Log File: ${LOG_FILE}" | ||
| if [ -n "${LITE_MODE_RPC}" ]; then | ||
| echo -e "${YELLOW}Lite Mode: ENABLED${NC}" | ||
| echo "Lite Mode RPC: ${LITE_MODE_RPC}" | ||
| else | ||
| echo "Lite Mode: DISABLED (standard derivation)" | ||
| fi | ||
| echo "==========================================" | ||
| echo "" | ||
|
|
||
| cd "${TEST_DIR}" | ||
|
|
||
| # Run the test | ||
| echo "Starting test..." | ||
| CIRCLECI_PARAMETERS_SYNC_TEST_OP_NODE_DISPATCH=true \ | ||
| TAILSCALE_NETWORKING=true \ | ||
| NETWORK_PRESET=op-sepolia \ | ||
| GOMAXPROCS=5 \ | ||
| OP_NODE_LITE_MODE_RPC="${LITE_MODE_RPC}" \ | ||
| go test -run '^TestSyncTesterExtEL$' -v -count=1 2>&1 | tee "${LOG_FILE}" | ||
|
|
||
| # Check exit code | ||
| EXIT_CODE=${PIPESTATUS[0]} | ||
|
|
||
| echo "" | ||
| echo "==========================================" | ||
| if [ ${EXIT_CODE} -eq 0 ]; then | ||
| echo -e "${GREEN}TEST PASSED ✓${NC}" | ||
| else | ||
| echo -e "${RED}TEST FAILED ✗${NC}" | ||
| fi | ||
| echo "Exit Code: ${EXIT_CODE}" | ||
| echo "Log File: ${LOG_FILE}" | ||
| echo "==========================================" | ||
|
|
||
| exit ${EXIT_CODE} |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,8 +23,10 @@ import ( | |
| "github.com/ethereum-optimism/optimism/op-node/rollup/sequencing" | ||
| "github.com/ethereum-optimism/optimism/op-node/rollup/status" | ||
| "github.com/ethereum-optimism/optimism/op-node/rollup/sync" | ||
| "github.com/ethereum-optimism/optimism/op-service/client" | ||
| "github.com/ethereum-optimism/optimism/op-service/eth" | ||
| "github.com/ethereum-optimism/optimism/op-service/event" | ||
| "github.com/ethereum-optimism/optimism/op-service/sources" | ||
| ) | ||
|
|
||
| // NewDriver composes an events handler that tracks L1 state, triggers L2 Derivation, and optionally sequences new L2 blocks. | ||
|
|
@@ -132,6 +134,42 @@ func NewDriver( | |
| sequencer = sequencing.DisabledSequencer{} | ||
| } | ||
|
|
||
| // Initialize lite mode sync if enabled | ||
| var liteModeSync *LiteModeSync | ||
| if syncCfg.LiteModeEnabled { | ||
| if driverCfg.LiteModeRPC == "" { | ||
| log.Crit("Lite mode enabled but no remote RPC endpoint configured") | ||
| } | ||
|
|
||
| log.Info("Initializing lite mode sync", | ||
| "remote_rpc", driverCfg.LiteModeRPC, | ||
| "poll_interval", driverCfg.LiteModePollInterval) | ||
|
|
||
| // Create remote L2 client (no JWT needed for external RPCs) | ||
| remoteRPC, err := client.NewRPC(driverCtx, log, driverCfg.LiteModeRPC) | ||
| if err != nil { | ||
| log.Crit("Failed to create remote RPC client for lite mode", "err", err) | ||
| } | ||
|
|
||
| // Create L2 client for the remote endpoint | ||
| // Use nil metrics since we don't need caching metrics for remote client | ||
| remoteClientCfg := sources.L2ClientDefaultConfig(cfg, true) | ||
| remoteL2Client, err := sources.NewL2Client(remoteRPC, log, nil, remoteClientCfg) | ||
| if err != nil { | ||
| log.Crit("Failed to create remote L2 client for lite mode", "err", err) | ||
| } | ||
|
|
||
| liteModeSync = NewLiteModeSync( | ||
| driverCtx, | ||
| log, | ||
| cfg, | ||
| remoteL2Client, // remoteEL | ||
| l2, // localEL | ||
| ec, // engine | ||
| driverCfg.LiteModePollInterval, | ||
| ) | ||
| } | ||
|
|
||
| driverEmitter := sys.Register("driver", nil) | ||
| driver := &Driver{ | ||
| StatusTracker: statusTracker, | ||
|
|
@@ -149,6 +187,7 @@ func NewDriver( | |
| sequencer: sequencer, | ||
| metrics: metrics, | ||
| altSync: altSync, | ||
| liteModeSync: liteModeSync, | ||
| } | ||
|
|
||
| return driver | ||
|
|
@@ -181,6 +220,9 @@ type Driver struct { | |
|
|
||
| sequencer sequencing.SequencerIface | ||
|
|
||
| // Lite mode sync component (nil if not in lite mode) | ||
| liteModeSync *LiteModeSync | ||
|
|
||
| metrics Metrics | ||
| log log.Logger | ||
|
|
||
|
|
@@ -195,6 +237,12 @@ type Driver struct { | |
| func (s *Driver) Start() error { | ||
| log.Info("Starting driver", "sequencerEnabled", s.driverConfig.SequencerEnabled, | ||
| "sequencerStopped", s.driverConfig.SequencerStopped, "recoverMode", s.driverConfig.RecoverMode) | ||
|
|
||
| // Start lite mode sync if enabled | ||
| if s.liteModeSync != nil { | ||
| s.liteModeSync.Start() | ||
| } | ||
|
|
||
| if s.driverConfig.SequencerEnabled { | ||
| if s.driverConfig.RecoverMode { | ||
| log.Warn("sequencer is in recover mode") | ||
|
|
@@ -218,6 +266,10 @@ func (s *Driver) Close() error { | |
| s.driverCancel() | ||
| s.wg.Wait() | ||
| s.sequencer.Close() | ||
| // Close lite mode sync if enabled | ||
| if s.liteModeSync != nil { | ||
| s.liteModeSync.Close() | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
|
|
@@ -229,6 +281,13 @@ func (s *Driver) eventLoop() { | |
|
|
||
| defer s.driverCancel() | ||
|
|
||
| // In lite mode, emit a reset event at startup to properly initialize forkchoice state. | ||
| // This triggers FindL2Heads which handles the case where unsafe < finalized. | ||
| if s.liteModeSync != nil { | ||
| s.log.Info("Lite mode: requesting initial engine reset to establish forkchoice state") | ||
| s.emitter.Emit(s.driverCtx, engine.ResetEngineRequestEvent{}) | ||
| } | ||
|
|
||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a more canonical way to do this? Where is this logic handled in the standard derivation process? |
||
| // reqStep requests a derivation step nicely, with a delay if this is a reattempt, or not at all if we already scheduled a reattempt. | ||
| reqStep := func() { | ||
| s.sched.RequestStep(s.driverCtx, false) | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we panic? How are other critical misconfigurations handled?