types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SubModuleName string = "commitment"

SubModuleName is the error codespace

Variables

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

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)
View Source
var KeyEncoding_name = map[int32]string{
	0: "KEY_ENCODING_URL_UNSPECIFIED",
	1: "KEY_ENCODING_HEX",
}
View Source
var KeyEncoding_value = map[string]int32{
	"KEY_ENCODING_URL_UNSPECIFIED": 0,
	"KEY_ENCODING_HEX":             1,
}
View Source
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

func RegisterCodec(cdc *codec.Codec)

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) Descriptor() ([]byte, []int)

func (*Key) Marshal

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

func (*Key) MarshalTo

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

func (*Key) MarshalToSizedBuffer

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

func (*Key) ProtoMessage

func (*Key) ProtoMessage()

func (*Key) Reset

func (m *Key) Reset()

func (*Key) Size

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

func (*Key) String

func (m *Key) String() string

func (*Key) Unmarshal

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

func (*Key) XXX_DiscardUnknown

func (m *Key) XXX_DiscardUnknown()

func (*Key) XXX_Marshal

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

func (*Key) XXX_Merge

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

func (*Key) XXX_Size

func (m *Key) XXX_Size() int

func (*Key) XXX_Unmarshal

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

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) Descriptor() ([]byte, []int)

func (*KeyPath) Marshal

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

func (*KeyPath) MarshalTo

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

func (*KeyPath) MarshalToSizedBuffer

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

func (*KeyPath) ProtoMessage

func (*KeyPath) ProtoMessage()

func (*KeyPath) Reset

func (m *KeyPath) Reset()

func (*KeyPath) Size

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

func (*KeyPath) String

func (pth *KeyPath) String() string

String implements the fmt.Stringer interface

func (*KeyPath) Unmarshal

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

func (*KeyPath) XXX_DiscardUnknown

func (m *KeyPath) XXX_DiscardUnknown()

func (*KeyPath) XXX_Marshal

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

func (*KeyPath) XXX_Merge

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

func (*KeyPath) XXX_Size

func (m *KeyPath) XXX_Size() int

func (*KeyPath) XXX_Unmarshal

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

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) 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.

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.

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) 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 {
	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) 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(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(root exported.Root, path exported.Path) error

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