pending

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: 5 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 (
	ErrPreConfirmedNotFound        = errors.New("pre_confirmed not found")
	ErrTransactionNotFound         = errors.New("pre_confirmed: transaction not found")
	ErrTransactionReceiptNotFound  = errors.New("pre_confirmed: transaction receipt not found")
	ErrTransactionIndexOutOfBounds = errors.New(
		"pre_confirmed: transaction index out of bounds",
	)
)
View Source
var ErrHistoricalTrieNotSupported = errors.New("cannot support historical trie")

Functions

func NewPreConfirmedWithBloom added in v0.17.0

func NewPreConfirmedWithBloom(preConfirmed *PreConfirmed) core.WithBloom[*PreConfirmed]

NewPreConfirmedWithBloom pairs a pre_confirmed with its event bloom filter, built from the pre_confirmed block's receipts.

Types

type PreConfirmed

type PreConfirmed struct {
	Block       *core.Block
	StateUpdate *core.StateUpdate
	// Node does not fetch unknown classes. but we keep it for sequencer
	NewClasses            map[felt.ClassHash]core.ClassDefinition
	TransactionStateDiffs []*core.StateDiff
	// BlockIdentifier is an identifier returned by the feeder gateway
	// that uniquely identifies the current round of the pre_confirmed block.
	// It is used to negotiate delta-sync responses on subsequent polls.
	BlockIdentifier string
}

func NewPreConfirmed

func NewPreConfirmed(
	block *core.Block,
	stateUpdate *core.StateUpdate,
	transactionStateDiffs []*core.StateDiff,
	blockIdentifier string,
) PreConfirmed

func (*PreConfirmed) Copy

func (p *PreConfirmed) Copy() *PreConfirmed

func (*PreConfirmed) GetBlock

func (p *PreConfirmed) GetBlock() *core.Block

func (*PreConfirmed) GetHeader

func (p *PreConfirmed) GetHeader() *core.Header

func (*PreConfirmed) GetNewClasses

func (p *PreConfirmed) GetNewClasses() map[felt.ClassHash]core.ClassDefinition

func (*PreConfirmed) GetStateUpdate

func (p *PreConfirmed) GetStateUpdate() *core.StateUpdate

func (*PreConfirmed) GetTransactionStateDiffs

func (p *PreConfirmed) GetTransactionStateDiffs() []*core.StateDiff

func (*PreConfirmed) GetTransactions

func (p *PreConfirmed) GetTransactions() []core.Transaction

func (*PreConfirmed) ReceiptByHash

func (p *PreConfirmed) ReceiptByHash(
	hash *felt.TransactionHash,
) (*core.TransactionReceipt, error)

func (*PreConfirmed) TransactionByHash

func (p *PreConfirmed) TransactionByHash(
	hash *felt.TransactionHash,
) (core.Transaction, uint, error)

TransactionByHash locates a transaction by hash in the block and returns it together with its index. Returns ErrTransactionNotFound when missing.

func (*PreConfirmed) WithNewClasses

func (p *PreConfirmed) WithNewClasses(
	newClasses map[felt.ClassHash]core.ClassDefinition,
) *PreConfirmed

type State

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

func NewState

func NewState(
	stateDiff *core.StateDiff,
	newClasses map[felt.ClassHash]core.ClassDefinition,
	head core.StateReader,
	blockNumber uint64,
) *State

func (*State) Class

func (p *State) Class(classHash *felt.ClassHash) (*core.DeclaredClassDefinition, error)

func (*State) ClassTrie

func (p *State) ClassTrie() (core.TrieReader, error)

func (*State) CompiledClassHash

func (p *State) CompiledClassHash(
	classHash *felt.SierraClassHash,
) (felt.CasmClassHash, error)

func (*State) CompiledClassHashV2

func (p *State) CompiledClassHashV2(
	classHash *felt.SierraClassHash,
) (felt.CasmClassHash, error)

func (*State) ContractClassHash

func (p *State) ContractClassHash(addr *felt.Address) (felt.ClassHash, error)

func (*State) ContractNonce

func (p *State) ContractNonce(addr *felt.Address) (felt.Felt, error)

func (*State) ContractStorage

func (p *State) ContractStorage(addr *felt.Address, key *felt.Felt) (felt.Felt, error)

func (*State) ContractStorageLastUpdatedBlock

func (p *State) ContractStorageLastUpdatedBlock(
	addr *felt.Address,
	key *felt.Felt,
) (uint64, error)

ContractStorageLastUpdatedBlock returns the most recent block number at which a given storage slot key of a given contract was last updated.

func (*State) ContractStorageTrie

func (p *State) ContractStorageTrie(addr *felt.Address) (core.TrieReader, error)

func (*State) ContractTrie

func (p *State) ContractTrie() (core.TrieReader, error)

func (*State) StateDiff

func (p *State) StateDiff() *core.StateDiff

type StateWriter

type StateWriter struct {
	*State
}

func NewStateWriter

func NewStateWriter(
	stateDiff *core.StateDiff,
	newClasses map[felt.ClassHash]core.ClassDefinition,
	head core.StateReader,
) StateWriter

func (*StateWriter) IncrementNonce

func (p *StateWriter) IncrementNonce(contractAddress *felt.Address) error

func (*StateWriter) SetClassHash

func (p *StateWriter) SetClassHash(contractAddress *felt.Address, classHash *felt.ClassHash) error

func (*StateWriter) SetCompiledClassHash

func (p *StateWriter) SetCompiledClassHash(
	classHash *felt.SierraClassHash,
	compiledClassHash *felt.CasmClassHash,
) error

SetCompiledClassHash writes CairoV1 classes to the pending state Assumption: SetContractClass was called for classHash and succeeded

func (*StateWriter) SetContractClass

func (p *StateWriter) SetContractClass(
	classHash *felt.ClassHash,
	class core.ClassDefinition,
) error

SetContractClass writes a new CairoV0 class to the PendingState Assumption: SetCompiledClassHash should be called for CairoV1 contracts

func (*StateWriter) SetStateDiff

func (p *StateWriter) SetStateDiff(stateDiff *core.StateDiff)

func (*StateWriter) SetStorage

func (p *StateWriter) SetStorage(
	contractAddress *felt.Address,
	key *felt.Felt,
	value *felt.Felt,
) error

func (*StateWriter) StateDiffAndClasses

func (p *StateWriter) StateDiffAndClasses() (
	core.StateDiff,
	map[felt.ClassHash]core.ClassDefinition,
)

StateDiffAndClasses returns the pending state's internal data. The returned objects will continue to be read and modified by the pending state.

Jump to

Keyboard shortcuts

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