From cb10847b3385a6f03f2c6d3164b676e93b3e8f0f Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Mon, 17 Jun 2024 14:45:53 -0700 Subject: [PATCH 1/2] ibc: fix timeouts: use client height and timestamp instead of processed height and timestamp --- .../ibc/src/component/msg_handler/timeout.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/core/component/ibc/src/component/msg_handler/timeout.rs b/crates/core/component/ibc/src/component/msg_handler/timeout.rs index 7951e8f5b0..e3f73d2ea7 100644 --- a/crates/core/component/ibc/src/component/msg_handler/timeout.rs +++ b/crates/core/component/ibc/src/component/msg_handler/timeout.rs @@ -61,13 +61,18 @@ impl MsgHandler for MsgTimeout { .context("failed to get connection")? .ok_or_else(|| anyhow::anyhow!("connection not found for channel"))?; - let chain_ts = state - .get_client_update_time(&connection.client_id, &self.proof_height_on_b) + let client_state = state.get_client_state(&connection.client_id).await?; + let last_consensus_state = state + .get_verified_consensus_state(&client_state.latest_height(), &connection.client_id) .await?; - let chain_height = self.proof_height_on_b; + let last_update_time = last_consensus_state.timestamp; + let last_update_height = client_state.latest_height(); // check that timeout height or timeout timestamp has passed on the other end - if !self.packet.timed_out(&chain_ts, chain_height) { + if !self + .packet + .timed_out(&last_update_time.into(), last_update_height) + { anyhow::bail!("packet has not timed out on the counterparty chain"); } From 466e53c4cfa98064d4ad8378760e32a6d21e7e07 Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Mon, 17 Jun 2024 16:17:05 -0700 Subject: [PATCH 2/2] use proof_height_on_b --- .../core/component/ibc/src/component/msg_handler/timeout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/core/component/ibc/src/component/msg_handler/timeout.rs b/crates/core/component/ibc/src/component/msg_handler/timeout.rs index e3f73d2ea7..e9c528bbac 100644 --- a/crates/core/component/ibc/src/component/msg_handler/timeout.rs +++ b/crates/core/component/ibc/src/component/msg_handler/timeout.rs @@ -66,12 +66,12 @@ impl MsgHandler for MsgTimeout { .get_verified_consensus_state(&client_state.latest_height(), &connection.client_id) .await?; let last_update_time = last_consensus_state.timestamp; - let last_update_height = client_state.latest_height(); + let proof_update_height = self.proof_height_on_b; // check that timeout height or timeout timestamp has passed on the other end if !self .packet - .timed_out(&last_update_time.into(), last_update_height) + .timed_out(&last_update_time.into(), proof_update_height) { anyhow::bail!("packet has not timed out on the counterparty chain"); }