Documentation ¶
Overview ¶
Package tracers is a manager for transaction tracing engines.
Index ¶
- Constants
- func NewTracer(tracer string, msg core.Message, cfg *params.ChainConfig, height int64) vm.EVMLogger
- func RegisterLookup(wildcard bool, lookup lookupFunc)
- type Context
- type ExecutionResult
- type NoOpTracer
- func (dt NoOpTracer) CaptureEnd(output []byte, gasUsed uint64, tm time.Duration, err error)
- func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, ...)
- func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error)
- func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, ...)
- func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, ...)
- func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, ...)
- func (dt NoOpTracer) CaptureTxEnd(restGas uint64)
- func (dt NoOpTracer) CaptureTxStart(gasLimit uint64)
- type StructLogRes
- type TraceConfig
- type Tracer
- type TxTraceResult
- type TxTraceTask
Constants ¶
const ( TracerAccessList = "access_list" TracerJSON = "json" TracerStruct = "struct" TracerMarkdown = "markdown" )
Variables ¶
This section is empty.
Functions ¶
func NewTracer ¶
NewTracer creates a new Logger tracer to collect execution traces from an EVM transaction.
func RegisterLookup ¶
func RegisterLookup(wildcard bool, lookup lookupFunc)
RegisterLookup registers a method as a lookup for tracers, meaning that users can invoke a named tracer through that lookup. If 'wildcard' is true, then the lookup will be placed last. This is typically meant for interpreted engines (js) which can evaluate dynamic user-supplied code.
Types ¶
type Context ¶
type Context struct { BlockHash common.Hash // Hash of the block the tx is contained within (zero if dangling tx or call) TxIndex int // Index of the transaction within a block (zero if dangling tx or call) TxHash common.Hash // Hash of the transaction being traced (zero if dangling call) }
Context contains some contextual infos for a transaction execution that is not available from within the EVM object.
type ExecutionResult ¶
type ExecutionResult struct { Gas uint64 `json:"gas"` Failed bool `json:"failed"` ReturnValue string `json:"returnValue"` StructLogs []StructLogRes `json:"structLogs"` }
ExecutionResult groups all structured logs emitted by the EVM while replaying a transaction in debug mode as well as transaction execution status, the amount of gas used and the return value
type NoOpTracer ¶
type NoOpTracer struct{}
NoOpTracer is an empty implementation of vm.Tracer interface
func (NoOpTracer) CaptureEnd ¶
CaptureEnd implements vm.Tracer interface
func (NoOpTracer) CaptureEnter ¶
func (dt NoOpTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
CaptureEnter implements vm.Tracer interface
func (NoOpTracer) CaptureExit ¶
func (dt NoOpTracer) CaptureExit(output []byte, gasUsed uint64, err error)
CaptureExit implements vm.Tracer interface
func (NoOpTracer) CaptureFault ¶
func (dt NoOpTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)
CaptureFault implements vm.Tracer interface
func (NoOpTracer) CaptureStart ¶
func (dt NoOpTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
CaptureStart implements vm.Tracer interface
func (NoOpTracer) CaptureState ¶
func (dt NoOpTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)
CaptureState implements vm.Tracer interface
func (NoOpTracer) CaptureTxEnd ¶
func (dt NoOpTracer) CaptureTxEnd(restGas uint64)
CaptureTxEnd implements vm.Tracer interface
func (NoOpTracer) CaptureTxStart ¶
func (dt NoOpTracer) CaptureTxStart(gasLimit uint64)
CaptureTxStart implements vm.Tracer interface
type StructLogRes ¶
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"` }
StructLogRes stores a structured log emitted by the EVM while replaying a transaction in debug mode. Taken from go-ethereum
func FormatLogs ¶
func FormatLogs(logs []logger.StructLog) []StructLogRes
FormatLogs formats EVM returned structured logs for json output
type TraceConfig ¶
type Tracer ¶
type Tracer interface { vm.EVMLogger GetResult() (json.RawMessage, error) // Stop terminates execution of the tracer at the first opportune moment. Stop(err error) }
Tracer interface extends vm.EVMLogger and additionally allows collecting the tracing result.
type TxTraceResult ¶
type TxTraceResult struct { Result interface{} `json:"result,omitempty"` // Trace results produced by the tracer Error string `json:"error,omitempty"` // Trace failure produced by the tracer }
TxTraceResult is the result of a single transaction trace during a block trace.
type TxTraceTask ¶
type TxTraceTask struct {
Index int // Transaction offset in the block
}
TxTraceTask represents a single transaction trace task when an entire block is being traced.
Directories ¶
Path | Synopsis |
---|---|
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
|
Package tracers contains the actual JavaScript tracer assets. |
Package native is a collection of tracers written in go.
|
Package native is a collection of tracers written in go. |