Skip to content

Commit 9101f11

Browse files
committed
update test based on new behavior
1 parent 1300d16 commit 9101f11

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/e2e/evm_full_node_e2e_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,20 @@ func testSequencerFullNodeRestart(t *testing.T, initialLazyMode, restartLazyMode
12221222

12231223
t.Log("Phase 4: Verifying blockchain state preservation after restart...")
12241224

1225+
// After restart, the full node needs to re-fetch blocks via P2P from the sequencer.
1226+
// Wait for the full node to sync up to the pre-restart height before verifying state preservation.
1227+
t.Log("Waiting for full node to re-sync blocks via P2P after restart...")
1228+
require.Eventually(t, func() bool {
1229+
fnHeader, fnErr := fullNodeClient.HeaderByNumber(ctx, nil)
1230+
if fnErr != nil {
1231+
return false
1232+
}
1233+
fnHeight := fnHeader.Number.Uint64()
1234+
t.Logf("Full node re-sync progress: current=%d, target=%d", fnHeight, preRestartFnHeight)
1235+
return fnHeight >= preRestartFnHeight
1236+
}, 60*time.Second, 1*time.Second, "Full node should re-sync to pre-restart height via P2P")
1237+
t.Log("Full node re-synced to pre-restart height")
1238+
12251239
postRestartSeqHeader, err := sequencerClient.HeaderByNumber(ctx, nil)
12261240
require.NoError(t, err, "Should get sequencer header after restart")
12271241
postRestartFnHeader, err := fullNodeClient.HeaderByNumber(ctx, nil)
@@ -1270,6 +1284,31 @@ func testSequencerFullNodeRestart(t *testing.T, initialLazyMode, restartLazyMode
12701284

12711285
t.Log("Phase 5: Verifying post-restart functionality and P2P sync...")
12721286

1287+
// After restart, the full node needs to re-fetch blocks via P2P from the sequencer.
1288+
// Wait for the full node to fully sync with the sequencer before submitting new transactions.
1289+
t.Log("Waiting for full node to fully sync with sequencer after restart...")
1290+
require.Eventually(t, func() bool {
1291+
seqHeader, seqErr := sequencerClient.HeaderByNumber(ctx, nil)
1292+
fnHeader, fnErr := fullNodeClient.HeaderByNumber(ctx, nil)
1293+
1294+
if seqErr != nil || fnErr != nil {
1295+
return false
1296+
}
1297+
1298+
seqHeight := seqHeader.Number.Uint64()
1299+
fnHeight := fnHeader.Number.Uint64()
1300+
1301+
// Full node should be within 2 blocks of sequencer to be considered fully synced
1302+
heightDiff := int64(seqHeight) - int64(fnHeight)
1303+
if heightDiff < 0 {
1304+
heightDiff = -heightDiff
1305+
}
1306+
1307+
t.Logf("Sync progress: sequencer=%d, full_node=%d, diff=%d", seqHeight, fnHeight, heightDiff)
1308+
return heightDiff <= 2
1309+
}, 60*time.Second, 1*time.Second, "Full node should fully sync with sequencer after restart")
1310+
t.Log("Full node fully synced with sequencer")
1311+
12731312
// Submit new transactions after restart to verify functionality
12741313
const numPostRestartTxs = 3
12751314
var postRestartTxHashes []common.Hash
@@ -1283,6 +1322,7 @@ func testSequencerFullNodeRestart(t *testing.T, initialLazyMode, restartLazyMode
12831322
t.Logf("Post-restart transaction %d included in sequencer block %d", i+1, txBlockNumber)
12841323

12851324
// Verify transaction syncs to full node (testing P2P sync functionality)
1325+
// Use longer timeout after restart since P2P sync pipeline may need time to stabilize
12861326
verifyTransactionSync(t, sequencerClient, fullNodeClient, txHash, txBlockNumber)
12871327
t.Logf("✅ Post-restart transaction %d synced to full node via P2P", i+1)
12881328

0 commit comments

Comments
 (0)