From b6d21fccd50c9bb052e2d2b750155c4a9ceca3ad Mon Sep 17 00:00:00 2001 From: Marian Vanderka Date: Thu, 5 Dec 2024 14:29:04 +0100 Subject: [PATCH] adds a check that only single ferry can happen on a deposit request --- pallets/rolldown/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pallets/rolldown/src/lib.rs b/pallets/rolldown/src/lib.rs index 6c598a7e9..2a6d769f9 100644 --- a/pallets/rolldown/src/lib.rs +++ b/pallets/rolldown/src/lib.rs @@ -525,6 +525,8 @@ pub mod pallet { UninitializedChainId, // Asset can be withdrawn only to sender's address NontransferableToken, + // the deposit was already ferried + AlreadyFerried, } #[cfg(feature = "runtime-benchmarks")] @@ -1843,6 +1845,11 @@ impl Pallet { return Err(Error::::AlreadyExecuted); } + ensure!( + !FerriedDeposits::::contains_key((chain, deposit_hash)), + Error::::AlreadyFerried + ); + let amount = deposit .amount .checked_sub(deposit.ferryTip)