1111// - Block propagation verification with multiple full nodes
1212// - Distributed node restart and recovery mechanisms
1313// - Lazy mode sequencer behavior with full node sync
14+ // - DA (Data Availability) inclusion synchronization between nodes
1415//
1516// Test Coverage:
1617// 1. TestEvmSequencerWithFullNodeE2E - Full node P2P sync with sequencer
@@ -23,6 +24,7 @@ package e2e
2324
2425import (
2526 "context"
27+ "encoding/binary"
2628 "flag"
2729 "path/filepath"
2830 "testing"
@@ -31,6 +33,9 @@ import (
3133 "github.com/ethereum/go-ethereum/common"
3234 "github.com/ethereum/go-ethereum/ethclient"
3335 "github.com/stretchr/testify/require"
36+
37+ "github.com/rollkit/rollkit/pkg/rpc/client"
38+ "github.com/rollkit/rollkit/pkg/store"
3439)
3540
3641// Note: evmSingleBinaryPath is declared in evm_sequencer_e2e_test.go to avoid duplicate declaration
@@ -264,6 +269,8 @@ func setupSequencerWithFullNode(t *testing.T, sut *SystemUnderTest, sequencerHom
264269// 5. Submits transaction to sequencer EVM and gets the block number
265270// 6. Verifies the full node syncs the exact same block containing the transaction
266271// 7. Performs comprehensive state root verification across all synced blocks
272+ // 8. Queries full node's latest block height and waits 2 DA block times for DA inclusion
273+ // 9. Verifies DA (Data Availability) inclusion has caught up to the queried block height
267274//
268275// Validation:
269276// - Both sequencer and full node start successfully
@@ -273,6 +280,7 @@ func setupSequencerWithFullNode(t *testing.T, sut *SystemUnderTest, sequencerHom
273280// - Transaction data is identical on both nodes (same block, same receipt)
274281// - State roots match between sequencer and full node for all blocks (key validation)
275282// - Block hashes and transaction counts are consistent across both nodes
283+ // - DA included height >= full node's block height after wait (ensuring DA layer sync)
276284//
277285// Key Technical Details:
278286// - Uses separate Docker Compose configurations for different EVM ports
@@ -283,8 +291,10 @@ func setupSequencerWithFullNode(t *testing.T, sut *SystemUnderTest, sequencerHom
283291// - Ensures EVM state consistency between sequencer and full node on the Reth side
284292//
285293// This test demonstrates that full nodes can sync with sequencers in real-time,
286- // validates the P2P block propagation mechanism in Rollkit, and ensures that
287- // the underlying EVM execution state remains consistent across all nodes.
294+ // validates the P2P block propagation mechanism in Rollkit, ensures that
295+ // the underlying EVM execution state remains consistent across all nodes, and
296+ // verifies that DA (Data Availability) inclusion processes blocks within expected
297+ // timeframes after allowing sufficient time for DA layer synchronization.
288298func TestEvmSequencerWithFullNodeE2E (t * testing.T ) {
289299 flag .Parse ()
290300 workDir := t .TempDir ()
@@ -398,8 +408,73 @@ func TestEvmSequencerWithFullNodeE2E(t *testing.T) {
398408 }
399409 }
400410
401- t .Logf ("✅ Test PASSED : All blocks (%d-%d) have matching state roots, %d transactions synced successfully across blocks %v" ,
411+ t .Logf ("✅ State root verification passed : All blocks (%d-%d) have matching state roots, %d transactions synced successfully across blocks %v" ,
402412 startHeight , endHeight , len (txHashes ), txBlockNumbers )
413+
414+ // === DA INCLUSION VERIFICATION ===
415+
416+ t .Log ("Verifying DA inclusion for latest block height..." )
417+
418+ // Create RPC client for full node
419+ fullNodeRPCClient := client .NewClient ("http://127.0.0.1:" + FullNodeRPCPort )
420+
421+ // Get the full node's current block height before waiting
422+ fnHeader , err = fullNodeClient .HeaderByNumber (fnCtx , nil )
423+ require .NoError (t , err , "Should get full node header for DA inclusion check" )
424+ fnBlockHeightBeforeWait := fnHeader .Number .Uint64 ()
425+
426+ t .Logf ("Full node block height before DA inclusion wait: %d" , fnBlockHeightBeforeWait )
427+
428+ // Wait for one DA block time to allow DA inclusion to process
429+ waitTime := 1 * time .Second
430+ t .Logf ("Waiting %v (1 DA block time) for DA inclusion to process..." , waitTime )
431+ time .Sleep (waitTime )
432+
433+ // Get the DA included height from full node after the wait
434+ fnDAIncludedHeightBytes , err := fullNodeRPCClient .GetMetadata (fnCtx , store .DAIncludedHeightKey )
435+ require .NoError (t , err , "Should get DA included height from full node" )
436+
437+ // Decode the DA included height
438+ require .Equal (t , 8 , len (fnDAIncludedHeightBytes ), "DA included height should be 8 bytes" )
439+ fnDAIncludedHeight := binary .LittleEndian .Uint64 (fnDAIncludedHeightBytes )
440+
441+ t .Logf ("After waiting, full node DA included height: %d" , fnDAIncludedHeight )
442+
443+ // Verify that the DA included height is >= the full node's block height before wait
444+ // This ensures that the blocks that existed before the wait have been DA included
445+ require .GreaterOrEqual (t , fnDAIncludedHeight , fnBlockHeightBeforeWait ,
446+ "Full node DA included height (%d) should be >= block height before wait (%d)" ,
447+ fnDAIncludedHeight , fnBlockHeightBeforeWait )
448+
449+ t .Logf ("✅ DA inclusion verification passed:" )
450+ t .Logf (" - Full node block height before wait: %d" , fnBlockHeightBeforeWait )
451+ t .Logf (" - Full node DA included height after wait: %d" , fnDAIncludedHeight )
452+ t .Logf (" - DA inclusion caught up to full node's block height ✓" )
453+
454+ // === COMPREHENSIVE TEST SUMMARY ===
455+
456+ t .Logf ("" )
457+ t .Logf ("🎉 TEST PASSED: Comprehensive EVM Full Node E2E Test Successfully Completed!" )
458+ t .Logf (" 📊 Test Statistics:" )
459+ t .Logf (" • Total transactions submitted: %d" , len (txHashes ))
460+ t .Logf (" • Transaction blocks: %v" , txBlockNumbers )
461+ t .Logf (" • Final sequencer height: %d" , seqHeight )
462+ t .Logf (" • Final full node height: %d" , fnHeight )
463+ t .Logf (" • State root verification range: blocks %d-%d" , startHeight , endHeight )
464+ t .Logf (" • Full node block height before DA wait: %d" , fnBlockHeightBeforeWait )
465+ t .Logf (" • DA wait time: %v (1 DA block time)" , waitTime )
466+ t .Logf (" • Full node DA included height after wait: %d" , fnDAIncludedHeight )
467+ t .Logf ("" )
468+ t .Logf (" ✅ Verified Components:" )
469+ t .Logf (" • P2P connection establishment between sequencer and full node" )
470+ t .Logf (" • Real-time transaction synchronization via P2P" )
471+ t .Logf (" • Block propagation and consistency across nodes" )
472+ t .Logf (" • State root consistency across all synced blocks" )
473+ t .Logf (" • Transaction receipt consistency between nodes" )
474+ t .Logf (" • DA (Data Availability) inclusion processing within expected timeframes" )
475+ t .Logf (" • EVM execution state consistency" )
476+ t .Logf ("" )
477+ t .Logf (" 🏆 All validation criteria met - distributed rollkit network is functioning correctly!" )
403478}
404479
405480// TestEvmFullNodeBlockPropagationE2E tests that blocks produced by the aggregator
0 commit comments