Documentation
¶
Index ¶
- Constants
- Variables
- func ParseNamespace(rawShares []shares.Share, startShare int, endShare int) (appns.Namespace, error)
- func QueryShareInclusionProof(_ sdk.Context, path []string, req abci.RequestQuery) ([]byte, error)
- func QueryTxInclusionProof(_ sdk.Context, path []string, req abci.RequestQuery) ([]byte, error)
- type NMTProof
- func (*NMTProof) Descriptor() ([]byte, []int)
- func (m *NMTProof) GetEnd() int32
- func (m *NMTProof) GetLeafHash() []byte
- func (m *NMTProof) GetNodes() [][]byte
- func (m *NMTProof) GetStart() int32
- func (m *NMTProof) Marshal() (dAtA []byte, err error)
- func (m *NMTProof) MarshalTo(dAtA []byte) (int, error)
- func (m *NMTProof) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*NMTProof) ProtoMessage()
- func (m *NMTProof) Reset()
- func (m *NMTProof) Size() (n int)
- func (m *NMTProof) String() string
- func (m *NMTProof) Unmarshal(dAtA []byte) error
- func (m *NMTProof) XXX_DiscardUnknown()
- func (m *NMTProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *NMTProof) XXX_Merge(src proto.Message)
- func (m *NMTProof) XXX_Size() int
- func (m *NMTProof) XXX_Unmarshal(b []byte) error
- type Proof
- func (*Proof) Descriptor() ([]byte, []int)
- func (m *Proof) GetAunts() [][]byte
- func (m *Proof) GetIndex() int64
- func (m *Proof) GetLeafHash() []byte
- func (m *Proof) GetTotal() int64
- func (m *Proof) Marshal() (dAtA []byte, err error)
- func (m *Proof) MarshalTo(dAtA []byte) (int, error)
- func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Proof) ProtoMessage()
- func (m *Proof) Reset()
- func (m *Proof) Size() (n int)
- func (m *Proof) String() string
- func (m *Proof) Unmarshal(dAtA []byte) error
- func (p *Proof) Verify(rootHash []byte, leaf []byte) error
- func (m *Proof) XXX_DiscardUnknown()
- func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Proof) XXX_Merge(src proto.Message)
- func (m *Proof) XXX_Size() int
- func (m *Proof) XXX_Unmarshal(b []byte) error
- type RowProof
- func (*RowProof) Descriptor() ([]byte, []int)
- func (m *RowProof) GetEndRow() uint32
- func (m *RowProof) GetProofs() []*Proof
- func (m *RowProof) GetRoot() []byte
- func (m *RowProof) GetRowRoots() [][]byte
- func (m *RowProof) GetStartRow() uint32
- func (m *RowProof) Marshal() (dAtA []byte, err error)
- func (m *RowProof) MarshalTo(dAtA []byte) (int, error)
- func (m *RowProof) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*RowProof) ProtoMessage()
- func (m *RowProof) Reset()
- func (m *RowProof) Size() (n int)
- func (m *RowProof) String() string
- func (m *RowProof) Unmarshal(dAtA []byte) error
- func (rp RowProof) Validate(root []byte) error
- func (rp RowProof) VerifyProof(root []byte) bool
- func (m *RowProof) XXX_DiscardUnknown()
- func (m *RowProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *RowProof) XXX_Merge(src proto.Message)
- func (m *RowProof) XXX_Size() int
- func (m *RowProof) XXX_Unmarshal(b []byte) error
- type ShareProof
- func (*ShareProof) Descriptor() ([]byte, []int)
- func (m *ShareProof) GetData() [][]byte
- func (m *ShareProof) GetNamespaceId() []byte
- func (m *ShareProof) GetNamespaceVersion() uint32
- func (m *ShareProof) GetRowProof() *RowProof
- func (m *ShareProof) GetShareProofs() []*NMTProof
- func (m *ShareProof) Marshal() (dAtA []byte, err error)
- func (m *ShareProof) MarshalTo(dAtA []byte) (int, error)
- func (m *ShareProof) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*ShareProof) ProtoMessage()
- func (m *ShareProof) Reset()
- func (m *ShareProof) Size() (n int)
- func (m *ShareProof) String() string
- func (m *ShareProof) Unmarshal(dAtA []byte) error
- func (sp ShareProof) Validate(root []byte) error
- func (sp ShareProof) VerifyProof() bool
- func (m *ShareProof) XXX_DiscardUnknown()
- func (m *ShareProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ShareProof) XXX_Merge(src proto.Message)
- func (m *ShareProof) XXX_Size() int
- func (m *ShareProof) XXX_Unmarshal(b []byte) error
Constants ¶
const TxInclusionQueryPath = "txInclusionProof"
Variables ¶
Functions ¶
func ParseNamespace ¶
func ParseNamespace(rawShares []shares.Share, startShare int, endShare int) (appns.Namespace, error)
ParseNamespace validates the share range, checks if it only contains one namespace and returns that namespace ID.
func QueryShareInclusionProof ¶
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 ¶
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) GetLeafHash ¶
func (*NMTProof) MarshalToSizedBuffer ¶
func (*NMTProof) ProtoMessage ¶
func (*NMTProof) ProtoMessage()
func (*NMTProof) XXX_DiscardUnknown ¶
func (m *NMTProof) XXX_DiscardUnknown()
func (*NMTProof) XXX_Marshal ¶
func (*NMTProof) XXX_Unmarshal ¶
type Proof ¶
type Proof struct { Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"` LeafHash []byte `protobuf:"bytes,3,opt,name=leaf_hash,json=leafHash,proto3" json:"leaf_hash,omitempty"` Aunts [][]byte `protobuf:"bytes,4,rep,name=aunts,proto3" json:"aunts,omitempty"` }
Proof is taken from the merkle package
func (*Proof) Descriptor ¶
func (*Proof) GetLeafHash ¶
func (*Proof) ProtoMessage ¶
func (*Proof) ProtoMessage()
func (*Proof) XXX_DiscardUnknown ¶
func (m *Proof) XXX_DiscardUnknown()
func (*Proof) XXX_Marshal ¶
func (*Proof) XXX_Unmarshal ¶
type RowProof ¶
type RowProof struct { RowRoots [][]byte `protobuf:"bytes,1,rep,name=row_roots,json=rowRoots,proto3" json:"row_roots,omitempty"` Proofs []*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) GetRowRoots ¶
func (*RowProof) GetStartRow ¶
func (*RowProof) MarshalToSizedBuffer ¶
func (*RowProof) ProtoMessage ¶
func (*RowProof) ProtoMessage()
func (RowProof) Validate ¶
Validate performs checks on the fields of this RowProof. Returns an error if the proof fails validation. If the proof passes validation, this function attempts to verify the proof. It returns nil if the proof is valid.
func (RowProof) VerifyProof ¶
VerifyProof verifies that all the row roots in this RowProof exist in a Merkle tree with the given root. Returns true if all proofs are valid.
func (*RowProof) XXX_DiscardUnknown ¶
func (m *RowProof) XXX_DiscardUnknown()
func (*RowProof) XXX_Marshal ¶
func (*RowProof) XXX_Unmarshal ¶
type ShareProof ¶
type ShareProof struct {}
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 NewShareInclusionProof ¶
func NewShareInclusionProof( dataSquare square.Square, namespace appns.Namespace, shareRange shares.Range, ) (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) (ShareProof, error)
NewTxInclusionProof returns a new share inclusion proof for the given transaction index.
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) 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) Validate ¶
func (sp ShareProof) Validate(root []byte) error
Validate runs basic validations on the proof then verifies if it is consistent. It returns nil if the proof is valid. Otherwise, it returns a sensible error. The `root` is the block data root that the shares to be proven belong to. Note: these proofs are tested on the app side.
func (ShareProof) VerifyProof ¶
func (sp ShareProof) VerifyProof() bool
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