Documentation ¶
Index ¶
- func NewMarkdownLogger(cfg *Config, writer io.Writer) *mdLogger
- func WriteLogs(writer io.Writer, logs []*types.Log)
- func WriteTrace(writer io.Writer, logs []StructLog)
- type Config
- type JSONLogger
- func (l *JSONLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error
- func (l *JSONLogger) CaptureEnter(env *vm.EVM, typ vm.OpCode, from common.Address, to common.Address, ...) error
- func (l *JSONLogger) CaptureExit(output []byte, gasUsed uint64, err error) error
- func (l *JSONLogger) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas uint64, cost uint64, ...) error
- func (l *JSONLogger) CaptureStart(env *vm.EVM, from, to common.Address, create bool, input []byte, gas uint64, ...) error
- func (l *JSONLogger) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, ...) error
- type Storage
- type StructLog
- type StructLogger
- func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error) error
- func (l *StructLogger) CaptureEnter(env *vm.EVM, typ vm.OpCode, from common.Address, to common.Address, ...) error
- func (l *StructLogger) CaptureExit(output []byte, gasUsed uint64, err error) error
- func (l *StructLogger) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, ...) error
- func (l *StructLogger) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, ...) error
- func (l *StructLogger) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, ...) error
- func (l *StructLogger) Error() error
- func (l *StructLogger) Output() []byte
- func (l *StructLogger) Reset()
- func (l *StructLogger) StructLogs() []StructLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMarkdownLogger ¶
NewMarkdownLogger creates a logger which outputs information in a format adapted for human readability, and is also a valid markdown table
func WriteTrace ¶
WriteTrace writes a formatted trace to the given writer
Types ¶
type Config ¶
type Config struct { EnableMemory bool // enable memory capture DisableStack bool // disable stack capture DisableStorage bool // disable storage capture EnableReturnData bool // enable return data capture Debug bool // print output during capture end Limit int // maximum length of output, but zero means unlimited // Chain overrides, can be used to execute a trace using future fork rules Overrides *params.ChainConfig `json:"overrides,omitempty"` }
Config are the configuration options for structured logger the EVM
type JSONLogger ¶
type JSONLogger struct {
// contains filtered or unexported fields
}
func NewJSONLogger ¶
func NewJSONLogger(cfg *Config, writer io.Writer) *JSONLogger
NewJSONLogger creates a new EVM tracer that prints execution steps as JSON objects into the provided stream.
func (*JSONLogger) CaptureEnd ¶
CaptureEnd is triggered at end of execution.
func (*JSONLogger) CaptureEnter ¶
func (*JSONLogger) CaptureExit ¶
func (l *JSONLogger) CaptureExit(output []byte, gasUsed uint64, err error) error
func (*JSONLogger) CaptureFault ¶
func (*JSONLogger) CaptureStart ¶
type StructLog ¶
type StructLog struct { Pc uint64 `json:"pc"` Op vm.OpCode `json:"op"` Gas uint64 `json:"gas"` GasCost uint64 `json:"gasCost"` Memory []byte `json:"memory"` MemorySize int `json:"memSize"` Stack []uint256.Int `json:"stack"` ReturnData []byte `json:"returnData"` Storage map[common.Hash]common.Hash `json:"-"` Depth int `json:"depth"` RefundCounter uint64 `json:"refund"` Err error `json:"-"` }
StructLog is emitted to the EVM each cycle and lists information about the current internal state prior to the execution of the statement.
func (*StructLog) ErrorString ¶
ErrorString formats the log's error as a string.
func (StructLog) MarshalJSON ¶
MarshalJSON marshals as JSON.
func (*StructLog) UnmarshalJSON ¶
UnmarshalJSON unmarshals from JSON.
type StructLogger ¶
type StructLogger struct {
// contains filtered or unexported fields
}
StructLogger is an EVM state logger and implements EVMLogger.
StructLogger can capture state based on the given Log configuration and also keeps a track record of modified storage which is used in reporting snapshots of the contract their storage.
func NewStructLogger ¶
func NewStructLogger(cfg *Config) *StructLogger
NewStructLogger returns a new logger
func (*StructLogger) CaptureEnd ¶
CaptureEnd is called after the call finishes to finalize the tracing.
func (*StructLogger) CaptureEnter ¶
func (*StructLogger) CaptureExit ¶
func (l *StructLogger) CaptureExit(output []byte, gasUsed uint64, err error) error
func (*StructLogger) CaptureFault ¶
func (*StructLogger) CaptureStart ¶
func (l *StructLogger) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) error
CaptureStart implements the EVMLogger interface to initialize the tracing operation.
func (*StructLogger) CaptureState ¶
func (l *StructLogger) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, memory *vm.Memory, stack *vm.Stack, contract *vm.Contract, depth int, err error) error
CaptureState logs a new structured log message and pushes it out to the environment
CaptureState also tracks SLOAD/SSTORE ops to track storage change.
func (*StructLogger) Error ¶
func (l *StructLogger) Error() error
Error returns the VM error captured by the trace.
func (*StructLogger) Output ¶
func (l *StructLogger) Output() []byte
Output returns the VM return value captured by the trace.
func (*StructLogger) Reset ¶
func (l *StructLogger) Reset()
Reset clears the data held by the logger.
func (*StructLogger) StructLogs ¶
func (l *StructLogger) StructLogs() []StructLog
StructLogs returns the captured log entries.