internal/ethapi: add refund to StructLogRes (#24567)

* internal/ethapi: add refund to StructLogRes

* Update internal/ethapi/api.go

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>

Co-authored-by: rjl493456442 <garyrong0905@gmail.com>
pull/24614/head
Zhang Zhuo 3 years ago committed by GitHub
parent 763b3f8d1f
commit b5a129ea24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      internal/ethapi/api.go

@ -1135,15 +1135,16 @@ type ExecutionResult struct {
// StructLogRes stores a structured log emitted by the EVM while replaying a // StructLogRes stores a structured log emitted by the EVM while replaying a
// transaction in debug mode // transaction in debug mode
type StructLogRes struct { type StructLogRes struct {
Pc uint64 `json:"pc"` Pc uint64 `json:"pc"`
Op string `json:"op"` Op string `json:"op"`
Gas uint64 `json:"gas"` Gas uint64 `json:"gas"`
GasCost uint64 `json:"gasCost"` GasCost uint64 `json:"gasCost"`
Depth int `json:"depth"` Depth int `json:"depth"`
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
Stack *[]string `json:"stack,omitempty"` Stack *[]string `json:"stack,omitempty"`
Memory *[]string `json:"memory,omitempty"` Memory *[]string `json:"memory,omitempty"`
Storage *map[string]string `json:"storage,omitempty"` Storage *map[string]string `json:"storage,omitempty"`
RefundCounter uint64 `json:"refund,omitempty"`
} }
// FormatLogs formats EVM returned structured logs for json output // FormatLogs formats EVM returned structured logs for json output
@ -1151,12 +1152,13 @@ func FormatLogs(logs []logger.StructLog) []StructLogRes {
formatted := make([]StructLogRes, len(logs)) formatted := make([]StructLogRes, len(logs))
for index, trace := range logs { for index, trace := range logs {
formatted[index] = StructLogRes{ formatted[index] = StructLogRes{
Pc: trace.Pc, Pc: trace.Pc,
Op: trace.Op.String(), Op: trace.Op.String(),
Gas: trace.Gas, Gas: trace.Gas,
GasCost: trace.GasCost, GasCost: trace.GasCost,
Depth: trace.Depth, Depth: trace.Depth,
Error: trace.ErrorString(), Error: trace.ErrorString(),
RefundCounter: trace.RefundCounter,
} }
if trace.Stack != nil { if trace.Stack != nil {
stack := make([]string, len(trace.Stack)) stack := make([]string, len(trace.Stack))

Loading…
Cancel
Save