-
Notifications
You must be signed in to change notification settings - Fork 384
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
Implementation side Feedback #145
Comments
Are you saying that we want to accept past consensus states in certain cases in the handshakes? (I agree) |
I think this is inevitable, in the handshake process, chain A at height H can only verify the consensus state of itself from height <H stored in chain B, unless two chains are working fully synchronous, so the chain have to verify the existence of one of its past consensus state on the counterparty. Also see: cosmos/cosmos-sdk#4647 |
Concurred; does 3f45935 match more or less what you have? |
@mossid Is the OP up-to-date with the latest spec? Alternatively, besides |
Separations between connection/channel elements is the only thing not yet included, but can be included in a latter rc(if exists, if not then should be in rc3). |
There will be a latter rc, I expect. PRs welcome! (or we can discuss, as you prefer) |
Hmm - why is this advantageous? It means that multiple proofs are required during handshakes, which seems unfortunate. I guess it reduces the amount of data read during some parts of packet handling. Is that the reason? |
We should separate out only state which has to be read individually. |
Current implementation-side separation, client/connection/channel prefix ignored: 02
03persistent
handshake
04persistent
handshake
|
Also in ICS 025: we have clauses for the privatestore that it
but it is
And the key format also need to be restricted in |
I generally like the store layout - two questions:
|
The current implementation does not include the unordered channel but it will.
Type of the connection {handshake, broadcastint, subscription, ...}. Not in the spec, added for possible future compatability |
@mossid Does the store layout above still reflect the implementation? What remains that we need to agree upon between the spec & implementation (w.r.t. this issue)? |
Bump @mossid (also @fedekunze - I recall you mentioned a question about store keys & iterations, and a desire to change the layout a bit). |
Yeah, one problem is that the store keys conflict with each other since there's no prefix that you can use to use iterators and thus aggregate the data. |
That can be fixed - do you want to write up the new suggested store layout or should I? |
I am assuming that the store layout changes (made by #332) are the only remaining actionable here. Please re-open if there are other spec changes which have not yet been made. |
This issue is for documenting the difference between the spec and the current implementation. Discussion will be followed to determine which part we want to merge back to the spec and which part we don't want.
NOTE: the current implementation code is based on pre-1.0.0 spec
ICS 23
The implementation can be found here: cosmos/cosmos-sdk#4515
verifyMembership
/verifyNonmembership
distinctionIn the spec, the functions are defined separately and takes value only if it is
verifyMembership
. In the implementation, there is one methodVerify
and it takesnil
as its value if it is an absent proof, which means there is no type distinction between membership proofs and non membership proofs. This approach is easier on implementation(asnil
means empty value onKVStore.Get()
too), but also they are semantically equivalent and type distinction in spec is better for its purpose, I suggest to not merge back to spec.verify*
takes key as argumentverify*
functions takes both key and value as argument in order to prove the proof. In the implementation, in order to store the proofs in a map, the proofs already contains its key and theVerify()
function takes only the value. Like as above, this is also equivalent to the spec.Path
to the typesPath
s are a prefix distinguisher for the keys. In many cases IBC logic will not be able to occupy the key format that is declared in the specification. For example in Cosmos-SDK case the merkle proof will be prefixed with aRootMultistore
proof.Path
can be understood as a prefix on keys. For a single KVStore with multiple IBC modules, each module can be stored under prefix"IBC{index}"
, preventing collision of the keys. The counterparties of the modules will storePath
with"IBC{index}"
, which will be prepended to the specified keys.The
verify*
functions now also have to takePath
in addition to theRoot
, key, value. The "kind" ofProof
andPath
should match(merkle.Proof
should only be used withmerkle.Path
).The
Path
should be, I think, unique per connection. If we storePath
per client, this will make the light clients have more than one purpose(verifying the counterparty consensus). ICS 02 Client should be only working as a light client for other chains, without storing any other information.ICS 02
The implementation can be found here: cosmos/cosmos-sdk#4516
The name "client" sometimes conflicts with the client side command line tools, not an importand suggestion.
ICS 03
The implementation can be found here: cosmos/cosmos-sdk#4517
type
ConnectionEnd
is defined asHowever elements in this data type is splitted in the implementation.
Also, considering that non-handshake connections(e.g. broadcaster) will be added later, it might be better to separate handshake logic from the core connection fields, and reserve a field for indicating connection type.
So It can be modified as:
Connection Connection
under"connection/{connectionIdentfier}"
Available bool
under"connection/{connectionIdentifier}/available"
ConnectionKind string/enum
under"connection/{connectionIdentnfier}/kind"
State
under"connection/{connectionIdentifier}/state"
CounterpartyClient
under"connection/{connectionIdentifier}/counterpartyClient"
NextTimeout uint
under"connection/{connectionIdentifier}/nextTimeout"
where
Connection
is(ClientIdentifier, CounterpartyConnectionIdentifier)
.Available
MUST be equal withState == Opened || State == TryClose
.For all kinds of connections, once it became
Available
, the only information the user have to access isAvailable
andConnection
.Connection
andConnectionKind
should not be modified after set.CounterpartyClient
,NextTimeout
should not be relevant after the opening handshake is finished.getConsensusState
inspects past stateIn the current definition,
getConsensusState
has two use cases: inspecting the current height of this chain, and inspecting one of its past consensus states.The functions which use
getConsensusState
for the latter purpose should take an additional argumentconsensusStateHeight
, which is provided togetConsensusState
. It will return theConsensusState
of this chain from that height.ICS 04
The implementation can be found here: cosmos/cosmos-sdk#4548
Equivalent to ICS 03 feedback, except for the
CounterpartyClient
as it doesn't exist in Channels.ChannelEnd
will be defined as(PortIdentifier, CounterpartyChannelIdentifier, CounterpartyPortIdentifier, ConnectionHops)
.NextSequenceReceive
,NextSequenceSend
,PacketCommitment
will not be effected.ConnectionHops
should be the list of connection that can reach to the origin chain. For example, If there is a channel for chains A-B-C-D, then theConnectionHops
should be ChainAonB-ChainBonC-ChainConD in chain D's perspective, and ChainDonC-ChainConB-ChainBonA in chain A's perspective. In general case thelen(ConnectionHops)
should belen(chaind)-1
.ICS 25
// Not finished yet
The text was updated successfully, but these errors were encountered: