Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConstructor ¶ added in v0.9.0
func NewConstructor(squareSize uint64, opts ...nmt.Option) rsmt2d.TreeConstructorFn
NewConstructor creates a tree constructor function as required by rsmt2d to calculate the data root. It creates that tree using the wrapper.ErasuredNamespacedMerkleTree.
Types ¶
type ErasuredNamespacedMerkleTree ¶
type ErasuredNamespacedMerkleTree struct {
// contains filtered or unexported fields
}
ErasuredNamespacedMerkleTree wraps NamespaceMerkleTree to conform to the rsmt2d.Tree interface while also providing the correct namespaces to the underlying NamespaceMerkleTree. It does this by adding the already included namespace to the first half of the tree, and then uses the parity namespace ID for each share pushed to the second half of the tree. This allows for the namespaces to be included in the erasure data, while also keeping the nmt library sufficiently general
func NewErasuredNamespacedMerkleTree ¶
func NewErasuredNamespacedMerkleTree(squareSize uint64, axisIndex uint, setters ...nmt.Option) ErasuredNamespacedMerkleTree
NewErasuredNamespacedMerkleTree creates a new ErasuredNamespacedMerkleTree with an underlying NMT of namespace size `appconsts.NamespaceSize`. axisIndex is the index of the row or column that this tree is committing to. squareSize must be greater than zero.
func (*ErasuredNamespacedMerkleTree) Prove ¶
func (w *ErasuredNamespacedMerkleTree) Prove(ind int) (nmt.Proof, error)
Prove returns a Merkle inclusion proof for the leaf at index `ind`.
func (*ErasuredNamespacedMerkleTree) ProveRange ¶ added in v1.0.0
func (w *ErasuredNamespacedMerkleTree) ProveRange(start, end int) (nmt.Proof, error)
ProveRange returns a Merkle range proof for the leaf range [start, end] where `end` is non-inclusive.
func (*ErasuredNamespacedMerkleTree) Push ¶
func (w *ErasuredNamespacedMerkleTree) Push(data []byte)
Push adds the provided data to the underlying NamespaceMerkleTree, and automatically uses the first DefaultNamespaceIDLen number of bytes as the namespace unless the data pushed to the second half of the tree. Fulfills the rsmt.Tree interface. NOTE: panics if an error is encountered while pushing or if the tree size is exceeded.
func (*ErasuredNamespacedMerkleTree) Root ¶
func (w *ErasuredNamespacedMerkleTree) Root() []byte
Root fulfills the rsmt.Tree interface by generating and returning the underlying NamespaceMerkleTree Root.