tracers

package
v0.0.0-...-5d05a64 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIs

func APIs(backend Backend) []rpc.API

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

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 API

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

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

func NewAPI

func NewAPI(backend Backend) *API

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

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) TraceBlock

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) TraceBlockFromFile

func (api *API) 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.

func (*API) TraceCall

func (api *API) TraceCall(ctx context.Context, args zondapi.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.

type Backend

type Backend interface {
	HeaderByHash(ctx context.Context, hash common.Hash) (*protos.BlockHeader, error)
	HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*protos.BlockHeader, error)
	BlockByHash(ctx context.Context, hash common.Hash) (*protos.Block, error)
	BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*protos.Block, error)
	GetTransaction(ctx context.Context, txHash common.Hash) (*protos.Transaction, common.Hash, uint64, uint64, error)
	RPCGasCap() uint64
}

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

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

StdTraceConfig holds extra parameters to standard-json trace functions.

type TraceCallConfig

type TraceCallConfig struct {
	*logger.Config
	Tracer         *string
	Timeout        *string
	Reexec         *uint64
	StateOverrides *zondapi.StateOverride
	BlockOverrides *zondapi.BlockOverrides
}

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

type TraceConfig

type TraceConfig struct {
	*logger.Config
	Tracer  *string
	Timeout *string
	Reexec  *uint64
}

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.

func New

func New(code string, ctx *Context) (Tracer, error)

New returns a new instance of a tracer, by iterating through the registered lookups.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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