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 13, 2024
1 parent 13c7fdd commit 1848eca
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 @@ -188,10 +188,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) {
// Update L1 Info Tree
_, err := gerSc.UpdateExitRoot(auth, common.HexToHash(strconv.Itoa(i)))
require.NoError(t, err)
Expand All @@ -207,6 +204,9 @@ func TestWithReorgs(t *testing.T) {
require.NoError(t, err)
}

// create some events and update the trees
updateL1InfoTreeAndRollupExitTree(1, 1)

// Block 4
commitBlocks(t, client, 1, time.Second*5)

Expand Down Expand Up @@ -238,7 +238,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 @@ -256,26 +257,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)

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 1848eca

Please sign in to comment.