proof

package
v0.12.0-rc4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const ShareInclusionQueryPath = "shareInclusionProof"
View Source
const TxInclusionQueryPath = "txInclusionProof"

Variables

This section is empty.

Functions

func BlobShareRange

func BlobShareRange(tx types.Tx) (beginShare uint64, endShare uint64, err error)

BlobShareRange returns the start and end positions for the shares where a given blob, referenced by its wrapped PFB transaction, was published at. Note: only supports transactions containing a single blob.

func GenerateSharesInclusionProof

func GenerateSharesInclusionProof(
	allRawShares []shares.Share,
	squareSize uint64,
	namespaceID namespace.ID,
	startShare uint64,
	endShare uint64,
) (types.SharesProof, error)

GenerateSharesInclusionProof generates an nmt inclusion proof for a set of shares to the data root. Expects the share range to be pre-validated. Note: only supports inclusion proofs for shares belonging to the same namespace.

func ParseNamespaceID

func ParseNamespaceID(rawShares []shares.Share, startShare int64, endShare int64) (namespace.ID, error)

ParseNamespaceID validates the share range, checks if it only contains one namespace and returns that namespace ID.

func QueryShareInclusionProof

func QueryShareInclusionProof(_ sdk.Context, path []string, req abci.RequestQuery) ([]byte, error)

QueryShareInclusionProof defines the logic performed when querying for the inclusion proofs of a set of shares to the data root. The share range should be appended to the path. Example path for proving the set of shares [3, 5]: custom/shareInclusionProof/3/5

func QueryTxInclusionProof

func QueryTxInclusionProof(_ sdk.Context, path []string, req abci.RequestQuery) ([]byte, error)

Querier defines the logic performed when the ABCI client using the Query method with the custom prove.QueryPath. The index of the transaction being proved must be appended to the path. The marshalled bytes of the transaction proof (tmproto.TxProof) are returned.

example path for proving the third transaction in that block: custom/txInclusionProof/3

func TxInclusion

func TxInclusion(codec rsmt2d.Codec, data types.Data, txIndex uint64) (types.TxProof, error)

TxInclusion uses the provided block data to progressively generate rows of a data square, and then using those shares to creates nmt inclusion proofs. It is possible that a transaction spans more than one row. In that case, we have to return more than one proof.

func TxSharePosition

func TxSharePosition(txs types.Txs, txIndex uint64) (startSharePos, endSharePos uint64, err error)

TxSharePosition returns the start and end positions for the shares that include a given txIndex. Returns an error if index is greater than the length of txs.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL