66 "testing"
77 "time"
88
9- "github.com/ethereum/go-ethereum/core/types "
9+ "github.com/offchainlabs/nitro/arbutil "
1010)
1111
1212func TestEthSyncing (t * testing.T ) {
@@ -18,6 +18,7 @@ func TestEthSyncing(t *testing.T) {
1818 cleanup := builder .Build (t )
1919 defer cleanup ()
2020
21+ builder .execConfig .SyncMonitor .MsgLag = builder .nodeConfig .SyncMonitor .MsgLag
2122 testClientB , cleanupB := builder .Build2ndNode (t , & SecondNodeParams {})
2223 defer cleanupB ()
2324
@@ -29,33 +30,26 @@ func TestEthSyncing(t *testing.T) {
2930
3031 builder .L2Info .GenerateAccount ("User2" )
3132
32- tx := builder .L2Info .PrepareTx ("Owner" , "User2" , builder .L2Info .TransferGas , big .NewInt (1e12 ), nil )
33-
34- err = builder .L2 .Client .SendTransaction (ctx , tx )
35- Require (t , err )
36-
37- _ , err = builder .L2 .EnsureTxSucceeded (tx )
38- Require (t , err )
33+ numTxs := uint64 (5 )
34+ for range numTxs {
35+ builder .L2 .TransferBalance (t , "Owner" , "User2" , big .NewInt (1e12 ), builder .L2Info )
36+ }
3937
40- // give the inbox reader a bit of time to pick up the delayed message
41- time .Sleep (time .Millisecond * 100 )
38+ // Give the inbox reader of testClientB a bit of time to pick up batches from L1 and add it to the consensus db
39+ time .Sleep (time .Millisecond * 500 )
4240
43- // sending l1 messages creates l1 blocks.. make enough to get that delayed inbox message in
44- for i := 0 ; i < 30 ; i ++ {
45- builder .L1 .SendWaitTestTransactions (t , []* types.Transaction {
46- builder .L1Info .PrepareTx ("Faucet" , "User" , 30000 , big .NewInt (1e12 ), nil ),
47- })
48- }
41+ // Advance parent chain enough to get the batches in
42+ AdvanceL1 (t , ctx , builder .L1 .Client , builder .L1Info , 30 )
4943
5044 attempt := 0
5145 for {
5246 if attempt > 30 {
53- Fatal (t , "2nd node didn't get tx on time" )
47+ Fatal (t , "2nd node didn't get all txs on time" )
5448 }
5549 Require (t , ctx .Err ())
5650 countAfter , err := testClientB .ConsensusNode .TxStreamer .GetMessageCount ()
5751 Require (t , err )
58- if countAfter > countBefore {
52+ if countAfter >= countBefore + arbutil . MessageIndex ( numTxs ) {
5953 break
6054 }
6155 select {
0 commit comments