ics | title | stage | category | kind | author | created | modified | requires | implements |
---|---|---|---|---|---|---|---|---|---|
9 |
Loopback Client |
draft |
IBC/TAO |
instantiation |
Christopher Goes <[email protected]> |
2020-01-17 |
2020-01-17 |
2 |
2 |
This specification describes a loop-back client, designed to be used for interaction over the IBC interface with modules present on the same ledger.
Loop-back clients may be useful in cases where the calling module does not have prior knowledge of where precisely the destination module lives and would like to use the uniform IBC message-passing interface (similar to 127.0.0.1
in TCP/IP).
Functions & terms are as defined in ICS 2.
Intended client semantics should be preserved, and loop-back abstractions should be negligible cost.
No client state, consensus state, headers, or evidence data structures are required for a loopback client.
type ClientState object
type ConsensusState object
type Header object
type Misbehaviour object
No initialisation is necessary for a loopback client; an empty state is returned.
function initialise(): ClientState {
return {}
}
No validity checking is necessary in a loopback client; the function should never be called.
function checkValidityAndUpdateState(
clientState: ClientState,
header: Header) {
assert(false)
}
No misbehaviour checking is necessary in a loopback client; the function should never be called.
function checkMisbehaviourAndUpdateState(
clientState: ClientState,
misbehaviour: Misbehaviour) {
return
}
Loop-back client state verification functions simply read the local state. Note that they will need (read-only) access to keys outside the client prefix.
function verifyClientConsensusState(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
clientIdentifier: Identifier,
consensusState: ConsensusState) {
path = applyPrefix(prefix, "consensusStates/{clientIdentifier}")
assert(get(path) === consensusState)
}
function verifyConnectionState(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
connectionIdentifier: Identifier,
connectionEnd: ConnectionEnd) {
path = applyPrefix(prefix, "connection/{connectionIdentifier}")
assert(get(path) === connectionEnd)
}
function verifyChannelState(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
channelEnd: ChannelEnd) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}")
assert(get(path) === channelEnd)
}
function verifyPacketData(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
sequence: uint64,
data: bytes) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}/packets/{sequence}")
assert(get(path) === commit(data))
}
function verifyPacketAcknowledgement(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
sequence: uint64,
acknowledgement: bytes) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}/acknowledgements/{sequence}")
assert(get(path) === acknowledgement)
}
function verifyPacketReceiptAbsence(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
sequence: uint64) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}/receipts/{sequence}")
assert(get(path) === nil)
}
function verifyNextSequenceRecv(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
nextSequenceRecv: uint64) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}/nextSequenceRecv")
assert(get(path) === nextSequenceRecv)
}
Semantics are as if this were a remote client of the local ledger.
Not applicable.
Not applicable. Alterations to the client algorithm will require a new client standard.
Coming soon.
None at present.
2020-01-17 - Initial version
All content herein is licensed under Apache 2.0.