executiontracer

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

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

func (c *CallFrame) IsContractCreation() bool

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

func (c *CallFrame) IsProxyCall() bool

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(chain *chain.TestChain, contractDefinitions contracts.Contracts, msg *core.Message, state *state.StateDB) (*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, cheatCodeContracts map[common.Address]*chain.CheatCodeContract) *ExecutionTracer

NewExecutionTracer creates a ExecutionTracer and returns it.

func (*ExecutionTracer) CaptureEnd

func (t *ExecutionTracer) CaptureEnd(output []byte, gasUsed uint64, err error)

CaptureEnd is called after a call to finalize tracing completes for the top of a call frame, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureEnter

func (t *ExecutionTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)

CaptureEnter is called upon entering of the call frame, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureExit

func (t *ExecutionTracer) CaptureExit(output []byte, gasUsed uint64, err error)

CaptureExit is called upon exiting of the call frame, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureFault

func (t *ExecutionTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error)

CaptureFault records an execution fault, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureStart

func (t *ExecutionTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)

CaptureStart initializes the tracing operation for the top of a call frame, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureState

func (t *ExecutionTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, vmErr error)

CaptureState records data from an EVM state update, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureTxEnd

func (t *ExecutionTracer) CaptureTxEnd(restGas uint64)

CaptureTxEnd is called upon the end of transaction execution, as defined by vm.EVMLogger.

func (*ExecutionTracer) CaptureTxStart

func (t *ExecutionTracer) CaptureTxStart(gasLimit uint64)

CaptureTxStart is called upon the start of transaction execution, as defined by vm.EVMLogger.

func (*ExecutionTracer) Trace

func (t *ExecutionTracer) Trace() *ExecutionTrace

Trace returns the currently recording or last recorded execution trace by the tracer.

Jump to

Keyboard shortcuts

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