Documentation ¶
Overview ¶
Package inclusion contains functions to generate the blob share commitment from a given blob.
Index ¶
- func BlobMinSquareSize(shareCount int) int
- func BlobSharesUsedNonInteractiveDefaults(cursor, subtreeRootThreshold int, blobShareLens ...int) (sharesUsed int, indexes []uint32)
- func CreateCommitment(blob *blob.Blob, merkleRootFn MerkleRootFn, subtreeRootThreshold int) ([]byte, error)
- func CreateCommitments(blobs []*blob.Blob, merkleRootFn MerkleRootFn, subtreeRootThreshold int) ([][]byte, error)
- func MerkleMountainRangeSizes(totalSize, maxTreeSize uint64) ([]uint64, error)
- func NextShareIndex(cursor, blobShareLen, subtreeRootThreshold int) int
- func RoundUpByMultipleOf(cursor, v int) int
- func SubTreeWidth(shareCount, subtreeRootThreshold int) int
- type MerkleRootFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlobMinSquareSize ¶
BlobMinSquareSize returns the minimum square size that can contain shareCount number of shares.
func BlobSharesUsedNonInteractiveDefaults ¶
func BlobSharesUsedNonInteractiveDefaults(cursor, subtreeRootThreshold int, blobShareLens ...int) (sharesUsed int, indexes []uint32)
BlobSharesUsedNonInteractiveDefaults returns the number of shares used by a given set of blobs share lengths. It follows the blob share commitment rules and returns the total shares used and share indexes for each blob.
func CreateCommitment ¶
func CreateCommitment(blob *blob.Blob, merkleRootFn MerkleRootFn, subtreeRootThreshold int) ([]byte, error)
CreateCommitment generates the share commitment for a given blob. See [data square layout rationale] and [blob share commitment rules].
[data square layout rationale]: ../../specs/src/specs/data_square_layout.md [blob share commitment rules]: ../../specs/src/specs/data_square_layout.md#blob-share-commitment-rules
func CreateCommitments ¶
func MerkleMountainRangeSizes ¶
MerkleMountainRangeSizes returns the sizes (number of leaf nodes) of the trees in a merkle mountain range constructed for a given totalSize and maxTreeSize.
https://docs.grin.mw/wiki/chain-state/merkle-mountain-range/ https://github.com/opentimestamps/opentimestamps-server/blob/master/doc/merkle-mountain-range.md
func NextShareIndex ¶
NextShareIndex determines the next index in a square that can be used. It follows the blob share commitment rules defined in ADR-013. Assumes that all args are non negative, that squareSize is a power of two and that the blob can fit in the square. The cursor is expected to be the index after the end of the previous blob.
See https://github.com/celestiaorg/celestia-app/blob/main/specs/src/specs/data_square_layout.md for more information.
func RoundUpByMultipleOf ¶
RoundUpByMultipleOf rounds cursor up to the next multiple of v. If cursor is divisible by v, then it returns cursor.
func SubTreeWidth ¶
SubTreeWidth returns the maximum number of leaves per subtree in the share commitment over a given blob. The input should be the total number of shares used by that blob. See ADR-013.