pending

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: 5 Imported by: 0

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

This section is empty.

Types

type Pending deprecated

type Pending struct {
	Block       *core.Block
	StateUpdate *core.StateUpdate
	NewClasses  map[felt.Felt]core.ClassDefinition
}

Deprecated: Pending is the pre-0.14.0 pending block variant. It is retained solely as a placeholder returned by rpc/v6/v8's Pending() and MakeEmptyPendingForParent to satisfy the "pending" block ID in the v6/v8 RPC spec. Remove this type when rpc/v6/v8 are deprecated.

func NewPending deprecated

func NewPending(
	block *core.Block,
	stateUpdate *core.StateUpdate,
	newClasses map[felt.Felt]core.ClassDefinition,
) Pending

Deprecated: NewPending constructs the deprecated Pending type.

func (*Pending) GetBlock

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

func (*Pending) GetHeader

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

func (*Pending) GetStateUpdate

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

func (*Pending) GetTransactions

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

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.Felt]core.ClassDefinition
	TransactionStateDiffs []*core.StateDiff
	CandidateTxs          []core.Transaction
	// Optional field, exists if pre_confirmed is N+2 when latest is N
	PreLatest *PreLatest
}

func NewPreConfirmed

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

func (*PreConfirmed) Copy

func (p *PreConfirmed) Copy() *PreConfirmed

func (*PreConfirmed) GetBlock

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

func (*PreConfirmed) GetCandidateTransaction

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

func (*PreConfirmed) GetHeader

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

func (*PreConfirmed) GetNewClasses

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

func (*PreConfirmed) GetPreLatest

func (p *PreConfirmed) GetPreLatest() *PreLatest

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) PendingState

func (p *PreConfirmed) PendingState(baseState core.StateReader) core.StateReader

func (*PreConfirmed) PendingStateBeforeIndex

func (p *PreConfirmed) PendingStateBeforeIndex(
	baseState core.StateReader,
	index uint,
) (core.StateReader, error)

func (*PreConfirmed) ReceiptByHash

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

func (*PreConfirmed) TransactionByHash

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

func (*PreConfirmed) Validate

func (p *PreConfirmed) Validate(parent *core.Header) bool

func (*PreConfirmed) WithNewClasses

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

func (*PreConfirmed) WithPreLatest

func (p *PreConfirmed) WithPreLatest(preLatest *PreLatest) *PreConfirmed

type PreLatest

type PreLatest Pending

type State

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

func NewState

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

func (*State) Class

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

func (*State) ClassTrie

func (p *State) ClassTrie() (core.Trie, 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.Felt) (felt.Felt, error)

func (*State) ContractNonce

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

func (*State) ContractStorage

func (p *State) ContractStorage(addr, 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.Felt) (core.Trie, error)

func (*State) ContractTrie

func (p *State) ContractTrie() (core.Trie, 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.Felt]core.ClassDefinition,
	head core.StateReader,
) StateWriter

func (*StateWriter) IncrementNonce

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

func (*StateWriter) SetClassHash

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

func (*StateWriter) SetCompiledClassHash

func (p *StateWriter) SetCompiledClassHash(classHash, compiledClassHash *felt.Felt) 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.Felt, 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, key, value *felt.Felt) error

func (*StateWriter) StateDiffAndClasses

func (p *StateWriter) StateDiffAndClasses() (core.StateDiff, map[felt.Felt]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