statebackend

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

View Source
var ErrParentDoesNotMatchHead = errors.New("block's parent hash does not match head block hash")

Functions

This section is empty.

Types

type SimulateResult

type SimulateResult struct {
	BlockCommitments *core.BlockCommitments
	ConcatCount      felt.Felt
}

type StateBackend

type StateBackend interface {
	HeadState() (core.StateReader, StateCloser, error)
	StateAtBlockNumber(blockNumber uint64) (core.StateReader, StateCloser, error)
	StateAtBlockHash(blockHash *felt.Felt) (core.StateReader, StateCloser, error)
	TrieStateAtBlockNumber(blockNumber uint64) (core.StateReader, StateCloser, error)
	Store(
		block *core.Block,
		commitments *core.BlockCommitments,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.ClassHash]core.ClassDefinition,
		eventsBloom *bloom.BloomFilter,
	) error
	RevertHead() error
	GetReverseStateDiff() (core.StateDiff, error)
	Simulate(
		block *core.Block,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.ClassHash]core.ClassDefinition,
		sign core.BlockSignFunc,
	) (SimulateResult, error)
	Finalise(
		block *core.Block,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.ClassHash]core.ClassDefinition,
		sign core.BlockSignFunc,
		eventsBloom *bloom.BloomFilter,
	) error
	VerifyBlockHash(
		b *core.Block,
		stateDiff *core.StateDiff,
	) (*core.BlockCommitments, error)
}

StateBackend is the interface for state operations in blockchain.

func New

func New(
	database db.KeyValueStore,
	runningFilter *core.RunningEventFilter,
	network *networks.Network,
	retentionFloor *pruner.RetentionFloor,
	stateVersion bool,
) StateBackend

type StateCloser

type StateCloser = func() error

StateCloser is called to release resources associated with a state reader.

var NoopStateCloser StateCloser = func() error { return nil }

NoopStateCloser is a StateCloser that does nothing.

Jump to

Keyboard shortcuts

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