Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add packet-forward and ica features to tests running Osmosis #4063

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Add the features `packet-forward` and `ica` to enable
Packet Forward Middleware and ICA when running tests with Osmosis
([\#3195](https://github.com/informalsystems/hermes/issues/3195))
2 changes: 1 addition & 1 deletion .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
command: osmosisd
account_prefix: osmo
native_token: stake
features: dynamic-gas-fee
features: dynamic-gas-fee,forward-packet,ica
- package: juno
command: junod
account_prefix: juno
Expand Down
2 changes: 2 additions & 0 deletions tools/integration-test/src/mbt/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub fn local_transfer_handler<ChainA: ChainHandle>(
target: u128,
denom: u128,
amount: u128,
fees: &TaggedTokenRef<ChainA>,
) -> Result<(), Error> {
let wallets = node.wallets();

Expand All @@ -50,6 +51,7 @@ pub fn local_transfer_handler<ChainA: ChainHandle>(
&source_wallet,
&target_wallet.address(),
&denom.with_amount(amount).as_ref(),
fees,
)?;

Ok(())
Expand Down
11 changes: 9 additions & 2 deletions tools/integration-test/src/mbt/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ impl TestOverrides for IbcTransferMBT {
impl BinaryChannelTest for IbcTransferMBT {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
relayer: RelayerDriver,
chains: ConnectedChains<ChainA, ChainB>,
channels: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(config.native_token(0)));
// relayer is spawned
let mut supervisor = Some(relayer.spawn_supervisor()?);

Expand All @@ -197,7 +199,12 @@ impl BinaryChannelTest for IbcTransferMBT {
info!("[LocalTransfer] Init");
let node: Tagged<ChainA, _> = get_chain(&chains, *chain_id);
super::handlers::local_transfer_handler(
node, *source, *target, *denom, *amount,
node,
*source,
*target,
*denom,
*amount,
&fee_denom_a.with_amount(1200u64).as_ref(),
)?;
info!("[LocalTransfer] Done");
}
Expand Down
2 changes: 1 addition & 1 deletion tools/integration-test/src/tests/async_icq/simple_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl BinaryConnectionTest for AsyncIcqTest {
connection: ConnectedConnection<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let port_a = DualTagged::new(PortId::oracle());
let port_b = DualTagged::new(PortId::icqhost());
let (channel_id_b, channel_id_a) = init_channel_version(
Expand Down
4 changes: 2 additions & 2 deletions tools/integration-test/src/tests/authz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl BinaryChannelTest for AuthzTest {
) -> Result<(), Error> {
let denom_a = chains.node_a.denom();
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let wallet_b = chains.node_b.wallets().user1().cloned();

let a_to_b_amount = 12345u64;
Expand Down Expand Up @@ -120,7 +120,7 @@ impl BinaryChannelTest for NoAuthzTest {
) -> Result<(), Error> {
let denom_a = chains.node_a.denom();
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let wallet_b = chains.node_b.wallets().user1().cloned();

let a_to_b_amount = 12345u64;
Expand Down
10 changes: 8 additions & 2 deletions tools/integration-test/src/tests/channel_upgrade/ica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ impl TestOverrides for ChannelUpgradeICACloseChannel {
impl BinaryConnectionTest for ChannelUpgradeICACloseChannel {
fn run<Controller: ChainHandle, Host: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
relayer: RelayerDriver,
chains: ConnectedChains<Controller, Host>,
connection: ConnectedConnection<Controller, Host>,
) -> Result<(), Error> {
let fee_denom_host: MonoTagged<Host, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
let stake_denom: MonoTagged<Host, Denom> = MonoTagged::new(Denom::base("stake"));

// Run the block with supervisor in order to open and then upgrade the ICA channel
Expand Down Expand Up @@ -219,6 +221,7 @@ impl BinaryConnectionTest for ChannelUpgradeICACloseChannel {
&chains.node_b.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_host.with_amount(1200u64).as_ref(),
)?;

chains.node_b.chain_driver().assert_eventual_wallet_amount(
Expand Down Expand Up @@ -335,11 +338,13 @@ impl TestOverrides for ChannelUpgradeICAUnordered {
impl BinaryConnectionTest for ChannelUpgradeICAUnordered {
fn run<Controller: ChainHandle, Host: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
_relayer: RelayerDriver,
chains: ConnectedChains<Controller, Host>,
connection: ConnectedConnection<Controller, Host>,
) -> Result<(), Error> {
let fee_denom_host: MonoTagged<Host, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
let stake_denom: MonoTagged<Host, Denom> = MonoTagged::new(Denom::base("stake"));

info!("Will register interchain account...");
Expand Down Expand Up @@ -377,6 +382,7 @@ impl BinaryConnectionTest for ChannelUpgradeICAUnordered {
&chains.node_b.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_host.with_amount(1200u64).as_ref(),
)?;

chains.node_b.chain_driver().assert_eventual_wallet_amount(
Expand Down
9 changes: 6 additions & 3 deletions tools/integration-test/src/tests/clear_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,13 @@ impl BinaryChannelTest for ClearPacketTest {
impl BinaryChannelTest for ClearPacketRecoveryTest {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
relayer: RelayerDriver,
chains: ConnectedChains<ChainA, ChainB>,
channel: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_b: MonoTagged<ChainB, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
let denom_a = chains.node_a.denom();
let denom_b1 = chains.node_b.denom();

Expand All @@ -168,6 +170,7 @@ impl BinaryChannelTest for ClearPacketRecoveryTest {
&relayer_wallet_b.as_ref(),
&wallet_b.address(),
&denom_b1.with_amount(100u64).as_ref(),
&fee_denom_b.with_amount(1200u64).as_ref(),
)?;

let amount1 = random_u128_range(1000, 5000);
Expand Down Expand Up @@ -224,7 +227,7 @@ impl BinaryChannelTest for ClearPacketNoScanTest {
channel: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let denom_a = chains.node_a.denom();
let fee_denom_a = MonoTagged::new(Denom::base(&config.native_tokens[0]));
let fee_denom_a = MonoTagged::new(Denom::base(config.native_token(0)));

let wallet_a = chains.node_a.wallets().user1().cloned();
let wallet_b = chains.node_b.wallets().user1().cloned();
Expand Down Expand Up @@ -344,7 +347,7 @@ impl BinaryChannelTest for ClearPacketOverrideTest {
channel: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let denom_a = chains.node_a.denom();
let fee_denom_a = MonoTagged::new(Denom::base(&config.native_tokens[0]));
let fee_denom_a = MonoTagged::new(Denom::base(config.native_token(0)));

let wallet_a = chains.node_a.wallets().user1().cloned();
let wallet_b = chains.node_b.wallets().user1().cloned();
Expand Down
8 changes: 4 additions & 4 deletions tools/integration-test/src/tests/client_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl BinaryChainTest for ClientUpgradeTest {
) -> Result<(), ibc_test_framework::prelude::Error> {
let upgraded_chain_id = ChainId::new("upgradedibc".to_owned(), 1);
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let foreign_clients = chains.clone().foreign_clients;

// Create and send an chain upgrade proposal
Expand Down Expand Up @@ -242,7 +242,7 @@ impl BinaryChainTest for HeightTooHighClientUpgradeTest {
) -> Result<(), ibc_test_framework::prelude::Error> {
let upgraded_chain_id = ChainId::new("upgradedibc".to_owned(), 1);
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let foreign_clients = chains.clone().foreign_clients;

// Create and send an chain upgrade proposal
Expand Down Expand Up @@ -340,7 +340,7 @@ impl BinaryChainTest for HeightTooLowClientUpgradeTest {
) -> Result<(), ibc_test_framework::prelude::Error> {
let upgraded_chain_id = ChainId::new("upgradedibc".to_owned(), 1);
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let foreign_clients = chains.clone().foreign_clients;

let opts = create_upgrade_plan(config, &chains, &upgraded_chain_id)?;
Expand Down Expand Up @@ -433,7 +433,7 @@ fn create_upgrade_plan<ChainA: ChainHandle, ChainB: ChainHandle>(
upgraded_chain_id: &ChainId,
) -> Result<UpgradePlanOptions, Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(&config.native_tokens[0]));
MonoTagged::new(Denom::base(config.native_token(0)));
let foreign_clients = chains.clone().foreign_clients;

let src_client_id = foreign_clients.client_id_b().0.clone();
Expand Down
4 changes: 2 additions & 2 deletions tools/integration-test/src/tests/fee_grant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl BinaryChannelTest for FeeGrantTest {
let denom_a = chains.node_a.denom();
let wallet_a = chains.node_a.wallets().user1().cloned();
let wallet_b = chains.node_b.wallets().user1().cloned();
let fee_denom_a = MonoTagged::new(Denom::base(&config.native_tokens[0]));
let fee_denom_a = MonoTagged::new(Denom::base(config.native_token(0)));

let a_to_b_amount = 12345u64;
let granter = chains
Expand Down Expand Up @@ -185,7 +185,7 @@ impl BinaryChannelTest for NoFeeGrantTest {
let wallet_a = chains.node_a.wallets().user1().cloned();
let wallet_a2 = chains.node_a.wallets().user2().cloned();
let wallet_b = chains.node_b.wallets().user1().cloned();
let fee_denom_a = MonoTagged::new(Denom::base(&config.native_tokens[0]));
let fee_denom_a = MonoTagged::new(Denom::base(config.native_token(0)));

let a_to_b_amount = 12345u64;
let granter = chains
Expand Down
11 changes: 9 additions & 2 deletions tools/integration-test/src/tests/ica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ impl TestOverrides for IcaFilterTestAllow {
// Enable channel workers and allow relaying on ICA channels
fn modify_relayer_config(&self, config: &mut Config) {
config.mode.channels.enabled = true;
config.mode.clients.misbehaviour = false;

for chain in &mut config.chains {
match chain {
Expand All @@ -88,11 +89,13 @@ impl TestOverrides for IcaFilterTestAllow {
impl BinaryConnectionTest for IcaFilterTestAllow {
fn run<Controller: ChainHandle, Host: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
_relayer: RelayerDriver,
chains: ConnectedChains<Controller, Host>,
connection: ConnectedConnection<Controller, Host>,
) -> Result<(), Error> {
let fee_denom_host: MonoTagged<Host, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
// Register an interchain account on behalf of
// controller wallet `user1` where the counterparty chain is the interchain accounts host.
let (wallet, channel_id, port_id) =
Expand Down Expand Up @@ -126,6 +129,7 @@ impl BinaryConnectionTest for IcaFilterTestAllow {
&chains.node_b.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_host.with_amount(1200u64).as_ref(),
)?;

chains.node_b.chain_driver().assert_eventual_wallet_amount(
Expand Down Expand Up @@ -242,11 +246,13 @@ impl TestOverrides for ICACloseChannelTest {
impl BinaryConnectionTest for ICACloseChannelTest {
fn run<Controller: ChainHandle, Host: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
relayer: RelayerDriver,
chains: ConnectedChains<Controller, Host>,
connection: ConnectedConnection<Controller, Host>,
) -> Result<(), Error> {
let fee_denom_host: MonoTagged<Host, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
let stake_denom: MonoTagged<Host, Denom> = MonoTagged::new(Denom::base("stake"));
let (wallet, ica_address, controller_channel_id, controller_port_id) = relayer
.with_supervisor(|| {
Expand Down Expand Up @@ -293,6 +299,7 @@ impl BinaryConnectionTest for ICACloseChannelTest {
&chains.node_b.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_host.with_amount(1200u64).as_ref(),
)?;

chains.node_b.chain_driver().assert_eventual_wallet_amount(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@ impl TestOverrides for IcaOrderedChannelTest {
impl BinaryChannelTest for IcaOrderedChannelTest {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
relayer: RelayerDriver,
chains: ConnectedChains<ChainA, ChainB>,
channel: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(config.native_token(0)));
let connection_b_to_a = channel.connection.clone().flip();
let (wallet, channel_id, port_id) =
register_interchain_account(&chains.node_b, chains.handle_b(), &connection_b_to_a)?;
Expand Down Expand Up @@ -113,6 +115,7 @@ impl BinaryChannelTest for IcaOrderedChannelTest {
&chains.node_a.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_a.with_amount(1200u64).as_ref(),
)?;

chains.node_a.chain_driver().assert_eventual_wallet_amount(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ impl TestOverrides for InterchainSecurityIcaTransferTest {
impl BinaryChannelTest for InterchainSecurityIcaTransferTest {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
_relayer: RelayerDriver,
chains: ConnectedChains<ChainA, ChainB>,
channel: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(config.native_token(0)));
let connection_b_to_a = channel.connection.clone().flip();
let (wallet, channel_id, port_id) =
register_interchain_account(&chains.node_b, chains.handle_b(), &connection_b_to_a)?;
Expand Down Expand Up @@ -86,6 +88,7 @@ impl BinaryChannelTest for InterchainSecurityIcaTransferTest {
&chains.node_a.wallets().user1(),
&ica_address.as_ref(),
&stake_denom.with_amount(ica_fund).as_ref(),
&fee_denom_a.with_amount(1200u64).as_ref(),
)?;

chains.node_a.chain_driver().assert_eventual_wallet_amount(
Expand Down
10 changes: 8 additions & 2 deletions tools/integration-test/src/tests/supervisor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ impl TestOverrides for SupervisorTest {
impl BinaryChainTest for SupervisorTest {
fn run<ChainA: ChainHandle, ChainB: ChainHandle>(
&self,
_config: &TestConfig,
config: &TestConfig,
_relayer: RelayerDriver,
chains: ConnectedChains<ChainA, ChainB>,
) -> Result<(), Error> {
let fee_denom_a: MonoTagged<ChainA, Denom> =
MonoTagged::new(Denom::base(config.native_token(0)));
let fee_denom_b: MonoTagged<ChainB, Denom> =
MonoTagged::new(Denom::base(config.native_token(1)));
let (connection_id_b, _) = init_connection(
&chains.handle_a,
&chains.handle_b,
Expand Down Expand Up @@ -112,12 +116,14 @@ impl BinaryChainTest for SupervisorTest {
&chains.node_a.wallets().relayer(),
&chains.node_a.wallets().user2().address(),
&denom_a.with_amount(1000u64).as_ref(),
&fee_denom_a.with_amount(1200u64).as_ref(),
)?;

chains.node_b.chain_driver().local_transfer_token(
&chains.node_b.wallets().relayer(),
&chains.node_b.wallets().user2().address(),
&chains.node_b.denom().with_amount(1000u64).as_ref(),
&fee_denom_b.with_amount(1200u64).as_ref(),
)?;

info!(
Expand Down Expand Up @@ -193,7 +199,7 @@ impl BinaryChannelTest for SupervisorScanTest {
channels: ConnectedChannel<ChainA, ChainB>,
) -> Result<(), Error> {
let denom_a = chains.node_a.denom();
let fee_denom_a = MonoTagged::new(Denom::base(&config.native_tokens[0]));
let fee_denom_a = MonoTagged::new(Denom::base(config.native_token(0)));

let denom_b = derive_ibc_denom(
&channels.port_b.as_ref(),
Expand Down
3 changes: 3 additions & 0 deletions tools/test-framework/src/chain/cli/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub fn local_transfer_token(
sender: &str,
recipient: &str,
token: &str,
fees: &str,
) -> Result<(), Error> {
simple_exec(
chain_id,
Expand All @@ -32,6 +33,8 @@ pub fn local_transfer_token(
home_path,
"--keyring-backend",
"test",
"--fees",
fees,
"--yes",
],
)?;
Expand Down
Loading
Loading