types

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	// hash represents the block hash for this block.
	Hash common.Hash

	// header represents the block header for this current block.
	Header *types.Header

	// Messages represent internal EVM core.Message objects. Messages are derived from transactions after validation
	// of a transaction occurs and can be thought of as an internal EVM transaction. It contains typical transaction
	// fields plainly (e.g., no transaction signature is included, the sender is derived and simply supplied as a field
	// in a message).
	Messages []*core.Message

	// MessageResults represents the results recorded while executing transactions.
	MessageResults []*MessageResults
}

Block represents a rudimentary block structure generated by sending messages to a test chain.

func NewBlock

func NewBlock(header *types.Header) *Block

NewBlock returns a new Block with the provided parameters.

type DeployedContractBytecode

type DeployedContractBytecode struct {
	// Address represents the Ethereum address where the deployed contract containing the method exists.
	Address common.Address

	// InitBytecode describes the bytecode used to deploy the contract.
	InitBytecode []byte

	// RuntimeBytecode describes the bytecode which was deployed by the InitBytecode. This is expected to be non-nil.
	RuntimeBytecode []byte
}

DeployedContractBytecode describes the init and runtime bytecode recorded for a given contract address.

type DeployedContractBytecodeChange

type DeployedContractBytecodeChange struct {
	// Contract describes the contract address which was affected as well as the relevant init and runtime bytecode.
	// If this change represents a creation, this is the new bytecode information. If it represents destruction, this
	// is the destroyed bytecode information.
	Contract *DeployedContractBytecode

	// Creation indicates whether the change made was a contract creation. This cannot be true if SelfDestructed or
	// Destroyed are true.
	Creation bool

	// DynamicCreation indicates whether the change made was a _dynamic_ contract creation. This cannot be true if
	// Creation is false.
	DynamicCreation bool

	// SelfDestructed indicates whether the change made was due to a self-destruct instruction being executed. This
	// cannot be true if Creation is true.
	// Note: This may not be indicative of contract removal (as is the case with Destroyed), as proposed changes to
	// the `SELFDESTRUCT` instruction aim to not remove contract code.
	SelfDestructed bool

	// Destroyed indicates whether the contract was destroyed as a result of the operation, indicating the code
	// provided by Contract is no longer available.
	Destroyed bool
}

DeployedContractBytecodeChange describes a change made to a given contract addresses' code due to state updates (e.g. from a transaction being processed).

type GenericHookFunc

type GenericHookFunc func()

GenericHookFunc defines a basic function that takes no arguments and returns none, to be used as a hook during execution.

type GenericHookFuncs

type GenericHookFuncs []GenericHookFunc

GenericHookFuncs wraps a list of GenericHookFunc items. It provides operations to push new hooks into the top or bottom of the list and execute in forward or backward directions.

func (*GenericHookFuncs) Execute

func (t *GenericHookFuncs) Execute(forward bool, clear bool)

Execute takes each hook in the list and executes it in the given order, indicating whether they should be cleared. If the forward flag is provided, hooks are executed from index 0 to the end, otherwise they are executed in reverse. If the clear flag is provided, it sets the hooks to empty/nil afterwards on the immediate pointer. Copies of the pointer should be considered carefully here.

func (*GenericHookFuncs) Push

func (t *GenericHookFuncs) Push(f GenericHookFunc)

Push pushes a provided hook onto the stack (end of the list).

type MessageResults

type MessageResults struct {
	// PreStateRoot refers to the state root hash prior to the execution of this transaction.
	PreStateRoot common.Hash

	// PostStateRoot refers to the state root hash after the execution of this transaction.
	PostStateRoot common.Hash

	// ExecutionResult describes the core.ExecutionResult returned after processing a given call.
	ExecutionResult *core.ExecutionResult

	// Receipt represents the transaction receipt
	Receipt *types.Receipt

	// ContractDeploymentChanges describes changes made to deployed contracts, such as creation and destruction.
	ContractDeploymentChanges []DeployedContractBytecodeChange

	// AdditionalResults represents results of arbitrary types which can be stored by any part of the application,
	// such as a tracers.
	AdditionalResults map[string]any

	// OnRevertHookFuncs refers hook functions that should be executed when this transaction is reverted.
	// This is to be used when a non-vm safe operation occurs, such as patching chain ID mid-execution, to ensure
	// that when the transaction is reverted, the value is also restored.
	// The hooks are executed as a stack (to support revert operations).
	OnRevertHookFuncs GenericHookFuncs
}

MessageResults represents metadata obtained from the execution of a CallMessage in a Block. This contains results such as contracts deployed, and other variables tracked by a chain.TestChain.

Jump to

Keyboard shortcuts

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