Skip to content

Commit

Permalink
errors is
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Oct 5, 2023
1 parent 40eb696 commit e21d980
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions core/vm/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package vm

import (
"errors"
"math/big"
"sync/atomic"

Expand Down Expand Up @@ -253,7 +254,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
// when we're in homestead this also counts for code storage gas errors.
if err != nil {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
if !errors.Is(err, ErrExecutionReverted) {
gas = 0
}
// TODO: consider clearing up unused snapshots:
Expand Down Expand Up @@ -306,7 +307,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
}
if err != nil {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
if !errors.Is(err, ErrExecutionReverted) {
gas = 0
}
}
Expand Down Expand Up @@ -350,7 +351,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
}
if err != nil {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
if !errors.Is(err, ErrExecutionReverted) {
gas = 0
}
}
Expand Down Expand Up @@ -406,7 +407,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
}
if err != nil {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
if !errors.Is(err, ErrExecutionReverted) {
gas = 0
}
}
Expand Down Expand Up @@ -501,7 +502,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
// when we're in homestead this also counts for code storage gas errors.
if err != nil && (evm.chainRules.IsHomestead || err != ErrCodeStoreOutOfGas) {
evm.StateDB.RevertToSnapshot(snapshot)
if err != ErrExecutionReverted {
if !errors.Is(err, ErrExecutionReverted) {
contract.UseGas(contract.Gas)
}
}
Expand Down

0 comments on commit e21d980

Please sign in to comment.