Skip to content

Commit

Permalink
fix: packet sequence in Timeout handlers should be encoded in big-end…
Browse files Browse the repository at this point in the history
…ian (#1004)

* fix: encode package sequence into big endian bytes

* Fix this issue in `to_vec` method.
  • Loading branch information
en authored and Farhad-Shabani committed Dec 22, 2023
1 parent 3be16b2 commit d52ff0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Encode packet sequence into a big endian bytes.
([\#1004](https://github.com/cosmos/ibc-rs/pull/1004))
5 changes: 5 additions & 0 deletions ibc-core/ics24-host/types/src/identifiers/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ impl Sequence {
pub fn increment(&self) -> Sequence {
Sequence(self.0 + 1)
}

/// Encodes the sequence number into a byte array in big endian.
pub fn to_vec(&self) -> Vec<u8> {
self.0.to_be_bytes().to_vec()
}
}

impl From<u64> for Sequence {
Expand Down

0 comments on commit d52ff0b

Please sign in to comment.