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

fix: revert frozen_height to 0 for active clients in conversions #1064

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: disallow proto frozen_height equal to None
  • Loading branch information
Farhad-Shabani committed Jan 29, 2024
commit 6d9416dc2f4b13e40eaceae25dd032ab92a7d2bc
6 changes: 5 additions & 1 deletion ibc-clients/ics07-tendermint/types/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,11 @@ impl TryFrom<RawTmClientState> for ClientState {
.try_into()
.map_err(|_| Error::MissingLatestHeight)?;

let frozen_height = raw.frozen_height.and_then(|h| Height::try_from(h).ok());
// NOTE: In `RawClientState`, a `frozen_height` of `0` means "not
// frozen". See:
// https://github.com/cosmos/ibc-go/blob/8422d0c4c35ef970539466c5bdec1cd27369bab3/modules/light-clients/07-tendermint/types/client_state.go#L74
let frozen_height =
Height::try_from(raw.frozen_height.ok_or(Error::MissingFrozenHeight)?).ok();

// We use set this deprecated field just so that we can properly convert
// it back in its raw form
Expand Down
4 changes: 2 additions & 2 deletions ibc-clients/ics07-tendermint/types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ pub enum Error {
HeaderTimestampTooLow { actual: String, min: String },
/// header revision height = `{height}` is invalid
InvalidHeaderHeight { height: u64 },
/// Disallowed to create a new client with a frozen height
FrozenHeightNotAllowed,
/// frozen height not found
Farhad-Shabani marked this conversation as resolved.
Show resolved Hide resolved
MissingFrozenHeight,
/// the header's trusted revision number (`{trusted_revision}`) and the update's revision number (`{header_revision}`) should be the same
MismatchHeightRevisions {
trusted_revision: u64,
Expand Down
Loading