Skip to content

Commit f460f01

Browse files
redsMartinrjl493456442
authored
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>
1 parent c088242 commit f460f01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

eth/tracers/logger/logger.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package logger
1919
import (
2020
"encoding/hex"
2121
"encoding/json"
22+
"errors"
2223
"fmt"
2324
"io"
2425
"maps"
@@ -350,7 +351,7 @@ func (l *StructLogger) GetResult() (json.RawMessage, error) {
350351
returnData := common.CopyBytes(l.output)
351352
// Return data when successful and revert reason when reverted, otherwise empty.
352353
returnVal := fmt.Sprintf("%x", returnData)
353-
if failed && l.err != vm.ErrExecutionReverted {
354+
if failed && !errors.Is(l.err, vm.ErrExecutionReverted) {
354355
returnVal = ""
355356
}
356357
return json.Marshal(&ExecutionResult{

0 commit comments

Comments
 (0)