-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the concept of a "zero Height" (#2346)
Prior to this PR, the `Height` type used a special `Height::zero()` value to denote the absence of height value. This caused ad hoc checks of whether a height is zero in various places. From now on, we instead use `Option<Height>` on places where the height value may be optional, and require non-zero value in the `Height` constructor. - Optional height parameters should use `Option<Height>` instead of `Height`. - Checking of `height == Height::zero()` is replaced with Option matching. --- * From<Height> for String fix * Use Option<Height> instead of Height::zero for consensus_height * recv_packet still had Height::zero() in events * TryFrom<RawHeight> for Height * pre height parse changes * Packet.timeout_height is now an Option<Height> * rustdoc * Remove Height::with_revision_height * commit pre-modifying cli * Finish Height::new() returns Result * remove Height::is_zero() * Remove `Height::zero()` * Remove Height::default() * Height fields accessors * use revision_height accessor * use revision_number accessor * make Height fields private (WIP) * compile error fixes * FIXME in transfer.rs addressed * Use existing constants instead of hardcoded strings * changelog * TimeoutHeight newtype * Use TimeoutHeight everywhere * Fixes after merging with master * has_expired() fix * doc url * fix send_packet test * Remove timeout_height == 0 && timestamp == 0 check * Remove `has_timeout()` * Change TimeoutHeight impl * docstrings * tests fix * fix history manipulation test * transfer test: no timeout * msgtransfer test * packet no timeout or timestamp test * send_packet timeout height equal destination chain height * send_packet test with timeout = height - 1 * test invalid timeout height * fix docstring * clippy * Fix clippy warnings introduced in Rust 1.62 * Fix serialization of `TimeoutHeight` to match the format used by `Height` Co-authored-by: Romain Ruetschi <romain@informal.systems>
- Loading branch information
Showing
85 changed files
with
944 additions
and
573 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.changelog/unreleased/improvements/ibc/1009-height-zero-complete.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- Remove the concept of a zero Height | ||
([#1009](https://github.com/informalsystems/ibc-rs/issues/1009)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.