Documentation
¶
Index ¶
- Variables
- type Pendingdeprecated
- type PreConfirmed
- func (p *PreConfirmed) Copy() *PreConfirmed
- func (p *PreConfirmed) GetBlock() *core.Block
- func (p *PreConfirmed) GetCandidateTransaction() []core.Transaction
- func (p *PreConfirmed) GetHeader() *core.Header
- func (p *PreConfirmed) GetNewClasses() map[felt.Felt]core.ClassDefinition
- func (p *PreConfirmed) GetPreLatest() *PreLatest
- func (p *PreConfirmed) GetStateUpdate() *core.StateUpdate
- func (p *PreConfirmed) GetTransactionStateDiffs() []*core.StateDiff
- func (p *PreConfirmed) GetTransactions() []core.Transaction
- func (p *PreConfirmed) PendingState(baseState core.StateReader) core.StateReader
- func (p *PreConfirmed) PendingStateBeforeIndex(baseState core.StateReader, index uint) (core.StateReader, error)
- func (p *PreConfirmed) ReceiptByHash(hash *felt.Felt) (*core.TransactionReceipt, *felt.Felt, uint64, error)
- func (p *PreConfirmed) TransactionByHash(hash *felt.Felt) (core.Transaction, error)
- func (p *PreConfirmed) Validate(parent *core.Header) bool
- func (p *PreConfirmed) WithNewClasses(newClasses map[felt.Felt]core.ClassDefinition) *PreConfirmed
- func (p *PreConfirmed) WithPreLatest(preLatest *PreLatest) *PreConfirmed
- type PreLatest
- type State
- func (p *State) Class(classHash *felt.Felt) (*core.DeclaredClassDefinition, error)
- func (p *State) ClassTrie() (core.Trie, error)
- func (p *State) CompiledClassHash(classHash *felt.SierraClassHash) (felt.CasmClassHash, error)
- func (p *State) CompiledClassHashV2(classHash *felt.SierraClassHash) (felt.CasmClassHash, error)
- func (p *State) ContractClassHash(addr *felt.Felt) (felt.Felt, error)
- func (p *State) ContractNonce(addr *felt.Felt) (felt.Felt, error)
- func (p *State) ContractStorage(addr, key *felt.Felt) (felt.Felt, error)
- func (p *State) ContractStorageLastUpdatedBlock(addr *felt.Address, key *felt.Felt) (uint64, error)
- func (p *State) ContractStorageTrie(addr *felt.Felt) (core.Trie, error)
- func (p *State) ContractTrie() (core.Trie, error)
- func (p *State) StateDiff() *core.StateDiff
- type StateWriter
- func (p *StateWriter) IncrementNonce(contractAddress *felt.Felt) error
- func (p *StateWriter) SetClassHash(contractAddress, classHash *felt.Felt) error
- func (p *StateWriter) SetCompiledClassHash(classHash, compiledClassHash *felt.Felt) error
- func (p *StateWriter) SetContractClass(classHash *felt.Felt, class core.ClassDefinition) error
- func (p *StateWriter) SetStateDiff(stateDiff *core.StateDiff)
- func (p *StateWriter) SetStorage(contractAddress, key, value *felt.Felt) error
- func (p *StateWriter) StateDiffAndClasses() (core.StateDiff, map[felt.Felt]core.ClassDefinition)
Constants ¶
This section is empty.
Variables ¶
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", ) )
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) 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) WithNewClasses ¶
func (p *PreConfirmed) WithNewClasses(newClasses map[felt.Felt]core.ClassDefinition) *PreConfirmed
func (*PreConfirmed) WithPreLatest ¶
func (p *PreConfirmed) WithPreLatest(preLatest *PreLatest) *PreConfirmed
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) 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 (*State) ContractStorage ¶
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 ¶
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.