ics | title | stage | category | kind | author | created | modified | requires | implements |
---|---|---|---|---|---|---|---|---|---|
9 |
回环客户端 |
草案 |
IBC/TAO |
实例化 |
Christopher Goes <[email protected]> |
2020-01-17 |
2020-01-17 |
2 |
2 |
本规范描述了一种回环客户端,该客户端旨在通过 IBC 接口与同一帐本中存在的模块进行交互。
如果调用模块不了解目标模块的确切位置,并且希望使用统一的 IBC 消息传递接口(类似于 TCP/IP 中的 127.0.0.1
),则回环客户端可能会派上用场。
函数和术语定义见 ICS 2。
应保留预期的客户端语义,而且回环抽象的成本应可忽略不计。
回环客户端不需要客户端状态、共识状态、区块头或证据数据结构。
type ClientState object
type ConsensusState object
type Header object
type Evidence object
回环客户端不需要初始化。将返回一个空状态。
function initialise(): ClientState {
return {}
}
在回环客户端中,无需进行合法性检查;该函数永远不应该被调用。
function checkValidityAndUpdateState(
clientState: ClientState,
header: Header) {
assert(false)
}
在回环客户端中无需进行任何不良行为检查;该函数永远不应该被调用。
function checkMisbehaviourAndUpdateState(
clientState: ClientState,
evidence: Evidence) {
return
}
回环客户端状态验证函数仅读取本地状态。请注意,他们将需要(只读)访问客户端前缀之外的键。
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 verifyPacketAcknowledgementAbsence(
clientState: ClientState,
height: uint64,
prefix: CommitmentPrefix,
proof: CommitmentProof,
portIdentifier: Identifier,
channelIdentifier: Identifier,
sequence: uint64) {
path = applyPrefix(prefix, "ports/{portIdentifier}/channels/{channelIdentifier}/acknowledgements/{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)
}
语义上类似一个本地帐本的远程客户端。
不适用。
不适用。更改客户端算法将需要新的客户端标准。
即将到来。
目前暂无。
2020-01-17-初始版本
本规范所有内容均采用 Apache 2.0 许可授权。