Skip to content

Commit

Permalink
statedb revert to snapshot for ignored batches (#1713)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudor-malene authored Dec 20, 2023
1 parent 63ba499 commit 5c36933
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions go/enclave/components/batch_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext, fail
if err != nil {
return nil, fmt.Errorf("could not create stateDB. Cause: %w", err)
}
snap := stateDB.Snapshot()

var messages common.CrossChainMessages
var transfers common.ValueTransferEvents
Expand Down Expand Up @@ -217,6 +218,8 @@ func (executor *batchExecutor) ComputeBatch(context *BatchExecutionContext, fail
len(crossChainTransactions) == 0 &&
len(messages) == 0 &&
len(transfers) == 0 {
// revert any unexpected mutation to the statedb
stateDB.RevertToSnapshot(snap)
return nil, ErrNoTransactionsToProcess
}

Expand Down

0 comments on commit 5c36933

Please sign in to comment.