eth/tracers/logger: return revert reason (#31013)

Fix the error comparison in tracer to prevent dropping revert reason data

---------

Co-authored-by: Martin <mrscdevel@gmail.com>
Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
This commit is contained in:
Martin Redmond 2025-01-13 10:12:15 -05:00 committed by GitHub
parent c0882429f0
commit f460f019e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package logger
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"maps"
@ -350,7 +351,7 @@ func (l *StructLogger) GetResult() (json.RawMessage, error) {
returnData := common.CopyBytes(l.output)
// Return data when successful and revert reason when reverted, otherwise empty.
returnVal := fmt.Sprintf("%x", returnData)
if failed && l.err != vm.ErrExecutionReverted {
if failed && !errors.Is(l.err, vm.ErrExecutionReverted) {
returnVal = ""
}
return json.Marshal(&ExecutionResult{