chainfixture

package
v1.20.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package chainfixture is a fixed test chain for driving a testengine process directly: a chain id, a chain config with every OP Stack fork active at genesis, a genesis writer and helpers that build blocks over the engine API.

Index

Constants

View Source
const ChainID = 901

ChainID is the chain id of the chains WriteGenesis builds. It is deliberately not OP Mainnet's (10): op-reth pins that chain's genesis hash to the registry value, which a synthetic genesis cannot reproduce, so the engine's genesis hash would differ from the one the genesis describes.

Variables

This section is empty.

Functions

func BlockHash

func BlockHash(t testing.TB, c *testengine.Client, number rpc.BlockNumber) common.Hash

BlockHash returns the hash of the block at number, which may be a label such as rpc.SafeBlockNumber, and fails the test if the block does not exist. The hash is computed from the header the engine serves, not taken from its hash field.

func BuildBlock

func BuildBlock(t testing.TB, c *testengine.Client, parent common.Hash, timestamp uint64, deposits []hexutil.Bytes, userTx hexutil.Bytes) common.Hash

BuildBlock runs one sequencer round over the engine API on top of parent — forkchoice update with attributes, optest_includeTx of userTx (if not nil), getPayload, newPayload, and a forkchoice update that makes the new block head, safe and finalized — and returns its hash. It uses the method versions op-node uses for a chain with every fork active.

func ChainConfig

func ChainConfig() *opparams.ChainConfig

ChainConfig returns the chain configuration of the chains WriteGenesis builds: every OP Stack fork through Karst active at genesis.

func DepositTx

func DepositTx(seed byte) hexutil.Bytes

DepositTx returns an encoded minimal deposit transaction; seed sets its source hash, so deposits with different seeds are distinct transactions.

func PayloadAttributes

func PayloadAttributes(timestamp uint64, deposits []hexutil.Bytes) *eth.PayloadAttributes

PayloadAttributes returns Karst-level payload attributes at timestamp that force-include deposits: withdrawals and parent beacon root (Canyon, Ecotone), the Holocene EIP-1559 params and the Jovian minimum base fee, as the Rust engine's own tests build them.

func SignTx

func SignTx(t testing.TB, key *ecdsa.PrivateKey, nonce uint64) hexutil.Bytes

SignTx returns an encoded, signed EIP-1559 value transfer from key's account at nonce.

func WriteGenesis

func WriteGenesis(t testing.TB, alloc types.GenesisAlloc) string

WriteGenesis writes the genesis of a ChainConfig chain to a temporary file and returns its path. The genesis holds alloc plus the L1Block predeploy seeded with the L1-cost inputs, and mirrors the Rust engine's own test chain so the two agree on block construction.

Types

This section is empty.

Jump to

Keyboard shortcuts

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