Skip to content

Commit

Permalink
fix wait
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaubennassar committed Nov 13, 2024
1 parent ce0b851 commit c9950df
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions l1infotreesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ func TestStressAndReorgs(t *testing.T) {
}
}

commitBlocks(t, client, 2, time.Millisecond*10)
commitBlocks(t, client, 1, time.Millisecond*10)

waitForSyncerToCatchUp(ctx, t, syncer, client)

Expand Down Expand Up @@ -340,9 +340,17 @@ func TestStressAndReorgs(t *testing.T) {

func waitForSyncerToCatchUp(ctx context.Context, t *testing.T, syncer *l1infotreesync.L1InfoTreeSync, client *simulated.Backend) {
t.Helper()
lastBlockNum, err := client.Client().BlockNumber(ctx)
require.NoError(t, err)
helpers.RequireProcessorUpdated(t, syncer, lastBlockNum)
for {
lastBlockNum, err := client.Client().BlockNumber(ctx)
require.NoError(t, err)
helpers.RequireProcessorUpdated(t, syncer, lastBlockNum)
lastBlockNum2, err := client.Client().BlockNumber(ctx)
require.NoError(t, err)
time.Sleep(time.Second / 2)
if lastBlockNum == lastBlockNum2 {
return
}
}
}

// commitBlocks commits the specified number of blocks with the given client and waits for the specified duration after each block
Expand Down

0 comments on commit c9950df

Please sign in to comment.