Skip to content

Commit

Permalink
Fix this issue in to_vec method.
Browse files Browse the repository at this point in the history
  • Loading branch information
en committed Dec 15, 2023
1 parent fa6cdbe commit d7e375d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 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))
3 changes: 1 addition & 2 deletions ibc-core/ics04-channel/src/handler/timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,13 @@ where
}
let seq_recv_path_on_b =
SeqRecvPath::new(&msg.packet.port_id_on_b, &msg.packet.chan_id_on_b);
let value = u64::from(msg.packet.seq_on_a).to_be_bytes().to_vec();

client_state_of_b_on_a.verify_membership(
conn_end_on_a.counterparty().prefix(),
&msg.proof_unreceived_on_b,
consensus_state_of_b_on_a.root(),
Path::SeqRecv(seq_recv_path_on_b),
value,
msg.packet.seq_on_a.to_vec(),
)
} else {
let receipt_path_on_b = ReceiptPath::new(
Expand Down
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 d7e375d

Please sign in to comment.