Versions in this module Expand all Collapse all v1 v1.1.1 Feb 22, 2026 v1.1.0 Feb 19, 2026 Changes in this version + var ErrInvalidBlockSequence = errors.New("invalid block sequence") + var ErrInvalidGasUsed = errors.New("invalid block gas used") + var ErrInvalidParentHash = errors.New("parent block hash is invalid") + var ErrInvalidReceiptsRoot = errors.New("invalid block receipts root") + var ErrInvalidReceiptsSize = errors.New("invalid number of receipts") + var ErrInvalidSha3Uncles = errors.New("invalid block sha3 uncles root") + var ErrInvalidStateRoot = errors.New("invalid block state root") + var ErrInvalidTxRoot = errors.New("invalid block transactions root") + var ErrNoBlock = errors.New("no block data passed in") + var ErrParentHashMismatch = errors.New("invalid parent block hash") + var ErrParentNotFound = errors.New("parent block not found") + func AppendNewTestHeaders(headers []*types.Header, n int) []*types.Header + func AppendNewTestheadersWithSeed(headers []*types.Header, n int, seed uint64) []*types.Header + func HeadersToBlocks(headers []*types.Header) []*types.Block + func NewTestHeaders(n int) []*types.Header + func NewTestHeadersWithSeed(genesis *types.Header, n int, seed uint64) []*types.Header + type BlockResult struct + Receipts []*types.Receipt + Root types.Hash + TotalGas uint64 + type Blockchain struct + func NewBlockchain(logger hclog.Logger, db storage.Storage, config *chain.Chain, ...) (*Blockchain, error) + func NewMockBlockchain(callbackMap map[TestCallbackType]interface{}) (*Blockchain, error) + func NewTestBlockchain(t *testing.T, headers []*types.Header) *Blockchain + func TestBlockchain(t *testing.T, genesis *chain.Genesis) *Blockchain + func (b *Blockchain) CalculateBaseFee(parent *types.Header) uint64 + func (b *Blockchain) CalculateGasLimit(number uint64) (uint64, error) + func (b *Blockchain) Close() error + func (b *Blockchain) ComputeGenesis() error + func (b *Blockchain) Config() *chain.Params + func (b *Blockchain) CurrentTD() *big.Int + func (b *Blockchain) Empty() bool + func (b *Blockchain) Genesis() types.Hash + func (b *Blockchain) GetAvgGasPrice() *big.Int + func (b *Blockchain) GetBlock(hash types.Hash, number uint64, full bool) (*types.Block, bool) + func (b *Blockchain) GetBlockByHash(hash types.Hash, full bool) (*types.Block, bool) + func (b *Blockchain) GetBlockByNumber(blockNumber uint64, full bool) (*types.Block, bool) + func (b *Blockchain) GetBodyByHash(hash types.Hash) (*types.Body, bool) + func (b *Blockchain) GetCachedReceipts(headerHash types.Hash) ([]*types.Receipt, error) + func (b *Blockchain) GetChainTD() (*big.Int, bool) + func (b *Blockchain) GetConsensus() Verifier + func (b *Blockchain) GetForks() ([]types.Hash, error) + func (b *Blockchain) GetHashByNumber(blockNumber uint64) types.Hash + func (b *Blockchain) GetHashHelper(header *types.Header) func(i uint64) (res types.Hash) + func (b *Blockchain) GetHeader(hash types.Hash, number uint64) (*types.Header, bool) + func (b *Blockchain) GetHeaderByHash(hash types.Hash) (*types.Header, bool) + func (b *Blockchain) GetHeaderByNumber(n uint64) (*types.Header, bool) + func (b *Blockchain) GetParent(header *types.Header) (*types.Header, bool) + func (b *Blockchain) GetReceiptsByHash(hash types.Hash) ([]*types.Receipt, error) + func (b *Blockchain) GetTD(hash types.Hash) (*big.Int, bool) + func (b *Blockchain) Header() *types.Header + func (b *Blockchain) ReadTxLookup(hash types.Hash) (types.Hash, bool) + func (b *Blockchain) SetConsensus(c Verifier) + func (b *Blockchain) SubscribeEvents() Subscription + func (b *Blockchain) UnsubscribeEvents(sub Subscription) + func (b *Blockchain) VerifyFinalizedBlock(block *types.Block) (*types.FullBlock, error) + func (b *Blockchain) VerifyPotentialBlock(block *types.Block) error + func (b *Blockchain) WriteBlock(block *types.Block, source string) error + func (b *Blockchain) WriteFullBlock(fblock *types.FullBlock, source string) error + func (b *Blockchain) WriteHeadersWithBodies(headers []*types.Header) error + type Event struct + Difficulty *big.Int + NewChain []*types.Header + OldChain []*types.Header + Source string + Type EventType + func (e *Event) AddNewHeader(newHeader *types.Header) + func (e *Event) AddOldHeader(oldHeader *types.Header) + func (e *Event) Header() *types.Header + func (e *Event) SetDifficulty(b *big.Int) + type EventType int + const EventFork + const EventHead + const EventReorg + type Executor interface + ProcessBlock func(parentRoot types.Hash, block *types.Block, blockCreator types.Address) (*state.Transition, error) + type MockSubscription struct + func NewMockSubscription() *MockSubscription + func (m *MockSubscription) Push(e *Event) + func (s MockSubscription) GetEvent() *Event + func (s MockSubscription) GetEventCh() chan *Event + type MockVerifier struct + func (m *MockVerifier) GetBlockCreator(header *types.Header) (types.Address, error) + func (m *MockVerifier) HookGetBlockCreator(fn getBlockCreatorDelegate) + func (m *MockVerifier) HookPreCommitState(fn preStateCommitDelegate) + func (m *MockVerifier) HookProcessHeaders(fn processHeadersDelegate) + func (m *MockVerifier) HookVerifyHeader(fn verifyHeaderDelegate) + func (m *MockVerifier) PreCommitState(block *types.Block, txn *state.Transition) error + func (m *MockVerifier) ProcessHeaders(headers []*types.Header) error + func (m *MockVerifier) VerifyHeader(header *types.Header) error + type Subscription interface + GetEvent func() *Event + GetEventCh func() chan *Event + type TestCallbackType string + const ChainCallback + const ExecutorCallback + const StorageCallback + const VerifierCallback + type TxSigner interface + Sender func(tx *types.Transaction) (types.Address, error) + type Verifier interface + GetBlockCreator func(header *types.Header) (types.Address, error) + PreCommitState func(block *types.Block, txn *state.Transition) error + ProcessHeaders func(headers []*types.Header) error + VerifyHeader func(header *types.Header) error