Skip to content

Commit

Permalink
fix: comments 2
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Sep 5, 2024
1 parent 924f8d6 commit da35bfe
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions l1infotreesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit da35bfe

Please sign in to comment.