proof

package
v1.0.0-rc62 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

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

Variables

View Source
var (
	ErrInvalidLengthProof        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProof          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProof = fmt.Errorf("proto: unexpected end of group")
)

Functions

func NewShareInclusionProof

func NewShareInclusionProof(
	dataSquare square.Square,
	namespace appns.Namespace,
	shareRange shares.Range,
) (types.ShareProof, error)

NewShareInclusionProof returns an NMT inclusion proof for a set of shares belonging to the same namespace to the data root. Expects the share range to be pre-validated.

func NewTxInclusionProof

func NewTxInclusionProof(txs [][]byte, txIndex, appVersion uint64) (types.ShareProof, error)

NewTxInclusionProof returns a new share inclusion proof for the given transaction index.

func ParseNamespace added in v1.0.0

func ParseNamespace(rawShares []shares.Share, startShare, endShare int) (appns.Namespace, error)

ParseNamespace 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.ShareProof) are returned.

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

Types

type NMTProof

type NMTProof struct {
	// Start index of this proof.
	Start int32 `protobuf:"varint,1,opt,name=start,proto3" json:"start,omitempty"`
	// End index of this proof.
	End int32 `protobuf:"varint,2,opt,name=end,proto3" json:"end,omitempty"`
	// Nodes that together with the corresponding leaf values can be used to
	// recompute the root and verify this proof. Nodes should consist of the max
	// and min namespaces along with the actual hash, resulting in each being 48
	// bytes each
	Nodes [][]byte `protobuf:"bytes,3,rep,name=nodes,proto3" json:"nodes,omitempty"`
	// leafHash are nil if the namespace is present in the NMT. In case the
	// namespace to be proved is in the min/max range of the tree but absent, this
	// will contain the leaf hash necessary to verify the proof of absence. Leaf
	// hashes should consist of the namespace along with the actual hash,
	// resulting 40 bytes total.
	LeafHash []byte `protobuf:"bytes,4,opt,name=leaf_hash,json=leafHash,proto3" json:"leaf_hash,omitempty"`
}

NMTProof is a proof of a namespace.ID in an NMT. In case this proof proves the absence of a namespace.ID in a tree it also contains the leaf hashes of the range where that namespace would be.

func (*NMTProof) Descriptor

func (*NMTProof) Descriptor() ([]byte, []int)

func (*NMTProof) GetEnd

func (m *NMTProof) GetEnd() int32

func (*NMTProof) GetLeafHash

func (m *NMTProof) GetLeafHash() []byte

func (*NMTProof) GetNodes

func (m *NMTProof) GetNodes() [][]byte

func (*NMTProof) GetStart

func (m *NMTProof) GetStart() int32

func (*NMTProof) Marshal

func (m *NMTProof) Marshal() (dAtA []byte, err error)

func (*NMTProof) MarshalTo

func (m *NMTProof) MarshalTo(dAtA []byte) (int, error)

func (*NMTProof) MarshalToSizedBuffer

func (m *NMTProof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*NMTProof) ProtoMessage

func (*NMTProof) ProtoMessage()

func (*NMTProof) Reset

func (m *NMTProof) Reset()

func (*NMTProof) Size

func (m *NMTProof) Size() (n int)

func (*NMTProof) String

func (m *NMTProof) String() string

func (*NMTProof) Unmarshal

func (m *NMTProof) Unmarshal(dAtA []byte) error

func (*NMTProof) XXX_DiscardUnknown

func (m *NMTProof) XXX_DiscardUnknown()

func (*NMTProof) XXX_Marshal

func (m *NMTProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*NMTProof) XXX_Merge

func (m *NMTProof) XXX_Merge(src proto.Message)

func (*NMTProof) XXX_Size

func (m *NMTProof) XXX_Size() int

func (*NMTProof) XXX_Unmarshal

func (m *NMTProof) XXX_Unmarshal(b []byte) error

type RowProof

type RowProof struct {
	RowRoots [][]byte        `protobuf:"bytes,1,rep,name=row_roots,json=rowRoots,proto3" json:"row_roots,omitempty"`
	Proofs   []*crypto.Proof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"`
	Root     []byte          `protobuf:"bytes,3,opt,name=root,proto3" json:"root,omitempty"`
	StartRow uint32          `protobuf:"varint,4,opt,name=start_row,json=startRow,proto3" json:"start_row,omitempty"`
	EndRow   uint32          `protobuf:"varint,5,opt,name=end_row,json=endRow,proto3" json:"end_row,omitempty"`
}

RowProof is a Merkle proof that a set of rows exist in a Merkle tree with a given data root.

func (*RowProof) Descriptor

func (*RowProof) Descriptor() ([]byte, []int)

func (*RowProof) GetEndRow

func (m *RowProof) GetEndRow() uint32

func (*RowProof) GetProofs

func (m *RowProof) GetProofs() []*crypto.Proof

func (*RowProof) GetRoot

func (m *RowProof) GetRoot() []byte

func (*RowProof) GetRowRoots

func (m *RowProof) GetRowRoots() [][]byte

func (*RowProof) GetStartRow

func (m *RowProof) GetStartRow() uint32

func (*RowProof) Marshal

func (m *RowProof) Marshal() (dAtA []byte, err error)

func (*RowProof) MarshalTo

func (m *RowProof) MarshalTo(dAtA []byte) (int, error)

func (*RowProof) MarshalToSizedBuffer

func (m *RowProof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RowProof) ProtoMessage

func (*RowProof) ProtoMessage()

func (*RowProof) Reset

func (m *RowProof) Reset()

func (*RowProof) Size

func (m *RowProof) Size() (n int)

func (*RowProof) String

func (m *RowProof) String() string

func (*RowProof) Unmarshal

func (m *RowProof) Unmarshal(dAtA []byte) error

func (*RowProof) XXX_DiscardUnknown

func (m *RowProof) XXX_DiscardUnknown()

func (*RowProof) XXX_Marshal

func (m *RowProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RowProof) XXX_Merge

func (m *RowProof) XXX_Merge(src proto.Message)

func (*RowProof) XXX_Size

func (m *RowProof) XXX_Size() int

func (*RowProof) XXX_Unmarshal

func (m *RowProof) XXX_Unmarshal(b []byte) error

type ShareProof

type ShareProof struct {
	Data             [][]byte    `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	ShareProofs      []*NMTProof `protobuf:"bytes,2,rep,name=share_proofs,json=shareProofs,proto3" json:"share_proofs,omitempty"`
	NamespaceId      []byte      `protobuf:"bytes,3,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"`
	RowProof         *RowProof   `protobuf:"bytes,4,opt,name=row_proof,json=rowProof,proto3" json:"row_proof,omitempty"`
	NamespaceVersion uint32      `protobuf:"varint,5,opt,name=namespace_version,json=namespaceVersion,proto3" json:"namespace_version,omitempty"`
}

ShareProof is an NMT proof that a set of shares exist in a set of rows and a Merkle proof that those rows exist in a Merkle tree with a given data root.

func (*ShareProof) Descriptor

func (*ShareProof) Descriptor() ([]byte, []int)

func (*ShareProof) GetData

func (m *ShareProof) GetData() [][]byte

func (*ShareProof) GetNamespaceId

func (m *ShareProof) GetNamespaceId() []byte

func (*ShareProof) GetNamespaceVersion

func (m *ShareProof) GetNamespaceVersion() uint32

func (*ShareProof) GetRowProof

func (m *ShareProof) GetRowProof() *RowProof

func (*ShareProof) GetShareProofs

func (m *ShareProof) GetShareProofs() []*NMTProof

func (*ShareProof) Marshal

func (m *ShareProof) Marshal() (dAtA []byte, err error)

func (*ShareProof) MarshalTo

func (m *ShareProof) MarshalTo(dAtA []byte) (int, error)

func (*ShareProof) MarshalToSizedBuffer

func (m *ShareProof) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ShareProof) ProtoMessage

func (*ShareProof) ProtoMessage()

func (*ShareProof) Reset

func (m *ShareProof) Reset()

func (*ShareProof) Size

func (m *ShareProof) Size() (n int)

func (*ShareProof) String

func (m *ShareProof) String() string

func (*ShareProof) Unmarshal

func (m *ShareProof) Unmarshal(dAtA []byte) error

func (*ShareProof) XXX_DiscardUnknown

func (m *ShareProof) XXX_DiscardUnknown()

func (*ShareProof) XXX_Marshal

func (m *ShareProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ShareProof) XXX_Merge

func (m *ShareProof) XXX_Merge(src proto.Message)

func (*ShareProof) XXX_Size

func (m *ShareProof) XXX_Size() int

func (*ShareProof) XXX_Unmarshal

func (m *ShareProof) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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