Skip to content

Commit

Permalink
internal/ethapi: add refund to StructLogRes (ethereum#24567)
Browse files Browse the repository at this point in the history
* internal/ethapi: add refund to StructLogRes

* Update internal/ethapi/api.go

Co-authored-by: rjl493456442 <[email protected]>

Co-authored-by: rjl493456442 <[email protected]>
  • Loading branch information
2 people authored and sadoci committed Jan 27, 2023
1 parent 8aac390 commit 8e24806
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1188,28 +1188,30 @@ type ExecutionResult struct {
// StructLogRes stores a structured log emitted by the EVM while replaying a
// transaction in debug mode
type StructLogRes struct {
Pc uint64 `json:"pc"`
Op string `json:"op"`
Gas uint64 `json:"gas"`
GasCost uint64 `json:"gasCost"`
Depth int `json:"depth"`
Error string `json:"error,omitempty"`
Stack *[]string `json:"stack,omitempty"`
Memory *[]string `json:"memory,omitempty"`
Storage *map[string]string `json:"storage,omitempty"`
Pc uint64 `json:"pc"`
Op string `json:"op"`
Gas uint64 `json:"gas"`
GasCost uint64 `json:"gasCost"`
Depth int `json:"depth"`
Error string `json:"error,omitempty"`
Stack *[]string `json:"stack,omitempty"`
Memory *[]string `json:"memory,omitempty"`
Storage *map[string]string `json:"storage,omitempty"`
RefundCounter uint64 `json:"refund,omitempty"`
}

// FormatLogs formats EVM returned structured logs for json output
func FormatLogs(logs []logger.StructLog) []StructLogRes {
formatted := make([]StructLogRes, len(logs))
for index, trace := range logs {
formatted[index] = StructLogRes{
Pc: trace.Pc,
Op: trace.Op.String(),
Gas: trace.Gas,
GasCost: trace.GasCost,
Depth: trace.Depth,
Error: trace.ErrorString(),
Pc: trace.Pc,
Op: trace.Op.String(),
Gas: trace.Gas,
GasCost: trace.GasCost,
Depth: trace.Depth,
Error: trace.ErrorString(),
RefundCounter: trace.RefundCounter,
}
if trace.Stack != nil {
stack := make([]string, len(trace.Stack))
Expand Down

0 comments on commit 8e24806

Please sign in to comment.