diff --git a/pool/pool.go b/pool/pool.go index 94510c011a..cb8aef3a6b 100644 --- a/pool/pool.go +++ b/pool/pool.go @@ -188,14 +188,14 @@ func (p *Pool) PreExecuteTx(ctx context.Context, tx types.Transaction) (preExecu response.usedZkCounters = processBatchResponse.UsedZkCounters - if processBatchResponse.IsBatchProcessed { + if !processBatchResponse.RomOOC { if processBatchResponse.Responses != nil && len(processBatchResponse.Responses) > 0 { r := processBatchResponse.Responses[0] response.isOOC = executor.IsROMOutOfGasError(executor.RomErrorCode(r.RomError)) response.isReverted = errors.Is(r.RomError, runtime.ErrExecutionReverted) } } else { - response.isOOG = !processBatchResponse.IsBatchProcessed + response.isOOG = processBatchResponse.RomOOC } return response, nil diff --git a/sequencer/finalizer.go b/sequencer/finalizer.go index 22be988e68..1c89fa685c 100644 --- a/sequencer/finalizer.go +++ b/sequencer/finalizer.go @@ -294,7 +294,7 @@ func (f *finalizer) newWIPBatch(ctx context.Context) (*WipBatch, error) { // Reprocess full batch as sanity check processBatchResponse, err := f.reprocessFullBatch(ctx, f.batch.batchNumber, f.batch.stateRoot) - if err != nil || !processBatchResponse.IsBatchProcessed { + if err != nil || processBatchResponse.RomOOC { log.Info("halting the finalizer because of a reprocessing error") if err != nil { f.halt(ctx, fmt.Errorf("failed to reprocess batch, err: %v", err)) @@ -400,7 +400,7 @@ func (f *finalizer) handleTxProcessResp(ctx context.Context, tx *TxTracker, resu // Handle Transaction Error errorCode := executor.RomErrorCode(result.Responses[0].RomError) - if !result.IsBatchProcessed || executor.IsIntrinsicError(errorCode) { + if result.RomOOC || executor.IsIntrinsicError(errorCode) { // If intrinsic error or OOC error, we skip adding the transaction to the batch f.handleTransactionError(ctx, result, tx) return result.Responses[0].RomError @@ -784,7 +784,7 @@ func (f *finalizer) reprocessFullBatch(ctx context.Context, batchNum uint64, exp return nil, err } - if !result.IsBatchProcessed { + if result.RomOOC { log.Errorf("failed to process batch %v because OutOfCounters", batch.BatchNumber) payload, err := json.Marshal(processRequest) if err != nil { diff --git a/state/converters.go b/state/converters.go index 693dcfc071..707edca81c 100644 --- a/state/converters.go +++ b/state/converters.go @@ -48,11 +48,11 @@ func (s *State) convertToProcessBatchResponse(txs []types.Transaction, response return nil, err } - isBatchProcessed := response.Error == executor.EXECUTOR_ERROR_NO_ERROR - if isBatchProcessed && len(response.Responses) > 0 { + romOOC := response.Error != executor.EXECUTOR_ERROR_NO_ERROR + if romOOC && len(response.Responses) > 0 { // Check out of counters errorToCheck := response.Responses[len(response.Responses)-1].Error - isBatchProcessed = !executor.IsROMOutOfCountersError(errorToCheck) + romOOC = executor.IsROMOutOfCountersError(errorToCheck) } return &ProcessBatchResponse{ @@ -63,7 +63,7 @@ func (s *State) convertToProcessBatchResponse(txs []types.Transaction, response UsedZkCounters: convertToCounters(response), Responses: responses, ExecutorError: executor.ExecutorErr(response.Error), - IsBatchProcessed: isBatchProcessed, + RomOOC: romOOC, ReadWriteAddresses: readWriteAddresses, }, nil } diff --git a/state/types.go b/state/types.go index a1d437d8eb..eccf1ed0bf 100644 --- a/state/types.go +++ b/state/types.go @@ -34,7 +34,7 @@ type ProcessBatchResponse struct { UsedZkCounters ZKCounters Responses []*ProcessTransactionResponse ExecutorError error - IsBatchProcessed bool + RomOOC bool ReadWriteAddresses map[common.Address]*InfoReadWrite }