-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update paths for consistency; revise ICS 2 for client type sub-specs #348
Conversation
@cwgoes any chance we could switch the channel paths from |
Hmm, we could, doesn't it seem a bit confusing though (since channel identifiers are unique "per-port")? What query do you want to run that requires contiguous keys? |
For consensus state heights, we need to pick a height at which to check that the counterparty chain has the correct consensus state. I think we should say that this must be the height at which we started the handshake, so that means we'll need to keep it in state (temporarily). That seems safest though. |
I wonder if client types should also define an |
Also, the spec should define what a loopback client implementation looks like. |
Split to #352. |
How to correctly sub-space with non-uniformly-prefixed keys? @fedekunze Do you know if the SDK has a substore wrapper which can limit read/write to specific keys (instead of just a prefix)? We want to limit client type instances to reading/writing only keys belonging to them, but we altered the layout like you mentioned so that keys for a given client don't have a uniform prefix (this makes for easier iteration, I suppose). |
|
Confirmed per discussion that we don't need this. |
For now I am going to update the paths so that everything is prefixed under |
This PR really makes me want a type-checked spec... |
| provableStore | "clients/{identifier}/type" | ClientType | [ICS 2](../ics-002-client-semantics) | | ||
| privateStore | "clients/{identifier}" | ClientState | [ICS 2](../ics-007-tendermint-client) | | ||
| provableStore | "clients/{identifier}/consensusStates/{height}" | ConsensusState | [ICS 7](../ics-007-tendermint-client) | | ||
| privateStore | "clients/{identifier}/connections | []Identifier | [ICS 3](../ics-003-connection-semantics) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this path for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's used for reverse lookup of what connections are using a client.
} | ||
``` | ||
Client consensus state and client internal state can be queried by identifier, but | ||
the specific paths which must be queried are defined by each client type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the specific paths which must be queried are defined by each client type.
why is this now defined per client? All clients need to still be able to query the consensus and client states
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client state, yes, but the consensus state, not necessarily, e.g. for a solo machine there is not a consensus state stored for each height. Client types can be required to expose queryConsensusState
I suppose - is this required? The relayer should use a client-type-agnostic method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The client state, yes, but the consensus state, not necessarily, e.g. for a solo machine there is not a consensus state stored for each height. Client types can be required to expose queryConsensusState I suppose...
👍 It'd be awesome if we could define a standard interface for all clients with the functions that they need to implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, agreed. I'll add that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With regards to a standard interface, I completely agree, but the only parts of that I can reliably guess are those which will be required by relayers (querying clients), so if you want additional functions for convenience or CLI UX, let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defined a few interfaces for clients in cosmos/cosmos-sdk#5485
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I think I'll split that out to a separate issue & we can discuss first. #356
Client types MUST define a method to fetch the current height (height of the most recent validated header). | ||
|
||
```typescript | ||
type latestHeight = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was confusing for me at least in the beginning. The naming of the third-party client consensus state vs the self consensus state was not clear. So whenever it said getConsensusState(height)
it meant self consensus state (i.e block header and validator info), while the getConsensusState(clientID, height)
meant the counterparty client.
I'd suggest adding the client
or self
prefix to the ConsensusState
to clarify this item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type latestHeight = ( | |
type latestClientHeight = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or, alternatively clientState.latestHeight()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, that makes sense, I'll change the client function name to getClientConsensusState
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I can't find any uses of getConsensusState
now which take a clientID
and height
. Can you point to a specific location which is confusing?
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Closes #345
Closes #346