-
Notifications
You must be signed in to change notification settings - Fork 94
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
[ICS02] Allow zero Height
creation, but keep the H>0 condition for CometBFT clients
#603
Comments
Farhad-Shabani
added
S: errors
Scope: related to error handlings
S: specs
Scope: related to IBC protocol specifications
labels
Apr 4, 2023
7 tasks
mina86
added a commit
to mina86/ibc-rs
that referenced
this issue
Nov 16, 2023
Replace ClientConsensusStatePath’s epoch and height fields with a single height field whose type is Height. This stores the exact same information but allows infallible way to get Height out of the path. Arguably it also makes more sense conceptually since the epoch and height are really just a single Height field. Even in formatted paths those two are a single component so it makes sense to have them as a single field. Issue: cosmos#603
7 tasks
Related problem is that there’s no infallible way to create Height
This can be done without affecting serde serialisation (so that PR with that change at #968 |
mina86
added a commit
to mina86/ibc-rs
that referenced
this issue
Nov 16, 2023
Replace ClientConsensusStatePath’s epoch and height fields with a single height field whose type is Height. This stores the exact same information but allows infallible way to get Height out of the path. Arguably it also makes more sense conceptually since the epoch and height are really just a single Height field. Even in formatted paths those two are a single component so it makes sense to have them as a single field. Issue: cosmos#603
mina86
added a commit
to mina86/ibc-rs
that referenced
this issue
Nov 16, 2023
Replace ClientConsensusStatePath’s epoch and height fields with a single height field whose type is Height. This stores the exact same information but allows infallible way to get Height out of the path. Arguably it also makes more sense conceptually since the epoch and height are really just a single Height field. Even in formatted paths those two are a single component so it makes sense to have them as a single field. Issue: cosmos#603
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem Statement
Client-specific condition
As for the new
Height
creation (here) it isn’t allowed to create a zero height and this height >0 is a client-specific condition. Looking into the links provided here It is required for CometBFT-based chains)Not in conflict with ICS02
This condition is not clearly outlined in ICS07, though should be added there. But ICS02 explicitly requires to have a zero element for the Height type which is not in conflict with having H>0 for the CometBFT clients:
Error handling side effect
Upon converting a proto zero height, we have to deal with the zero-height error variant (
ClientError::InvalidHeight
) which is only needed for ICS07-related codes. And, in the places we have to observe H>0, this error is mapped to a different type and even leftunwrap()
like e.g. here & here & here & hereBenefit from
Option<Height>
Living in Rust, using
Option
and converting toNone
would be more efficient, where a proto zero height means the absence of height, while still allowing zero height creation. (As also suggested inPacket.timeoutHeight
should have typeOption<Height>
(or equivalent) ibc#776)Related Context
To create a valid not-frozen client, the
frozen_height
within the proto message is set to 0, but upon converting to a domainHeight
, it turns to an unacceptable value. So we have to manage it by turning aResult
toOption
via.ok()
methodAcceptance Criteria
Allow zero
Height
creation, but keep the H>0 condition for CometBFT clients (be efficient to handle that only where we really care about not having a zero height.)The text was updated successfully, but these errors were encountered: