mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
This reverts commit b84f4ed6f8.
This commit is contained in:
parent
ee0410ec10
commit
2ba5ea3058
4 changed files with 24 additions and 16 deletions
|
|
@ -70,7 +70,7 @@ type ExecutionResult struct {
|
||||||
// currently they are just `from` and `to` account
|
// currently they are just `from` and `to` account
|
||||||
AccountsAfter []*AccountWrapper `json:"accountAfter"`
|
AccountsAfter []*AccountWrapper `json:"accountAfter"`
|
||||||
|
|
||||||
StructLogs []StructLogRes `json:"structLogs"`
|
StructLogs []*StructLogRes `json:"structLogs"`
|
||||||
CallTrace json.RawMessage `json:"callTrace"`
|
CallTrace json.RawMessage `json:"callTrace"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,8 +91,8 @@ type StructLogRes struct {
|
||||||
|
|
||||||
// NewStructLogResBasic Basic StructLogRes skeleton, Stack&Memory&Storage&ExtraData are separated from it for GC optimization;
|
// NewStructLogResBasic Basic StructLogRes skeleton, Stack&Memory&Storage&ExtraData are separated from it for GC optimization;
|
||||||
// still need to fill in with Stack&Memory&Storage&ExtraData
|
// still need to fill in with Stack&Memory&Storage&ExtraData
|
||||||
func NewStructLogResBasic(pc uint64, op string, gas, gasCost uint64, depth int, refundCounter uint64, err error) StructLogRes {
|
func NewStructLogResBasic(pc uint64, op string, gas, gasCost uint64, depth int, refundCounter uint64, err error) *StructLogRes {
|
||||||
logRes := StructLogRes{
|
logRes := &StructLogRes{
|
||||||
Pc: pc,
|
Pc: pc,
|
||||||
Op: op,
|
Op: op,
|
||||||
Gas: gas,
|
Gas: gas,
|
||||||
|
|
|
||||||
|
|
@ -79,8 +79,8 @@ type StructLog struct {
|
||||||
Err error `json:"-"`
|
Err error `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStructlog(pc uint64, op OpCode, gas, cost uint64, depth int, err error) StructLog {
|
func NewStructlog(pc uint64, op OpCode, gas, cost uint64, depth int, err error) *StructLog {
|
||||||
return StructLog{
|
return &StructLog{
|
||||||
Pc: pc,
|
Pc: pc,
|
||||||
Op: op,
|
Op: op,
|
||||||
Gas: gas,
|
Gas: gas,
|
||||||
|
|
@ -90,6 +90,14 @@ func NewStructlog(pc uint64, op OpCode, gas, cost uint64, depth int, err error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *StructLog) clean() {
|
||||||
|
s.Memory.Reset()
|
||||||
|
s.Stack = s.Stack[:0]
|
||||||
|
s.ReturnData.Reset()
|
||||||
|
s.Storage = nil
|
||||||
|
s.Err = nil
|
||||||
|
}
|
||||||
|
|
||||||
// overrides for gencodec
|
// overrides for gencodec
|
||||||
type structLogMarshaling struct {
|
type structLogMarshaling struct {
|
||||||
Gas math.HexOrDecimal64
|
Gas math.HexOrDecimal64
|
||||||
|
|
@ -151,7 +159,7 @@ type StructLogger struct {
|
||||||
createdAccount *types.AccountWrapper
|
createdAccount *types.AccountWrapper
|
||||||
|
|
||||||
callStackLogInd []int
|
callStackLogInd []int
|
||||||
logs []StructLog
|
logs []*StructLog
|
||||||
output []byte
|
output []byte
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
|
|
@ -351,7 +359,7 @@ func (l *StructLogger) TracedBytecodes() map[common.Hash]CodeInfo {
|
||||||
func (l *StructLogger) CreatedAccount() *types.AccountWrapper { return l.createdAccount }
|
func (l *StructLogger) CreatedAccount() *types.AccountWrapper { return l.createdAccount }
|
||||||
|
|
||||||
// StructLogs returns the captured log entries.
|
// StructLogs returns the captured log entries.
|
||||||
func (l *StructLogger) StructLogs() []StructLog { return l.logs }
|
func (l *StructLogger) StructLogs() []*StructLog { return l.logs }
|
||||||
|
|
||||||
// Error returns the VM error captured by the trace.
|
// Error returns the VM error captured by the trace.
|
||||||
func (l *StructLogger) Error() error { return l.err }
|
func (l *StructLogger) Error() error { return l.err }
|
||||||
|
|
@ -360,7 +368,7 @@ func (l *StructLogger) Error() error { return l.err }
|
||||||
func (l *StructLogger) Output() []byte { return l.output }
|
func (l *StructLogger) Output() []byte { return l.output }
|
||||||
|
|
||||||
// WriteTrace writes a formatted trace to the given writer
|
// WriteTrace writes a formatted trace to the given writer
|
||||||
func WriteTrace(writer io.Writer, logs []StructLog) {
|
func WriteTrace(writer io.Writer, logs []*StructLog) {
|
||||||
for _, log := range logs {
|
for _, log := range logs {
|
||||||
fmt.Fprintf(writer, "%-16spc=%08d gas=%v cost=%v", log.Op, log.Pc, log.Gas, log.GasCost)
|
fmt.Fprintf(writer, "%-16spc=%08d gas=%v cost=%v", log.Op, log.Pc, log.Gas, log.GasCost)
|
||||||
if log.Err != nil {
|
if log.Err != nil {
|
||||||
|
|
@ -480,8 +488,8 @@ func (t *mdLogger) CaptureEnter(typ OpCode, from common.Address, to common.Addre
|
||||||
func (t *mdLogger) CaptureExit(output []byte, gasUsed uint64, err error) {}
|
func (t *mdLogger) CaptureExit(output []byte, gasUsed uint64, err error) {}
|
||||||
|
|
||||||
// FormatLogs formats EVM returned structured logs for json output
|
// FormatLogs formats EVM returned structured logs for json output
|
||||||
func FormatLogs(logs []StructLog) []types.StructLogRes {
|
func FormatLogs(logs []*StructLog) []*types.StructLogRes {
|
||||||
formatted := make([]types.StructLogRes, 0, len(logs))
|
formatted := make([]*types.StructLogRes, 0, len(logs))
|
||||||
|
|
||||||
for _, trace := range logs {
|
for _, trace := range logs {
|
||||||
logRes := types.NewStructLogResBasic(trace.Pc, trace.Op.String(), trace.Gas, trace.GasCost, trace.Depth, trace.RefundCounter, trace.Err)
|
logRes := types.NewStructLogResBasic(trace.Pc, trace.Op.String(), trace.Gas, trace.GasCost, trace.Depth, trace.RefundCounter, trace.Err)
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@ func TestTraceCall(t *testing.T) {
|
||||||
Gas: params.TxGas,
|
Gas: params.TxGas,
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ReturnValue: "",
|
ReturnValue: "",
|
||||||
StructLogs: []types.StructLogRes{},
|
StructLogs: []*types.StructLogRes{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Standard JSON trace upon the head, plain transfer.
|
// Standard JSON trace upon the head, plain transfer.
|
||||||
|
|
@ -245,7 +245,7 @@ func TestTraceCall(t *testing.T) {
|
||||||
Gas: params.TxGas,
|
Gas: params.TxGas,
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ReturnValue: "",
|
ReturnValue: "",
|
||||||
StructLogs: []types.StructLogRes{},
|
StructLogs: []*types.StructLogRes{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Standard JSON trace upon the non-existent block, error expects
|
// Standard JSON trace upon the non-existent block, error expects
|
||||||
|
|
@ -275,7 +275,7 @@ func TestTraceCall(t *testing.T) {
|
||||||
Gas: params.TxGas,
|
Gas: params.TxGas,
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ReturnValue: "",
|
ReturnValue: "",
|
||||||
StructLogs: []types.StructLogRes{},
|
StructLogs: []*types.StructLogRes{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Standard JSON trace upon the pending block
|
// Standard JSON trace upon the pending block
|
||||||
|
|
@ -293,7 +293,7 @@ func TestTraceCall(t *testing.T) {
|
||||||
Gas: params.TxGas,
|
Gas: params.TxGas,
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ReturnValue: "",
|
ReturnValue: "",
|
||||||
StructLogs: []types.StructLogRes{},
|
StructLogs: []*types.StructLogRes{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ func TestTraceTransaction(t *testing.T) {
|
||||||
Gas: params.TxGas,
|
Gas: params.TxGas,
|
||||||
Failed: false,
|
Failed: false,
|
||||||
ReturnValue: "",
|
ReturnValue: "",
|
||||||
StructLogs: []types.StructLogRes{},
|
StructLogs: []*types.StructLogRes{},
|
||||||
}) {
|
}) {
|
||||||
t.Error("Transaction tracing result is different")
|
t.Error("Transaction tracing result is different")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 5 // Minor version component of the current release
|
VersionMinor = 5 // Minor version component of the current release
|
||||||
VersionPatch = 21 // Patch version component of the current release
|
VersionPatch = 22 // Patch version component of the current release
|
||||||
VersionMeta = "mainnet" // Version metadata to append to the version string
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue