Skip to content

Commit

Permalink
improve createClient conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sangier committed Oct 8, 2024
1 parent c236761 commit 1bf8335
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spec/core/v2/ics-004-packet-semantics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,12 @@ The channel creation process establishes the communication pathway between two c

###### Conditions Table

| **Condition Type** | **Description** |
| **Condition Type** | **Description** | **Code Checks** |
|-------------------------------|-----------------------------------------------------------------------------------------------------|
| **Ante-Conditions** | - The clientId provided in input to createChannel MUST exist. |
| **Error-Conditions** | - Incorrect clientId.<br> - Unexpected keyPrefix format. |
| **Post-Conditions (Success)** | - A channel is set in store and it's accessible with key channelId.<br> - The creator is set in store and it's accessible with key [channelId, address]. |
| **Post-Conditions (Error)** | - If one payload fails, then all state changes happened on the successful application execution must be reverted.<br> - No packetCommitment has been generated.<br> - The sequence number bound to sourceId MUST be unchanged. |
| **ante-conditions** | - The used clientId exist. `createClient` has been called at least once. |
| **error-conditions** | - Incorrect clientId.<br> - Unexpected keyPrefix format.<br> - Invalid channelId .<br> | - `client==null`.<br> - `isFormatOk(counterpartyKeyPrefix)==False`.<br> - `validatedChannelIdentifier(channelId)==False`.<br> - `getChannel(channelId)!=null`.<br> |
| **post-conditions (success)** | - A channel is set in store and it's accessible with key channelId.<br> - The creator is set in store and it's accessible with key channelId.<br> - nextSequenceSend is initialized.<br> - client is stored in the router | - `storedChannel[channelId]!=null`.<br> - `channelCreator[channelId]!=null`.<br> - `router[channelId]!=null`.<br> - `nextSequenceSend[channelId]==1` |
| **post-conditions (error)** | - None of the post-conditions (success) is true.<br>| - `storedChannel[channelId]==null`.<br> - `channelCreator[channelId]==null`.<br> - `router[channelId]==null`.<br> - `nextSequenceSend[channelId]!=1|

###### Pseudo-Code

Expand Down Expand Up @@ -657,6 +657,15 @@ The IBC handler performs the following steps in order:
- Checks that an acknowledgement for this packet has not yet been written
- Sets the opaque acknowledgement value at a store path unique to the packet

###### Conditions Table

| **Condition Type** | **Description** |
|-------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| **Ante-Conditions** | - `receivePacket` has been called on chain `B`.<br> `onReceivePacket` application callback has been executed.|
| **Error-Conditions** | - acknowledgement is empty.<br> - The `packetAcknowledgementPath` stores already a value. |
| **Post-Conditions (Success)** | - The opaque acknowledgement has been written at `packetAcknowledgementPath`. |
| **Post-Conditions (Error)** | - No value is stored at the `packetAcknowledgementPath`. |

```typescript
function writeAcknowledgement(
packet: Packet,
Expand Down

0 comments on commit 1bf8335

Please sign in to comment.