statebackend

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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 {
	StateCommitment() (felt.Felt, error)
	HeadState() (core.StateReader, StateCloser, error)
	StateAtBlockNumber(blockNumber uint64) (core.StateReader, StateCloser, error)
	StateAtBlockHash(blockHash *felt.Felt) (core.StateReader, StateCloser, error)
	Store(
		block *core.Block,
		commitments *core.BlockCommitments,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.Felt]core.ClassDefinition,
	) error
	RevertHead() error
	GetReverseStateDiff() (core.StateDiff, error)
	Simulate(
		block *core.Block,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.Felt]core.ClassDefinition,
		sign utils.BlockSignFunc,
	) (SimulateResult, error)
	Finalise(
		block *core.Block,
		stateUpdate *core.StateUpdate,
		newClasses map[felt.Felt]core.ClassDefinition,
		sign utils.BlockSignFunc,
	) error
}

StateBackend is the interface for state operations in blockchain.

func New

func New(
	database db.KeyValueStore,
	runningFilter *core.RunningEventFilter,
	network *utils.Network,
	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