Skip to content

Commit

Permalink
e2: fix regression in json encoding of stack values in traces due to …
Browse files Browse the repository at this point in the history
…chan… (#11810)

cherry-pick from PR #11061 from main (the regression is present also in
release 2.60)

Regression caused by this change in uint256 library:


holiman/uint256@f24ed59

It was causing trace json to encode stack values as quoted (string)
decimal values rather than a hex encoded value.

Co-authored-by: bgelb <ben.gelb@gmail.com>
  • Loading branch information
lupin012 and bgelb authored Aug 31, 2024
1 parent e62c2fd commit fbc4122
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion eth/tracers/logger/json_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (l *JsonStreamLogger) CaptureState(pc uint64, op vm.OpCode, gas, cost uint6
if i > 0 {
l.stream.WriteMore()
}
l.stream.WriteString(stackValue.String())
l.stream.WriteString(stackValue.Hex())
}
l.stream.WriteArrayEnd()
}
Expand Down
6 changes: 3 additions & 3 deletions turbo/jsonrpc/trace_adhoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scop
}
for i := showStack - 1; i >= 0; i-- {
if st.Len() > i {
ot.lastVmOp.Ex.Push = append(ot.lastVmOp.Ex.Push, st.Back(i).String())
ot.lastVmOp.Ex.Push = append(ot.lastVmOp.Ex.Push, st.Back(i).Hex())
}
}
// Set the "mem" of the last operation
Expand All @@ -512,7 +512,7 @@ func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scop
if ot.lastOffStack != nil {
ot.lastOffStack.Ex.Used = int(gas)
if st.Len() > 0 {
ot.lastOffStack.Ex.Push = []string{st.Back(0).String()}
ot.lastOffStack.Ex.Push = []string{st.Back(0).Hex()}
} else {
ot.lastOffStack.Ex.Push = []string{}
}
Expand Down Expand Up @@ -584,7 +584,7 @@ func (ot *OeTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scop
ot.memLenStack = append(ot.memLenStack, 0)
case vm.SSTORE:
if st.Len() > 1 {
ot.lastVmOp.Ex.Store = &VmTraceStore{Key: st.Back(0).String(), Val: st.Back(1).String()}
ot.lastVmOp.Ex.Store = &VmTraceStore{Key: st.Back(0).Hex(), Val: st.Back(1).Hex()}
}
}
if ot.lastVmOp.Ex.Used < 0 {
Expand Down

0 comments on commit fbc4122

Please sign in to comment.