Skip to content

Latest commit

 

History

History
196 lines (149 loc) · 4.88 KB

README.md

File metadata and controls

196 lines (149 loc) · 4.88 KB
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

Synopsis

This specification describes a loop-back client, designed to be used for interaction over the IBC interface with modules present on the same ledger.

Motivation

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).

Definitions

Functions & terms are as defined in ICS 2.

Desired Properties

Intended client semantics should be preserved, and loop-back abstractions should be negligible cost.

Technical Specification

Data structures

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

Client initialisation

No initialisation is necessary for a loopback client; an empty state is returned.

function initialise(): ClientState {
  return {}
}

Validity predicate

No validity checking is necessary in a loopback client; the function should never be called.

function checkValidityAndUpdateState(
  clientState: ClientState,
  header: Header) {
    assert(false)
}

Misbehaviour predicate

No misbehaviour checking is necessary in a loopback client; the function should never be called.

function checkMisbehaviourAndUpdateState(
  clientState: ClientState,
  misbehaviour: Misbehaviour) {
    return
}

State verification functions

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)
}

Properties & Invariants

Semantics are as if this were a remote client of the local ledger.

Backwards Compatibility

Not applicable.

Forwards Compatibility

Not applicable. Alterations to the client algorithm will require a new client standard.

Example Implementation

Coming soon.

Other Implementations

None at present.

History

2020-01-17 - Initial version

Copyright

All content herein is licensed under Apache 2.0.