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 Dec 16, 2023
1 parent 9a81b2b commit 0ed6ae4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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))
6 changes: 2 additions & 4 deletions ibc-core/ics24-host/types/src/identifiers/sequence.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use ibc_primitives::prelude::*;
use ibc_primitives::ToVec;

use crate::error::IdentifierError;

Expand Down Expand Up @@ -50,10 +49,9 @@ impl Sequence {
Sequence(self.0 + 1)
}

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

Expand Down

0 comments on commit 0ed6ae4

Please sign in to comment.