Documentation
¶
Overview ¶
Package tracers is a collection of JavaScript transaction tracers.
Index ¶
- func APIs(backend Backend) []rpc.API
- type API
- func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config *TraceConfig) ([]common.Hash, error)
- func (api *API) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, ...) (interface{}, error)
- func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
- func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
- type Backend
- type Context
- type StdTraceConfig
- type TraceCallConfig
- type TraceConfig
- type Tracer
- func (jst *Tracer) CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
- func (jst *Tracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, ...)
- func (jst *Tracer) CaptureExit(output []byte, gasUsed uint64, err error)
- func (jst *Tracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, ...)
- func (jst *Tracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, ...)
- func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, ...)
- func (jst *Tracer) GetResult() (json.RawMessage, error)
- func (jst *Tracer) Stop(err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is the collection of tracing APIs exposed over the private debugging endpoint.
func (*API) IntermediateRoots ¶
func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config *TraceConfig) ([]common.Hash, error)
IntermediateRoots executes a block (bad- or canon- or side-), and returns a list of intermediate roots: the stateroot after each transaction.
func (*API) TraceBadBlock ¶
func (api *API) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
TraceBadBlock returns the structured logs created during the execution of EVM against a block pulled from the pool of bad ones and returns them as a JSON object.
func (*API) TraceBlock ¶
func (api *API) TraceBlock(ctx context.Context, blob []byte, config *TraceConfig) ([]*txTraceResult, error)
TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*API) TraceBlockByHash ¶
func (api *API) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByHash returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*API) TraceBlockByNumber ¶
func (api *API) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]*txTraceResult, error)
TraceBlockByNumber returns the structured logs created during the execution of EVM and returns them as a JSON object.
func (*API) TraceCall ¶
func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error)
TraceCall lets you trace a given eth_call. It collects the structured logs created during the execution of EVM if the given transaction was added on top of the provided block and returns them as a JSON object. You can provide -2 as a block number to trace on top of the pending block.
func (*API) TraceChain ¶
func (api *API) TraceChain(ctx context.Context, start, end rpc.BlockNumber, config *TraceConfig) (*rpc.Subscription, error)
TraceChain returns the structured logs created during the execution of EVM between two blocks (excluding start) and returns them as a JSON object.
func (*API) TraceTransaction ¶
func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type Backend ¶
type Backend interface { HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error) BadBlocks() []*types.Block GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) RPCGasCap() uint64 ChainConfig() *params.ChainConfig Engine() consensus.Engine ChainDb() ethdb.Database StateAtBlock(ctx context.Context, block *types.Block, reexec uint64, base *state.StateDB, checkLive bool) (*state.StateDB, error) StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (core.Message, vm.BlockContext, *state.StateDB, error) }
Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.
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 StdTraceConfig ¶
StdTraceConfig holds extra parameters to standard-json trace functions.
type TraceCallConfig ¶
type TraceCallConfig struct { *vm.LogConfig Tracer *string Timeout *string Reexec *uint64 StateOverrides *ethapi.StateOverride }
TraceCallConfig is the config for traceCall API. It holds one more field to override the state for tracing.
type TraceConfig ¶
TraceConfig holds extra parameters to trace functions.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer provides an implementation of Tracer that evaluates a Javascript function for each VM execution step.
func New ¶
New instantiates a new tracer instance. code specifies a Javascript snippet, which must evaluate to an expression returning an object with 'step', 'fault' and 'result' functions.
func (*Tracer) CaptureEnd ¶
CaptureEnd is called after the call finishes to finalize the tracing.
func (*Tracer) CaptureEnter ¶
func (jst *Tracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct).
func (*Tracer) CaptureExit ¶
CaptureExit is called when EVM exits a scope, even if the scope didn't execute any code.
func (*Tracer) CaptureFault ¶
func (jst *Tracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)
CaptureFault implements the Tracer interface to trace an execution fault
func (*Tracer) CaptureStart ¶
func (jst *Tracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
CaptureStart implements the Tracer interface to initialize the tracing operation.
func (*Tracer) CaptureState ¶
func (jst *Tracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error)
CaptureState implements the Tracer interface to trace a single step of VM execution.