Documentation
¶
Overview ¶
Package tracers is a manager for transaction tracing engines.
Index ¶
- Variables
- func APIs(backend Backend) []rpc.API
- func GetMemoryCopyPadded(m *vm.Memory, offset, size int64) ([]byte, error)
- type API
- func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config *TraceConfig) ([]common.Hash, error)
- func (api *API) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
- func (api *API) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([]string, error)
- func (api *API) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceBlock(ctx context.Context, blob hexutil.Bytes, 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) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([]*txTraceResult, error)
- func (api *API) TraceCall(ctx context.Context, args ethapi.TransactionArgs, ...) (interface{}, error)
- func (api *API) TraceCallMany(ctx context.Context, txs []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 ParityTrace
- type StateReleaseFunc
- type StdTraceConfig
- type TraceAPI
- func (api *TraceAPI) Block(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]interface{}, error)
- func (api *TraceAPI) Call(ctx context.Context, args ethapi.TransactionArgs, ...) (interface{}, error)
- func (api *TraceAPI) CallMany(ctx context.Context, txs []ethapi.TransactionArgs, ...) (interface{}, error)
- func (api *TraceAPI) Filter(ctx context.Context, args TraceFilterArgs, config *TraceConfig) (*rpc.Subscription, error)
- func (api *TraceAPI) Transaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
- type TraceCallConfig
- type TraceConfig
- type TraceFilterArgs
- type TraceRewardAction
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var DefaultDirectory = directory{/* contains filtered or unexported fields */}
DefaultDirectory is the collection of tracers bundled by default.
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) StandardTraceBadBlockToFile ¶
func (api *API) 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 (*API) StandardTraceBlockToFile ¶
func (api *API) 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 (*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 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 ¶
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) 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 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) TraceCallMany ¶
func (api *API) TraceCallMany(ctx context.Context, txs []ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error)
TraceCallMany 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)
GetTransaction(ctx context.Context, txHash common.Hash) (bool, *types.Transaction, common.Hash, uint64, uint64, error)
RPCGasCap() uint64
ChainConfig() ctypes.ChainConfigurator
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)
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 ¶
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 ParityTrace ¶
type ParityTrace struct {
Action TraceRewardAction `json:"action"`
BlockHash common.Hash `json:"blockHash"`
BlockNumber uint64 `json:"blockNumber"`
Error string `json:"error,omitempty"`
Result interface{} `json:"result"`
Subtraces int `json:"subtraces"`
TraceAddress []int `json:"traceAddress"`
TransactionHash *common.Hash `json:"transactionHash"`
TransactionPosition *uint64 `json:"transactionPosition"`
Type string `json:"type"`
}
ParityTrace A trace in the desired format (Parity/OpenEtherum) See: https://Parity.github.io/wiki/JSONRPC-trace-module
type StateReleaseFunc ¶
type StateReleaseFunc func()
StateReleaseFunc is used to deallocate resources held by constructing a historical state for tracing purposes.
type StdTraceConfig ¶
StdTraceConfig holds extra parameters to standard-json trace functions.
type TraceAPI ¶
type TraceAPI struct {
// contains filtered or unexported fields
}
TraceAPI is the collection of Ethereum full node APIs exposed over the private debugging endpoint.
func NewTraceAPI ¶
NewTraceAPI creates a new API definition for the full node-related private debug methods of the Ethereum service.
func (*TraceAPI) Block ¶
func (api *TraceAPI) Block(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([]interface{}, error)
Block returns the structured logs created during the execution of EVM and returns them as a JSON object. The correct name will be TraceBlockByNumber, though we want to be compatible with Parity trace module.
func (*TraceAPI) Call ¶
func (api *TraceAPI) Call(ctx context.Context, args ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error)
Call 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 (*TraceAPI) CallMany ¶
func (api *TraceAPI) CallMany(ctx context.Context, txs []ethapi.TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceCallConfig) (interface{}, error)
CallMany 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 (*TraceAPI) Filter ¶
func (api *TraceAPI) Filter(ctx context.Context, args TraceFilterArgs, config *TraceConfig) (*rpc.Subscription, error)
Filter configures a new tracer according to the provided configuration, and executes all the transactions contained within. The return value will be one item per transaction, dependent on the requested tracer.
func (*TraceAPI) Transaction ¶
func (api *TraceAPI) Transaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error)
Transaction returns the structured logs created during the execution of EVM and returns them as a JSON object.
type TraceCallConfig ¶
type TraceCallConfig struct {
TraceConfig
StateOverrides *ethapi.StateOverride
BlockOverrides *ethapi.BlockOverrides
NestedTraceOutput bool // Returns the trace output JSON nested under the trace name key. This allows full Parity compatibility to be achieved.
TxIndex *hexutil.Uint
}
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
NestedTraceOutput bool // Returns the trace output JSON nested under the trace name key. This allows full Parity compatibility to be achieved.
// 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 TraceFilterArgs ¶
type TraceFilterArgs struct {
FromBlock hexutil.Uint64 `json:"fromBlock,omitempty"` // Trace from this starting block
ToBlock hexutil.Uint64 `json:"toBlock,omitempty"` // Trace utill this end block
FromAddress *common.Address `json:"fromAddress,omitempty"` // Sent from these addresses
ToAddress *common.Address `json:"toAddress,omitempty"` // Sent to these addresses
After uint64 `json:"after,omitempty"` // The offset trace number
Count uint64 `json:"count,omitempty"` // Integer number of traces to display in a batch
}
TraceFilterArgs represents the arguments for a call.