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

Feature remove executor errors #3317

Merged
merged 2 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 0 additions & 2 deletions event/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ const (
EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT"
// EventID_SequenceSenderHalt is triggered when the SequenceSender halts
EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT"
// EventID_UnsupportedPrecompile is triggered when the executor returns an unsupported precompile error
EventID_UnsupportedPrecompile EventID = "UNSUPPORTED PRECOMPILE"

// EventID_NodeOOC is triggered when an OOC at node level is detected
EventID_NodeOOC EventID = "NODE OOC"
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/endpoints_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (e *EthEndpoints) Call(arg *types.TxArgs, blockArg *types.BlockNumberOrHash
result, err := e.state.ProcessUnsignedTransaction(ctx, tx, sender, blockToProcess, true, dbTx)
if err != nil {
errMsg := fmt.Sprintf("failed to execute the unsigned transaction: %v", err.Error())
logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !(errors.Is(err, runtime.ErrOutOfGas) || errors.Is(err, runtime.ErrExecutorErrorOOG2))
logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !errors.Is(err, runtime.ErrOutOfGas)
return RPCErrorResponse(types.DefaultErrorCode, errMsg, nil, logError)
}

Expand Down
4 changes: 2 additions & 2 deletions pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func (p *Pool) preExecuteTx(ctx context.Context, tx types.Transaction) (preExecu
processBatchResponse, err := p.state.PreProcessTransaction(ctx, &tx, nil)
if err != nil {
isOOC := executor.IsROMOutOfCountersError(executor.RomErrorCode(err))
isOOG := errors.Is(err, runtime.ErrOutOfGas) || errors.Is(err, runtime.ErrExecutorErrorOOG2)
isOOG := errors.Is(err, runtime.ErrOutOfGas)
if !isOOC && !isOOG {
return response, err
} else {
Expand All @@ -324,7 +324,7 @@ func (p *Pool) preExecuteTx(ctx context.Context, tx types.Transaction) (preExecu
if executor.IsROMOutOfCountersError(executor.RomErrorCode(errorToCheck)) {
response.OOCError = err
}
if errors.Is(errorToCheck, runtime.ErrOutOfGas) || errors.Is(errorToCheck, runtime.ErrExecutorErrorOOG2) {
if errors.Is(errorToCheck, runtime.ErrOutOfGas) {
response.OOGError = err
}
} else {
Expand Down
6 changes: 0 additions & 6 deletions proto/src/proto/executor/v1/executor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,4 @@ enum ExecutorError {
EXECUTOR_ERROR_INVALID_DATA_STREAM = 115;
// EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE indicates that the provided update merkle tree is invalid, e.g. because the executor is configured not to write to database
EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE = 116;
// EXECUTOR_ERROR_UNSUPPORTED_PRECOMPILED indicates that an unsupported precompiled has been used
EXECUTOR_ERROR_UNSUPPORTED_PRECOMPILED = 117;
// EXECUTOR_ERROR_OOG_2 indicates that an out of gas has occurred
EXECUTOR_ERROR_OOG_2 = 118;
// EXECUTOR_ERROR_CLOSE_BATCH indicates that batch must be closed
EXECUTOR_ERROR_CLOSE_BATCH = 119;
}
4 changes: 1 addition & 3 deletions sequencer/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package sequencer
import (
"context"
"encoding/json"
"errors"
"fmt"
"time"

Expand All @@ -12,7 +11,6 @@ import (
"github.com/0xPolygonHermez/zkevm-node/sequencer/metrics"
"github.com/0xPolygonHermez/zkevm-node/state"
stateMetrics "github.com/0xPolygonHermez/zkevm-node/state/metrics"
"github.com/0xPolygonHermez/zkevm-node/state/runtime"
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/ethereum/go-ethereum/common"
)
Expand Down Expand Up @@ -412,7 +410,7 @@ func (f *finalizer) batchSanityCheck(ctx context.Context, batchNum uint64, initi
return nil, ErrProcessBatch
}

if batchResponse.ExecutorError != nil && !errors.Is(batchResponse.ExecutorError, runtime.ErrExecutorErrorCloseBatch) {
if batchResponse.ExecutorError != nil {
log.Errorf("executor error when reprocessing batch %d, error: %v", batch.BatchNumber, batchResponse.ExecutorError)
reprocessError(batch)
return nil, ErrExecutorError
Expand Down
28 changes: 0 additions & 28 deletions sequencer/finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sequencer

import (
"context"
"encoding/json"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -446,27 +445,6 @@ func (f *finalizer) processTransaction(ctx context.Context, tx *TxTracker, first
} else if err != nil {
log.Errorf("error received from executor, error: %v", err)

if errors.Is(err, runtime.ErrExecutorErrorUnsupportedPrecompile) {
payload, err := json.Marshal(batchRequest)
if err != nil {
log.Errorf("error marshaling payload, error: %v", err)
} else {
event := &event.Event{
ReceivedAt: time.Now(),
Source: event.Source_Node,
Component: event.Component_Sequencer,
Level: event.Level_Warning,
EventID: event.EventID_UnsupportedPrecompile,
Description: string(payload),
Json: batchRequest,
}
err = f.eventLog.LogEvent(ctx, event)
if err != nil {
log.Errorf("error storing payload, error: %v", err)
}
}
}

// Delete tx from the worker
f.workerIntf.DeleteTx(tx.Hash, tx.From)

Expand Down Expand Up @@ -603,15 +581,9 @@ func (f *finalizer) handleProcessTransactionResponse(ctx context.Context, tx *Tx
tx.EGPLog.GasPrice, tx.EGPLog.L1GasPrice, tx.EGPLog.L2GasPrice, tx.EGPLog.Reprocess, tx.EGPLog.GasPriceOC, tx.EGPLog.BalanceOC, egpEnabled, len(tx.RawTx), tx.HashStr, tx.EGPLog.Error)

f.wipL2Block.addTx(tx)

f.wipBatch.countOfTxs++

f.updateWorkerAfterSuccessfulProcessing(ctx, tx.Hash, tx.From, false, result)

if result.CloseBatch_V2 {
return nil, true, nil
}

return nil, false, nil
}

Expand Down
6 changes: 2 additions & 4 deletions sequencer/l2block.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sequencer

import (
"context"
"errors"
"fmt"
"time"

Expand All @@ -12,7 +11,6 @@ import (
"github.com/0xPolygonHermez/zkevm-node/sequencer/metrics"
"github.com/0xPolygonHermez/zkevm-node/state"
stateMetrics "github.com/0xPolygonHermez/zkevm-node/state/metrics"
"github.com/0xPolygonHermez/zkevm-node/state/runtime"
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/ethereum/go-ethereum/common"
)
Expand Down Expand Up @@ -283,7 +281,7 @@ func (f *finalizer) executeL2Block(ctx context.Context, initialStateRoot common.
return nil, 0, err
}

if batchResponse.ExecutorError != nil && !errors.Is(batchResponse.ExecutorError, runtime.ErrExecutorErrorCloseBatch) {
if batchResponse.ExecutorError != nil {
executeL2BLockError(batchResponse.ExecutorError)
return nil, 0, ErrExecutorError
}
Expand Down Expand Up @@ -562,7 +560,7 @@ func (f *finalizer) executeNewWIPL2Block(ctx context.Context) (*state.ProcessBat
return nil, err
}

if batchResponse.ExecutorError != nil && !errors.Is(batchResponse.ExecutorError, runtime.ErrExecutorErrorCloseBatch) {
if batchResponse.ExecutorError != nil {
return nil, ErrExecutorError
}

Expand Down
4 changes: 2 additions & 2 deletions state/batchV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (s *State) ExecuteBatchV2(ctx context.Context, batch Batch, L1InfoTreeRoot
if err != nil {
log.Error("error executing batch: ", err)
return nil, err
} else if processBatchResponse != nil && processBatchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR && processBatchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH {
} else if processBatchResponse != nil && processBatchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
err = executor.ExecutorErr(processBatchResponse.Error)
s.eventLog.LogExecutorErrorV2(ctx, processBatchResponse.Error, processBatchRequest)
}
Expand Down Expand Up @@ -303,7 +303,7 @@ func (s *State) sendBatchRequestToExecutorV2(ctx context.Context, batchRequest *
log.Errorf("error executor ProcessBatchV2 response: %v", batchResponse)
} else {
batchResponseToString := processBatchResponseToString(newBatchNum, batchResponse, elapsed)
if batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR && batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH {
if batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR {
err = executor.ExecutorErr(batchResponse.Error)
log.Warnf("executor batch %d response, executor error: %v", newBatchNum, err)
log.Warn(batchResponseToString)
Expand Down
3 changes: 1 addition & 2 deletions state/convertersV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (s *State) convertToProcessBatchResponseV2(batchResponse *executor.ProcessB
FlushID: batchResponse.FlushId,
StoredFlushID: batchResponse.StoredFlushId,
ProverID: batchResponse.ProverId,
IsExecutorLevelError: (batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR && batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH),
IsExecutorLevelError: batchResponse.Error != executor.ExecutorError_EXECUTOR_ERROR_NO_ERROR,
IsRomLevelError: isRomLevelError,
IsRomOOCError: isRomOOCError,
GasUsed_V2: batchResponse.GasUsed,
Expand All @@ -65,7 +65,6 @@ func (s *State) convertToProcessBatchResponseV2(batchResponse *executor.ProcessB
ForkID: batchResponse.ForkId,
InvalidBatch_V2: batchResponse.InvalidBatch != 0,
RomError_V2: executor.RomErr(batchResponse.ErrorRom),
CloseBatch_V2: batchResponse.Error == executor.ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH,
}, nil
}

Expand Down
12 changes: 0 additions & 12 deletions state/runtime/executor/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,12 +454,6 @@ func ExecutorErr(errorCode ExecutorError) error {
return runtime.ErrExecutorErrorInvalidDataStream
case ExecutorError_EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE:
return runtime.ErrExecutorErrorInvalidUpdateMerkleTree
case ExecutorError_EXECUTOR_ERROR_UNSUPPORTED_PRECOMPILED:
return runtime.ErrExecutorErrorUnsupportedPrecompile
case ExecutorError_EXECUTOR_ERROR_OOG_2:
return runtime.ErrExecutorErrorOOG2
case ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH:
return runtime.ErrExecutorErrorCloseBatch
}
return ErrExecutorUnknown
}
Expand Down Expand Up @@ -700,12 +694,6 @@ func ExecutorErrorCode(err error) ExecutorError {
return ExecutorError_EXECUTOR_ERROR_INVALID_DATA_STREAM
case runtime.ErrExecutorErrorInvalidUpdateMerkleTree:
return ExecutorError_EXECUTOR_ERROR_INVALID_UPDATE_MERKLE_TREE
case runtime.ErrExecutorErrorUnsupportedPrecompile:
return ExecutorError_EXECUTOR_ERROR_UNSUPPORTED_PRECOMPILED
case runtime.ErrExecutorErrorOOG2:
return ExecutorError_EXECUTOR_ERROR_OOG_2
case runtime.ErrExecutorErrorCloseBatch:
return ExecutorError_EXECUTOR_ERROR_CLOSE_BATCH
}

return ErrCodeExecutorUnknown
Expand Down
70 changes: 26 additions & 44 deletions state/runtime/executor/executor.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion state/runtime/executor/executor_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions state/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,12 +319,6 @@ var (
ErrExecutorErrorInvalidDataStream = errors.New("invalid data stream")
// ErrExecutorErrorInvalidUpdateMerkleTree indicates that the input parameter update merkle tree is invalid
ErrExecutorErrorInvalidUpdateMerkleTree = errors.New("invalid update merkle tree")
// ErrExecutorErrorUnsupportedPrecompile indicates that the precompile is not supported
ErrExecutorErrorUnsupportedPrecompile = errors.New("unsupported precompile")
// ErrExecutorErrorOOG2 indicates that an out of gas has occurred
ErrExecutorErrorOOG2 = errors.New("out of gas 2")
// ErrExecutorErrorCloseBatch indicates that batch must be closed
ErrExecutorErrorCloseBatch = errors.New("close batch")

// GRPC ERRORS
// ===========
Expand Down
Loading
Loading