Skip to content

Commit

Permalink
add oog2 checks for all the oog cheks (#3277)
Browse files Browse the repository at this point in the history
  • Loading branch information
tclemos authored Feb 14, 2024
1 parent 2d76f12 commit 20fa91f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
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)
logError := !executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) && !(errors.Is(err, runtime.ErrOutOfGas) || errors.Is(err, runtime.ErrExecutorErrorOOG2))
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)
isOOG := errors.Is(err, runtime.ErrOutOfGas) || errors.Is(err, runtime.ErrExecutorErrorOOG2)
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) {
if errors.Is(errorToCheck, runtime.ErrOutOfGas) || errors.Is(errorToCheck, runtime.ErrExecutorErrorOOG2) {
response.OOGError = err
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion state/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func (s *State) buildTrace(evm *fakevm.FakeEVM, result *runtime.ExecutionResult,
if previousStep.Depth > step.Depth && previousStep.OpCode != "REVERT" {
var gasUsed uint64
var err error
if errors.Is(previousStep.Error, runtime.ErrOutOfGas) {
if errors.Is(previousStep.Error, runtime.ErrOutOfGas) || errors.Is(previousStep.Error, runtime.ErrExecutorErrorOOG2) {
itCtx, err := internalTxSteps.Pop()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion state/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ func isGasApplyError(err error) bool {

// Checks if EVM level valid gas errors occurred
func isGasEVMError(err error) bool {
return errors.Is(err, runtime.ErrOutOfGas)
return errors.Is(err, runtime.ErrOutOfGas) || errors.Is(err, runtime.ErrExecutorErrorOOG2)
}

// Checks if the EVM reverted during execution
Expand Down

0 comments on commit 20fa91f

Please sign in to comment.