Documentation ¶
Index ¶
- func WriteLogs(writer io.Writer, logs []*types.Log)
- func WriteTrace(writer io.Writer, logs []StructLog)
- type Storage
- type StructLog
- type StructLogger
- func (l *StructLogger) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
- func (l *StructLogger) CaptureEnter(opCode int, from, to types.Address, input []byte, gas uint64, value *big.Int)
- func (l *StructLogger) CaptureExit(output []byte, gasUsed uint64, err error)
- func (l *StructLogger) CaptureFault(ctx *runtime.ScopeContext, pc uint64, opCode int, gas, cost uint64, depth int, ...)
- func (l *StructLogger) CaptureStart(txn runtime.Txn, from, to types.Address, create bool, input []byte, gas uint64, ...)
- func (l *StructLogger) CaptureState(ctx *runtime.ScopeContext, pc uint64, opCode int, gas, cost uint64, ...)
- 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 WriteTrace ¶
WriteTrace writes a formatted trace to the given writer
Types ¶
type StructLog ¶
type StructLog struct { Pc uint64 `json:"pc"` Op int `json:"op"` Gas uint64 `json:"gas"` GasCost uint64 `json:"gasCost"` Memory []byte `json:"memory"` MemorySize int `json:"memSize"` Stack []*big.Int `json:"stack"` ReturnData []byte `json:"returnData"` Storage map[types.Hash]types.Hash `json:"-"` Depth int `json:"depth"` RefundCounter uint64 `json:"refund"` Err error `json:"-"` OpName string `json:"opName"` ErrorString string `json:"error"` }
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) GetErrorString ¶
GetErrorString formats the log's error as a string.
func (StructLog) MarshalJSON ¶
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(txn runtime.Txn) *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)
func (*StructLogger) CaptureFault ¶
func (l *StructLogger) CaptureFault(ctx *runtime.ScopeContext, pc uint64, opCode int, gas, cost uint64, depth int, err error)
CaptureFault implements the EVMLogger interface to trace an execution fault while running an opcode.
func (*StructLogger) CaptureStart ¶
func (l *StructLogger) CaptureStart(txn runtime.Txn, from, to types.Address, create bool, input []byte, gas uint64, value *big.Int)
CaptureStart implements the EVMLogger interface to initialize the tracing operation.
func (*StructLogger) CaptureState ¶
func (l *StructLogger) CaptureState( ctx *runtime.ScopeContext, pc uint64, opCode int, gas, cost uint64, rData []byte, depth int, err 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.