Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterCodec(cdc *codec.Codec)
- type Key
- func (*Key) Descriptor() ([]byte, []int)
- func (m *Key) Marshal() (dAtA []byte, err error)
- func (m *Key) MarshalTo(dAtA []byte) (int, error)
- func (m *Key) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Key) ProtoMessage()
- func (m *Key) Reset()
- func (m *Key) Size() (n int)
- func (m *Key) String() string
- func (m *Key) Unmarshal(dAtA []byte) error
- func (m *Key) XXX_DiscardUnknown()
- func (m *Key) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Key) XXX_Merge(src proto.Message)
- func (m *Key) XXX_Size() int
- func (m *Key) XXX_Unmarshal(b []byte) error
- type KeyEncoding
- type KeyPath
- func (pth KeyPath) AppendKey(key []byte, enc KeyEncoding) KeyPath
- func (*KeyPath) Descriptor() ([]byte, []int)
- func (m *KeyPath) Marshal() (dAtA []byte, err error)
- func (m *KeyPath) MarshalTo(dAtA []byte) (int, error)
- func (m *KeyPath) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*KeyPath) ProtoMessage()
- func (m *KeyPath) Reset()
- func (m *KeyPath) Size() (n int)
- func (pth *KeyPath) String() string
- func (m *KeyPath) Unmarshal(dAtA []byte) error
- func (m *KeyPath) XXX_DiscardUnknown()
- func (m *KeyPath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *KeyPath) XXX_Merge(src proto.Message)
- func (m *KeyPath) XXX_Size() int
- func (m *KeyPath) XXX_Unmarshal(b []byte) error
- type MerklePath
- func (*MerklePath) Descriptor() ([]byte, []int)
- func (MerklePath) GetCommitmentType() exported.Type
- func (m *MerklePath) GetKeyPath() KeyPath
- func (mp MerklePath) IsEmpty() bool
- func (m *MerklePath) Marshal() (dAtA []byte, err error)
- func (m *MerklePath) MarshalTo(dAtA []byte) (int, error)
- func (m *MerklePath) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (mp MerklePath) Pretty() string
- func (*MerklePath) ProtoMessage()
- func (m *MerklePath) Reset()
- func (m *MerklePath) Size() (n int)
- func (mp MerklePath) String() string
- func (m *MerklePath) Unmarshal(dAtA []byte) error
- func (m *MerklePath) XXX_DiscardUnknown()
- func (m *MerklePath) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MerklePath) XXX_Merge(src proto.Message)
- func (m *MerklePath) XXX_Size() int
- func (m *MerklePath) XXX_Unmarshal(b []byte) error
- type MerklePrefix
- func (mp MerklePrefix) Bytes() []byte
- func (*MerklePrefix) Descriptor() ([]byte, []int)
- func (MerklePrefix) GetCommitmentType() exported.Type
- func (m *MerklePrefix) GetKeyPrefix() []byte
- func (mp MerklePrefix) IsEmpty() bool
- func (m *MerklePrefix) Marshal() (dAtA []byte, err error)
- func (m *MerklePrefix) MarshalTo(dAtA []byte) (int, error)
- func (m *MerklePrefix) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MerklePrefix) ProtoMessage()
- func (m *MerklePrefix) Reset()
- func (m *MerklePrefix) Size() (n int)
- func (m *MerklePrefix) String() string
- func (m *MerklePrefix) Unmarshal(dAtA []byte) error
- func (m *MerklePrefix) XXX_DiscardUnknown()
- func (m *MerklePrefix) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MerklePrefix) XXX_Merge(src proto.Message)
- func (m *MerklePrefix) XXX_Size() int
- func (m *MerklePrefix) XXX_Unmarshal(b []byte) error
- type MerkleProof
- func (*MerkleProof) Descriptor() ([]byte, []int)
- func (this *MerkleProof) Equal(that interface{}) bool
- func (MerkleProof) GetCommitmentType() exported.Type
- func (m *MerkleProof) GetProof() *merkle.Proof
- func (proof MerkleProof) IsEmpty() bool
- func (m *MerkleProof) Marshal() (dAtA []byte, err error)
- func (m *MerkleProof) MarshalTo(dAtA []byte) (int, error)
- func (m *MerkleProof) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MerkleProof) ProtoMessage()
- func (m *MerkleProof) Reset()
- func (m *MerkleProof) Size() (n int)
- func (m *MerkleProof) String() string
- func (m *MerkleProof) Unmarshal(dAtA []byte) error
- func (proof MerkleProof) ValidateBasic() error
- func (proof MerkleProof) VerifyMembership(root exported.Root, path exported.Path, value []byte) error
- func (proof MerkleProof) VerifyNonMembership(root exported.Root, path exported.Path) error
- func (m *MerkleProof) XXX_DiscardUnknown()
- func (m *MerkleProof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MerkleProof) XXX_Merge(src proto.Message)
- func (m *MerkleProof) XXX_Size() int
- func (m *MerkleProof) XXX_Unmarshal(b []byte) error
- type MerkleRoot
- func (*MerkleRoot) Descriptor() ([]byte, []int)
- func (MerkleRoot) GetCommitmentType() exported.Type
- func (mr MerkleRoot) GetHash() []byte
- func (mr MerkleRoot) IsEmpty() bool
- func (m *MerkleRoot) Marshal() (dAtA []byte, err error)
- func (m *MerkleRoot) MarshalTo(dAtA []byte) (int, error)
- func (m *MerkleRoot) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*MerkleRoot) ProtoMessage()
- func (m *MerkleRoot) Reset()
- func (m *MerkleRoot) Size() (n int)
- func (m *MerkleRoot) String() string
- func (m *MerkleRoot) Unmarshal(dAtA []byte) error
- func (m *MerkleRoot) XXX_DiscardUnknown()
- func (m *MerkleRoot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *MerkleRoot) XXX_Merge(src proto.Message)
- func (m *MerkleRoot) XXX_Size() int
- func (m *MerkleRoot) XXX_Unmarshal(b []byte) error
Constants ¶
const SubModuleName string = "commitment"
SubModuleName is the error codespace
Variables ¶
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
var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group") )
var KeyEncoding_name = map[int32]string{
0: "KEY_ENCODING_URL_UNSPECIFIED",
1: "KEY_ENCODING_HEX",
}
var KeyEncoding_value = map[string]int32{
"KEY_ENCODING_URL_UNSPECIFIED": 0,
"KEY_ENCODING_HEX": 1,
}
var ( // SubModuleCdc references the global x/ibc/23-commitmentl module codec. Note, the codec should // ONLY be used in certain instances of tests and for JSON encoding as Amino is // still used for that purpose. // // The actual codec used for serialization should be provided to x/ibc/23-commitmentl and // defined at the application level. SubModuleCdc = codec.NewHybridCodec(amino, cdctypes.NewInterfaceRegistry()) )
Functions ¶
func RegisterCodec ¶
RegisterCodec registers the necessary x/ibc/23-commitment interfaces and concrete types on the provided Amino codec. These types are used for Amino JSON serialization.
Types ¶
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key defines a proof Key
func (*Key) Descriptor ¶
func (*Key) ProtoMessage ¶
func (*Key) ProtoMessage()
func (*Key) XXX_DiscardUnknown ¶
func (m *Key) XXX_DiscardUnknown()
func (*Key) XXX_Unmarshal ¶
type KeyEncoding ¶
type KeyEncoding int32
KeyEncoding defines the encoding format of a key's bytes.
const ( // URL encoding URL KeyEncoding = 0 // Hex encoding HEX KeyEncoding = 1 )
func (KeyEncoding) EnumDescriptor ¶
func (KeyEncoding) EnumDescriptor() ([]byte, []int)
type KeyPath ¶
type KeyPath struct {
Keys []*Key `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
}
KeyPath defines a slice of keys
func (KeyPath) AppendKey ¶
func (pth KeyPath) AppendKey(key []byte, enc KeyEncoding) KeyPath
AppendKey appends a new key to a KeyPath
func (*KeyPath) Descriptor ¶
func (*KeyPath) MarshalToSizedBuffer ¶
func (*KeyPath) ProtoMessage ¶
func (*KeyPath) ProtoMessage()
func (*KeyPath) XXX_DiscardUnknown ¶
func (m *KeyPath) XXX_DiscardUnknown()
func (*KeyPath) XXX_Marshal ¶
func (*KeyPath) XXX_Unmarshal ¶
type MerklePath ¶
type MerklePath struct {
KeyPath KeyPath `protobuf:"bytes,1,opt,name=key_path,json=keyPath,proto3" json:"key_path" yaml:"key_path"`
}
MerklePath is the path used to verify commitment proofs, which can be an arbitrary structured object (defined by a commitment type).
func ApplyPrefix ¶
func ApplyPrefix(prefix exported.Prefix, path string) (MerklePath, error)
ApplyPrefix constructs a new commitment path from the arguments. It interprets the path argument in the context of the prefix argument.
CONTRACT: provided path string MUST be a well formated path. See ICS24 for reference.
func NewMerklePath ¶
func NewMerklePath(keyPathStr []string) MerklePath
NewMerklePath creates a new MerklePath instance
func (*MerklePath) Descriptor ¶
func (*MerklePath) Descriptor() ([]byte, []int)
func (MerklePath) GetCommitmentType ¶
func (MerklePath) GetCommitmentType() exported.Type
GetCommitmentType implements PathI
func (*MerklePath) GetKeyPath ¶
func (m *MerklePath) GetKeyPath() KeyPath
func (MerklePath) IsEmpty ¶
func (mp MerklePath) IsEmpty() bool
IsEmpty returns true if the path is empty
func (*MerklePath) Marshal ¶
func (m *MerklePath) Marshal() (dAtA []byte, err 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.
func (*MerklePath) ProtoMessage ¶
func (*MerklePath) ProtoMessage()
func (*MerklePath) Reset ¶
func (m *MerklePath) Reset()
func (*MerklePath) Size ¶
func (m *MerklePath) Size() (n int)
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) GetCommitmentType ¶
func (MerklePrefix) GetCommitmentType() exported.Type
GetCommitmentType implements Prefix interface
func (*MerklePrefix) GetKeyPrefix ¶
func (m *MerklePrefix) GetKeyPrefix() []byte
func (MerklePrefix) IsEmpty ¶
func (mp MerklePrefix) IsEmpty() bool
IsEmpty returns true if the prefix is empty
func (*MerklePrefix) Marshal ¶
func (m *MerklePrefix) Marshal() (dAtA []byte, err 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 {
Proof *merkle.Proof `protobuf:"bytes,1,opt,name=proof,proto3" json:"proof,omitempty"`
}
MerkleProof is a wrapper type that contains a merkle proof. 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.
func (*MerkleProof) Descriptor ¶
func (*MerkleProof) Descriptor() ([]byte, []int)
func (*MerkleProof) Equal ¶
func (this *MerkleProof) Equal(that interface{}) bool
func (MerkleProof) GetCommitmentType ¶
func (MerkleProof) GetCommitmentType() exported.Type
GetCommitmentType implements ProofI
func (*MerkleProof) GetProof ¶
func (m *MerkleProof) GetProof() *merkle.Proof
func (MerkleProof) IsEmpty ¶
func (proof MerkleProof) IsEmpty() bool
IsEmpty returns true if the root is empty
func (*MerkleProof) Marshal ¶
func (m *MerkleProof) Marshal() (dAtA []byte, err 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(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 ¶
VerifyNonMembership verifies the absence of a merkle proof against the given root and path.
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) GetCommitmentType ¶
func (MerkleRoot) GetCommitmentType() exported.Type
GetCommitmentType implements RootI interface
func (MerkleRoot) GetHash ¶
func (mr MerkleRoot) GetHash() []byte
GetHash implements RootI interface
func (MerkleRoot) IsEmpty ¶
func (mr MerkleRoot) IsEmpty() bool
IsEmpty returns true if the root is empty
func (*MerkleRoot) Marshal ¶
func (m *MerkleRoot) Marshal() (dAtA []byte, err 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