eestconv

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package eestconv provides functionality to convert Ethereum Execution Spec Test (EEST) fixtures to an intermediate representation that can be replayed on a normal network.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressMapper

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

AddressMapper tracks address to placeholder mappings

func NewAddressMapper

func NewAddressMapper() *AddressMapper

NewAddressMapper creates a new AddressMapper instance

func (*AddressMapper) GetBytecodeKey

func (m *AddressMapper) GetBytecodeKey(addr string) string

GetBytecodeKey returns the placeholder for use in bytecode/addresses: $contract[i] or $sender[i]

func (*AddressMapper) GetContractIndex

func (m *AddressMapper) GetContractIndex(addr string) (int, bool)

GetContractIndex returns the contract index for an address

func (*AddressMapper) GetSenderIndex

func (m *AddressMapper) GetSenderIndex(addr string) (int, bool)

GetSenderIndex returns the sender index for an address

func (*AddressMapper) GetYAMLKey

func (m *AddressMapper) GetYAMLKey(addr string) string

GetYAMLKey returns the key for use in YAML maps (prerequisites, postcheck, from): contract[1] or sender[1]

func (*AddressMapper) RegisterContract

func (m *AddressMapper) RegisterContract(addr string) int

RegisterContract registers a contract address and returns its index

func (*AddressMapper) RegisterSender

func (m *AddressMapper) RegisterSender(addr string) int

RegisterSender registers a sender address and returns its index

func (*AddressMapper) ReplaceAddresses

func (m *AddressMapper) ReplaceAddresses(data string) string

ReplaceAddresses replaces all known addresses in a string with their placeholders

type ConvertOptions

type ConvertOptions struct {
	// TestPattern is a regex pattern to include tests by path/name
	TestPattern string
	// ExcludePattern is a regex pattern to exclude tests by path/name
	ExcludePattern string
	// Verbose enables verbose logging of each converted payload
	Verbose bool
}

ConvertOptions holds options for the conversion process

type ConvertedAccessListItem

type ConvertedAccessListItem struct {
	Address     string   `yaml:"address"`
	StorageKeys []string `yaml:"storageKeys,omitempty"`
}

ConvertedAccessListItem represents a converted access list entry

type ConvertedAuthorizationItem

type ConvertedAuthorizationItem struct {
	ChainID uint64 `yaml:"chainId"`
	Address string `yaml:"address"` // Address to delegate to (can be $contract[i])
	Nonce   uint64 `yaml:"nonce"`
	Signer  string `yaml:"signer,omitempty"` // Original signer address or $sender[i] if it's a sender
	V       string `yaml:"v,omitempty"`      // Original signature V (for non-sender signers)
	R       string `yaml:"r,omitempty"`      // Original signature R (for non-sender signers)
	S       string `yaml:"s,omitempty"`      // Original signature S (for non-sender signers)
}

ConvertedAuthorizationItem represents a converted authorization entry

type ConvertedOutput

type ConvertedOutput struct {
	Payloads []ConvertedPayload `yaml:"payloads"`
}

ConvertedOutput is the top-level output structure

type ConvertedPayload

type ConvertedPayload struct {
	Name          string                    `yaml:"name"`
	Prerequisites map[string]string         `yaml:"prerequisites"`
	Txs           []ConvertedTx             `yaml:"txs"`
	PostCheck     map[string]PostCheckEntry `yaml:"postcheck"`
}

ConvertedPayload represents a single converted test case

type ConvertedTx

type ConvertedTx struct {
	From                 string                       `yaml:"from"`
	Type                 int                          `yaml:"type"`
	To                   string                       `yaml:"to,omitempty"`
	Data                 string                       `yaml:"data,omitempty"`
	Gas                  uint64                       `yaml:"gas"`
	GasPrice             uint64                       `yaml:"gasPrice,omitempty"`
	MaxFeePerGas         uint64                       `yaml:"maxFeePerGas,omitempty"`
	MaxPriorityFeePerGas uint64                       `yaml:"maxPriorityFeePerGas,omitempty"`
	Value                string                       `yaml:"value,omitempty"`
	AccessList           []ConvertedAccessListItem    `yaml:"accessList,omitempty"`
	BlobCount            int                          `yaml:"blobCount,omitempty"`         // Number of blobs for type 3 tx
	AuthorizationList    []ConvertedAuthorizationItem `yaml:"authorizationList,omitempty"` // EIP-7702 authorizations for type 4 tx
	FixtureBaseFee       uint64                       `yaml:"fixtureBaseFee,omitempty"`    // Block base fee from fixture for balance scaling
}

ConvertedTx represents a converted transaction

type Converter

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

Converter handles the conversion of EEST fixtures

func NewConverter

func NewConverter(logger logrus.FieldLogger, options ConvertOptions) (*Converter, error)

NewConverter creates a new Converter instance

func (*Converter) ConvertDirectory

func (c *Converter) ConvertDirectory(inputPath string) (*ConvertedOutput, error)

ConvertDirectory converts all EEST fixtures in a directory

type EESTAccessListEntry

type EESTAccessListEntry struct {
	Address     string   `json:"address"`
	StorageKeys []string `json:"storageKeys"`
}

EESTAccessListEntry represents an EIP-2930 access list entry

type EESTAccount

type EESTAccount struct {
	Nonce   string            `json:"nonce"`
	Balance string            `json:"balance"`
	Code    string            `json:"code"`
	Storage map[string]string `json:"storage"`
}

EESTAccount represents an account state

type EESTAuthorizationEntry

type EESTAuthorizationEntry struct {
	ChainID string `json:"chainId"`
	Address string `json:"address"`
	Nonce   string `json:"nonce"`
	V       string `json:"v"`
	R       string `json:"r"`
	S       string `json:"s"`
	Signer  string `json:"signer"`
	YParity string `json:"yParity"`
}

EESTAuthorizationEntry represents an EIP-7702 authorization entry

type EESTBlock

type EESTBlock struct {
	BlockHeader  EESTBlockHeader   `json:"blockHeader"`
	Transactions []EESTTransaction `json:"transactions"`
}

EESTBlock represents a block

type EESTBlockHeader

type EESTBlockHeader struct {
	ParentHash    string `json:"parentHash"`
	Coinbase      string `json:"coinbase"`
	StateRoot     string `json:"stateRoot"`
	Number        string `json:"number"`
	GasLimit      string `json:"gasLimit"`
	GasUsed       string `json:"gasUsed"`
	Timestamp     string `json:"timestamp"`
	BaseFeePerGas string `json:"baseFeePerGas"`
}

EESTBlockHeader represents a block header

type EESTConfig

type EESTConfig struct {
	Network string `json:"network"`
	ChainID string `json:"chainid"`
}

EESTConfig represents the test configuration

type EESTFixture

type EESTFixture map[string]EESTTestCase

EESTFixture represents a collection of test cases

type EESTTestCase

type EESTTestCase struct {
	Network            string                 `json:"network"`
	GenesisBlockHeader EESTBlockHeader        `json:"genesisBlockHeader"`
	Pre                map[string]EESTAccount `json:"pre"`
	PostState          map[string]EESTAccount `json:"postState"`
	Blocks             []EESTBlock            `json:"blocks"`
	Config             EESTConfig             `json:"config"`
	Info               map[string]any         `json:"_info"`
}

EESTTestCase represents a single test case in the fixture

type EESTTransaction

type EESTTransaction struct {
	Type     string `json:"type"`
	ChainID  string `json:"chainId"`
	Nonce    string `json:"nonce"`
	GasPrice string `json:"gasPrice"`
	GasLimit string `json:"gasLimit"`
	To       string `json:"to"`
	Value    string `json:"value"`
	Data     string `json:"data"`
	V        string `json:"v"`
	R        string `json:"r"`
	S        string `json:"s"`
	Sender   string `json:"sender"`
	// EIP-1559 fields
	MaxFeePerGas         string `json:"maxFeePerGas"`
	MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas"`
	// EIP-2930 access list
	AccessList []EESTAccessListEntry `json:"accessList"`
	// EIP-4844 blob tx fields
	MaxFeePerBlobGas    string   `json:"maxFeePerBlobGas"`
	BlobVersionedHashes []string `json:"blobVersionedHashes"`
	// EIP-7702 set code tx fields
	AuthorizationList []EESTAuthorizationEntry `json:"authorizationList"`
}

EESTTransaction represents a transaction

type PostCheckEntry

type PostCheckEntry struct {
	Balance string            `yaml:"balance,omitempty"`
	Storage map[string]string `yaml:"storage,omitempty"`
}

PostCheckEntry represents checks to perform after execution

Jump to

Keyboard shortcuts

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