Skip to content

Commit

Permalink
move outbound_ics20_transfers_enable to check_historical
Browse files Browse the repository at this point in the history
  • Loading branch information
avahowell committed Mar 26, 2024
1 parent 4fa7cc2 commit c2c28ed
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions crates/core/app/src/action_handler/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit c2c28ed

Please sign in to comment.