Documentation ¶
Overview ¶
24-host is an implementation of ICS 24.
The storage path supported are defined in ICS 24 (https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements#path-space).
Hostname validation is implemented as defined in ICS 24 (https://github.com/cosmos/ibc/tree/master/spec/core/ics-024-host-requirements).
Index ¶
- Constants
- Variables
- func ChannelCapabilityPath(portID, channelID string) string
- func ChannelCounterpartyUpgradeKey(portID, channelID string) []byte
- func ChannelCounterpartyUpgradePath(portID, channelID string) string
- func ChannelIdentifierValidator(id string) error
- func ChannelKey(portID, channelID string) []byte
- func ChannelPath(portID, channelID string) string
- func ChannelUpgradeErrorKey(portID, channelID string) []byte
- func ChannelUpgradeErrorPath(portID, channelID string) string
- func ChannelUpgradeKey(portID, channelID string) []byte
- func ChannelUpgradePath(portID, channelID string) string
- func ClientConnectionsKey(clientID string) []byte
- func ClientConnectionsPath(clientID string) string
- func ClientIdentifierValidator(id string) error
- func ClientStateKey() []byte
- func ConnectionIdentifierValidator(id string) error
- func ConnectionKey(connectionID string) []byte
- func ConnectionPath(connectionID string) string
- func ConsensusStateKey(height exported.Height) []byte
- func ConsensusStatePath(height exported.Height) string
- func FullClientKey(clientID string, path []byte) []byte
- func FullClientPath(clientID string, path string) string
- func FullClientStateKey(clientID string) []byte
- func FullClientStatePath(clientID string) string
- func FullConsensusStateKey(clientID string, height exported.Height) []byte
- func FullConsensusStatePath(clientID string, height exported.Height) string
- func MustParseChannelPath(path string) (string, string)
- func MustParseClientStatePath(path string) string
- func MustParseConnectionPath(path string) string
- func NextSequenceAckKey(portID, channelID string) []byte
- func NextSequenceAckPath(portID, channelID string) string
- func NextSequenceRecvKey(portID, channelID string) []byte
- func NextSequenceRecvPath(portID, channelID string) string
- func NextSequenceSendKey(portID, channelID string) []byte
- func NextSequenceSendPath(portID, channelID string) string
- func PacketAcknowledgementKey(portID, channelID string, sequence uint64) []byte
- func PacketAcknowledgementPath(portID, channelID string, sequence uint64) string
- func PacketAcknowledgementPrefixPath(portID, channelID string) string
- func PacketCommitmentKey(portID, channelID string, sequence uint64) []byte
- func PacketCommitmentPath(portID, channelID string, sequence uint64) string
- func PacketCommitmentPrefixPath(portID, channelID string) string
- func PacketReceiptKey(portID, channelID string, sequence uint64) []byte
- func PacketReceiptPath(portID, channelID string, sequence uint64) string
- func ParseChannelPath(path string) (string, string, error)
- func ParseConnectionPath(path string) (string, error)
- func ParseIdentifier(identifier, prefix string) (uint64, error)
- func PortIdentifierValidator(id string) error
- func PortPath(portID string) string
- func PrefixedClientStoreKey(prefix []byte) []byte
- func PrefixedClientStorePath(prefix []byte) string
- func PruningSequenceStartKey(portID, channelID string) []byte
- func PruningSequenceStartPath(portID, channelID string) string
- func RecvStartSequenceKey(portID, channelID string) []byte
- func RecvStartSequencePath(portID, channelID string) string
- type ValidateFn
Constants ¶
const ( KeyChannelEndPrefix = "channelEnds" KeyChannelPrefix = "channels" KeyChannelUpgradePrefix = "channelUpgrades" KeyUpgradePrefix = "upgrades" KeyUpgradeErrorPrefix = "upgradeError" KeyCounterpartyUpgrade = "counterpartyUpgrade" KeyChannelCapabilityPrefix = "capabilities" )
const ( KeyClientState = "clientState" KeyConsensusStatePrefix = "consensusStates" )
const ( KeySequencePrefix = "sequences" KeyNextSeqSendPrefix = "nextSequenceSend" KeyNextSeqRecvPrefix = "nextSequenceRecv" KeyNextSeqAckPrefix = "nextSequenceAck" KeyPacketCommitmentPrefix = "commitments" KeyPacketAckPrefix = "acks" KeyPacketReceiptPrefix = "receipts" KeyPruningSequenceStart = "pruningSequenceStart" KeyRecvStartSequence = "recvStartSequence" )
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 KeyConnectionPrefix = "connections"
const (
KeyPortPrefix = "ports"
)
const SubModuleName = "host"
SubModuleName defines the ICS 24 host
Variables ¶
var ( ErrInvalidID = errorsmod.Register(SubModuleName, 2, "invalid identifier") ErrInvalidPath = errorsmod.Register(SubModuleName, 3, "invalid path") ErrInvalidPacket = errorsmod.Register(SubModuleName, 4, "invalid packet") )
IBC client sentinel errors
var DefaultMaxPortCharacterLength = 128
DefaultMaxPortCharacterLength defines the default maximum character length used in validation of port identifiers.
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")
KeyClientStorePrefix defines the KVStore key prefix for IBC clients
Functions ¶
func ChannelCapabilityPath ¶
ChannelCapabilityPath defines the path under which capability keys associated with a channel are stored
func ChannelCounterpartyUpgradeKey ¶ added in v8.1.0
ChannelCounterpartyUpgradeKey returns the store key for the upgrade used on the counterparty channel.
func ChannelCounterpartyUpgradePath ¶ added in v8.1.0
ChannelCounterpartyUpgradePath defines the path under which the upgrade used on the counterparty channel is stored.
func ChannelIdentifierValidator ¶
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 ChannelKey ¶
ChannelKey returns the store key for a particular channel
func ChannelPath ¶
ChannelPath defines the path under which channels are stored
func ChannelUpgradeErrorKey ¶ added in v8.1.0
ChannelUpgradeErrorKey returns the store key for a particular channelEnd used to stor the ErrorReceipt in the case that a chain does not accept the proposed upgrade
func ChannelUpgradeErrorPath ¶ added in v8.1.0
ChannelUpgradeErrorPath defines the path under which the ErrorReceipt is stored in the case that a chain does not accept the proposed upgrade
func ChannelUpgradeKey ¶ added in v8.1.0
ChannelUpgradeKey returns the store key for a particular channel upgrade attempt
func ChannelUpgradePath ¶ added in v8.1.0
ChannelUpgradePath defines the path which stores the information related to an upgrade attempt
func ClientConnectionsKey ¶
ClientConnectionsKey returns the store key for the connections of a given client
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-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 ConnectionKey ¶
ConnectionKey returns the store key for a particular connection
func ConnectionPath ¶
ConnectionPath defines the path under which connection paths are stored
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 FullClientKey ¶
FullClientKey returns the full path of specific client path in the format: "clients/{clientID}/{path}" as a byte array.
func FullClientPath ¶
FullClientPath returns the full path of a specific client path in the format: "clients/{clientID}/{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 MustParseChannelPath ¶
MustParseChannelPath returns the port and channel ID from a full path. Panics if the provided path is invalid.
func MustParseClientStatePath ¶
MustParseClientStatePath returns the client ID from a client state path. It panics if the provided path is invalid or if the clientID is empty.
func MustParseConnectionPath ¶
MustParseConnectionPath returns the connection ID from a full path. Panics if the provided path is invalid.
func NextSequenceAckKey ¶
NextSequenceAckKey returns the store key for the acknowledgement sequence of a particular channel binded to a specific port.
func NextSequenceAckPath ¶
NextSequenceAckPath defines the next acknowledgement sequence counter store path
func NextSequenceRecvKey ¶
NextSequenceRecvKey returns the store key for the receive sequence of a particular channel binded to a specific port
func NextSequenceRecvPath ¶
NextSequenceRecvPath defines the next receive sequence counter store path.
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 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 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 PortIdentifierValidator ¶
PortIdentifierValidator is the default validator function for Port identifiers. A valid Identifier must be between 2-64 characters and only contain alphanumeric and some allowed special characters (see IsValidID).
func PortPath ¶
PortPath defines the path under which ports paths are stored on the capability module
func PrefixedClientStoreKey ¶
PrefixedClientStoreKey returns a key which can be used for prefixed key store iteration. The prefix may be a clientType, clientID, or any valid key prefix which may be concatenated with the client store constant.
func PrefixedClientStorePath ¶
PrefixedClientStorePath returns a key path which can be used for prefixed key store iteration. The prefix may be a clientType, clientID, or any valid key prefix which may be concatenated with the client store constant.
func PruningSequenceStartKey ¶ added in v8.1.0
PruningSequenceStartKey returns the store key for the pruning sequence start of a particular channel
func PruningSequenceStartPath ¶ added in v8.1.0
PruningSequenceStartPath defines the path under which the pruning sequence starting value is stored
func RecvStartSequenceKey ¶ added in v8.1.0
RecvStartSequenceKey returns the store key for the recv start sequence of a particular channel
func RecvStartSequencePath ¶ added in v8.1.0
RecvStartSequencePath defines the path under which the recv start sequence is stored
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.