Skip to content

Commit

Permalink
fix: expire 07-tendermint client when elapsed time from trusted equal…
Browse files Browse the repository at this point in the history
…s trusting period (#1287)

* fix: expire client when elapsed time from trusted equals trusting period

* nit

* fix: drop equality in test_expired_client
  • Loading branch information
Farhad-Shabani authored Jul 24, 2024
1 parent d995df7 commit d91b303
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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))
5 changes: 4 additions & 1 deletion ibc-clients/ics07-tendermint/src/client_state/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit d91b303

Please sign in to comment.