Versions in this module Expand all Collapse all v0 v0.0.1 Jul 4, 2023 Changes in this version + const BytesInInt + const NodeSize + const SparseBlockLog2Size + const SparseBlockSize + type CommAndLoc struct + Comm Node + Loc Location + type Hybrid struct + func NewHybrid(log2Leafs int) (Hybrid, error) + func (h *Hybrid) MarshalCBOR(w io.Writer) error + func (h *Hybrid) UnmarshalCBOR(r io.Reader) (err error) + func (ht *Hybrid) BatchSet(vals []CommAndLoc) error + func (ht *Hybrid) SetNode(level int, idx uint64, n *Node) error + func (ht Hybrid) CollectProof(level int, idx uint64) (ProofData, error) + func (ht Hybrid) GetNode(level int, idx uint64) (Node, error) + func (ht Hybrid) MaxLevel() int + func (ht Hybrid) Root() Node + type Location struct + Index uint64 + Level int + func (l Location) LeafIndex() uint64 + type MerkleTree interface + ConstructProof func(lvl int, idx uint64) (*ProofData, error) + Depth func() int + LeafCount func() uint64 + Leafs func() []Node + Node func(int, uint64) *Node + Root func() *Node + Serialize func() ([]byte, error) + Validate func() bool + ValidateFromLeafs func(leafData [][]byte) error + type Node [NodeSize]byte + func TruncatedHash(data []byte) *Node + func ZeroCommitmentForLevel(lvl int) Node + func ZeroCommitmentForSize(size uint64) (Node, error) + func (n *Node) IsZero() bool + func (n *Node) MarshalCBOR(w io.Writer) error + func (n *Node) UnmarshalCBOR(r io.Reader) error + type ProofData struct + Index uint64 + Path []Node + func (d ProofData) ComputeRoot(subtree *Node) (*Node, error) + func (d ProofData) Depth() int + func (d ProofData) ValidateLeaf(data []byte, root *Node) error + func (d ProofData) ValidateSubtree(subtree *Node, root *Node) error + func (nd *ProofData) UnmarshalCBOR(r io.Reader) error + func (pd *ProofData) MarshalCBOR(w io.Writer) error + type ProofDataSerialization struct + Index uint64 + Path nodeArray + func (t *ProofDataSerialization) MarshalCBOR(w io.Writer) error + func (t *ProofDataSerialization) UnmarshalCBOR(r io.Reader) (err error) + type SparseArray struct + func (sa *SparseArray[T]) GetSliceRef(index uint64, length int) ([]T, error) + func (sa *SparseArray[T]) Set(index uint64, val *T) T + func (sa SparseArray[T]) Get(index uint64) T + type TreeData struct + func DeserializeTree(tree []byte) (*TreeData, error) + func GrowTree(leafData [][]byte) (*TreeData, error) + func GrowTreeHashedLeafs(leafs []Node) *TreeData + func (d TreeData) ConstructProof(lvl int, idx uint64) (*ProofData, error) + func (d TreeData) Depth() int + func (d TreeData) LeafCount() uint64 + func (d TreeData) Leafs() []Node + func (d TreeData) Node(lvl int, idx uint64) *Node + func (d TreeData) Root() *Node + func (d TreeData) Serialize() ([]byte, error) + func (d TreeData) Validate() bool + func (d TreeData) ValidateFromLeafs(leafs [][]byte) error