From da35bfeb9df84032fa7c8161191c2425d30b71fa Mon Sep 17 00:00:00 2001 From: Goran Rojovic Date: Thu, 5 Sep 2024 13:54:16 +0200 Subject: [PATCH] fix: comments 2 --- l1infotreesync/e2e_test.go | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/l1infotreesync/e2e_test.go b/l1infotreesync/e2e_test.go index c6a404a2..68e2b972 100644 --- a/l1infotreesync/e2e_test.go +++ b/l1infotreesync/e2e_test.go @@ -186,10 +186,7 @@ func TestWithReorgs(t *testing.T) { reorgFrom := header.Hash() fmt.Println("start from header:", header.Number) - { - i := 1 - rollupID := uint32(1) - + updateL1InfoTreeAndRollupExitTree := func(i int, rollupID uint32, auth *bind.TransactOpts) { // Update L1 Info Tree _, err := gerSc.UpdateExitRoot(auth, common.HexToHash(strconv.Itoa(i))) require.NoError(t, err) @@ -205,6 +202,9 @@ func TestWithReorgs(t *testing.T) { require.NoError(t, err) } + // create some events and update the trees + updateL1InfoTreeAndRollupExitTree(1, 1, auth) + // Block 4 commitBlocks(t, client, 1, time.Second*5) @@ -236,7 +236,8 @@ func TestWithReorgs(t *testing.T) { err = client.Fork(reorgFrom) require.NoError(t, err) - commitBlocks(t, client, 3, time.Millisecond*100) // Block 4, 5, 6 after the fork + // Block 4, 5, 6 after the fork + commitBlocks(t, client, 3, time.Millisecond*100) // Make sure syncer is up to date waitForSyncerToCatchUp(ctx, t, syncer, client) @@ -254,26 +255,11 @@ func TestWithReorgs(t *testing.T) { require.NoError(t, err) time.Sleep(time.Millisecond * 100) - { - i := 2 - rollupID := uint32(1) - - // Update L1 Info Tree - _, err := gerSc.UpdateExitRoot(auth, common.HexToHash(strconv.Itoa(i))) - require.NoError(t, err) - - // Update L1 Info Tree + Rollup Exit Tree - newLocalExitRoot := common.HexToHash(strconv.Itoa(i) + "ffff" + strconv.Itoa(1)) - _, err = verifySC.VerifyBatches(auth, rollupID, 0, newLocalExitRoot, common.Hash{}, true) - require.NoError(t, err) - - // Update Rollup Exit Tree - newLocalExitRoot = common.HexToHash(strconv.Itoa(i) + "ffff" + strconv.Itoa(2)) - _, err = verifySC.VerifyBatches(auth, rollupID, 0, newLocalExitRoot, common.Hash{}, false) - require.NoError(t, err) - } + // create some events and update the trees + updateL1InfoTreeAndRollupExitTree(2, 1, auth) - commitBlocks(t, client, 4, time.Millisecond*100) // Block 4, 5, 6, 7 after the fork + // Block 4, 5, 6, 7 after the fork + commitBlocks(t, client, 4, time.Millisecond*100) // Make sure syncer is up to date waitForSyncerToCatchUp(ctx, t, syncer, client)