Documentation
¶
Index ¶
- type CallFrame
- type CallFrames
- type ExecutionTrace
- type ExecutionTracer
- func (t *ExecutionTracer) Close()
- func (t *ExecutionTracer) GetTrace(txHash common.Hash) *ExecutionTrace
- func (t *ExecutionTracer) NativeTracer() *chain.TestChainTracer
- func (t *ExecutionTracer) OnEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, ...)
- func (t *ExecutionTracer) OnExit(depth int, output []byte, gasUsed uint64, err error, reverted bool)
- func (t *ExecutionTracer) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, rData []byte, ...)
- func (t *ExecutionTracer) OnTxEnd(receipt *coretypes.Receipt, err error)
- func (t *ExecutionTracer) OnTxStart(vm *tracing.VMContext, tx *coretypes.Transaction, from common.Address)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallFrame ¶
type CallFrame struct {
// SenderAddress refers to the address which produced this call.
SenderAddress common.Address
// ToAddress refers to the address which was called by the sender.
ToAddress common.Address
// ToContractName refers to the name of the contract which was resolved for the ToAddress.
ToContractName string
// ToContractAbi refers to the ABI of the contract which was resolved for the ToAddress.
ToContractAbi *abi.ABI
// ToInitBytecode refers to the init bytecode recorded for the ToAddress. This is only set if it was being deployed.
ToInitBytecode []byte
// ToRuntimeBytecode refers to the bytecode recorded for the ToAddress. This is only set if the contract was
// successfully deployed in a previous call or at the end of the current call scope.
ToRuntimeBytecode []byte
// CodeAddress refers to the address of the code being executed. This can be different from ToAddress if
// a delegate call was made.
CodeAddress common.Address
// CodeContractName refers to the name of the contract which was resolved for the CodeAddress.
CodeContractName string
// CodeContractAbi refers to the ABI of the contract which was resolved for the CodeAddress.
CodeContractAbi *abi.ABI
// CodeRuntimeBytecode refers to the bytecode recorded for the CodeAddress.
CodeRuntimeBytecode []byte
// Operations contains a chronological history of updates in the call frame.
// Potential types currently are *types.Log (events) or CallFrame (entering of a new child frame).
Operations []any
// SelfDestructed indicates whether the call frame executed a SELFDESTRUCT operation.
SelfDestructed bool
// InputData refers to the message data the EVM call was made with.
InputData []byte
// ConstructorArgsData refers to the subset of InputData that represents constructor argument ABI data. This
// is only set if this call frame is performing a contract creation. Otherwise, this buffer is always nil.
ConstructorArgsData []byte
// ReturnData refers to the data returned by this current call frame.
ReturnData []byte
// CallValue describes the ETH value attached to a given CallFrame
CallValue *big.Int
// ExecutedCode is a boolean that indicates whether code was executed within a CallFrame. A simple transfer of ETH
// would be an example of a CallFrame where ExecutedCode would be false
ExecutedCode bool
// ReturnError refers to any error returned by the EVM in the current call frame.
ReturnError error
// ParentCallFrame refers to the call frame which entered this call frame directly. It may be nil if the current
// call frame is a top level call frame.
ParentCallFrame *CallFrame
}
CallFrame contains information on each EVM call scope, as recorded by an ExecutionTracer.
func (*CallFrame) ChildCallFrames ¶
func (c *CallFrame) ChildCallFrames() CallFrames
ChildCallFrames is a getter function that returns all children of the current CallFrame. A child CallFrame is one that is entered by this CallFrame
func (*CallFrame) IsContractCreation ¶
IsContractCreation indicates whether a contract creation operation was attempted immediately within this call frame. This does not include child or parent frames. Returns true if this call frame attempted contract creation.
func (*CallFrame) IsProxyCall ¶
IsProxyCall indicates whether the address the message was sent to, and the address the code is being executed from are different. This would be indicative of a delegate call. Returns true if the code address and to address do not match, implying a delegate call occurred.
type CallFrames ¶
type CallFrames []*CallFrame
CallFrames represents a list of call frames recorded by the ExecutionTracer.
type ExecutionTrace ¶
type ExecutionTrace struct {
// TopLevelCallFrame refers to the root call frame, the first EVM call scope entered when an externally-owned
// address calls upon a contract.
TopLevelCallFrame *CallFrame
// contains filtered or unexported fields
}
ExecutionTrace contains information recorded by an ExecutionTracer. It contains information about each call scope entered and exited, and their associated contract definitions.
func CallWithExecutionTrace ¶
func CallWithExecutionTrace(testChain *chain.TestChain, contractDefinitions contracts.Contracts, msg *core.Message, state types.MedusaStateDB, verbosity config.VerbosityLevel) (*core.ExecutionResult, *ExecutionTrace, error)
CallWithExecutionTrace obtains an execution trace for a given call, on the provided chain, using the state provided. If a nil state is provided, the current chain state will be used. Returns the ExecutionTrace for the call or an error if one occurs.
func (*ExecutionTrace) Log ¶ added in v0.1.1
func (t *ExecutionTrace) Log() *logging.LogBuffer
Log returns a logging.LogBuffer that represents this execution trace. This buffer will be passed to the underlying logger which will format it accordingly for console or file.
func (*ExecutionTrace) String ¶
func (t *ExecutionTrace) String() string
String returns the string representation of this execution trace
type ExecutionTracer ¶
type ExecutionTracer struct {
// contains filtered or unexported fields
}
ExecutionTracer records execution information into an ExecutionTrace, containing information about each call scope entered and exited.
func NewExecutionTracer ¶
func NewExecutionTracer(contractDefinitions contracts.Contracts, testChain *chain.TestChain, verbosity config.VerbosityLevel) *ExecutionTracer
NewExecutionTracer creates a ExecutionTracer and returns it.
func (*ExecutionTracer) Close ¶ added in v0.1.4
func (t *ExecutionTracer) Close()
Close sets the traceMap to nil and should be called after the execution tracer is finished being used.
func (*ExecutionTracer) GetTrace ¶ added in v0.1.4
func (t *ExecutionTracer) GetTrace(txHash common.Hash) *ExecutionTrace
GetTrace returns the currently recording or last recorded execution trace by the tracer.
func (*ExecutionTracer) NativeTracer ¶ added in v0.1.4
func (t *ExecutionTracer) NativeTracer() *chain.TestChainTracer
NativeTracer returns the underlying TestChainTracer.
func (*ExecutionTracer) OnEnter ¶ added in v0.1.4
func (t *ExecutionTracer) OnEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
OnEnter initializes the tracing operation for the top of a call frame, as defined by tracers.Tracer.
func (*ExecutionTracer) OnExit ¶ added in v0.1.4
func (t *ExecutionTracer) OnExit(depth int, output []byte, gasUsed uint64, err error, reverted bool)
OnExit is called after a call to finalize tracing completes for the top of a call frame, as defined by tracers.Tracer.
func (*ExecutionTracer) OnOpcode ¶ added in v0.1.4
func (t *ExecutionTracer) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, rData []byte, depth int, err error)
OnOpcode records data from an EVM state update, as defined by tracers.Tracer.
func (*ExecutionTracer) OnTxEnd ¶ added in v0.1.4
func (t *ExecutionTracer) OnTxEnd(receipt *coretypes.Receipt, err error)
OnTxEnd is called upon the end of transaction execution, as defined by tracers.Tracer.
func (*ExecutionTracer) OnTxStart ¶ added in v0.1.4
func (t *ExecutionTracer) OnTxStart(vm *tracing.VMContext, tx *coretypes.Transaction, from common.Address)
OnTxStart is called upon the start of transaction execution, as defined by tracers.Tracer.