Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stateroot mismatch bug during resequencing #1754

Open
wants to merge 2 commits into
base: zkevm
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions zk/stages/stage_sequence_execute_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,19 @@ func prepareL1AndInfoTreeRelatedStuff(sdb *stageDb, batchState *BatchState, prop
if batchState.resequenceBatchJob.AtNewBlockBoundary() {
l1TreeUpdateIndex = uint64(batchState.resequenceBatchJob.CurrentBlock().L1InfoTreeIndex)
}
if infoTreeIndexProgress >= l1TreeUpdateIndex {
shouldWriteGerToContract = false
}
// l1TreeUpdateIndex->GER from datastream and hermezdb are not consistent, so we should instead get l1TreeUpdate with
// hermezDb.GetL1InfoTreeUpdateByGer(batchState.resequenceBatchJob.CurrentBlock().GlobalExitRoot),
// otherwise any l1info update will cause a mismatch of root during resequencing.
if l1TreeUpdateIndex > 0 {
infoTreeIndexProgress = l1TreeUpdateIndex
l1BlockHash = batchState.resequenceBatchJob.CurrentBlock().L1BlockHash
ger = batchState.resequenceBatchJob.CurrentBlock().GlobalExitRoot
l1TreeUpdate, _ = sdb.hermezDb.GetL1InfoTreeUpdateByGer(ger)
}
return
}
if l1TreeUpdate, err = sdb.hermezDb.GetL1InfoTreeUpdate(l1TreeUpdateIndex); err != nil {
return
Expand Down