Skip to content

Commit

Permalink
chore: unify fallback events (#5513)
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-llimos authored Dec 20, 2024
1 parent 5a9a98e commit 05a4bbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions state-chain/cf-integration-tests/src/swapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,7 @@ fn can_handle_failed_vault_transfer() {
amount,
destination_address,
broadcast_id,
egress_details: None,
},
));
testnet.move_forward_blocks(11);
Expand Down
17 changes: 10 additions & 7 deletions state-chain/pallets/cf-ingress-egress/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ pub mod pallet {
amount: TargetChainAmount<T, I>,
destination_address: TargetChainAccount<T, I>,
broadcast_id: BroadcastId,
egress_details: Option<ScheduledEgressDetails<T::TargetChain>>,
},
/// A CCM has failed to broadcast.
CcmBroadcastFailed {
Expand Down Expand Up @@ -871,10 +872,6 @@ pub mod pallet {
account_id: T::AccountId,
tx_id: TransactionInIdFor<T, I>,
},
CcmFallbackScheduled {
broadcast_id: BroadcastId,
egress_details: ScheduledEgressDetails<T::TargetChain>,
},
TransactionRejectedByBroker {
broadcast_id: BroadcastId,
tx_id: <T::TargetChain as Chain>::DepositDetails,
Expand Down Expand Up @@ -1230,6 +1227,7 @@ pub mod pallet {
amount,
destination_address,
broadcast_id,
egress_details: None,
});
},
// The only way this can fail is if the target chain is unsupported, which should
Expand Down Expand Up @@ -2738,15 +2736,20 @@ impl<T: Config<I>, I: 'static> Pallet<T, I> {
broadcast_id: BroadcastId,
fallback: TransferAssetParams<T::TargetChain>,
) {
// let destination_address = fallback.to.clone();

match Self::schedule_egress(
fallback.asset,
fallback.amount,
fallback.to,
fallback.to.clone(),
None,
) {
Ok(egress_details) => Self::deposit_event(Event::<T, I>::CcmFallbackScheduled {
Ok(egress_details) => Self::deposit_event(Event::<T, I>::TransferFallbackRequested {
asset: fallback.asset,
amount: fallback.amount,
destination_address: fallback.to,
broadcast_id,
egress_details,
egress_details: Some(egress_details),
}),
Err(e) => log::error!("Ccm fallback failed to schedule the fallback egress: Target chain: {:?}, broadcast_id: {:?}, error: {:?}", T::TargetChain::get(), broadcast_id, e),
}
Expand Down
1 change: 1 addition & 0 deletions state-chain/pallets/cf-ingress-egress/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,7 @@ fn can_store_failed_vault_transfers() {
amount,
destination_address,
broadcast_id,
egress_details: None,
},
));
assert_eq!(
Expand Down

0 comments on commit 05a4bbc

Please sign in to comment.