tracers

package
v0.13.5-remove-optiona... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2024 License: GPL-3.0, LGPL-3.0 Imports: 24 Imported by: 11

Documentation

Overview

Package tracers is a manager for transaction tracing engines.

Index

Constants

This section is empty.

Variables

View Source
var DefaultDirectory = directory{/* contains filtered or unexported fields */}

DefaultDirectory is the collection of tracers bundled by default.

Functions

func APIs added in v0.5.0

func APIs(backend Backend) []rpc.API

APIs return the collection of RPC services the tracer package offers.

func GetMemoryCopyPadded added in v0.12.4

func GetMemoryCopyPadded(m *vm.Memory, offset, size int64) ([]byte, error)

GetMemoryCopyPadded returns offset + size as a new slice. It zero-pads the slice if it extends beyond memory bounds.

Types

type API added in v0.5.0

type API struct {
	// contains filtered or unexported fields
}

API is the collection of tracing APIs exposed over the private debugging endpoint.

func NewAPI added in v0.5.0

func NewAPI(backend Backend) *API

NewAPI creates a new API definition for the tracing methods of the Ethereum service.

func (*API) IntermediateRoots added in v0.7.1

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 added in v0.7.4

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 added in v0.5.0

func (api *API) TraceBlock(ctx context.Context, blob hexutil.Bytes, 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 added in v0.5.0

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 added in v0.5.0

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 added in v0.5.0

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. If no transaction index is specified, the trace will be conducted on the state after executing the specified block. However, if a transaction index is provided, the trace will be conducted on the state after executing the specified transaction within the specified block.

func (*API) TraceChain added in v0.5.0

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 added in v0.5.0

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 added in v0.5.0

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, []*core.BadBlockReason)
	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, readOnly bool, preferDisk bool) (*state.StateDB, StateReleaseFunc, error)
	StateAtNextBlock(ctx context.Context, parent, block *types.Block, reexec uint64, base *state.StateDB, readOnly bool, preferDisk bool) (*state.StateDB, StateReleaseFunc, error)
	StateAtTransaction(ctx context.Context, block *types.Block, txIndex int, reexec uint64) (*core.Message, vm.BlockContext, *state.StateDB, StateReleaseFunc, error)
}

Backend interface provides the common API services (that are provided by both full and light clients) with access to necessary functions.

type Context added in v0.6.0

type Context struct {
	BlockHash   common.Hash // Hash of the block the tx is contained within (zero if dangling tx or call)
	BlockNumber *big.Int    // Number 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 FileTracerAPI added in v0.11.7

type FileTracerAPI struct {
	// contains filtered or unexported fields
}

FileTracerAPI is the collection of additional tracing APIs exposed over the private debugging endpoint that log their output to a file.

func NewFileTracerAPI added in v0.11.7

func NewFileTracerAPI(backend Backend) *FileTracerAPI

NewFileTracerAPI creates a new API definition for the tracing methods of the Ethererum service that log their output to a file.

func (*FileTracerAPI) StandardTraceBadBlockToFile added in v0.11.7

func (api *FileTracerAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)

StandardTraceBadBlockToFile dumps the structured logs created during the execution of EVM against a block pulled from the pool of bad ones to the local file system and returns a list of files to the caller.

func (*FileTracerAPI) StandardTraceBlockToFile added in v0.11.7

func (api *FileTracerAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)

StandardTraceBlockToFile dumps the structured logs created during the execution of EVM to the local file system and returns a list of files to the caller.

func (*FileTracerAPI) TraceBlock added in v0.11.7

func (api *FileTracerAPI) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *TraceConfig) ([]*txTraceResult, error)

TraceBlock returns the structured logs created during the execution of EVM and returns them as a JSON object.

func (*FileTracerAPI) TraceBlockFromFile added in v0.11.7

func (api *FileTracerAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)

TraceBlockFromFile returns the structured logs created during the execution of EVM and returns them as a JSON object.

type StateReleaseFunc added in v0.12.0

type StateReleaseFunc func()

StateReleaseFunc is used to deallocate resources held by constructing a historical state for tracing purposes.

type StdTraceConfig added in v0.5.0

type StdTraceConfig struct {
	logger.Config
	Reexec *uint64
	TxHash common.Hash
}

StdTraceConfig holds extra parameters to standard-json trace functions.

type TraceCallConfig added in v0.5.4

type TraceCallConfig struct {
	TraceConfig
	StateOverrides *ethapi.StateOverride
	BlockOverrides *ethapi.BlockOverrides
	TxIndex        *hexutil.Uint
}

TraceCallConfig is the config for traceCall API. It holds one more field to override the state for tracing.

type TraceConfig added in v0.5.0

type TraceConfig struct {
	*logger.Config
	Tracer  *string
	Timeout *string
	Reexec  *uint64
	// Config specific to given tracer. Note struct logger
	// config are historically embedded in main object.
	TracerConfig json.RawMessage
}

TraceConfig holds extra parameters to trace functions.

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.

Directories

Path Synopsis
internal
tracetest
(c) 2023, Ava Labs, Inc.
(c) 2023, Ava Labs, Inc.
js
internal/tracers
Package tracers contains the actual JavaScript tracer assets.
Package tracers contains the actual JavaScript tracer assets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL