mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/tracers/logger: make structlog/json-log stack hex again
This commit is contained in:
parent
eede592372
commit
4d002e2ab7
2 changed files with 13 additions and 4 deletions
|
|
@ -23,7 +23,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
||||||
GasCost math.HexOrDecimal64 `json:"gasCost"`
|
GasCost math.HexOrDecimal64 `json:"gasCost"`
|
||||||
Memory hexutil.Bytes `json:"memory,omitempty"`
|
Memory hexutil.Bytes `json:"memory,omitempty"`
|
||||||
MemorySize int `json:"memSize"`
|
MemorySize int `json:"memSize"`
|
||||||
Stack []uint256.Int `json:"stack"`
|
Stack []hexutil.U256 `json:"stack"`
|
||||||
ReturnData hexutil.Bytes `json:"returnData,omitempty"`
|
ReturnData hexutil.Bytes `json:"returnData,omitempty"`
|
||||||
Storage map[common.Hash]common.Hash `json:"-"`
|
Storage map[common.Hash]common.Hash `json:"-"`
|
||||||
Depth int `json:"depth"`
|
Depth int `json:"depth"`
|
||||||
|
|
@ -39,7 +39,12 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
||||||
enc.GasCost = math.HexOrDecimal64(s.GasCost)
|
enc.GasCost = math.HexOrDecimal64(s.GasCost)
|
||||||
enc.Memory = s.Memory
|
enc.Memory = s.Memory
|
||||||
enc.MemorySize = s.MemorySize
|
enc.MemorySize = s.MemorySize
|
||||||
enc.Stack = s.Stack
|
if s.Stack != nil {
|
||||||
|
enc.Stack = make([]hexutil.U256, len(s.Stack))
|
||||||
|
for k, v := range s.Stack {
|
||||||
|
enc.Stack[k] = hexutil.U256(v)
|
||||||
|
}
|
||||||
|
}
|
||||||
enc.ReturnData = s.ReturnData
|
enc.ReturnData = s.ReturnData
|
||||||
enc.Storage = s.Storage
|
enc.Storage = s.Storage
|
||||||
enc.Depth = s.Depth
|
enc.Depth = s.Depth
|
||||||
|
|
@ -59,7 +64,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
||||||
GasCost *math.HexOrDecimal64 `json:"gasCost"`
|
GasCost *math.HexOrDecimal64 `json:"gasCost"`
|
||||||
Memory *hexutil.Bytes `json:"memory,omitempty"`
|
Memory *hexutil.Bytes `json:"memory,omitempty"`
|
||||||
MemorySize *int `json:"memSize"`
|
MemorySize *int `json:"memSize"`
|
||||||
Stack []uint256.Int `json:"stack"`
|
Stack []hexutil.U256 `json:"stack"`
|
||||||
ReturnData *hexutil.Bytes `json:"returnData,omitempty"`
|
ReturnData *hexutil.Bytes `json:"returnData,omitempty"`
|
||||||
Storage map[common.Hash]common.Hash `json:"-"`
|
Storage map[common.Hash]common.Hash `json:"-"`
|
||||||
Depth *int `json:"depth"`
|
Depth *int `json:"depth"`
|
||||||
|
|
@ -89,7 +94,10 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
||||||
s.MemorySize = *dec.MemorySize
|
s.MemorySize = *dec.MemorySize
|
||||||
}
|
}
|
||||||
if dec.Stack != nil {
|
if dec.Stack != nil {
|
||||||
s.Stack = dec.Stack
|
s.Stack = make([]uint256.Int, len(dec.Stack))
|
||||||
|
for k, v := range dec.Stack {
|
||||||
|
s.Stack[k] = uint256.Int(v)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if dec.ReturnData != nil {
|
if dec.ReturnData != nil {
|
||||||
s.ReturnData = *dec.ReturnData
|
s.ReturnData = *dec.ReturnData
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,7 @@ type structLogMarshaling struct {
|
||||||
GasCost math.HexOrDecimal64
|
GasCost math.HexOrDecimal64
|
||||||
Memory hexutil.Bytes
|
Memory hexutil.Bytes
|
||||||
ReturnData hexutil.Bytes
|
ReturnData hexutil.Bytes
|
||||||
|
Stack []hexutil.U256
|
||||||
OpName string `json:"opName"` // adds call to OpName() in MarshalJSON
|
OpName string `json:"opName"` // adds call to OpName() in MarshalJSON
|
||||||
ErrorString string `json:"error,omitempty"` // adds call to ErrorString() in MarshalJSON
|
ErrorString string `json:"error,omitempty"` // adds call to ErrorString() in MarshalJSON
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue