From 4fa7cc2da1601f3a4f32123d9fadade403afdbb8 Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Mon, 25 Mar 2024 19:26:59 -0700 Subject: [PATCH 1/3] ibc: use outbound_ics20_transfers_enabled chain parameter --- crates/core/app/src/action_handler/actions.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/core/app/src/action_handler/actions.rs b/crates/core/app/src/action_handler/actions.rs index 6262b7382d..f96ca58d26 100644 --- a/crates/core/app/src/action_handler/actions.rs +++ b/crates/core/app/src/action_handler/actions.rs @@ -116,7 +116,19 @@ impl AppActionHandler for Action { .execute(state) .await } - Action::Ics20Withdrawal(action) => action.check_and_execute(state).await, + Action::Ics20Withdrawal(action) => { + // SAFETY: this is safe to check in parallel because IBC enablement cannot + // change during transaction execution. + if !state + .get_ibc_params() + .await? + .outbound_ics20_transfers_enabled + { + anyhow::bail!("transaction contains IBC actions, but IBC is not enabled"); + } + + action.check_and_execute(state).await + } Action::CommunityPoolSpend(action) => action.check_and_execute(state).await, Action::CommunityPoolOutput(action) => action.check_and_execute(state).await, Action::CommunityPoolDeposit(action) => action.check_and_execute(state).await, From c2c28ed398433920707f4fe844dfc163e746227d Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Tue, 26 Mar 2024 11:59:44 -0700 Subject: [PATCH 2/3] move outbound_ics20_transfers_enable to check_historical --- crates/core/app/src/action_handler/actions.rs | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/crates/core/app/src/action_handler/actions.rs b/crates/core/app/src/action_handler/actions.rs index f96ca58d26..b9868912f5 100644 --- a/crates/core/app/src/action_handler/actions.rs +++ b/crates/core/app/src/action_handler/actions.rs @@ -84,7 +84,18 @@ impl AppActionHandler for Action { .check_stateful(state) .await } - Action::Ics20Withdrawal(action) => action.check_historical(state).await, + Action::Ics20Withdrawal(action) => { + // SAFETY: this is safe to check in parallel because IBC enablement cannot + // change during transaction execution. + if !state + .get_ibc_params() + .await? + .outbound_ics20_transfers_enabled + { + anyhow::bail!("transaction contains IBC actions, but IBC is not enabled"); + } + action.check_historical(state).await + } Action::CommunityPoolSpend(action) => action.check_historical(state).await, Action::CommunityPoolOutput(action) => action.check_historical(state).await, Action::CommunityPoolDeposit(action) => action.check_historical(state).await, @@ -116,19 +127,7 @@ impl AppActionHandler for Action { .execute(state) .await } - Action::Ics20Withdrawal(action) => { - // SAFETY: this is safe to check in parallel because IBC enablement cannot - // change during transaction execution. - if !state - .get_ibc_params() - .await? - .outbound_ics20_transfers_enabled - { - anyhow::bail!("transaction contains IBC actions, but IBC is not enabled"); - } - - action.check_and_execute(state).await - } + Action::Ics20Withdrawal(action) => action.check_and_execute(state).await, Action::CommunityPoolSpend(action) => action.check_and_execute(state).await, Action::CommunityPoolOutput(action) => action.check_and_execute(state).await, Action::CommunityPoolDeposit(action) => action.check_and_execute(state).await, From 8c64a2be0c49d49cb512a909211346c7ffd10f2b Mon Sep 17 00:00:00 2001 From: Ava Howell Date: Tue, 26 Mar 2024 12:02:02 -0700 Subject: [PATCH 3/3] fix error text --- crates/core/app/src/action_handler/actions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/core/app/src/action_handler/actions.rs b/crates/core/app/src/action_handler/actions.rs index b9868912f5..4bc74f331e 100644 --- a/crates/core/app/src/action_handler/actions.rs +++ b/crates/core/app/src/action_handler/actions.rs @@ -92,7 +92,7 @@ impl AppActionHandler for Action { .await? .outbound_ics20_transfers_enabled { - anyhow::bail!("transaction contains IBC actions, but IBC is not enabled"); + anyhow::bail!("transaction an ICS20 withdrawal, but outbound ICS20 withdrawals are not enabled"); } action.check_historical(state).await }