@@ -57,7 +57,7 @@ function updateClient(
57
57
header : bytes ,
58
58
): error
59
59
60
- // once a client has been created, relayers can submit misbehaviour that proves the counterparty chain
60
+ // once a client has been created, relayers can submit misbehaviour that proves the counterparty chain violated the trust model.
61
61
// The light client must verify the misbehaviour using the trust model of the consensus mechanism
62
62
// and execute some custom logic such as freezing the client from accepting future updates and proof verification.
63
63
function submitMisbehaviour(
@@ -107,25 +107,25 @@ interface Counterparty {
107
107
}
108
108
109
109
function ProvideCounterparty(
110
- channelIdentifier : Identifier, // this will be our own client identifier representing our channel to desired chain
111
- counterpartyChannelIdentifier : Identifier, // this is the counterparty's identifier of our chain
110
+ clientIdentifier : Identifier, // this will be our own client identifier representing our channel to desired chain
111
+ counterpartyClientIdentifier : Identifier, // this is the counterparty's identifier of our chain
112
112
counterpartyKeyPrefix: CommitmentPrefix,
113
113
authentication: data, // implementation-specific authentication data
114
114
) {
115
115
assert(verify(authentication))
116
116
117
117
counterparty = Counterparty{
118
- channelId: counterpartyChannelIdentifier ,
118
+ clientId: counterpartyClientIdentifier ,
119
119
keyPrefix: counterpartyKeyPrefix
120
120
}
121
121
122
122
privateStore.set(counterpartyPath(channelIdentifier), counterparty)
123
123
}
124
124
125
125
// getCounterparty retrieves the stored counterparty identifier
126
- // given the channelIdentifier on our chain once it is provided
127
- function getCounterparty(channelIdentifier : Identifier): Counterparty {
128
- return privateStore.get(counterpartyPath(channelIdentifier ))
126
+ // given the clientIdentifier on our chain once it is provided
127
+ function getCounterparty(clientIdentifier : Identifier): Counterparty {
128
+ return privateStore.get(counterpartyPath(clientIdentifier ))
129
129
}
130
130
` ` `
131
131
@@ -192,7 +192,7 @@ function sendPacket(
192
192
193
193
// if the sequence doesn't already exist, this call initializes the sequence to 0
194
194
sequence = channelStore.get(nextSequenceSendPath(sourcePort, sourceChannel))
195
-
195
+
196
196
// store commitment to the packet data & packet timeout
197
197
channelStore.set(
198
198
packetCommitmentPath(sourcePort, sourceChannel, sequence),
@@ -245,7 +245,7 @@ function recvPacket(
245
245
assert(packet.timeoutHeight === 0 || getConsensusHeight() < packet.timeoutHeight)
246
246
assert(packet.timeoutTimestamp === 0 || currentTimestamp() < packet.timeoutTimestamp)
247
247
248
-
248
+
249
249
// we must set the receipt so it can be verified on the other side
250
250
// this receipt does not contain any data, since the packet has not yet been processed
251
251
// it's the sentinel success receipt: []byte{0x01}
@@ -274,7 +274,7 @@ function recvPacket(
274
274
cbs = router.callbacks[packet.destPort]
275
275
// IMPORTANT: if the ack is error, then the callback reverts its internal state changes, but the entire tx continues
276
276
ack = cbs.OnRecvPacket(packet, relayer)
277
-
277
+
278
278
if ack != nil {
279
279
channelStore.set(packetAcknowledgementPath(packet.destPort, packet.destChannel, packet.sequence), ack)
280
280
}
@@ -294,7 +294,7 @@ function acknowledgePacket(
294
294
// assert dest channel is sourceChannel's counterparty channel identifier
295
295
counterparty = getCounterparty(packet.destChannel)
296
296
assert(packet.sourceChannel == counterparty.channelId)
297
-
297
+
298
298
// assert dest port is sourcePort's counterparty port identifier
299
299
assert(packet.destPort == ports[packet.sourcePort])
300
300
@@ -331,7 +331,7 @@ function timeoutPacket(
331
331
// assert dest channel is sourceChannel's counterparty channel identifier
332
332
counterparty = getCounterparty(packet.destChannel)
333
333
assert(packet.sourceChannel == counterparty.channelId)
334
-
334
+
335
335
// assert dest port is sourcePort's counterparty port identifier
336
336
assert(packet.destPort == ports[packet.sourcePort])
337
337
@@ -381,12 +381,12 @@ Similarly, for packet flow messages sent to the sender (AcknowledgePacket, Timeo
381
381
382
382
Claim : If the clients are setup correctly , then a chain cannot mistake a packet flow message intended for a different chain as a valid message from a valid counterparty .
383
383
384
- We must note that client identifiers are unique to each chain but are not globally unique . Let us first consider a user that correctly specifies the source and destination identifiers in the packet .
384
+ We must note that client identifiers are unique to each chain but are not globally unique . Let us first consider a user that correctly specifies the source and destination identifiers in the packet .
385
385
386
386
We wish to ensure that well - formed packets (i .e . packets with correctly setup client ids ) cannot have packet flow messages succeed on third - party chains . Ill - formed packets (i .e . packets with invalid client ids ) may in some cases complete in invalid states ; however we must ensure that any completed state from these packets cannot mix with the state of other valid packets .
387
387
388
388
We are guaranteed that the source identifier is unique on the source chain , the destination identifier is unique on the destination chain . Additionally , the destination identifier points to a valid client of the source chain , and the source identifier points to a valid client of the destination chain .
389
389
390
- Suppose the RecvPacket is sent to a chain other than the one identified by the sourceClient on the source chain .
390
+ Suppose the RecvPacket is sent to a chain other than the one identified by the sourceClient on the source chain .
391
391
392
392
In the packet flow messages sent to the receiver (RecvPacket), the packet send is verified using the client on the destination chain (retrieved using destination identifier) with the packet commitment path derived by the source identifier. This verification check can only pass if the chain identified by the destination client committed the packet we received under the source channel identifier. This is only possible if the destination client is pointing to the original source chain, or if it is pointing to a different chain that committed the exact same packet. Pointing to the original source chain would mean we sent the packet to the correct . Since the sender only sends packets intended for the destination chain by setting to a unique source identifier, we can be sure the packet was indeed intended for us. Since our client on the receiver is also correctly pointing to the sender chain, we are verifying the proof against a specific consensus algorithm that we assume to be honest. If the packet is committed to the wrong key path, then we will not accept the packet. Similarly, if the packet is committed by the wrong chain then we will not be able to verify correctly.
0 commit comments