Skip to content
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

Merged
merged 14 commits into from
Jan 22, 2020

Conversation

cwgoes
Copy link
Contributor

@cwgoes cwgoes commented Jan 9, 2020

Closes #345
Closes #346

@cwgoes cwgoes changed the title Start updating paths Update paths for consistency Jan 9, 2020
@fedekunze
Copy link

@cwgoes any chance we could switch the channel paths from "ports/{portID}/channels/{channelID}" to "channels/{channelID}/ports/{portID}"

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 10, 2020

@cwgoes any chance we could switch the channel paths from "ports/{portID}/channels/{channelID}" to "channels/{channelID}/ports/{portID}"

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?

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 13, 2020

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.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 13, 2020

I wonder if client types should also define an initialise function, we want to avoid paths in ICS 2.

@cwgoes cwgoes changed the title Update paths for consistency Update paths for consistency; revise ICS 2 for client type sub-specs Jan 13, 2020
@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 13, 2020

Also, the spec should define what a loopback client implementation looks like.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 15, 2020

Also, the spec should define what a loopback client implementation looks like.

Split to #352.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 15, 2020

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).

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 16, 2020

  • Fix ICS 4, thanks Fede.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 16, 2020

@cwgoes any chance we could switch the channel paths from "ports/{portID}/channels/{channelID}" to "channels/{channelID}/ports/{portID}"

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?

Confirmed per discussion that we don't need this.

@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 17, 2020

For now I am going to update the paths so that everything is prefixed under clients/{identifier} - this means that we can use the prefix store for permissioning. IMO that is worth possibly having to skip items while iterating, since that only ought to be happening out of transaction processing.

@cwgoes cwgoes marked this pull request as ready for review January 17, 2020 14:34
@cwgoes cwgoes added tao Transport, authentication, & ordering layer. from-review Feedback / alterations from specification review. ready-for-review Pull requests which are ready for review. labels Jan 17, 2020
@cwgoes
Copy link
Contributor Author

cwgoes commented Jan 17, 2020

This PR really makes me want a type-checked spec...

@cwgoes cwgoes added this to the IBC 1.0.0-rc6 milestone Jan 17, 2020
| 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) |

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?

Copy link
Contributor Author

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.

spec/ics-002-client-semantics/README.md Show resolved Hide resolved
@cwgoes cwgoes requested a review from fedekunze January 20, 2020 10:58
}
```
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.

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

Copy link
Contributor Author

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.

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

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

Copy link
Contributor Author

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 = (

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.

Choose a reason for hiding this comment

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

Suggested change
type latestHeight = (
type latestClientHeight = (

Choose a reason for hiding this comment

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

or, alternatively clientState.latestHeight().

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

cwgoes and others added 2 commits January 20, 2020 14:31
Co-Authored-By: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
@cwgoes cwgoes merged commit 6754b8e into master Jan 22, 2020
@cwgoes cwgoes deleted the cwgoes/fixup-paths branch January 22, 2020 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
from-review Feedback / alterations from specification review. ready-for-review Pull requests which are ready for review. tao Transport, authentication, & ordering layer.
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

Update ICS 2 for ICS 6, 7 Inconsistencies in paths between ICS
2 participants