cosmos-sdk: github.com/cosmos/cosmos-sdk/x/ibc/24-host Index | Files

package host

import "github.com/cosmos/cosmos-sdk/x/ibc/24-host"

Index

Package Files

errors.go keys.go parse.go validate.go

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 - `.`, `_`, `+`, `-`, `#` - `[`, `]`, `<`, `>`

func ChannelCapabilityPath Uses

func ChannelCapabilityPath(portID, channelID string) string

ChannelCapabilityPath defines the path under which capability keys associated with a channel are stored

func ChannelIdentifierValidator Uses

func ChannelIdentifierValidator(id string) error

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 Uses

func ChannelPath(portID, channelID string) string

ChannelPath defines the path under which channels are stored

func ClientConnectionsPath Uses

func ClientConnectionsPath(clientID string) string

ClientConnectionsPath defines a reverse mapping from clients to a set of connections

func ClientIdentifierValidator Uses

func ClientIdentifierValidator(id string) error

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 Uses

func ClientStatePath() string

ClientStatePath takes an Identifier and returns a Path under which to store a particular client state

func ClientTypePath Uses

func ClientTypePath() string

ClientTypePath takes an Identifier and returns Path under which to store the type of a particular client.

func ConnectionIdentifierValidator Uses

func ConnectionIdentifierValidator(id string) error

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 Uses

func ConnectionPath(connectionID string) string

ConnectionPath defines the path under which connection paths are stored

func ConsensusStatePath Uses

func ConsensusStatePath(height uint64) string

ConsensusStatePath takes an Identifier and returns a Path under which to store the consensus state of a client.

func FullKeyClientPath Uses

func FullKeyClientPath(clientID string, path []byte) []byte

FullKeyClientPath returns the full path of specific client path in the format: "clients/{clientID}/{path}".

func GetChannelPortsKeysPrefix Uses

func GetChannelPortsKeysPrefix(prefix int) []byte

GetChannelPortsKeysPrefix returns the prefix bytes for ICS04 and ICS05 iterators

func KeyChannel Uses

func KeyChannel(portID, channelID string) []byte

KeyChannel returns the store key for a particular channel

func KeyClientConnections Uses

func KeyClientConnections(clientID string) []byte

KeyClientConnections returns the store key for the connectios of a given client

func KeyClientState Uses

func KeyClientState() []byte

KeyClientState returns the store key for a particular client state

func KeyClientType Uses

func KeyClientType() []byte

KeyClientType returns the store key for type of a particular client

func KeyConnection Uses

func KeyConnection(connectionID string) []byte

KeyConnection returns the store key for a particular connection

func KeyConsensusState Uses

func KeyConsensusState(height uint64) []byte

KeyConsensusState returns the store key for the consensus state of a particular client

func KeyNextSequenceAck Uses

func KeyNextSequenceAck(portID, channelID string) []byte

KeyNextSequenceAck returns the store key for the acknowledgement sequence of a particular channel binded to a specific port.

func KeyNextSequenceRecv Uses

func KeyNextSequenceRecv(portID, channelID string) []byte

KeyNextSequenceRecv returns the store key for the receive sequence of a particular channel binded to a specific port

func KeyNextSequenceSend Uses

func KeyNextSequenceSend(portID, channelID string) []byte

KeyNextSequenceSend returns the store key for the send sequence of a particular channel binded to a specific port

func KeyPacketAcknowledgement Uses

func KeyPacketAcknowledgement(portID, channelID string, sequence uint64) []byte

KeyPacketAcknowledgement returns the store key of under which a packet acknowledgement is stored

func KeyPacketCommitment Uses

func KeyPacketCommitment(portID, channelID string, sequence uint64) []byte

KeyPacketCommitment returns the store key of under which a packet commitment is stored

func KeyPrefixBytes Uses

func KeyPrefixBytes(prefix int) []byte

KeyPrefixBytes return the key prefix bytes from a URL string format

func MustParseChannelPath Uses

func MustParseChannelPath(path string) (string, string)

MustParseChannelPath returns the port and channel ID from a full path. Panics if the provided path is invalid

func MustParseConnectionPath Uses

func MustParseConnectionPath(path string) string

MustParseConnectionPath returns the connection ID from a full path. Panics if the provided path is invalid

func NextSequenceAckPath Uses

func NextSequenceAckPath(portID, channelID string) string

NextSequenceAckPath defines the next acknowledgement sequence counter store path

func NextSequenceRecvPath Uses

func NextSequenceRecvPath(portID, channelID string) string

NextSequenceRecvPath defines the next receive sequence counter store path

func NextSequenceSendPath Uses

func NextSequenceSendPath(portID, channelID string) string

NextSequenceSendPath defines the next send sequence counter store path

func PacketAcknowledgementPath Uses

func PacketAcknowledgementPath(portID, channelID string, sequence uint64) string

PacketAcknowledgementPath defines the packet acknowledgement store path

func PacketCommitmentPath Uses

func PacketCommitmentPath(portID, channelID string, sequence uint64) string

PacketCommitmentPath defines the commitments to packet data fields store path

func PacketCommitmentPrefixPath Uses

func PacketCommitmentPrefixPath(portID, channelID string) string

PacketCommitmentPrefixPath defines the prefix for commitments to packet data fields store path.

func ParseChannelPath Uses

func ParseChannelPath(path string) (string, string, error)

ParseChannelPath returns the port and channel ID from a full path. It returns an error if the provided path is invalid,

func ParseConnectionPath Uses

func ParseConnectionPath(path string) (string, error)

ParseConnectionPath returns the connection ID from a full path. It returns an error if the provided path is invalid,

func PathValidator Uses

func PathValidator(path string) error

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 Uses

func PortIdentifierValidator(id string) error

PortIdentifierValidator is the default validator function for Port identifiers. A valid Identifier must be between 2-20 characters and only contain lowercase alphabetic characters,

func PortPath Uses

func PortPath(portID string) string

PortPath defines the path under which ports paths are stored on the capability module

func RemovePath Uses

func RemovePath(paths []string, path string) ([]string, bool)

RemovePath is an util function to remove a path from a set.

type ValidateFn Uses

type ValidateFn func(string) error

ValidateFn function type to validate path and identifier bytestrings

func NewPathValidator Uses

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

Package host imports 4 packages (graph) and is imported by 28 packages. Updated 2020-07-28. Refresh now. Tools for package owners.