Skip to content

Commit

Permalink
fix: rebuild tree after reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
goran-ethernal committed Sep 20, 2024
1 parent 5a974dc commit 388e941
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions l1infotreesync/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func TestWithReorgs(t *testing.T) {

func TestStressAndReorgs(t *testing.T) {
const (
totalIterations = 2 // Have tested with much larger number (+10k)
totalIterations = 10
blocksInIteration = 140
reorgEveryXIterations = 70
reorgSizeInBlocks = 2
Expand Down Expand Up @@ -356,7 +356,7 @@ func TestStressAndReorgs(t *testing.T) {

t.Logf("expectedL1InfoRoot: %s", common.Hash(expectedL1InfoRoot).String())
require.Equal(t, common.Hash(expectedGER), info.GlobalExitRoot, fmt.Sprintf("%+v", info))
// require.Equal(t, common.Hash(expectedL1InfoRoot), lastRoot.Hash) // TODO this fails
require.Equal(t, common.Hash(expectedL1InfoRoot), lastRoot.Hash)
}

func waitForSyncerToCatchUp(ctx context.Context, t *testing.T, syncer *l1infotreesync.L1InfoTreeSync, client *simulated.Backend) {
Expand Down
2 changes: 1 addition & 1 deletion tree/appendonlytree.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (t *AppendOnlyTree) initCache(tx db.Txer) error {
}

// Reverse the siblings to go from leafs to root
for i, j := 0, len(siblings)-1; i < j; i, j = i+1, j-1 {
for i, j := 0, len(siblings)-1; i <= j; i, j = i+1, j-1 {
siblings[i], siblings[j] = siblings[j], siblings[i]
}

Expand Down

0 comments on commit 388e941

Please sign in to comment.