From 7688fc4a24f62d8a3c24cd3738eb923ea00166ef Mon Sep 17 00:00:00 2001 From: yito88 Date: Tue, 9 Jul 2024 11:08:49 +0200 Subject: [PATCH] fix tests between gaia and namada --- .../src/tests/clear_packet.rs | 8 ++-- .../src/tests/client_expiration.rs | 2 +- .../integration-test/src/tests/denom_trace.rs | 2 +- tools/integration-test/src/tests/memo.rs | 4 +- .../integration-test/src/tests/supervisor.rs | 4 +- .../src/tests/tendermint/sequential.rs | 39 +++++++++++++------ .../src/tests/ternary_transfer.rs | 6 +-- 7 files changed, 41 insertions(+), 24 deletions(-) diff --git a/tools/integration-test/src/tests/clear_packet.rs b/tools/integration-test/src/tests/clear_packet.rs index 7a343148a4..bd07ac8408 100644 --- a/tools/integration-test/src/tests/clear_packet.rs +++ b/tools/integration-test/src/tests/clear_packet.rs @@ -128,7 +128,7 @@ impl BinaryChannelTest for ClearPacketTest { sleep(Duration::from_secs(1)); let amount_b = amount2.transfer( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), )?; @@ -187,7 +187,7 @@ impl BinaryChannelTest for ClearPacketRecoveryTest { )?; let denom_b2 = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, @@ -255,7 +255,7 @@ impl BinaryChannelTest for ClearPacketNoScanTest { )?; let denom_b2 = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, @@ -381,7 +381,7 @@ impl BinaryChannelTest for ClearPacketOverrideTest { )?; let denom_b2 = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, diff --git a/tools/integration-test/src/tests/client_expiration.rs b/tools/integration-test/src/tests/client_expiration.rs index c75b7bc191..234bea6b1c 100644 --- a/tools/integration-test/src/tests/client_expiration.rs +++ b/tools/integration-test/src/tests/client_expiration.rs @@ -213,7 +213,7 @@ impl BinaryChainTest for ChannelExpirationTest { }, // From simapp version v7.1.0 if `ConnOpenInit` is sent while the client // is expired, an error will be returned. - Err(e) => match chains.node_a.chain_driver().value().chain_type { + Err(e) => match chains.node_b.chain_driver().value().chain_type { ChainType::Namada => { // See https://github.com/cosmos/ibc-rs/blob/v0.53.0/ibc-core/ics02-client/types/src/error.rs#L22 assert!(e.to_string().contains("client is not active. Status=`Expired`")) diff --git a/tools/integration-test/src/tests/denom_trace.rs b/tools/integration-test/src/tests/denom_trace.rs index 50dbbd4aa8..f8246059ba 100644 --- a/tools/integration-test/src/tests/denom_trace.rs +++ b/tools/integration-test/src/tests/denom_trace.rs @@ -40,7 +40,7 @@ impl BinaryChannelTest for IbcDenomTraceTest { )?; let denom_b = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, diff --git a/tools/integration-test/src/tests/memo.rs b/tools/integration-test/src/tests/memo.rs index ad49db460b..93f3e9a85f 100644 --- a/tools/integration-test/src/tests/memo.rs +++ b/tools/integration-test/src/tests/memo.rs @@ -70,7 +70,7 @@ impl BinaryChannelTest for MemoTest { )?; let denom_b = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, @@ -130,7 +130,7 @@ impl BinaryChannelTest for MemoOverwriteTest { )?; let denom_b = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channel.port_b.as_ref(), &channel.channel_id_b.as_ref(), &denom_a, diff --git a/tools/integration-test/src/tests/supervisor.rs b/tools/integration-test/src/tests/supervisor.rs index 217b16b51a..86b190a06c 100644 --- a/tools/integration-test/src/tests/supervisor.rs +++ b/tools/integration-test/src/tests/supervisor.rs @@ -96,7 +96,7 @@ impl BinaryChainTest for SupervisorTest { let denom_a = chains.node_a.denom(); let denom_b = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &port_b.as_ref(), &channel_id_b.as_ref(), &denom_a, @@ -210,7 +210,7 @@ impl BinaryChannelTest for SupervisorScanTest { )); let denom_b = derive_ibc_denom( - &chains.node_b.chain_driver().value().chain_type, + &chains.node_a.chain_driver().value().chain_type, &channels.port_b.as_ref(), &channels.channel_id_b.as_ref(), &denom_a, diff --git a/tools/integration-test/src/tests/tendermint/sequential.rs b/tools/integration-test/src/tests/tendermint/sequential.rs index 4bfbb7e15f..69177ade2b 100644 --- a/tools/integration-test/src/tests/tendermint/sequential.rs +++ b/tools/integration-test/src/tests/tendermint/sequential.rs @@ -3,6 +3,7 @@ use std::time::Instant; use ibc_relayer::chain::tracking::TrackedMsgs; use ibc_relayer::config::types::max_msg_num::MaxMsgNum; use ibc_relayer::config::ChainConfig; +use ibc_test_framework::chain::chain_type::ChainType; use ibc_test_framework::chain::config; use ibc_test_framework::prelude::*; use ibc_test_framework::relayer::transfer::build_transfer_message; @@ -104,16 +105,28 @@ impl BinaryChannelTest for SequentialCommitTest { TOTAL_MESSAGES, duration ); - // Time taken for submitting sequential batches should be around number of transactions * block time - - assert!( - duration - > Duration::from_millis((BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) - 1000) - ); - assert!( - duration - < Duration::from_millis((BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) + 1000) - ); + let (min_duration, max_duration) = match chains.node_a.chain_driver().value().chain_type + { + ChainType::Namada => ( + Duration::from_millis((BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) - 1000), + Duration::from_millis( + (BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) * 2 + 1000, + ), + ), + _ => { + // Time taken for submitting sequential batches should be around number of transactions * block time + ( + Duration::from_millis( + (BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) - 1000, + ), + Duration::from_millis( + (BLOCK_TIME_MILLIS * TOTAL_TRANSACTIONS as u64) + 1000, + ), + ) + } + }; + assert!(duration > min_duration); + assert!(duration < max_duration); } { @@ -150,7 +163,11 @@ impl BinaryChannelTest for SequentialCommitTest { TOTAL_MESSAGES, duration ); - assert!(duration < Duration::from_millis(BLOCK_TIME_MILLIS * 3)); + let max_duration = match chains.node_b.chain_driver().value().chain_type { + ChainType::Namada => Duration::from_millis(BLOCK_TIME_MILLIS * 2 * 2), + _ => Duration::from_millis(BLOCK_TIME_MILLIS * 2), + }; + assert!(duration < max_duration); } Ok(()) diff --git a/tools/integration-test/src/tests/ternary_transfer.rs b/tools/integration-test/src/tests/ternary_transfer.rs index eff39b352a..7ceca55001 100644 --- a/tools/integration-test/src/tests/ternary_transfer.rs +++ b/tools/integration-test/src/tests/ternary_transfer.rs @@ -66,7 +66,7 @@ impl NaryChannelTest<3> for TernaryIbcTransferTest { )?; let denom_a_to_b = derive_ibc_denom( - &node_b.chain_driver().value().chain_type, + &node_a.chain_driver().value().chain_type, &channel_a_to_b.port_b.as_ref(), &channel_a_to_b.channel_id_b.as_ref(), &denom_a, @@ -98,7 +98,7 @@ impl NaryChannelTest<3> for TernaryIbcTransferTest { let channel_b_to_c = channels.channel_at::<1, 2>()?; let denom_a_to_c = derive_ibc_denom( - &node_c.chain_driver().value().chain_type, + &node_a.chain_driver().value().chain_type, &channel_b_to_c.port_b.as_ref(), &channel_b_to_c.channel_id_b.as_ref(), &denom_a_to_b.as_ref(), @@ -136,7 +136,7 @@ impl NaryChannelTest<3> for TernaryIbcTransferTest { let channel_c_to_a = channels.channel_at::<2, 0>()?; let denom_a_to_c_to_a = derive_ibc_denom( - &node_b.chain_driver().value().chain_type, + &node_a.chain_driver().value().chain_type, &channel_c_to_a.port_b.as_ref(), &channel_c_to_a.channel_id_b.as_ref(), &denom_a_to_c.as_ref(),