types

package
v0.0.0-...-2a91c6f Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SubModuleName string = "commitment"

SubModuleName is the error codespace

Variables

View Source
var (
	ErrInvalidLengthCommitment        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCommitment          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupCommitment = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidProof       = sdkerrors.Register(SubModuleName, 2, "invalid proof")
	ErrInvalidPrefix      = sdkerrors.Register(SubModuleName, 3, "invalid prefix")
	ErrInvalidMerkleProof = sdkerrors.Register(SubModuleName, 4, "invalid merkle proof")
)

IBC connection sentinel errors

Functions

func GetSDKSpecs

func GetSDKSpecs() []*ics23.ProofSpec

GetSDKSpecs is a getter function for the proofspecs of an sdk chain

func RegisterInterfaces

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the commitment interfaces to protobuf Any.

Types

type MerklePath

type MerklePath struct {
	KeyPath []string `protobuf:"bytes,1,rep,name=key_path,json=keyPath,proto3" json:"key_path,omitempty" yaml:"key_path"`
}

MerklePath is the path used to verify commitment proofs, which can be an arbitrary structured object (defined by a commitment type). MerklePath is represented from root-to-leaf

func ApplyPrefix

func ApplyPrefix(prefix exported.Prefix, path MerklePath) (MerklePath, error)

ApplyPrefix constructs a new commitment path from the arguments. It prepends the prefix key with the given path.

func NewMerklePath

func NewMerklePath(keyPath ...string) MerklePath

NewMerklePath creates a new MerklePath instance The keys must be passed in from root-to-leaf order

func (*MerklePath) Descriptor

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

func (MerklePath) Empty

func (mp MerklePath) Empty() bool

Empty returns true if the path is empty

func (MerklePath) GetKey

func (mp MerklePath) GetKey(i uint64) ([]byte, error)

GetKey will return a byte representation of the key after URL escaping the key element

func (*MerklePath) GetKeyPath

func (m *MerklePath) GetKeyPath() []string

func (*MerklePath) Marshal

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

func (*MerklePath) MarshalTo

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

func (*MerklePath) MarshalToSizedBuffer

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

func (MerklePath) Pretty

func (mp MerklePath) Pretty() string

Pretty returns the unescaped path of the URL string. This function will unescape any backslash within a particular store key. This makes the keypath more human-readable while removing information about the exact partitions in the key path.

func (*MerklePath) ProtoMessage

func (*MerklePath) ProtoMessage()

func (*MerklePath) Reset

func (m *MerklePath) Reset()

func (*MerklePath) Size

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

func (MerklePath) String

func (mp MerklePath) String() string

String implements fmt.Stringer. This represents the path in the same way the tendermint KeyPath will represent a key path. The backslashes partition the key path into the respective stores they belong to.

func (*MerklePath) Unmarshal

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

func (*MerklePath) XXX_DiscardUnknown

func (m *MerklePath) XXX_DiscardUnknown()

func (*MerklePath) XXX_Marshal

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

func (*MerklePath) XXX_Merge

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

func (*MerklePath) XXX_Size

func (m *MerklePath) XXX_Size() int

func (*MerklePath) XXX_Unmarshal

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

type MerklePrefix

type MerklePrefix struct {
	KeyPrefix []byte `protobuf:"bytes,1,opt,name=key_prefix,json=keyPrefix,proto3" json:"key_prefix,omitempty" yaml:"key_prefix"`
}

MerklePrefix is merkle path prefixed to the key. The constructed key from the Path and the key will be append(Path.KeyPath, append(Path.KeyPrefix, key...))

func NewMerklePrefix

func NewMerklePrefix(keyPrefix []byte) MerklePrefix

NewMerklePrefix constructs new MerklePrefix instance

func (MerklePrefix) Bytes

func (mp MerklePrefix) Bytes() []byte

Bytes returns the key prefix bytes

func (*MerklePrefix) Descriptor

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

func (MerklePrefix) Empty

func (mp MerklePrefix) Empty() bool

Empty returns true if the prefix is empty

func (*MerklePrefix) GetKeyPrefix

func (m *MerklePrefix) GetKeyPrefix() []byte

func (*MerklePrefix) Marshal

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

func (*MerklePrefix) MarshalTo

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

func (*MerklePrefix) MarshalToSizedBuffer

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

func (*MerklePrefix) ProtoMessage

func (*MerklePrefix) ProtoMessage()

func (*MerklePrefix) Reset

func (m *MerklePrefix) Reset()

func (*MerklePrefix) Size

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

func (*MerklePrefix) String

func (m *MerklePrefix) String() string

func (*MerklePrefix) Unmarshal

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

func (*MerklePrefix) XXX_DiscardUnknown

func (m *MerklePrefix) XXX_DiscardUnknown()

func (*MerklePrefix) XXX_Marshal

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

func (*MerklePrefix) XXX_Merge

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

func (*MerklePrefix) XXX_Size

func (m *MerklePrefix) XXX_Size() int

func (*MerklePrefix) XXX_Unmarshal

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

type MerkleProof

type MerkleProof struct {
	Proofs []*_go.CommitmentProof `protobuf:"bytes,1,rep,name=proofs,proto3" json:"proofs,omitempty"`
}

MerkleProof is a wrapper type over a chain of CommitmentProofs. It demonstrates membership or non-membership for an element or set of elements, verifiable in conjunction with a known commitment root. Proofs should be succinct. MerkleProofs are ordered from leaf-to-root

func ConvertProofs

func ConvertProofs(tmProof *crypto.ProofOps) (MerkleProof, error)

ConvertProofs converts crypto.ProofOps into MerkleProof

func (MerkleProof) BatchVerifyMembership

func (proof MerkleProof) BatchVerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items map[string][]byte) error

BatchVerifyMembership verifies a group of key value pairs against the given root NOTE: Currently left unimplemented as it is unused

func (MerkleProof) BatchVerifyNonMembership

func (proof MerkleProof) BatchVerifyNonMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, items [][]byte) error

BatchVerifyNonMembership verifies absence of a group of keys against the given root NOTE: Currently left unimplemented as it is unused

func (*MerkleProof) Descriptor

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

func (*MerkleProof) Empty

func (proof *MerkleProof) Empty() bool

Empty returns true if the root is empty

func (*MerkleProof) GetProofs

func (m *MerkleProof) GetProofs() []*_go.CommitmentProof

func (*MerkleProof) Marshal

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

func (*MerkleProof) MarshalTo

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

func (*MerkleProof) MarshalToSizedBuffer

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

func (*MerkleProof) ProtoMessage

func (*MerkleProof) ProtoMessage()

func (*MerkleProof) Reset

func (m *MerkleProof) Reset()

func (*MerkleProof) Size

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

func (*MerkleProof) String

func (m *MerkleProof) String() string

func (*MerkleProof) Unmarshal

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

func (MerkleProof) ValidateBasic

func (proof MerkleProof) ValidateBasic() error

ValidateBasic checks if the proof is empty.

func (MerkleProof) VerifyMembership

func (proof MerkleProof) VerifyMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path, value []byte) error

VerifyMembership verifies the membership pf a merkle proof against the given root, path, and value.

func (MerkleProof) VerifyNonMembership

func (proof MerkleProof) VerifyNonMembership(specs []*ics23.ProofSpec, root exported.Root, path exported.Path) error

VerifyNonMembership verifies the absence of a merkle proof against the given root and path. VerifyNonMembership verifies a chained proof where the absence of a given path is proven at the lowest subtree and then each subtree's inclusion is proved up to the final root.

func (*MerkleProof) XXX_DiscardUnknown

func (m *MerkleProof) XXX_DiscardUnknown()

func (*MerkleProof) XXX_Marshal

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

func (*MerkleProof) XXX_Merge

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

func (*MerkleProof) XXX_Size

func (m *MerkleProof) XXX_Size() int

func (*MerkleProof) XXX_Unmarshal

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

type MerkleRoot

type MerkleRoot struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
}

MerkleRoot defines a merkle root hash. In the Cosmos SDK, the AppHash of a block header becomes the root.

func NewMerkleRoot

func NewMerkleRoot(hash []byte) MerkleRoot

NewMerkleRoot constructs a new MerkleRoot

func (*MerkleRoot) Descriptor

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

func (MerkleRoot) Empty

func (mr MerkleRoot) Empty() bool

Empty returns true if the root is empty

func (MerkleRoot) GetHash

func (mr MerkleRoot) GetHash() []byte

GetHash implements RootI interface

func (*MerkleRoot) Marshal

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

func (*MerkleRoot) MarshalTo

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

func (*MerkleRoot) MarshalToSizedBuffer

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

func (*MerkleRoot) ProtoMessage

func (*MerkleRoot) ProtoMessage()

func (*MerkleRoot) Reset

func (m *MerkleRoot) Reset()

func (*MerkleRoot) Size

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

func (*MerkleRoot) String

func (m *MerkleRoot) String() string

func (*MerkleRoot) Unmarshal

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

func (*MerkleRoot) XXX_DiscardUnknown

func (m *MerkleRoot) XXX_DiscardUnknown()

func (*MerkleRoot) XXX_Marshal

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

func (*MerkleRoot) XXX_Merge

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

func (*MerkleRoot) XXX_Size

func (m *MerkleRoot) XXX_Size() int

func (*MerkleRoot) XXX_Unmarshal

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

Jump to

Keyboard shortcuts

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