Documentation
¶
Index ¶
- Constants
- Variables
- func CheckBlockVersion(protocolVersion string) error
- func ConcatCounts(txCount, eventCount, stateDiffLen uint64, l1Mode L1DAMode) felt.Felt
- func ContractAddress(callerAddress, classHash, salt *felt.Felt, constructorCallData []*felt.Felt) *felt.Felt
- func ContractClassHash(addr *felt.Felt, txn db.IndexedBatch) (*felt.Felt, error)
- func ContractNonce(addr *felt.Felt, txn db.IndexedBatch) (*felt.Felt, error)
- func ContractRoot(addr *felt.Felt, txn db.IndexedBatch) (*felt.Felt, error)
- func ContractStorage(addr, key *felt.Felt, txn db.IndexedBatch) (*felt.Felt, error)
- func DeleteBlockCommitment(w db.KeyValueWriter, blockNum uint64) error
- func DeleteBlockHeaderByNumber(w db.KeyValueWriter, number uint64) error
- func DeleteBlockHeaderNumberByHash(w db.KeyValueWriter, hash *felt.Felt) error
- func DeleteChainHeight(w db.KeyValueWriter) error
- func DeleteClass(w db.KeyValueWriter, classHash *felt.Felt) error
- func DeleteContractDeploymentHeight(w db.KeyValueWriter, addr *felt.Felt) error
- func DeleteL1HandlerTxnHashByMsgHash(w db.KeyValueWriter, msgHash []byte) error
- func DeleteReceiptByBlockNumIndex(w db.KeyValueWriter, num, index uint64) error
- func DeleteStateUpdateByBlockNum(w db.KeyValueWriter, blockNum uint64) error
- func DeleteTxBlockNumIndexByHash(w db.KeyValueWriter, hash *felt.Felt) error
- func DeleteTxByBlockNumIndex(w db.KeyValueWriter, num, index uint64) error
- func DeleteTxsAndReceipts(batch db.IndexedBatch, blockNum, numTxs uint64) error
- func EventsBloom(receipts []*TransactionReceipt) *bloom.BloomFilter
- func GetBlockHeaderNumberByHash(r db.KeyValueReader, hash *felt.Felt) (uint64, error)
- func GetChainHeight(r db.KeyValueReader) (uint64, error)
- func GetContractClassHash(r db.KeyValueReader, addr *felt.Felt) (felt.Felt, error)
- func GetContractDeploymentHeight(r db.KeyValueReader, addr *felt.Felt) (uint64, error)
- func GetContractNonce(r db.KeyValueReader, addr *felt.Felt) (felt.Felt, error)
- func GetL1HandlerTxnHashByMsgHash(r db.KeyValueReader, msgHash []byte) (felt.Felt, error)
- func GetTxBlockNumIndexByHash(r db.KeyValueReader, hash *felt.Felt) (db.BlockNumIndexKey, error)
- func HasClass(r db.KeyValueReader, classHash *felt.Felt) (bool, error)
- func MarshalBlockNumber(blockNumber uint64) []byte
- func ParseBlockVersion(protocolVersion string) (*semver.Version, error)
- func SegmentedBytecodeHash(bytecode []*felt.Felt, segmentLengths []SegmentLengths) *felt.Felt
- func TransactionHash(transaction Transaction, n *utils.Network) (*felt.Felt, error)
- func UnmarshalBlockNumber(val []byte) uint64
- func VerifyClassHashes(classes map[felt.Felt]Class) error
- func VerifyTransactions(txs []Transaction, n *utils.Network, protocolVersion string) error
- func WriteAggregatedBloomFilter(w db.KeyValueWriter, filter *AggregatedBloomFilter) error
- func WriteBlockCommitment(w db.KeyValueWriter, blockNum uint64, commitment *BlockCommitments) error
- func WriteBlockHeader(r db.KeyValueWriter, header *Header) error
- func WriteBlockHeaderByNumber(w db.KeyValueWriter, header *Header) error
- func WriteBlockHeaderNumberByHash(w db.KeyValueWriter, hash *felt.Felt, number uint64) error
- func WriteChainHeight(w db.KeyValueWriter, height uint64) error
- func WriteClass(w db.KeyValueWriter, classHash *felt.Felt, class *DeclaredClass) error
- func WriteContractClassHash(w db.KeyValueWriter, addr, classHash *felt.Felt) error
- func WriteContractDeploymentHeight(w db.KeyValueWriter, addr *felt.Felt, height uint64) error
- func WriteContractNonce(w db.KeyValueWriter, addr, nonce *felt.Felt) error
- func WriteL1HandlerMsgHashes(w db.KeyValueWriter, txns []Transaction) error
- func WriteL1HandlerTxnHashByMsgHash(w db.KeyValueWriter, msgHash []byte, l1HandlerTxnHash *felt.Felt) error
- func WriteL1Head(w db.KeyValueWriter, l1Head *L1Head) error
- func WriteReceiptByBlockNumIndex(w db.KeyValueWriter, num, index uint64, receipt *TransactionReceipt) error
- func WriteRunningEventFilter(w db.KeyValueWriter, filter *RunningEventFilter) error
- func WriteStateUpdateByBlockNum(w db.KeyValueWriter, blockNum uint64, stateUpdate *StateUpdate) error
- func WriteTxAndReceipt(w db.KeyValueWriter, num, index uint64, tx Transaction, ...) error
- func WriteTxBlockNumIndexByHash(w db.KeyValueWriter, num, index uint64, hash *felt.Felt) error
- func WriteTxByBlockNumIndex(w db.KeyValueWriter, num, index uint64, tx Transaction) error
- type AggregatedBloomFilter
- func (f *AggregatedBloomFilter) BlocksForKeys(keys [][]byte) *bitset.BitSet
- func (f *AggregatedBloomFilter) BlocksForKeysInto(keys [][]byte, out *bitset.BitSet) error
- func (f *AggregatedBloomFilter) Clone() AggregatedBloomFilter
- func (f *AggregatedBloomFilter) FromBlock() uint64
- func (f *AggregatedBloomFilter) Insert(filter *bloom.BloomFilter, blockNumber uint64) error
- func (f *AggregatedBloomFilter) MarshalBinary() ([]byte, error)
- func (f *AggregatedBloomFilter) ToBlock() uint64
- func (f *AggregatedBloomFilter) UnmarshalBinary(data []byte) error
- type Block
- type BlockCommitments
- func BlockHash(b *Block, stateDiff *StateDiff, network *utils.Network, ...) (*felt.Felt, *BlockCommitments, error)
- func GetBlockCommitmentByBlockNum(r db.KeyValueReader, blockNum uint64) (*BlockCommitments, error)
- func Post0132Hash(b *Block, stateDiff *StateDiff) (*felt.Felt, *BlockCommitments, error)
- func VerifyBlockHash(b *Block, network *utils.Network, stateDiff *StateDiff) (*BlockCommitments, error)
- type BuiltinInstanceCounter
- type Cairo0Class
- type Cairo1Class
- type Class
- type CompiledClass
- type CompiledEntryPoint
- type ContractUpdater
- type DataAvailability
- type DataAvailabilityMode
- type DeclareTransaction
- type DeclaredClass
- type DeployAccountTransaction
- type DeployTransaction
- type EntryPoint
- type Event
- type ExecutionResources
- type FeeUnit
- type GasConsumed
- type GasPrice
- type Header
- type InvokeTransaction
- type L1DAMode
- type L1HandlerTransaction
- type L1Head
- type L1ToL2Message
- type L2ToL1Message
- type OnValueChanged
- type Pending
- func (p *Pending) GetBlock() *Block
- func (p *Pending) GetCandidateTransaction() []Transaction
- func (p *Pending) GetHeader() *Header
- func (p *Pending) GetNewClasses() map[felt.Felt]Class
- func (p *Pending) GetPreLatest() *PreLatest
- func (p *Pending) GetStateUpdate() *StateUpdate
- func (p *Pending) GetTransactionStateDiffs() []*StateDiff
- func (p *Pending) GetTransactions() []Transaction
- func (p *Pending) Validate(parent *Header) bool
- func (p *Pending) Variant() PendingDataVariant
- type PendingData
- type PendingDataVariant
- type PreConfirmed
- func (p *PreConfirmed) Copy() *PreConfirmed
- func (p *PreConfirmed) GetBlock() *Block
- func (p *PreConfirmed) GetCandidateTransaction() []Transaction
- func (p *PreConfirmed) GetHeader() *Header
- func (p *PreConfirmed) GetNewClasses() map[felt.Felt]Class
- func (p *PreConfirmed) GetPreLatest() *PreLatest
- func (p *PreConfirmed) GetStateUpdate() *StateUpdate
- func (p *PreConfirmed) GetTransactionStateDiffs() []*StateDiff
- func (p *PreConfirmed) GetTransactions() []Transaction
- func (p *PreConfirmed) Validate(parent *Header) bool
- func (p *PreConfirmed) Variant() PendingDataVariant
- func (p *PreConfirmed) WithNewClasses(newClasses map[felt.Felt]Class) *PreConfirmed
- func (p *PreConfirmed) WithPreLatest(preLatest *PreLatest) *PreConfirmed
- type PreLatest
- type Resource
- type ResourceBounds
- type RunningEventFilter
- func (f *RunningEventFilter) BlocksForKeys(keys [][]byte) *bitset.BitSet
- func (f *RunningEventFilter) BlocksForKeysInto(keys [][]byte, out *bitset.BitSet) error
- func (f *RunningEventFilter) Clone() *RunningEventFilter
- func (f *RunningEventFilter) FromBlock() uint64
- func (f *RunningEventFilter) InnerFilter() *AggregatedBloomFilter
- func (f *RunningEventFilter) Insert(bloom *bloom.BloomFilter, blockNumber uint64) error
- func (f *RunningEventFilter) MarshalBinary() ([]byte, error)
- func (f *RunningEventFilter) NextBlock() uint64
- func (f *RunningEventFilter) OnReorg() error
- func (f *RunningEventFilter) ToBlock() uint64
- func (f *RunningEventFilter) UnmarshalBinary(data []byte) error
- func (f *RunningEventFilter) Write() error
- type SegmentLengths
- type SierraEntryPoint
- type State
- func (s *State) ChainHeight() (uint64, error)
- func (s *State) Class(classHash *felt.Felt) (*DeclaredClass, error)
- func (s *State) ClassTrie() (*trie.Trie, error)
- func (s *State) ContractClassHash(addr *felt.Felt) (*felt.Felt, error)
- func (h State) ContractClassHashAt(contractAddress *felt.Felt, height uint64) (*felt.Felt, error)
- func (s *State) ContractIsAlreadyDeployedAt(addr *felt.Felt, blockNumber uint64) (bool, error)
- func (s *State) ContractNonce(addr *felt.Felt) (*felt.Felt, error)
- func (h State) ContractNonceAt(contractAddress *felt.Felt, height uint64) (*felt.Felt, error)
- func (s *State) ContractStorage(addr, key *felt.Felt) (*felt.Felt, error)
- func (h State) ContractStorageAt(contractAddress, storageLocation *felt.Felt, height uint64) (*felt.Felt, error)
- func (s *State) ContractStorageTrie(addr *felt.Felt) (*trie.Trie, error)
- func (s *State) ContractTrie() (*trie.Trie, error)
- func (h State) DeleteContractClassHashLog(contractAddress *felt.Felt, height uint64) error
- func (h State) DeleteContractNonceLog(contractAddress *felt.Felt, height uint64) error
- func (h State) DeleteContractStorageLog(contractAddress, storageLocation *felt.Felt, height uint64) error
- func (s *State) GetReverseStateDiff(blockNumber uint64, diff *StateDiff) (*StateDiff, error)
- func (h State) LogContractClassHash(contractAddress, oldValue *felt.Felt, height uint64) error
- func (h State) LogContractNonce(contractAddress, oldValue *felt.Felt, height uint64) error
- func (h State) LogContractStorage(contractAddress, storageLocation, oldValue *felt.Felt, height uint64) error
- func (s *State) Revert(blockNumber uint64, update *StateUpdate) error
- func (s *State) Root() (*felt.Felt, error)
- func (s *State) Update(blockNumber uint64, update *StateUpdate, declaredClasses map[felt.Felt]Class, ...) error
- type StateDiff
- type StateHistoryReader
- type StateReader
- type StateUpdate
- type Transaction
- func GetTxByBlockNumIndex(r db.KeyValueReader, blockNum, index uint64) (Transaction, error)
- func GetTxByBlockNumIndexBytes(r db.KeyValueReader, val []byte) (Transaction, error)
- func GetTxByHash(r db.KeyValueReader, hash *felt.Felt) (Transaction, error)
- func GetTxsByBlockNum(iterable db.Iterable, blockNum uint64) ([]Transaction, error)
- type TransactionReceipt
- type TransactionVersion
- func (v *TransactionVersion) AsFelt() *felt.Felt
- func (v *TransactionVersion) HasQueryBit() bool
- func (v *TransactionVersion) Is(u64 uint64) bool
- func (v *TransactionVersion) MarshalCBOR() ([]byte, error)
- func (v *TransactionVersion) SetUint64(u64 uint64) *TransactionVersion
- func (v *TransactionVersion) String() string
- func (v *TransactionVersion) UnmarshalCBOR(data []byte) error
- func (v *TransactionVersion) WithoutQueryBit() TransactionVersion
Constants ¶
const ( // Calculated at https://hur.st/bloomfilter/?n=1000&p=&m=8192&k= // provides 1 in 51 possibility of false positives for approximately 1000 elements EventsBloomLength = 8192 EventsBloomHashFuncs = 6 )
const ContractStorageTrieHeight = 251
contract storage has fixed height at 251
const (
NumBlocksPerFilter uint64 = 8192
)
Variables ¶
var ( ErrAggregatedBloomFilterBlockOutOfRange error = errors.New("block number is not within range") ErrBloomFilterSizeMismatch error = errors.New("bloom filter len mismatch") ErrMatchesBufferNil error = errors.New("matches buffer must not be nil") ErrMatchesBufferSizeMismatch error = errors.New("matches buffer size mismatch") )
var ( ErrContractNotDeployed = errors.New("contract not deployed") ErrContractAlreadyDeployed = errors.New("contract already deployed") )
var ( Ver0_13_2 = semver.MustParse("0.13.2") Ver0_13_4 = semver.MustParse("0.13.4") Ver0_14_0 = semver.MustParse("0.14.0") LatestVer = Ver0_14_0 )
var ErrCheckHeadState = errors.New("check head state")
var ErrHistoricalTrieNotSupported = errors.New("cannot support historical trie")
var SierraVersion010 felt.Felt = felt.Felt( [4]uint64{ 18446737451840584193, 18446744073709551615, 18446744073709551615, 576348180530977296, })
Single felt identifying the number "0.1.0" as a short string
Functions ¶
func CheckBlockVersion ¶ added in v0.15.6
CheckBlockVersion checks if the block protocol version is supported by Juno
func ConcatCounts ¶ added in v0.14.6
func ContractAddress ¶
func ContractAddress(callerAddress, classHash, salt *felt.Felt, constructorCallData []*felt.Felt) *felt.Felt
ContractAddress computes the address of a Starknet contract.
func ContractClassHash ¶ added in v0.7.5
ContractClassHash returns hash of the class that the contract at the given address instantiates.
func ContractNonce ¶ added in v0.7.5
ContractNonce returns the amount transactions sent from this contract. Only account contracts can have a non-zero nonce.
func ContractRoot ¶ added in v0.7.5
ContractRoot returns the root of the contract storage.
func ContractStorage ¶ added in v0.7.5
func DeleteBlockCommitment ¶ added in v0.14.4
func DeleteBlockCommitment(w db.KeyValueWriter, blockNum uint64) error
func DeleteBlockHeaderByNumber ¶ added in v0.14.4
func DeleteBlockHeaderByNumber(w db.KeyValueWriter, number uint64) error
func DeleteBlockHeaderNumberByHash ¶ added in v0.14.4
func DeleteBlockHeaderNumberByHash(w db.KeyValueWriter, hash *felt.Felt) error
func DeleteChainHeight ¶ added in v0.14.3
func DeleteChainHeight(w db.KeyValueWriter) error
func DeleteClass ¶ added in v0.14.4
func DeleteClass(w db.KeyValueWriter, classHash *felt.Felt) error
func DeleteContractDeploymentHeight ¶ added in v0.14.4
func DeleteContractDeploymentHeight(w db.KeyValueWriter, addr *felt.Felt) error
func DeleteL1HandlerTxnHashByMsgHash ¶ added in v0.14.4
func DeleteL1HandlerTxnHashByMsgHash(w db.KeyValueWriter, msgHash []byte) error
func DeleteReceiptByBlockNumIndex ¶ added in v0.14.4
func DeleteReceiptByBlockNumIndex(w db.KeyValueWriter, num, index uint64) error
func DeleteStateUpdateByBlockNum ¶ added in v0.14.4
func DeleteStateUpdateByBlockNum(w db.KeyValueWriter, blockNum uint64) error
func DeleteTxBlockNumIndexByHash ¶ added in v0.14.4
func DeleteTxBlockNumIndexByHash(w db.KeyValueWriter, hash *felt.Felt) error
func DeleteTxByBlockNumIndex ¶ added in v0.14.4
func DeleteTxByBlockNumIndex(w db.KeyValueWriter, num, index uint64) error
func DeleteTxsAndReceipts ¶ added in v0.14.4
func DeleteTxsAndReceipts(batch db.IndexedBatch, blockNum, numTxs uint64) error
func EventsBloom ¶ added in v0.3.1
func EventsBloom(receipts []*TransactionReceipt) *bloom.BloomFilter
func GetBlockHeaderNumberByHash ¶ added in v0.14.4
func GetChainHeight ¶ added in v0.14.4
func GetChainHeight(r db.KeyValueReader) (uint64, error)
func GetContractClassHash ¶ added in v0.14.4
func GetContractDeploymentHeight ¶ added in v0.14.4
func GetContractNonce ¶ added in v0.14.4
func GetL1HandlerTxnHashByMsgHash ¶ added in v0.14.4
func GetTxBlockNumIndexByHash ¶ added in v0.14.4
func GetTxBlockNumIndexByHash(r db.KeyValueReader, hash *felt.Felt) (db.BlockNumIndexKey, error)
func MarshalBlockNumber ¶ added in v0.4.0
func ParseBlockVersion ¶ added in v0.3.1
ParseBlockVersion computes the block version, defaulting to "0.0.0" for empty strings
func SegmentedBytecodeHash ¶ added in v0.11.0
func SegmentedBytecodeHash(bytecode []*felt.Felt, segmentLengths []SegmentLengths) *felt.Felt
func TransactionHash ¶ added in v0.4.0
func UnmarshalBlockNumber ¶ added in v0.14.3
func VerifyTransactions ¶ added in v0.2.1
func VerifyTransactions(txs []Transaction, n *utils.Network, protocolVersion string) error
func WriteAggregatedBloomFilter ¶ added in v0.14.6
func WriteAggregatedBloomFilter(w db.KeyValueWriter, filter *AggregatedBloomFilter) error
func WriteBlockCommitment ¶ added in v0.14.4
func WriteBlockCommitment(w db.KeyValueWriter, blockNum uint64, commitment *BlockCommitments) error
func WriteBlockHeader ¶ added in v0.14.4
func WriteBlockHeader(r db.KeyValueWriter, header *Header) error
func WriteBlockHeaderByNumber ¶ added in v0.14.4
func WriteBlockHeaderByNumber(w db.KeyValueWriter, header *Header) error
func WriteBlockHeaderNumberByHash ¶ added in v0.14.4
func WriteChainHeight ¶ added in v0.14.4
func WriteChainHeight(w db.KeyValueWriter, height uint64) error
func WriteClass ¶ added in v0.14.4
func WriteClass(w db.KeyValueWriter, classHash *felt.Felt, class *DeclaredClass) error
func WriteContractClassHash ¶ added in v0.14.4
func WriteContractClassHash(w db.KeyValueWriter, addr, classHash *felt.Felt) error
func WriteContractDeploymentHeight ¶ added in v0.14.4
func WriteContractNonce ¶ added in v0.14.4
func WriteContractNonce(w db.KeyValueWriter, addr, nonce *felt.Felt) error
func WriteL1HandlerMsgHashes ¶ added in v0.14.4
func WriteL1HandlerMsgHashes(w db.KeyValueWriter, txns []Transaction) error
func WriteL1HandlerTxnHashByMsgHash ¶ added in v0.14.4
func WriteL1Head ¶ added in v0.14.4
func WriteL1Head(w db.KeyValueWriter, l1Head *L1Head) error
func WriteReceiptByBlockNumIndex ¶ added in v0.14.4
func WriteReceiptByBlockNumIndex(w db.KeyValueWriter, num, index uint64, receipt *TransactionReceipt) error
func WriteRunningEventFilter ¶ added in v0.14.6
func WriteRunningEventFilter(w db.KeyValueWriter, filter *RunningEventFilter) error
func WriteStateUpdateByBlockNum ¶ added in v0.14.4
func WriteStateUpdateByBlockNum(w db.KeyValueWriter, blockNum uint64, stateUpdate *StateUpdate) error
func WriteTxAndReceipt ¶ added in v0.14.4
func WriteTxAndReceipt(w db.KeyValueWriter, num, index uint64, tx Transaction, receipt *TransactionReceipt) error
func WriteTxBlockNumIndexByHash ¶ added in v0.14.4
func WriteTxByBlockNumIndex ¶ added in v0.14.4
func WriteTxByBlockNumIndex(w db.KeyValueWriter, num, index uint64, tx Transaction) error
Types ¶
type AggregatedBloomFilter ¶ added in v0.14.6
type AggregatedBloomFilter struct {
// contains filtered or unexported fields
}
AggregatedBloomFilter provides a space-efficient, probabilistic data structure for testing set membership of keys (such as event topics or contract addresses) across large block ranges in a blockchain.
When querying which blocks in a large range might contain a certain key, it is inefficient to load and individually check every block’s Bloom filter. To optimise this, AggregatedBloomFilter aggregates multiple Bloom filters (spanning a range of blocks) into a single structure. This aggregation makes it possible to check, in a single operation, which blocks in the range might include a given key.
Internally, AggregatedBloomFilter is represented as a bit matrix: each row corresponds to a Bloom filter index, and each column corresponds to a block in the range. When adding a key for a particular block, the indices mapped by Bloom hash functions are determined, and the bits at those row-column intersections are set for that block.
Visually, this can be thought of as "rotating" the per-block Bloom filters into columns of a matrix.
-----| Block 0 | Block 1 | Block 2 | ... | Block 9 | Idx0 | 0 | 0 | 0 | ... | 0 | Idx1 | 1 | 0 | 1 | ... | 0 | Idx2 | 0 | 1 | 0 | ... | 0 | Idx3 | 1 | 0 | 0 | ... | 0 | Idx4 | 1 | 0 | 1 | ... | 1 | Idx5 | 0 | 0 | 0 | ... | 0 | Idx6 | 0 | 0 | 1 | ... | 0 | Idx7 | 0 | 1 | 0 | ... | 0 |
To query for a key, the AggregatedBloomFilter:
- Determines the relevant indices for the key using the same hash functions.
- Performs a bitwise AND over the selected rows, producing a bit vector.
- The set bits in this result indicate block numbers within the filter's range where the key may be present (with the usual caveat of possible false positives). Note: The set bit positions are *relative to the filter's range start* (i.e., the range's first block number), not absolute global block numbers.
Query example for a key mapping to indices Idx1 and Idx4:
Select rows 1 and 4 (Idx1 & Idx4): Idx1: 1 0 1 ... 0 Idx4: 1 0 1 ... 1
------------------------------- AND: 1 0 1 ... 0
After AND: Resulting vector is 1 0 1 ... 0
This means Block 0 and Block 2 are possible matches for this key.
This approach allows for efficient, bulk event queries on blockchain data without needing to individually examine every single block’s Bloom filter.
Using this method, you can quickly identify candidate blocks for a key, improving the performance of large-range event queries.
func GetAggregatedBloomFilter ¶ added in v0.14.6
func GetAggregatedBloomFilter(r db.KeyValueReader, fromBlock, toBLock uint64) (AggregatedBloomFilter, error)
func NewAggregatedFilter ¶ added in v0.14.6
func NewAggregatedFilter(fromBlock uint64) AggregatedBloomFilter
NewAggregatedFilter creates a new AggregatedBloomFilter starting from the specified block number. It initialises the bitmap array with empty bitsets of size NumBlocksPerFilter.
func (*AggregatedBloomFilter) BlocksForKeys ¶ added in v0.14.6
func (f *AggregatedBloomFilter) BlocksForKeys(keys [][]byte) *bitset.BitSet
BlocksForKeys returns a bitset indicating which blocks within the range might contain the given keys. If no keys are provided, returns a bitset with all bits set.
func (*AggregatedBloomFilter) BlocksForKeysInto ¶ added in v0.14.6
func (f *AggregatedBloomFilter) BlocksForKeysInto(keys [][]byte, out *bitset.BitSet) error
BlocksForKeysInto reuses a preallocated bitset (should be NumBlocksPerFilter bits).
func (*AggregatedBloomFilter) Clone ¶ added in v0.14.6
func (f *AggregatedBloomFilter) Clone() AggregatedBloomFilter
Copy creates a deep copy of the AggregatedBloomFilter.
func (*AggregatedBloomFilter) FromBlock ¶ added in v0.14.6
func (f *AggregatedBloomFilter) FromBlock() uint64
FromBlock returns the starting block number of the filter's range.
func (*AggregatedBloomFilter) Insert ¶ added in v0.14.6
func (f *AggregatedBloomFilter) Insert(filter *bloom.BloomFilter, blockNumber uint64) error
Insert adds a bloom filter's data for a specific block number into the aggregated filter. If filter is nil, no-op. Returns an error if the block number is out of range or if the bloom filter size doesn't match.
func (*AggregatedBloomFilter) MarshalBinary ¶ added in v0.14.6
func (f *AggregatedBloomFilter) MarshalBinary() ([]byte, error)
func (*AggregatedBloomFilter) ToBlock ¶ added in v0.14.6
func (f *AggregatedBloomFilter) ToBlock() uint64
ToBlock returns the ending block number of the filter's range.
func (*AggregatedBloomFilter) UnmarshalBinary ¶ added in v0.14.6
func (f *AggregatedBloomFilter) UnmarshalBinary(data []byte) error
type Block ¶
type Block struct { *Header Transactions []Transaction Receipts []*TransactionReceipt }
func GetBlockByNumber ¶ added in v0.14.4
func GetBlockByNumber(r db.IndexedBatch, blockNum uint64) (*Block, error)
func (*Block) L2GasConsumed ¶ added in v0.15.3
type BlockCommitments ¶ added in v0.6.0
type BlockCommitments struct { TransactionCommitment *felt.Felt EventCommitment *felt.Felt ReceiptCommitment *felt.Felt StateDiffCommitment *felt.Felt }
func BlockHash ¶ added in v0.10.0
func BlockHash(b *Block, stateDiff *StateDiff, network *utils.Network, overrideSeqAddr *felt.Felt) (*felt.Felt, *BlockCommitments, error, )
blockHash computes the block hash, with option to override sequence address
func GetBlockCommitmentByBlockNum ¶ added in v0.14.4
func GetBlockCommitmentByBlockNum(r db.KeyValueReader, blockNum uint64) (*BlockCommitments, error)
func Post0132Hash ¶ added in v0.12.0
func VerifyBlockHash ¶
func VerifyBlockHash(b *Block, network *utils.Network, stateDiff *StateDiff) (*BlockCommitments, error)
VerifyBlockHash verifies the block hash. Due to bugs in Starknet alpha, not all blocks have verifiable hashes.
type BuiltinInstanceCounter ¶
type Cairo0Class ¶ added in v0.2.1
type Cairo0Class struct { Abi json.RawMessage // External functions defined in the class. Externals []EntryPoint // Functions that receive L1 messages. See // https://www.cairo-lang.org/docs/hello_starknet/l1l2.html#receiving-a-message-from-l1 L1Handlers []EntryPoint // Constructors for the class. Currently, only one is allowed. Constructors []EntryPoint // Base64 encoding of compressed Program Program string }
todo(rdr): rename this to DeprecatedCairoClass Cairo0Class unambiguously defines a [Contract]'s semantics.
func (*Cairo0Class) SierraVersion ¶ added in v0.13.3
func (c *Cairo0Class) SierraVersion() string
func (*Cairo0Class) Version ¶ added in v0.2.1
func (c *Cairo0Class) Version() uint64
type Cairo1Class ¶ added in v0.2.1
type Cairo1Class struct { Abi string AbiHash *felt.Felt // TODO: will implement this on a follow up PR commit to avoid the migration // EntryPoints SierraEntryPointsByType EntryPoints struct { Constructor []SierraEntryPoint External []SierraEntryPoint L1Handler []SierraEntryPoint } Program []*felt.Felt ProgramHash *felt.Felt // TODO: Remove this semantic version on a follow up PR. Let's put Sierra version instead SemanticVersion string Compiled *CompiledClass }
todo(rdr): rename this to CairoClass Cairo1Class unambiguously defines a [Contract]'s semantics.
func (*Cairo1Class) SierraVersion ¶ added in v0.13.3
func (c *Cairo1Class) SierraVersion() string
todo(rdr): Make the SierraVersion returned here a sem ver Returns the Sierra version for the Cairo 1 class
Sierra programs contain the version number in two possible formats. For pre-1.0-rc0 Cairo versions the program contains the Sierra version "0.1.0" as a shortstring in its first Felt (0x302e312e30 = "0.1.0"). For all subsequent versions the version number is the first three felts representing the three parts of a semantic version number.
func (*Cairo1Class) Version ¶ added in v0.2.1
func (c *Cairo1Class) Version() uint64
type Class ¶
todo(rdr): this Class name is not a really good name, what could be a more descriptive one Class unambiguously defines a [Contract]'s semantics.
type CompiledClass ¶ added in v0.9.3
type CompiledClass struct { Bytecode []*felt.Felt PythonicHints json.RawMessage CompilerVersion string Hints json.RawMessage Prime *big.Int External []CompiledEntryPoint L1Handler []CompiledEntryPoint Constructor []CompiledEntryPoint BytecodeSegmentLengths SegmentLengths }
todo(rdr): rename CompiledClass to CasmClass
func (*CompiledClass) Hash ¶ added in v0.9.3
func (c *CompiledClass) Hash() *felt.Felt
type CompiledEntryPoint ¶ added in v0.9.3
todo(rdr): rename this to CasmEntryPoint
type ContractUpdater ¶ added in v0.7.5
type ContractUpdater struct { // Address that this contract instance is deployed to Address *felt.Felt // contains filtered or unexported fields }
ContractUpdater is a helper to update an existing contract instance.
func DeployContract ¶ added in v0.2.1
func DeployContract(addr, classHash *felt.Felt, txn db.IndexedBatch) (*ContractUpdater, error)
DeployContract sets up the database for a new contract.
func NewContractUpdater ¶ added in v0.7.5
func NewContractUpdater(addr *felt.Felt, txn db.IndexedBatch) (*ContractUpdater, error)
NewContractUpdater creates an updater for the contract instance at the given address. Deploy should be called for contracts that were just deployed to the network.
func (*ContractUpdater) Purge ¶ added in v0.7.5
func (c *ContractUpdater) Purge() error
Purge eliminates the contract instance, deleting all associated data from storage assumes storage is cleared in revert process
func (*ContractUpdater) Replace ¶ added in v0.7.5
func (c *ContractUpdater) Replace(classHash *felt.Felt) error
Replace replaces the class that the contract instantiates
func (*ContractUpdater) UpdateNonce ¶ added in v0.7.5
func (c *ContractUpdater) UpdateNonce(nonce *felt.Felt) error
UpdateNonce updates the nonce value in the database.
func (*ContractUpdater) UpdateStorage ¶ added in v0.7.5
func (c *ContractUpdater) UpdateStorage(diff map[felt.Felt]*felt.Felt, cb OnValueChanged) error
UpdateStorage applies a change-set to the contract storage.
type DataAvailability ¶ added in v0.11.0
type DataAvailabilityMode ¶ added in v0.8.0
type DataAvailabilityMode uint32
const ( DAModeL1 DataAvailabilityMode = iota DAModeL2 )
type DeclareTransaction ¶
type DeclareTransaction struct { TransactionHash *felt.Felt // The class hash ClassHash *felt.Felt // The address of the account initiating the transaction. SenderAddress *felt.Felt // The maximum fee that the sender is willing to pay for the transaction. // Available in versions 1, 2 MaxFee *felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt // The transaction nonce. Nonce *felt.Felt // The transaction’s version. Possible values are 0, 1, 2, or 3. // When the fields that comprise a transaction change, // either with the addition of a new field or the removal of an existing field, // then the transaction version increases. // Transaction version 0 is deprecated and will be removed in a future version of Starknet. Version *TransactionVersion // Version 2 fields CompiledClassHash *felt.Felt // Version 3 fields // See InvokeTransaction for descriptions of the fields. ResourceBounds map[Resource]ResourceBounds Tip uint64 PaymasterData []*felt.Felt AccountDeploymentData []*felt.Felt NonceDAMode DataAvailabilityMode FeeDAMode DataAvailabilityMode }
func (*DeclareTransaction) Hash ¶
func (d *DeclareTransaction) Hash() *felt.Felt
func (*DeclareTransaction) Signature ¶
func (d *DeclareTransaction) Signature() []*felt.Felt
func (*DeclareTransaction) TxVersion ¶ added in v0.8.0
func (d *DeclareTransaction) TxVersion() *TransactionVersion
type DeclaredClass ¶ added in v0.3.0
todo(rdr): We can find a better naming for this as well
func GetClass ¶ added in v0.14.4
func GetClass(r db.KeyValueReader, classHash *felt.Felt) (*DeclaredClass, error)
func (*DeclaredClass) MarshalBinary ¶ added in v0.14.7
func (d *DeclaredClass) MarshalBinary() ([]byte, error)
func (*DeclaredClass) UnmarshalBinary ¶ added in v0.14.7
func (d *DeclaredClass) UnmarshalBinary(data []byte) error
type DeployAccountTransaction ¶
type DeployAccountTransaction struct { DeployTransaction // The maximum fee that the sender is willing to pay for the transaction. MaxFee *felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt // The transaction nonce. Nonce *felt.Felt // Version 3 fields // See InvokeTransaction for descriptions of the fields. ResourceBounds map[Resource]ResourceBounds Tip uint64 PaymasterData []*felt.Felt NonceDAMode DataAvailabilityMode FeeDAMode DataAvailabilityMode }
func (*DeployAccountTransaction) Hash ¶
func (d *DeployAccountTransaction) Hash() *felt.Felt
func (*DeployAccountTransaction) Signature ¶
func (d *DeployAccountTransaction) Signature() []*felt.Felt
type DeployTransaction ¶
type DeployTransaction struct { TransactionHash *felt.Felt // A random number used to distinguish between different instances of the contract. ContractAddressSalt *felt.Felt // The address of the contract. ContractAddress *felt.Felt // The hash of the class which defines the contract’s functionality. ClassHash *felt.Felt // The arguments passed to the constructor during deployment. ConstructorCallData []*felt.Felt // The transaction’s version. Possible values are 1 or 0. // // When the fields that comprise a transaction change, // either with the addition of a new field or the removal of an existing field, // then the transaction version increases. // Transaction version 0 is deprecated and will be removed in a future version of Starknet. Version *TransactionVersion }
func (*DeployTransaction) Hash ¶
func (d *DeployTransaction) Hash() *felt.Felt
func (*DeployTransaction) Signature ¶
func (d *DeployTransaction) Signature() []*felt.Felt
func (*DeployTransaction) TxVersion ¶ added in v0.8.0
func (d *DeployTransaction) TxVersion() *TransactionVersion
type EntryPoint ¶
type EntryPoint struct { // starknet_keccak hash of the function signature. Selector *felt.Felt // The offset of the instruction in the class's bytecode. Offset *felt.Felt }
todo(rdr): rename this to DeprecatedEntryPoint EntryPoint uniquely identifies a Cairo function to execute.
type ExecutionResources ¶
type ExecutionResources struct { BuiltinInstanceCounter BuiltinInstanceCounter MemoryHoles uint64 Steps uint64 DataAvailability *DataAvailability TotalGasConsumed *GasConsumed }
type GasConsumed ¶ added in v0.12.0
type Header ¶
type Header struct { // The hash of this block Hash *felt.Felt // The hash of this block’s parent ParentHash *felt.Felt // The number (height) of this block Number uint64 // The state commitment after this block GlobalStateRoot *felt.Felt // The Starknet address of the sequencer who created this block SequencerAddress *felt.Felt // The amount Transactions and Receipts stored in this block TransactionCount uint64 // The amount of events stored in transaction receipts EventCount uint64 // The time the sequencer created this block before executing transactions Timestamp uint64 // Todo(rdr): It makes more sense for Protocol version to be stored in semver.Version instead // The version of the Starknet protocol used when creating this block ProtocolVersion string // Bloom filter on the events emitted this block EventsBloom *bloom.BloomFilter // Amount of WEI charged per Gas spent on L1 L1GasPriceETH *felt.Felt `cbor:"gasprice"` // Amount of STRK charged per Gas spent on L2 Signatures [][]*felt.Felt // Amount of STRK charged per Gas spent on L1 L1GasPriceSTRK *felt.Felt `cbor:"gaspricestrk"` // Amount of STRK charged per Gas spent on L2 L1DAMode L1DAMode // The gas price for L1 data availability L1DataGasPrice *GasPrice L2GasPrice *GasPrice }
func GetBlockHeaderByHash ¶ added in v0.14.4
func GetBlockHeaderByNumber ¶ added in v0.14.4
func GetBlockHeaderByNumber(r db.KeyValueReader, blockNum uint64) (*Header, error)
type InvokeTransaction ¶
type InvokeTransaction struct { TransactionHash *felt.Felt // The arguments that are passed to the validated and execute functions. CallData []*felt.Felt // Additional information given by the sender, used to validate the transaction. TransactionSignature []*felt.Felt // The maximum fee that the sender is willing to pay for the transaction // Available in version 1 only MaxFee *felt.Felt // The address of the contract invoked by this transaction. ContractAddress *felt.Felt // When the fields that comprise a transaction change, // either with the addition of a new field or the removal of an existing field, // then the transaction version increases. Version *TransactionVersion // Version 0 fields // The encoding of the selector for the function invoked (the entry point in the contract) EntryPointSelector *felt.Felt // Version 1 fields // The transaction nonce. Nonce *felt.Felt // The address of the sender of this transaction SenderAddress *felt.Felt // Version 3 fields (there was no version 2) ResourceBounds map[Resource]ResourceBounds Tip uint64 // From the RPC spec: data needed to allow the paymaster to pay for the transaction in native tokens PaymasterData []*felt.Felt // From RPC spec: data needed to deploy the account contract from which this tx will be initiated AccountDeploymentData []*felt.Felt // From RPC spec: The storage domain of the account's nonce (an account has a nonce per DA mode) NonceDAMode DataAvailabilityMode // From RPC spec: The storage domain of the account's balance from which fee will be charged FeeDAMode DataAvailabilityMode }
func (*InvokeTransaction) Hash ¶
func (i *InvokeTransaction) Hash() *felt.Felt
func (*InvokeTransaction) Signature ¶
func (i *InvokeTransaction) Signature() []*felt.Felt
func (*InvokeTransaction) TxVersion ¶ added in v0.8.0
func (i *InvokeTransaction) TxVersion() *TransactionVersion
type L1HandlerTransaction ¶
type L1HandlerTransaction struct { TransactionHash *felt.Felt // The address of the contract. ContractAddress *felt.Felt // The encoding of the selector for the function invoked (the entry point in the contract) EntryPointSelector *felt.Felt // The transaction nonce. Nonce *felt.Felt // The arguments that are passed to the validated and execute functions. CallData []*felt.Felt // When the fields that comprise a transaction change, // either with the addition of a new field or the removal of an existing field, // then the transaction version increases. Version *TransactionVersion }
func (*L1HandlerTransaction) Hash ¶
func (l *L1HandlerTransaction) Hash() *felt.Felt
func (*L1HandlerTransaction) MessageHash ¶ added in v0.7.0
func (l *L1HandlerTransaction) MessageHash() []byte
func (*L1HandlerTransaction) Signature ¶
func (l *L1HandlerTransaction) Signature() []*felt.Felt
func (*L1HandlerTransaction) TxVersion ¶ added in v0.8.0
func (l *L1HandlerTransaction) TxVersion() *TransactionVersion
type L1ToL2Message ¶
type L2ToL1Message ¶
type OnValueChanged ¶ added in v0.3.0
type Pending ¶ added in v0.15.5
type Pending struct { Block *Block StateUpdate *StateUpdate NewClasses map[felt.Felt]Class }
func NewPending ¶ added in v0.15.5
func (*Pending) GetCandidateTransaction ¶ added in v0.15.5
func (p *Pending) GetCandidateTransaction() []Transaction
func (*Pending) GetNewClasses ¶ added in v0.15.5
func (*Pending) GetPreLatest ¶ added in v0.15.6
func (*Pending) GetStateUpdate ¶ added in v0.15.5
func (p *Pending) GetStateUpdate() *StateUpdate
func (*Pending) GetTransactionStateDiffs ¶ added in v0.15.5
func (*Pending) GetTransactions ¶ added in v0.15.5
func (p *Pending) GetTransactions() []Transaction
func (*Pending) Variant ¶ added in v0.15.5
func (p *Pending) Variant() PendingDataVariant
type PendingData ¶ added in v0.15.0
type PendingData interface { GetBlock() *Block GetHeader() *Header GetTransactions() []Transaction GetStateUpdate() *StateUpdate GetNewClasses() map[felt.Felt]Class GetCandidateTransaction() []Transaction GetTransactionStateDiffs() []*StateDiff GetPreLatest() *PreLatest // Validate returns true if pendingData is valid for given predecessor, // otherwise returns false Validate(parent *Header) bool Variant() PendingDataVariant }
type PendingDataVariant ¶ added in v0.15.0
type PendingDataVariant uint8
const ( PendingBlockVariant PendingDataVariant = iota + 1 PreConfirmedBlockVariant )
type PreConfirmed ¶ added in v0.15.0
type PreConfirmed struct { Block *Block StateUpdate *StateUpdate // Node does not fetch unknown classes. but we keep it for sequencer NewClasses map[felt.Felt]Class TransactionStateDiffs []*StateDiff CandidateTxs []Transaction // Optional field, exists if pre_confirmed is N+2 when latest is N PreLatest *PreLatest }
func NewPreConfirmed ¶ added in v0.15.0
func NewPreConfirmed( block *Block, stateUpdate *StateUpdate, transactionStateDiffs []*StateDiff, candidateTxs []Transaction, ) PreConfirmed
func (*PreConfirmed) Copy ¶ added in v0.15.6
func (p *PreConfirmed) Copy() *PreConfirmed
func (*PreConfirmed) GetBlock ¶ added in v0.15.0
func (p *PreConfirmed) GetBlock() *Block
func (*PreConfirmed) GetCandidateTransaction ¶ added in v0.15.0
func (p *PreConfirmed) GetCandidateTransaction() []Transaction
func (*PreConfirmed) GetHeader ¶ added in v0.15.0
func (p *PreConfirmed) GetHeader() *Header
func (*PreConfirmed) GetNewClasses ¶ added in v0.15.0
func (p *PreConfirmed) GetNewClasses() map[felt.Felt]Class
func (*PreConfirmed) GetPreLatest ¶ added in v0.15.6
func (p *PreConfirmed) GetPreLatest() *PreLatest
func (*PreConfirmed) GetStateUpdate ¶ added in v0.15.0
func (p *PreConfirmed) GetStateUpdate() *StateUpdate
func (*PreConfirmed) GetTransactionStateDiffs ¶ added in v0.15.0
func (p *PreConfirmed) GetTransactionStateDiffs() []*StateDiff
func (*PreConfirmed) GetTransactions ¶ added in v0.15.0
func (p *PreConfirmed) GetTransactions() []Transaction
func (*PreConfirmed) Validate ¶ added in v0.15.6
func (p *PreConfirmed) Validate(parent *Header) bool
func (*PreConfirmed) Variant ¶ added in v0.15.0
func (p *PreConfirmed) Variant() PendingDataVariant
func (*PreConfirmed) WithNewClasses ¶ added in v0.15.6
func (p *PreConfirmed) WithNewClasses(newClasses map[felt.Felt]Class) *PreConfirmed
func (*PreConfirmed) WithPreLatest ¶ added in v0.15.6
func (p *PreConfirmed) WithPreLatest(preLatest *PreLatest) *PreConfirmed
type ResourceBounds ¶ added in v0.8.0
type ResourceBounds struct { MaxAmount uint64 // MaxPricePerUnit is technically a uint128 MaxPricePerUnit *felt.Felt }
From the RPC spec: The max amount and max price per unit of gas used in this transaction.
func (ResourceBounds) Bytes ¶ added in v0.8.0
func (rb ResourceBounds) Bytes(resource Resource) []byte
func (ResourceBounds) IsZero ¶ added in v0.13.3
func (rb ResourceBounds) IsZero() bool
type RunningEventFilter ¶ added in v0.14.6
type RunningEventFilter struct {
// contains filtered or unexported fields
}
RunningEventFilter provides a thread-safe wrapper around AggregatedBloomFilter that automatically manages the creation of new filters when the current one reaches its capacity. It maintains the current state of event filtering across the blockchain.
func GetRunningEventFilter ¶ added in v0.14.6
func GetRunningEventFilter(r db.KeyValueReader) (*RunningEventFilter, error)
func NewRunningEventFilterHot ¶ added in v0.14.6
func NewRunningEventFilterHot(txn db.KeyValueStore, filter *AggregatedBloomFilter, nextBlock uint64) *RunningEventFilter
NewRunningFilter returns a RunningEventFilter that wraps the provided aggregated filter with the expected next block to process.
func NewRunningEventFilterLazy ¶ added in v0.14.6
func NewRunningEventFilterLazy(txn db.KeyValueStore) *RunningEventFilter
func (*RunningEventFilter) BlocksForKeys ¶ added in v0.14.6
func (f *RunningEventFilter) BlocksForKeys(keys [][]byte) *bitset.BitSet
BlocksForKeys returns a bitset indicating which blocks within the range might contain the given keys. If no keys are provided, returns a bitset with all bits set.
func (*RunningEventFilter) BlocksForKeysInto ¶ added in v0.14.6
func (f *RunningEventFilter) BlocksForKeysInto(keys [][]byte, out *bitset.BitSet) error
BlocksForKeysInto reuses a preallocated bitset (should be NumBlocksPerFilter bits).
func (*RunningEventFilter) Clone ¶ added in v0.14.6
func (f *RunningEventFilter) Clone() *RunningEventFilter
Clone returns a deep copy of the RunningEventFilter—including a full copy of its internal AggregatedBloomFilter window.
func (*RunningEventFilter) FromBlock ¶ added in v0.14.6
func (f *RunningEventFilter) FromBlock() uint64
FromBlock returns the starting block number of the current filter window.
func (*RunningEventFilter) InnerFilter ¶ added in v0.14.6
func (f *RunningEventFilter) InnerFilter() *AggregatedBloomFilter
InnerFilter returns a deep copy of the current AggregatedBloomFilter window.
func (*RunningEventFilter) Insert ¶ added in v0.14.6
func (f *RunningEventFilter) Insert( bloom *bloom.BloomFilter, blockNumber uint64, ) error
Insert adds a bloom filter for a single block, updating the internal aggregated filter. If the current window is full, it will be persisted using WriteAggregatedBloomFilter and a new window will be started. This implementation assumes blocks are not missed. Returns an error if the block cannot be inserted.
func (*RunningEventFilter) MarshalBinary ¶ added in v0.14.6
func (f *RunningEventFilter) MarshalBinary() ([]byte, error)
func (*RunningEventFilter) NextBlock ¶ added in v0.14.6
func (f *RunningEventFilter) NextBlock() uint64
NextBlock returns the next block number to be processed.
func (*RunningEventFilter) OnReorg ¶ added in v0.14.6
func (f *RunningEventFilter) OnReorg() error
Clear erases the bloom filter data for the specified block
func (*RunningEventFilter) ToBlock ¶ added in v0.14.6
func (f *RunningEventFilter) ToBlock() uint64
ToBlock returns the ending block number of the current filter window.
func (*RunningEventFilter) UnmarshalBinary ¶ added in v0.14.6
func (f *RunningEventFilter) UnmarshalBinary(data []byte) error
func (*RunningEventFilter) Write ¶ added in v0.14.6
func (f *RunningEventFilter) Write() error
Write writes the current state of the RunningEventFilter to persistent storage.
type SegmentLengths ¶ added in v0.11.0
type SegmentLengths struct { Children []SegmentLengths Length uint64 }
type SierraEntryPoint ¶ added in v0.2.1
type State ¶
type State struct {
// contains filtered or unexported fields
}
func NewState ¶
func NewState(txn db.IndexedBatch) *State
func (*State) ChainHeight ¶ added in v0.14.3
func (*State) Class ¶ added in v0.3.0
func (s *State) Class(classHash *felt.Felt) (*DeclaredClass, error)
Class returns the class object corresponding to the given classHash
func (*State) ContractClassHash ¶ added in v0.2.1
ContractClassHash returns class hash of a contract at a given address.
func (State) ContractClassHashAt ¶ added in v0.6.0
func (*State) ContractIsAlreadyDeployedAt ¶ added in v0.3.0
ContractIsAlreadyDeployedAt returns if contract at given addr was deployed at blockNumber
func (*State) ContractNonce ¶ added in v0.2.1
ContractNonce returns nonce of a contract at a given address.
func (State) ContractNonceAt ¶ added in v0.6.0
func (*State) ContractStorage ¶ added in v0.3.0
ContractStorage returns value of a key in the storage of the contract at the given address.
func (State) ContractStorageAt ¶ added in v0.6.0
func (h State) ContractStorageAt(contractAddress, storageLocation *felt.Felt, height uint64) (*felt.Felt, error)
ContractStorageAt returns the value of a storage location of the given contract at the height `height`
func (*State) ContractStorageTrie ¶ added in v0.13.0
func (State) DeleteContractClassHashLog ¶ added in v0.6.0
func (State) DeleteContractNonceLog ¶ added in v0.6.0
func (State) DeleteContractStorageLog ¶ added in v0.6.0
func (h State) DeleteContractStorageLog(contractAddress, storageLocation *felt.Felt, height uint64) error
DeleteContractStorageLog deletes the log at the given height
func (*State) GetReverseStateDiff ¶ added in v0.12.3
func (State) LogContractClassHash ¶ added in v0.6.0
func (State) LogContractNonce ¶ added in v0.6.0
func (State) LogContractStorage ¶ added in v0.6.0
func (h State) LogContractStorage(contractAddress, storageLocation, oldValue *felt.Felt, height uint64) error
LogContractStorage logs the old value of a storage location for the given contract which changed on height `height`
func (*State) Revert ¶ added in v0.4.0
func (s *State) Revert(blockNumber uint64, update *StateUpdate) error
func (*State) Update ¶
func (s *State) Update( blockNumber uint64, update *StateUpdate, declaredClasses map[felt.Felt]Class, skipVerifyNewRoot bool, ) error
Update applies a StateUpdate to the State object. State is not updated if an error is encountered during the operation. If update's old or new root does not match the state's old or new roots, [ErrMismatchedRoot] is returned.
type StateDiff ¶
type StateDiff struct { StorageDiffs map[felt.Felt]map[felt.Felt]*felt.Felt // addr -> {key -> value, ...} Nonces map[felt.Felt]*felt.Felt // addr -> nonce DeployedContracts map[felt.Felt]*felt.Felt // addr -> class hash DeclaredV0Classes []*felt.Felt // class hashes DeclaredV1Classes map[felt.Felt]*felt.Felt // class hash -> compiled class hash ReplacedClasses map[felt.Felt]*felt.Felt // addr -> class hash }
func EmptyStateDiff ¶ added in v0.7.5
func EmptyStateDiff() StateDiff
func (*StateDiff) Commitment ¶ added in v0.7.0
type StateHistoryReader ¶ added in v0.3.0
type StateHistoryReader interface { StateReader ContractStorageAt(addr, key *felt.Felt, blockNumber uint64) (*felt.Felt, error) ContractNonceAt(addr *felt.Felt, blockNumber uint64) (*felt.Felt, error) ContractClassHashAt(addr *felt.Felt, blockNumber uint64) (*felt.Felt, error) ContractIsAlreadyDeployedAt(addr *felt.Felt, blockNumber uint64) (bool, error) }
type StateReader ¶ added in v0.3.0
type StateReader interface { ChainHeight() (uint64, error) ContractClassHash(addr *felt.Felt) (*felt.Felt, error) ContractNonce(addr *felt.Felt) (*felt.Felt, error) ContractStorage(addr, key *felt.Felt) (*felt.Felt, error) Class(classHash *felt.Felt) (*DeclaredClass, error) ClassTrie() (*trie.Trie, error) ContractTrie() (*trie.Trie, error) ContractStorageTrie(addr *felt.Felt) (*trie.Trie, error) }
func NewStateSnapshot ¶ added in v0.3.0
func NewStateSnapshot(state StateHistoryReader, blockNumber uint64) StateReader
type StateUpdate ¶
type StateUpdate struct { BlockHash *felt.Felt NewRoot *felt.Felt OldRoot *felt.Felt StateDiff *StateDiff }
func GetStateUpdateByBlockNum ¶ added in v0.14.4
func GetStateUpdateByBlockNum(r db.KeyValueReader, blockNum uint64) (*StateUpdate, error)
func GetStateUpdateByHash ¶ added in v0.14.4
func GetStateUpdateByHash(r db.KeyValueReader, hash *felt.Felt) (*StateUpdate, error)
type Transaction ¶
type Transaction interface { Hash() *felt.Felt Signature() []*felt.Felt TxVersion() *TransactionVersion }
func GetTxByBlockNumIndex ¶ added in v0.14.4
func GetTxByBlockNumIndex(r db.KeyValueReader, blockNum, index uint64) (Transaction, error)
func GetTxByBlockNumIndexBytes ¶ added in v0.14.4
func GetTxByBlockNumIndexBytes(r db.KeyValueReader, val []byte) (Transaction, error)
func GetTxByHash ¶ added in v0.14.4
func GetTxByHash(r db.KeyValueReader, hash *felt.Felt) (Transaction, error)
func GetTxsByBlockNum ¶ added in v0.14.4
func GetTxsByBlockNum(iterable db.Iterable, blockNum uint64) ([]Transaction, error)
Returns all transactions in a given block
type TransactionReceipt ¶
type TransactionReceipt struct { Fee *felt.Felt FeeUnit FeeUnit Events []*Event ExecutionResources *ExecutionResources L1ToL2Message *L1ToL2Message L2ToL1Message []*L2ToL1Message TransactionHash *felt.Felt Reverted bool RevertReason string }
func GetReceiptByBlockNumIndexBytes ¶ added in v0.14.4
func GetReceiptByBlockNumIndexBytes(r db.KeyValueReader, bnIndex []byte) (*TransactionReceipt, error)
func GetReceiptByHash ¶ added in v0.14.4
func GetReceiptByHash(r db.KeyValueReader, hash *felt.Felt) (*TransactionReceipt, error)
func GetReceiptsByBlockNum ¶ added in v0.14.4
func GetReceiptsByBlockNum(iterable db.Iterable, blockNum uint64) ([]*TransactionReceipt, error)
Returns all receipts in a given block
type TransactionVersion ¶ added in v0.6.2
Keep in mind that this is used as a storage type, make sure you migrate the DB if you change the underlying type
func (*TransactionVersion) AsFelt ¶ added in v0.6.2
func (v *TransactionVersion) AsFelt() *felt.Felt
func (*TransactionVersion) HasQueryBit ¶ added in v0.6.2
func (v *TransactionVersion) HasQueryBit() bool
func (*TransactionVersion) Is ¶ added in v0.6.2
func (v *TransactionVersion) Is(u64 uint64) bool
Is compares the version (without query bit) with the given value
func (*TransactionVersion) MarshalCBOR ¶ added in v0.6.2
func (v *TransactionVersion) MarshalCBOR() ([]byte, error)
func (*TransactionVersion) SetUint64 ¶ added in v0.6.2
func (v *TransactionVersion) SetUint64(u64 uint64) *TransactionVersion
func (*TransactionVersion) String ¶ added in v0.6.2
func (v *TransactionVersion) String() string
func (*TransactionVersion) UnmarshalCBOR ¶ added in v0.6.2
func (v *TransactionVersion) UnmarshalCBOR(data []byte) error
func (*TransactionVersion) WithoutQueryBit ¶ added in v0.6.2
func (v *TransactionVersion) WithoutQueryBit() TransactionVersion
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package trie implements a dense Merkle Patricia Trie.
|
Package trie implements a dense Merkle Patricia Trie. |