Skip to content

Commit

Permalink
add test for packet with no timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Apr 29, 2024
1 parent ffba2e6 commit 60ba653
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ibc-testkit/tests/core/ics04_channel/send_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use core::time::Duration;
use ibc::core::channel::handler::send_packet;
use ibc::core::channel::types::channel::{ChannelEnd, Counterparty, Order, State};
use ibc::core::channel::types::packet::Packet;
use ibc::core::channel::types::timeout::TimeoutHeight;
use ibc::core::channel::types::Version;
use ibc::core::client::types::Height;
use ibc::core::commitment_types::commitment::CommitmentPrefix;
Expand Down Expand Up @@ -84,6 +85,13 @@ fn send_packet_processing() {

let client_height = Height::new(0, client_raw_height).unwrap();

let packet_with_no_timeout: Packet = {
let mut packet: Packet = dummy_raw_packet(10, 10).try_into().unwrap();
packet.timeout_height_on_b = TimeoutHeight::no_timeout();
packet.timeout_timestamp_on_b = Timestamp::none();
packet
};

let tests: Vec<Test> = vec![
Test {
name: "Processing fails because no channel exists in the context".to_string(),
Expand Down Expand Up @@ -136,6 +144,21 @@ fn send_packet_processing() {
packet: packet_timeout_one_before_client_height,
want_pass: false,
},
Test {
name: "Packet without height and timestamp timeout".to_string(),
ctx: context
.clone()
.with_client_config(
MockClientConfig::builder()
.latest_height(client_height)
.build(),
)
.with_connection(ConnectionId::zero(), conn_end_on_a.clone())
.with_channel(PortId::transfer(), ChannelId::zero(), chan_end_on_a.clone())
.with_send_sequence(PortId::transfer(), ChannelId::zero(), 1.into()),
packet: packet_with_no_timeout,
want_pass: false,
},
Test {
name: "Packet timeout due to timestamp".to_string(),
ctx: context
Expand Down

0 comments on commit 60ba653

Please sign in to comment.