From a8c7e1f6ed76809b06d3f83bf6d7147e2218d81c Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Sat, 22 Mar 2025 13:32:34 +0100 Subject: [PATCH] internal/ethapi: return ethapi.revertError from DoCall/DoEstimateGas even if a revert reason was not supplied --- internal/ethapi/api.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index f3975d35a0..979a7e822a 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -761,8 +761,7 @@ func (api *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockN if err != nil { return nil, err } - // If the result contains a revert reason, try to unpack and return it. - if len(result.Revert()) > 0 { + if errors.Is(result.Err, vm.ErrExecutionReverted) { return nil, newRevertError(result.Revert()) } return result.Return(), result.Err @@ -842,7 +841,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr // Run the gas estimation and wrap any revertals into a custom return estimate, revert, err := gasestimator.Estimate(ctx, call, opts, gasCap) if err != nil { - if len(revert) > 0 { + if errors.Is(err, vm.ErrExecutionReverted) { return 0, newRevertError(revert) } return 0, err