From f62502e1232d8d1f340cf141c19650a60927674b Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Tue, 17 Oct 2023 20:11:04 +0800 Subject: [PATCH] internal/ethapi, accounts/abi/bind: use `errors.Is` for error comparison (#28348) Co-authored-by: lightclient --- accounts/abi/bind/backends/simulated.go | 2 +- internal/ethapi/api.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index 854997648..6892668cb 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -586,7 +586,7 @@ func (b *SimulatedBackend) EstimateGas(ctx context.Context, call ethereum.CallMs return 0, err } if failed { - if result != nil && result.Err != vm.ErrOutOfGas { + if result != nil && !errors.Is(result.Err, vm.ErrOutOfGas) { if len(result.Revert()) > 0 { return 0, newRevertError(result) } diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 640693132..38a792412 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1271,7 +1271,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr return 0, err } if failed { - if result != nil && result.Err != vm.ErrOutOfGas { + if result != nil && !errors.Is(result.Err, vm.ErrOutOfGas) { if len(result.Revert()) > 0 { return 0, newRevertError(result) }