Documentation
¶
Index ¶
- Constants
- Variables
- func CleanPacketCommitmentKey(sourceChain, destinationChain string) []byte
- func CleanPacketCommitmentPath(sourceChain, destinationChain string) string
- func ClientIdentifierValidator(id string) error
- func ClientStateKey() []byte
- func ConnectionIdentifierValidator(id string) error
- func ConsensusStateKey(height exported.Height) []byte
- func ConsensusStatePath(height exported.Height) string
- func DestChainValidator(id string) error
- func FullClientKey(chainName string, path []byte) []byte
- func FullClientPath(chainName string, path string) string
- func FullClientStateKey(chainName string) []byte
- func FullClientStatePath(chainName string) string
- func FullConsensusStateKey(chainName string, height exported.Height) []byte
- func FullConsensusStatePath(chainName string, height exported.Height) string
- func NextSequenceSendKey(sourceChain, destChain string) []byte
- func NextSequenceSendPath(sourceChain, destChain string) string
- func PacketAcknowledgementKey(sourceChain, destinationChain string, sequence uint64) []byte
- func PacketAcknowledgementPath(sourceChain, destinationChain string, sequence uint64) string
- func PacketAcknowledgementPrefixPath(sourceChain, destinationChain string) string
- func PacketCommitmentKey(sourceChain, destinationChain string, sequence uint64) []byte
- func PacketCommitmentPath(sourceChain, destinationChain string, sequence uint64) string
- func PacketCommitmentPrefixPath(sourceChain, destinationChain string) string
- func PacketReceiptKey(sourceChain, destinationChain string, sequence uint64) []byte
- func PacketReceiptPath(sourceChain, destinationChain string, sequence uint64) string
- func PacketReceiptPrefixPath(sourceChain, destinationChain string) string
- func ParseChannelPath(path string) (string, string, error)
- func ParseIdentifier(identifier, prefix string) (uint64, error)
- func PortPath(portID string) string
- func SourceChainValidator(id string) error
- type ValidateFn
Constants ¶
const ( // ModuleName is the name of the IBC module ModuleName = "tibc" // StoreKey is the string store representation StoreKey string = ModuleName // QuerierRoute is the querier route for the IBC module QuerierRoute string = ModuleName // RouterKey is the msg router key for the IBC module RouterKey string = ModuleName )
const ( KeyClientState = "clientState" KeyConsensusStatePrefix = "consensusStates" KeyPortPrefix = "ports" KeySequencePrefix = "sequences" KeyNextSeqSendPrefix = "nextSequenceSend" KeyNextSeqRecvPrefix = "nextSequenceRecv" KeyNextSeqAckPrefix = "nextSequenceAck" KeyPacketCommitmentPrefix = "commitments" KeyPacketAckPrefix = "acks" KeyPacketReceiptPrefix = "receipts" KeyCleanPacketCommitmentPrefix = "cleans" )
KVStore key prefixes for IBC
const DefaultMaxCharacterLength = 64
DefaultMaxCharacterLength defines the default maximum character length used in validation of identifiers including the client, connection, port and channel identifiers.
NOTE: this restriction is specific to this golang implementation of IBC. If your use case demands a higher limit, please open an issue and we will consider adjusting this restriction.
const SubModuleName = "host"
SubModuleName defines the ICS 24 host
Variables ¶
var ( ErrInvalidID = sdkerrors.Register(moduleName, 2, "invalid identifier") ErrInvalidPath = sdkerrors.Register(moduleName, 3, "invalid path") ErrInvalidPacket = sdkerrors.Register(moduleName, 4, "invalid packet") )
IBC client sentinel errors
var IsValidID = regexp.MustCompile(`^[a-zA-Z0-9\.\_\+\-\#\[\]\<\>]+$`).MatchString
IsValidID defines regular expression to check if the string consist of characters in one of the following categories only: - Alphanumeric - `.`, `_`, `+`, `-`, `#` - `[`, `]`, `<`, `>`
var (
KeyClientStorePrefix = []byte("clients")
)
KVStore key prefixes for IBC
Functions ¶
func CleanPacketCommitmentKey ¶
CleanPacketCommitmentKey returns the store key of under which a clean packet commitment is stored
func CleanPacketCommitmentPath ¶
CleanPacketCommitmentPrefixPath defines the prefix for commitments to packet data fields store path.
func ClientIdentifierValidator ¶
ClientIdentifierValidator is the default validator function for Client identifiers. A valid Identifier must be between 9-64 characters and only contain alphanumeric and some allowed special characters (see IsValidID).
func ClientStateKey ¶
func ClientStateKey() []byte
ClientStateKey returns a store key under which a particular client state is stored in a client prefixed store
func ConnectionIdentifierValidator ¶
ConnectionIdentifierValidator is the default validator function for Connection identifiers. A valid Identifier must be between 10-64 characters and only contain alphanumeric and some allowed special characters (see IsValidID).
func ConsensusStateKey ¶
ConsensusStateKey returns the store key for a the consensus state of a particular client stored in a client prefixed store.
func ConsensusStatePath ¶
ConsensusStatePath returns the suffix store key for the consensus state at a particular height stored in a client prefixed store.
func DestChainValidator ¶
ChannelIdentifierValidator is the default validator function for Channel identifiers. A valid Identifier must be between 8-64 characters and only contain alphanumeric and some allowed special characters (see IsValidID).
func FullClientKey ¶
FullClientKey returns the full path of specific client path in the format: "clients/{chainName}/{path}" as a byte array.
func FullClientPath ¶
FullClientPath returns the full path of a specific client path in the format: "clients/{chainName}/{path}" as a string.
func FullClientStateKey ¶
FullClientStateKey takes a client identifier and returns a Key under which to store a particular client state.
func FullClientStatePath ¶
FullClientStatePath takes a client identifier and returns a Path under which to store a particular client state
func FullConsensusStateKey ¶
FullConsensusStateKey returns the store key for the consensus state of a particular client.
func FullConsensusStatePath ¶
FullConsensusStatePath takes a client identifier and returns a Path under which to store the consensus state of a client.
func NextSequenceSendKey ¶
NextSequenceSendKey returns the store key for the send sequence of a particular channel binded to a specific port.
func NextSequenceSendPath ¶
NextSequenceSendPath defines the next send sequence counter store path
func PacketAcknowledgementKey ¶
PacketAcknowledgementKey returns the store key of under which a packet acknowledgement is stored
func PacketAcknowledgementPath ¶
PacketAcknowledgementPath defines the packet acknowledgement store path
func PacketAcknowledgementPrefixPath ¶
PacketAcknowledgementPrefixPath defines the prefix for commitments to packet data fields store path.
func PacketCommitmentKey ¶
PacketCommitmentKey returns the store key of under which a packet commitment is stored
func PacketCommitmentPath ¶
PacketCommitmentPath defines the commitments to packet data fields store path
func PacketCommitmentPrefixPath ¶
PacketCommitmentPrefixPath defines the prefix for commitments to packet data fields store path.
func PacketReceiptKey ¶
PacketReceiptKey returns the store key of under which a packet receipt is stored
func PacketReceiptPath ¶
PacketReceiptPath defines the packet receipt store path
func PacketReceiptPrefixPath ¶
PacketReceiptKey returns the store key of under which a packet receipt is stored
func ParseChannelPath ¶
ParseChannelPath returns the port and channel ID from a full path. It returns an error if the provided path is invalid.
func ParseIdentifier ¶
ParseIdentifier parses the sequence from the identifier using the provided prefix. This function does not need to be used by counterparty chains. SDK generated connection and channel identifiers are required to use this format.
func PortPath ¶
PortPath defines the path under which ports paths are stored on the capability module
func SourceChainValidator ¶
SourceChainValidator is the default validator function for SourceChain name. A valid Identifier must be between 2-64 characters and only contain alphanumeric and some allowed special characters (see IsValidID).
Types ¶
type ValidateFn ¶
ValidateFn function type to validate path and identifier bytestrings
func NewPathValidator ¶
func NewPathValidator(idValidator ValidateFn) ValidateFn
NewPathValidator takes in a Identifier Validator function and returns a Path Validator function which requires path to consist of `/`-separated valid identifiers, where a valid identifier is between 1-64 characters, contains only alphanumeric and some allowed special characters (see IsValidID), and satisfies the custom `idValidator` function.