Documentation ¶
Index ¶
- Constants
- func EqualCommitments(c1, c2 trie.Serializable) bool
- func ForEachBlockIndex(store kvstore.KVStore, fun func(blockIndex uint32) bool) error
- func GetMerkleProof(key []byte, tr trie.NodeStore) *trie_blake2b.Proof
- func LoadBlockBytes(store kvstore.KVStore, stateIndex uint32) ([]byte, error)
- func NewOptimisticStateReader(db kvstore.KVStore, glb coreutil.ChainStateSync) *optimisticStateReaderImpl
- func NewStateUpdate(timestamp ...time.Time) *stateUpdateImpl
- func NewTrie(db kvstore.KVStore) *trie.Trie
- func NewTrieReader(trieKV, valueKV trie.KVReader) *trie.TrieReader
- func NewVirtualState(db kvstore.KVStore) *virtualStateAccess
- func OriginStateCommitment() trie.VCommitment
- func RootCommitment(tr trie.NodeStore) trie.VCommitment
- func VCommitmentFromBytes(data []byte) (trie.VCommitment, error)
- func ValidateMerkleProof(proof *trie_blake2b.Proof, root trie.VCommitment, value ...[]byte) error
- type Block
- type BlockHash
- type L1Commitment
- func L1CommitmentFromAliasOutput(output *iotago.AliasOutput) (*L1Commitment, error)
- func L1CommitmentFromAnchorOutput(o *iotago.AliasOutput) (L1Commitment, error)
- func L1CommitmentFromBytes(data []byte) (L1Commitment, error)
- func NewL1Commitment(c trie.VCommitment, blockHash BlockHash) *L1Commitment
- func OriginL1Commitment() *L1Commitment
- func RandL1Commitment() *L1Commitment
- type OnBlockSaveClosure
- type OptimisticStateReader
- type Update
- type VirtualStateAccess
- func CreateOriginState(store kvstore.KVStore, chainID *isc.ChainID) (VirtualStateAccess, error)
- func LoadSolidState(store kvstore.KVStore, chainID *isc.ChainID) (VirtualStateAccess, bool, error)
- func WrapMustOptimisticVirtualStateAccess(state VirtualStateAccess, baseline coreutil.StateBaseline) VirtualStateAccess
Constants ¶
const BlockHashSize = 20
const (
OriginStateCommitmentHex = "c4f09061cd63ea506f89b7cbb3c6e0984f124158"
)
Variables ¶
This section is empty.
Functions ¶
func EqualCommitments ¶ added in v0.3.0
func EqualCommitments(c1, c2 trie.Serializable) bool
func ForEachBlockIndex ¶ added in v0.3.0
ForEachBlockIndex iterates over all indices of block saved in the DB Order non-deterministic
func GetMerkleProof ¶ added in v0.3.0
func GetMerkleProof(key []byte, tr trie.NodeStore) *trie_blake2b.Proof
func LoadBlockBytes ¶ added in v0.2.0
LoadBlockBytes loads block bytes of the specified block index from DB
func NewOptimisticStateReader ¶ added in v0.2.0
func NewOptimisticStateReader(db kvstore.KVStore, glb coreutil.ChainStateSync) *optimisticStateReaderImpl
NewOptimisticStateReader creates new optimistic read-only access to the database. It contains own read baseline
func NewStateUpdate ¶
NewStateUpdate creates a state update with timestamp mutation, if provided
func NewTrieReader ¶ added in v0.3.0
func NewTrieReader(trieKV, valueKV trie.KVReader) *trie.TrieReader
func NewVirtualState ¶
NewVirtualState creates VirtualStateAccess interface with the partition of KVStore
func OriginStateCommitment ¶ added in v0.3.0
func OriginStateCommitment() trie.VCommitment
func RootCommitment ¶ added in v0.3.0
func RootCommitment(tr trie.NodeStore) trie.VCommitment
func VCommitmentFromBytes ¶ added in v0.3.0
func VCommitmentFromBytes(data []byte) (trie.VCommitment, error)
func ValidateMerkleProof ¶ added in v0.3.0
func ValidateMerkleProof(proof *trie_blake2b.Proof, root trie.VCommitment, value ...[]byte) error
Types ¶
type Block ¶ added in v0.1.0
type Block interface { BlockIndex() uint32 ApprovingOutputID() *iotago.UTXOInput SetApprovingOutputID(*iotago.UTXOInput) Timestamp() time.Time PreviousL1Commitment() *L1Commitment EssenceBytes() []byte // except state transaction id Bytes() []byte }
Block is a wrapped update
func BlockFromBytes ¶ added in v0.2.0
type BlockHash ¶ added in v0.3.0
type BlockHash [BlockHashSize]byte
func BlockHashFromData ¶ added in v0.3.0
func OriginBlockHash ¶ added in v0.3.0
func OriginBlockHash() (ret BlockHash)
type L1Commitment ¶ added in v0.3.0
type L1Commitment struct { // root commitment to the state StateCommitment trie.VCommitment // hash of the essence of the last block BlockHash BlockHash }
L1Commitment represents parsed data stored as a metadata in the anchor output
var L1CommitmentNil *L1Commitment
func L1CommitmentFromAliasOutput ¶ added in v0.3.0
func L1CommitmentFromAliasOutput(output *iotago.AliasOutput) (*L1Commitment, error)
func L1CommitmentFromAnchorOutput ¶ added in v0.3.0
func L1CommitmentFromAnchorOutput(o *iotago.AliasOutput) (L1Commitment, error)
func L1CommitmentFromBytes ¶ added in v0.3.0
func L1CommitmentFromBytes(data []byte) (L1Commitment, error)
func NewL1Commitment ¶ added in v0.3.0
func NewL1Commitment(c trie.VCommitment, blockHash BlockHash) *L1Commitment
func OriginL1Commitment ¶ added in v0.3.0
func OriginL1Commitment() *L1Commitment
func RandL1Commitment ¶ added in v0.3.0
func RandL1Commitment() *L1Commitment
RandL1Commitment for testing only
func (*L1Commitment) Bytes ¶ added in v0.3.0
func (s *L1Commitment) Bytes() []byte
func (*L1Commitment) String ¶ added in v0.3.0
func (s *L1Commitment) String() string
type OnBlockSaveClosure ¶ added in v0.3.0
type OnBlockSaveClosure func(stateCommitment trie.VCommitment, block Block)
func SaveRawBlockClosure ¶ added in v0.3.0
func SaveRawBlockClosure(dir string, log *logger.Logger) OnBlockSaveClosure
SaveRawBlockClosure return closure which saves block in specified directory
type OptimisticStateReader ¶ added in v0.2.0
type Update ¶ added in v0.3.0
type Update interface { Mutations() *buffered.Mutations Clone() Update Bytes() []byte String() string }
Update is a set of mutations
func NewStateUpdateWithBlockLogValues ¶ added in v0.3.0
func NewStateUpdateWithBlockLogValues(blockIndex uint32, timestamp time.Time, prevL1Commitment *L1Commitment) Update
type VirtualStateAccess ¶ added in v0.2.0
type VirtualStateAccess interface { ChainID() *isc.ChainID BlockIndex() uint32 Timestamp() time.Time TrieNodeStore() trie.NodeStore PreviousL1Commitment() *L1Commitment Commit() ReconcileTrie() []kv.Key KVStoreReader() kv.KVStoreReader OptimisticStateReader(glb coreutil.ChainStateSync) OptimisticStateReader ApplyStateUpdate(Update) ApplyBlock(Block) error ProofGeneric(key []byte) *trie.ProofGeneric ExtractBlock() (Block, error) Save(blocks ...Block) error KVStore() *buffered.BufferedKVStoreAccess Copy() VirtualStateAccess DangerouslyConvertToString() string WithOnBlockSave(fun OnBlockSaveClosure) }
VirtualStateAccess is a virtualized access interface to the chain's database It consists of state reader and the buffer to collect mutations to key values
func CreateOriginState ¶ added in v0.2.0
CreateOriginState creates and saves origin state in DB
func LoadSolidState ¶
LoadSolidState establishes VirtualStateAccess interface with the solid state in DB. Checks root commitment to chainID
func WrapMustOptimisticVirtualStateAccess ¶ added in v0.2.0
func WrapMustOptimisticVirtualStateAccess(state VirtualStateAccess, baseline coreutil.StateBaseline) VirtualStateAccess
WrapMustOptimisticVirtualStateAccess wraps virtual state with state baseline in on object Does not copy buffers