cosmos-sdk: github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types Index | Files

package types

import "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"

Index

Package Files

codec.go commitment.pb.go errors.go key_path.go merkle.go

Constants

const SubModuleName string = "commitment"

SubModuleName is the error codespace

Variables

var (
    ErrInvalidLengthCommitment        = fmt.Errorf("proto: negative length found during unmarshaling")
    ErrIntOverflowCommitment          = fmt.Errorf("proto: integer overflow")
    ErrUnexpectedEndOfGroupCommitment = fmt.Errorf("proto: unexpected end of group")
)
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 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.NewProtoCodec(codectypes.NewInterfaceRegistry())
)

func GetSDKSpecs Uses

func GetSDKSpecs() []*ics23.ProofSpec

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

func RegisterCodec Uses

func RegisterCodec(cdc *codec.LegacyAmino)

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.

func RegisterInterfaces Uses

func RegisterInterfaces(registry codectypes.InterfaceRegistry)

RegisterInterfaces registers the commitment interfaces to protobuf Any.

type Key Uses

type Key struct {
    // contains filtered or unexported fields
}

Key defines a proof Key

func (*Key) Descriptor Uses

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

func (*Key) Marshal Uses

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

func (*Key) MarshalTo Uses

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

func (*Key) MarshalToSizedBuffer Uses

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

func (*Key) ProtoMessage Uses

func (*Key) ProtoMessage()

func (*Key) Reset Uses

func (m *Key) Reset()

func (*Key) Size Uses

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

func (*Key) String Uses

func (m *Key) String() string

func (*Key) Unmarshal Uses

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

func (*Key) XXX_DiscardUnknown Uses

func (m *Key) XXX_DiscardUnknown()

func (*Key) XXX_Marshal Uses

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

func (*Key) XXX_Merge Uses

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

func (*Key) XXX_Size Uses

func (m *Key) XXX_Size() int

func (*Key) XXX_Unmarshal Uses

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

type KeyEncoding Uses

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 Uses

func (KeyEncoding) EnumDescriptor() ([]byte, []int)

type KeyPath Uses

type KeyPath struct {
    Keys []*Key `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
}

KeyPath defines a slice of keys

func (KeyPath) AppendKey Uses

func (pth KeyPath) AppendKey(key []byte, enc KeyEncoding) KeyPath

AppendKey appends a new key to a KeyPath

func (*KeyPath) Descriptor Uses

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

func (*KeyPath) GetKey Uses

func (pth *KeyPath) GetKey(i int) []byte

GetKey returns the bytes representation of key at given index Passing in a positive index return the key at index in forward order from the highest key to the lowest key Passing in a negative index will return the key at index in reverse order from the lowest key to the highest key. This is the order for proof verification, since we prove lowest key first before moving to key of higher subtrees

func (*KeyPath) Marshal Uses

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

func (*KeyPath) MarshalTo Uses

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

func (*KeyPath) MarshalToSizedBuffer Uses

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

func (*KeyPath) ProtoMessage Uses

func (*KeyPath) ProtoMessage()

func (*KeyPath) Reset Uses

func (m *KeyPath) Reset()

func (*KeyPath) Size Uses

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

func (*KeyPath) String Uses

func (pth *KeyPath) String() string

String implements the fmt.Stringer interface

func (*KeyPath) Unmarshal Uses

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

func (*KeyPath) XXX_DiscardUnknown Uses

func (m *KeyPath) XXX_DiscardUnknown()

func (*KeyPath) XXX_Marshal Uses

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

func (*KeyPath) XXX_Merge Uses

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

func (*KeyPath) XXX_Size Uses

func (m *KeyPath) XXX_Size() int

func (*KeyPath) XXX_Unmarshal Uses

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

type MerklePath Uses

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 Uses

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 Uses

func NewMerklePath(keyPathStr []string) MerklePath

NewMerklePath creates a new MerklePath instance

func (*MerklePath) Descriptor Uses

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

func (MerklePath) Empty Uses

func (mp MerklePath) Empty() bool

Empty returns true if the path is empty

func (*MerklePath) GetKeyPath Uses

func (m *MerklePath) GetKeyPath() KeyPath

func (*MerklePath) Marshal Uses

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

func (*MerklePath) MarshalTo Uses

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

func (*MerklePath) MarshalToSizedBuffer Uses

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

func (MerklePath) Pretty Uses

func (mp MerklePath) Pretty() string

Pretty returns the unescaped path of the URL string.

func (*MerklePath) ProtoMessage Uses

func (*MerklePath) ProtoMessage()

func (*MerklePath) Reset Uses

func (m *MerklePath) Reset()

func (*MerklePath) Size Uses

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

func (MerklePath) String Uses

func (mp MerklePath) String() string

String implements fmt.Stringer.

func (*MerklePath) Unmarshal Uses

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

func (*MerklePath) XXX_DiscardUnknown Uses

func (m *MerklePath) XXX_DiscardUnknown()

func (*MerklePath) XXX_Marshal Uses

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

func (*MerklePath) XXX_Merge Uses

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

func (*MerklePath) XXX_Size Uses

func (m *MerklePath) XXX_Size() int

func (*MerklePath) XXX_Unmarshal Uses

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

type MerklePrefix Uses

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 Uses

func NewMerklePrefix(keyPrefix []byte) MerklePrefix

NewMerklePrefix constructs new MerklePrefix instance

func (MerklePrefix) Bytes Uses

func (mp MerklePrefix) Bytes() []byte

Bytes returns the key prefix bytes

func (*MerklePrefix) Descriptor Uses

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

func (MerklePrefix) Empty Uses

func (mp MerklePrefix) Empty() bool

Empty returns true if the prefix is empty

func (*MerklePrefix) GetKeyPrefix Uses

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

func (*MerklePrefix) Marshal Uses

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

func (*MerklePrefix) MarshalTo Uses

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

func (*MerklePrefix) MarshalToSizedBuffer Uses

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

func (*MerklePrefix) ProtoMessage Uses

func (*MerklePrefix) ProtoMessage()

func (*MerklePrefix) Reset Uses

func (m *MerklePrefix) Reset()

func (*MerklePrefix) Size Uses

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

func (*MerklePrefix) String Uses

func (m *MerklePrefix) String() string

func (*MerklePrefix) Unmarshal Uses

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

func (*MerklePrefix) XXX_DiscardUnknown Uses

func (m *MerklePrefix) XXX_DiscardUnknown()

func (*MerklePrefix) XXX_Marshal Uses

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

func (*MerklePrefix) XXX_Merge Uses

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

func (*MerklePrefix) XXX_Size Uses

func (m *MerklePrefix) XXX_Size() int

func (*MerklePrefix) XXX_Unmarshal Uses

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

type MerkleProof Uses

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) BatchVerifyMembership Uses

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: All items must be part of a batch proof in the first chained proof, i.e. items must all be part of smallest subtree in the chained proof NOTE: The path passed in must be the path from the root to the smallest subtree in the chained proof NOTE: Untested

func (MerkleProof) BatchVerifyNonMembership Uses

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: All items must be part of a batch proof in the first chained proof, i.e. items must all be part of smallest subtree in the chained proof NOTE: The path passed in must be the path from the root to the smallest subtree in the chained proof NOTE: Untested

func (*MerkleProof) Descriptor Uses

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

func (MerkleProof) Empty Uses

func (proof MerkleProof) Empty() bool

Empty returns true if the root is empty

func (*MerkleProof) Equal Uses

func (this *MerkleProof) Equal(that interface{}) bool

func (*MerkleProof) GetProof Uses

func (m *MerkleProof) GetProof() *merkle.Proof

func (*MerkleProof) Marshal Uses

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

func (*MerkleProof) MarshalTo Uses

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

func (*MerkleProof) MarshalToSizedBuffer Uses

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

func (*MerkleProof) ProtoMessage Uses

func (*MerkleProof) ProtoMessage()

func (*MerkleProof) Reset Uses

func (m *MerkleProof) Reset()

func (*MerkleProof) Size Uses

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

func (*MerkleProof) String Uses

func (m *MerkleProof) String() string

func (*MerkleProof) Unmarshal Uses

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

func (MerkleProof) ValidateBasic Uses

func (proof MerkleProof) ValidateBasic() error

ValidateBasic checks if the proof is empty.

func (MerkleProof) VerifyMembership Uses

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 Uses

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 Uses

func (m *MerkleProof) XXX_DiscardUnknown()

func (*MerkleProof) XXX_Marshal Uses

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

func (*MerkleProof) XXX_Merge Uses

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

func (*MerkleProof) XXX_Size Uses

func (m *MerkleProof) XXX_Size() int

func (*MerkleProof) XXX_Unmarshal Uses

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

type MerkleRoot Uses

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 Uses

func NewMerkleRoot(hash []byte) MerkleRoot

NewMerkleRoot constructs a new MerkleRoot

func (*MerkleRoot) Descriptor Uses

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

func (MerkleRoot) Empty Uses

func (mr MerkleRoot) Empty() bool

Empty returns true if the root is empty

func (MerkleRoot) GetHash Uses

func (mr MerkleRoot) GetHash() []byte

GetHash implements RootI interface

func (*MerkleRoot) Marshal Uses

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

func (*MerkleRoot) MarshalTo Uses

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

func (*MerkleRoot) MarshalToSizedBuffer Uses

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

func (*MerkleRoot) ProtoMessage Uses

func (*MerkleRoot) ProtoMessage()

func (*MerkleRoot) Reset Uses

func (m *MerkleRoot) Reset()

func (*MerkleRoot) Size Uses

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

func (*MerkleRoot) String Uses

func (m *MerkleRoot) String() string

func (*MerkleRoot) Unmarshal Uses

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

func (*MerkleRoot) XXX_DiscardUnknown Uses

func (m *MerkleRoot) XXX_DiscardUnknown()

func (*MerkleRoot) XXX_Marshal Uses

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

func (*MerkleRoot) XXX_Merge Uses

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

func (*MerkleRoot) XXX_Size Uses

func (m *MerkleRoot) XXX_Size() int

func (*MerkleRoot) XXX_Unmarshal Uses

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

Package types imports 15 packages (graph) and is imported by 14 packages. Updated 2020-08-13. Refresh now. Tools for package owners.