From 17adaeb233975f99b493a4576b6ef5d063db02e8 Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Thu, 13 Jun 2024 16:11:25 +0100 Subject: [PATCH] Adjust IBC timeout values --- crates/ibc/src/context/validation.rs | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/crates/ibc/src/context/validation.rs b/crates/ibc/src/context/validation.rs index 44982d0fa1..f51ccf7cbf 100644 --- a/crates/ibc/src/context/validation.rs +++ b/crates/ibc/src/context/validation.rs @@ -269,13 +269,22 @@ where .get_block_height() .expect("The height should exist"); - namada_parameters::estimate_max_block_time_from_blocks_and_params( - &*self.inner.borrow(), - height, - 5, // estimate max height with up to 5 blocks in the past - ) - .expect("Failed to estimate max block time") - .into() + let estimate = + namada_parameters::estimate_max_block_time_from_blocks_and_params( + &*self.inner.borrow(), + height, + // NB: estimate max height with up to 5 blocks in the past, + // which will not result in too many reads + 5, + ) + .expect("Failed to estimate max block time"); + + // NB: pick a lower max blocktime estimate during tests, + // to avoid flakes in CI + #[cfg(any(test, feature = "testing"))] + let estimate = estimate.min(namada_core::time::DurationSecs(5)); + + estimate.into() } fn validate_message_signer(