Documentation ¶
Index ¶
- Constants
- Variables
- func ChannelCapabilityPath(portID, channelID string) string
- func ChannelIdentifierValidator(id string) error
- func ChannelPath(portID, channelID string) string
- func ClientConnectionsPath(clientID string) string
- func ClientIdentifierValidator(id string) error
- func ClientStatePath() string
- func ClientTypePath() string
- func ConnectionIdentifierValidator(id string) error
- func ConnectionPath(connectionID string) string
- func ConsensusStatePath(height uint64) string
- func FullKeyClientPath(clientID string, path []byte) []byte
- func GetChannelPortsKeysPrefix(prefix int) []byte
- func KeyChannel(portID, channelID string) []byte
- func KeyClientConnections(clientID string) []byte
- func KeyClientState() []byte
- func KeyClientType() []byte
- func KeyConnection(connectionID string) []byte
- func KeyConsensusState(height uint64) []byte
- func KeyNextSequenceAck(portID, channelID string) []byte
- func KeyNextSequenceRecv(portID, channelID string) []byte
- func KeyNextSequenceSend(portID, channelID string) []byte
- func KeyPacketAcknowledgement(portID, channelID string, sequence uint64) []byte
- func KeyPacketCommitment(portID, channelID string, sequence uint64) []byte
- func KeyPrefixBytes(prefix int) []byte
- func MustParseChannelPath(path string) (string, string)
- func MustParseConnectionPath(path string) string
- func NextSequenceAckPath(portID, channelID string) string
- func NextSequenceRecvPath(portID, channelID string) string
- func NextSequenceSendPath(portID, channelID string) string
- func PacketAcknowledgementPath(portID, channelID string, sequence uint64) string
- func PacketCommitmentPath(portID, channelID string, sequence uint64) string
- func PacketCommitmentPrefixPath(portID, channelID string) string
- func ParseChannelPath(path string) (string, string, error)
- func ParseConnectionPath(path string) (string, error)
- func PathValidator(path string) error
- func PortIdentifierValidator(id string) error
- func PortPath(portID string) string
- func RemovePath(paths []string, path string) ([]string, bool)
- type ValidateFn
Constants ¶
const ( // ModuleName is the name of the IBC module ModuleName = "ibc" // 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 ( KeyChannelPrefix = "channelEnds" KeyChannelCapabilityPrefix = "capabilities" KeyNextSeqSendPrefix = "seqSends" KeyNextSeqRecvPrefix = "seqRecvs" KeyNextSeqAckPrefix = "seqAcks" KeyPacketCommitmentPrefix = "commitments" KeyPacketAckPrefix = "acks" )
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(SubModuleName, 2, "invalid identifier") ErrInvalidPath = sdkerrors.Register(SubModuleName, 3, "invalid path") ErrInvalidPacket = sdkerrors.Register(SubModuleName, 4, "invalid packet") ErrInvalidVersion = sdkerrors.Register(SubModuleName, 5, "invalid version") )
IBC client sentinel errors
var ( KeyClientStorePrefix = []byte("clients") KeyConnectionPrefix = []byte("connections") )
KVStore key prefixes for IBC
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 - `.`, `_`, `+`, `-`, `#` - `[`, `]`, `<`, `>`
Functions ¶
func ChannelCapabilityPath ¶
ChannelCapabilityPath defines the path under which capability keys associated with a channel are stored
func ChannelIdentifierValidator ¶
ChannelIdentifierValidator is the default validator function for Channel identifiers. A valid Identifier must be between 10-20 characters and only contain lowercase alphabetic characters,
func ChannelPath ¶
ChannelPath defines the path under which channels are stored
func ClientConnectionsPath ¶
ClientConnectionsPath defines a reverse mapping from clients to a set of connections
func ClientIdentifierValidator ¶
ClientIdentifierValidator is the default validator function for Client identifiers. A valid Identifier must be between 9-20 characters and only contain lowercase alphabetic characters,
func ClientStatePath ¶
func ClientStatePath() string
ClientStatePath takes an Identifier and returns a Path under which to store a particular client state
func ClientTypePath ¶
func ClientTypePath() string
ClientTypePath takes an Identifier and returns Path under which to store the type of a particular client.
func ConnectionIdentifierValidator ¶
ConnectionIdentifierValidator is the default validator function for Connection identifiers. A valid Identifier must be between 10-20 characters and only contain lowercase alphabetic characters,
func ConnectionPath ¶
ConnectionPath defines the path under which connection paths are stored
func ConsensusStatePath ¶
ConsensusStatePath takes an Identifier and returns a Path under which to store the consensus state of a client.
func FullKeyClientPath ¶
FullKeyClientPath returns the full path of specific client path in the format: "clients/{clientID}/{path}".
func GetChannelPortsKeysPrefix ¶
GetChannelPortsKeysPrefix returns the prefix bytes for ICS04 and ICS05 iterators
func KeyChannel ¶
KeyChannel returns the store key for a particular channel
func KeyClientConnections ¶
KeyClientConnections returns the store key for the connectios of a given client
func KeyClientState ¶
func KeyClientState() []byte
KeyClientState returns the store key for a particular client state
func KeyClientType ¶
func KeyClientType() []byte
KeyClientType returns the store key for type of a particular client
func KeyConnection ¶
KeyConnection returns the store key for a particular connection
func KeyConsensusState ¶
KeyConsensusState returns the store key for the consensus state of a particular client
func KeyNextSequenceAck ¶
KeyNextSequenceAck returns the store key for the acknowledgement sequence of a particular channel binded to a specific port.
func KeyNextSequenceRecv ¶
KeyNextSequenceRecv returns the store key for the receive sequence of a particular channel binded to a specific port
func KeyNextSequenceSend ¶
KeyNextSequenceSend returns the store key for the send sequence of a particular channel binded to a specific port
func KeyPacketAcknowledgement ¶
KeyPacketAcknowledgement returns the store key of under which a packet acknowledgement is stored
func KeyPacketCommitment ¶
KeyPacketCommitment returns the store key of under which a packet commitment is stored
func KeyPrefixBytes ¶
KeyPrefixBytes return the key prefix bytes from a URL string format
func MustParseChannelPath ¶
MustParseChannelPath returns the port and channel ID from a full path. Panics if the provided path is invalid
func MustParseConnectionPath ¶
MustParseConnectionPath returns the connection ID from a full path. Panics if the provided path is invalid
func NextSequenceAckPath ¶
NextSequenceAckPath defines the next acknowledgement sequence counter store path
func NextSequenceRecvPath ¶
NextSequenceRecvPath defines the next receive sequence counter store path
func NextSequenceSendPath ¶
NextSequenceSendPath defines the next send sequence counter store path
func PacketAcknowledgementPath ¶
PacketAcknowledgementPath defines the packet acknowledgement store path
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 ParseChannelPath ¶
ParseChannelPath returns the port and channel ID from a full path. It returns an error if the provided path is invalid,
func ParseConnectionPath ¶
ParseConnectionPath returns the connection ID from a full path. It returns an error if the provided path is invalid,
func PathValidator ¶
PathValidator takes in path string and validates with default identifier rules. This is optimized by simply checking that all path elements are alphanumeric.
func PortIdentifierValidator ¶
PortIdentifierValidator is the default validator function for Port identifiers. A valid Identifier must be between 2-20 characters and only contain lowercase alphabetic characters,
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 only has valid identifiers alphanumeric character strings, and "/" separators