Skip to content

Conversation

@sangier
Copy link
Contributor

@sangier sangier commented Dec 13, 2023

Closes: #555

Add:

  • Status function (in helper function section) to retrieve the client status
  • Check that client is active in sendPacket
Copy link
Contributor

@crodriguezvega crodriguezvega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @sangier. I think you could add the Status function to ICS 02, together with the other functions defined for client state (e.g. verifyClientMessage, updateState, etc).

Comment on lines 710 to 727
// Returns the status of a client given its store.
function Status (client: clientState) {
if (client.FrozenHeight !== 0) {
return Frozen
}
// Get latest consensus state from clientStore to check for expiry
consState, err := client.latestClientHeight()
if err (!== nil) {
return Unknown
}
// Check if Expired
let expirationTime := consState.Timestamp + client.TrustingPeriod
if (expirationTime <== now){
return Expired
}

return Active
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this implementation of Status is specific to Tendermint, I think I would move it to ICS 07.

connection = provableStore.get(connectionPath(channel.connectionHops[0]))
abortTransactionUnless(connection !== null)

client = provableStore.get(clientStatePath(connection.clientIdenfier))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could do here clientState = queryClientState(connection.clientIdenfier) (queryClientState is defined in ICS 02)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha, thank you @crodriguezvega! Please, verify if the latest commit c1637a9 address all of your comments.

The function is defined as:

```typescript
type Status = (Client) => Void
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHouldn't the return value not be Void? Since it is returning a status

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, definitively should not be void. @AdityaSripal would be correct to return bytes or shall we define a type Status = bytes in the Data Structure section and return Status itself?


### Retrieve client status

Return the status of the wasm client. Status can be either `Active`, `Expired`, `Unknown` or `Frozen`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the Unknown status for the wasm-client? Where it is used?


#### Retrieve client status

Status is an opaque function defined by a client type to retrieve the current clientState. Status can be either `Active`, `Expired`, `Unknown` or `Frozen`.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here, If Unknown status is not needed in the wasm-client we can remove it from client-semantics too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants