From d91b303c1e9247c686269dfc6f4cb4b1a834c1d4 Mon Sep 17 00:00:00 2001 From: Farhad Shabani Date: Wed, 24 Jul 2024 12:27:58 -0700 Subject: [PATCH] fix: expire 07-tendermint client when elapsed time from trusted equals trusting period (#1287) * fix: expire client when elapsed time from trusted equals trusting period * nit * fix: drop equality in test_expired_client --- .../1239-consider-client-expired-at-trusting-period.md | 3 +++ ibc-clients/ics07-tendermint/src/client_state/validation.rs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changelog/unreleased/bug-fixes/1239-consider-client-expired-at-trusting-period.md diff --git a/.changelog/unreleased/bug-fixes/1239-consider-client-expired-at-trusting-period.md b/.changelog/unreleased/bug-fixes/1239-consider-client-expired-at-trusting-period.md new file mode 100644 index 000000000..3f2ecbcd2 --- /dev/null +++ b/.changelog/unreleased/bug-fixes/1239-consider-client-expired-at-trusting-period.md @@ -0,0 +1,3 @@ +- [ibc-client-tendermint] Expire a client when the elapsed time from a trusted + header equals the trusting period, to stay consistent with the expiry logic in + `tendermint-rs` ([\#1239](https://github.com/cosmos/ibc-rs/issues/1239)) diff --git a/ibc-clients/ics07-tendermint/src/client_state/validation.rs b/ibc-clients/ics07-tendermint/src/client_state/validation.rs index 116b84dd8..4a7f7f6a3 100644 --- a/ibc-clients/ics07-tendermint/src/client_state/validation.rs +++ b/ibc-clients/ics07-tendermint/src/client_state/validation.rs @@ -221,7 +221,10 @@ where if let Some(elapsed_since_latest_consensus_state) = now.duration_since(&latest_consensus_state.timestamp().into()) { - if elapsed_since_latest_consensus_state > client_state.trusting_period { + // Note: The equality is considered as expired to stay consistent with + // the check in tendermint-rs, where a header at `trusted_header_time + + // trusting_period` is considered expired. + if elapsed_since_latest_consensus_state >= client_state.trusting_period { return Ok(Status::Expired); } }