host

package
v0.0.0-...-7c30539 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	KeyChannelPrefix           = "channelEnds"
	KeyChannelCapabilityPrefix = "capabilities"
	KeyNextSeqSendPrefix       = "seqSends"
	KeyNextSeqRecvPrefix       = "seqRecvs"
	KeyNextSeqAckPrefix        = "seqAcks"
	KeyPacketCommitmentPrefix  = "commitments"
	KeyPacketAckPrefix         = "acks"
)

KVStore key prefixes for IBC

View Source
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.

View Source
const SubModuleName = "host"

SubModuleName defines the ICS 24 host

Variables

View Source
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

View Source
var (
	KeyClientStorePrefix = []byte("clients")
	KeyConnectionPrefix  = []byte("connections")
)

KVStore key prefixes for IBC

View Source
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

func ChannelCapabilityPath(portID, channelID string) string

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

func ChannelIdentifierValidator

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

func ChannelPath(portID, channelID string) string

ChannelPath defines the path under which channels are stored

func ClientConnectionsPath

func ClientConnectionsPath(clientID string) string

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

func ClientIdentifierValidator

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

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

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

func ConnectionPath(connectionID string) string

ConnectionPath defines the path under which connection paths are stored

func ConsensusStatePath

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

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

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

func GetChannelPortsKeysPrefix

func GetChannelPortsKeysPrefix(prefix int) []byte

GetChannelPortsKeysPrefix returns the prefix bytes for ICS04 and ICS05 iterators

func KeyChannel

func KeyChannel(portID, channelID string) []byte

KeyChannel returns the store key for a particular channel

func KeyClientConnections

func KeyClientConnections(clientID string) []byte

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

func KeyConnection(connectionID string) []byte

KeyConnection returns the store key for a particular connection

func KeyConsensusState

func KeyConsensusState(height uint64) []byte

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

func KeyNextSequenceAck

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

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

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

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

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

func KeyPacketCommitment

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

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

func KeyPrefixBytes

func KeyPrefixBytes(prefix int) []byte

KeyPrefixBytes return the key prefix bytes from a URL string format

func MustParseChannelPath

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

func MustParseConnectionPath(path string) string

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

func NextSequenceAckPath

func NextSequenceAckPath(portID, channelID string) string

NextSequenceAckPath defines the next acknowledgement sequence counter store path

func NextSequenceRecvPath

func NextSequenceRecvPath(portID, channelID string) string

NextSequenceRecvPath defines the next receive sequence counter store path

func NextSequenceSendPath

func NextSequenceSendPath(portID, channelID string) string

NextSequenceSendPath defines the next send sequence counter store path

func PacketAcknowledgementPath

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

PacketAcknowledgementPath defines the packet acknowledgement store path

func PacketCommitmentPath

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

PacketCommitmentPath defines the commitments to packet data fields store path

func PacketCommitmentPrefixPath

func PacketCommitmentPrefixPath(portID, channelID string) string

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

func ParseChannelPath

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

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

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

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

func PortPath(portID string) string

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

func RemovePath

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

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

Types

type ValidateFn

type ValidateFn func(string) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL