From 5f05e2e2ba412a9660071af8718845e10c375a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Costin=20Caraba=C8=99?= Date: Mon, 9 Dec 2024 17:52:49 +0200 Subject: [PATCH] bridge-proxy: Remove cooldown from refund --- bridge-proxy/src/bridge-proxy.rs | 10 +--------- bridge-proxy/tests/bridge_proxy_blackbox_test.rs | 11 ----------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/bridge-proxy/src/bridge-proxy.rs b/bridge-proxy/src/bridge-proxy.rs index bb041f3b..d97d8050 100644 --- a/bridge-proxy/src/bridge-proxy.rs +++ b/bridge-proxy/src/bridge-proxy.rs @@ -9,7 +9,6 @@ use transaction::{CallData, EthTransaction}; const MIN_GAS_LIMIT_FOR_SC_CALL: u64 = 10_000_000; const MAX_GAS_LIMIT_FOR_SC_CALL: u64 = 249999999; const DEFAULT_GAS_LIMIT_FOR_REFUND_CALLBACK: u64 = 20_000_000; // 20 million -const DELAY_BEFORE_OWNER_CAN_REFUND_TRANSACTION: u64 = 300; #[multiversx_sc::contract] pub trait BridgeProxyContract: @@ -113,13 +112,6 @@ pub trait BridgeProxyContract: #[endpoint(executeRefundTransaction)] fn execute_refund_transaction(&self, tx_id: usize) { - let tx_start_round = self.ongoing_execution(tx_id).get(); - let current_block_round = self.blockchain().get_block_round(); - require!( - current_block_round - tx_start_round > DELAY_BEFORE_OWNER_CAN_REFUND_TRANSACTION, - "Refund executed too early!" - ); - let tx = self.get_refund_transaction_by_id(tx_id); let esdt_safe_contract_address = self.get_esdt_safe_address(); let unwrapped_token = self.unwrap_token(&tx.token_id, tx_id); @@ -184,10 +176,10 @@ pub trait BridgeProxyContract: } fn finish_refund(&self, tx_id: usize) { - self.refund_transactions().remove(&tx_id); self.ongoing_execution(tx_id).clear(); self.payments(tx_id).clear(); self.batch_id(tx_id).clear(); + self.refund_transactions().remove(&tx_id); } fn add_pending_tx_to_refund(&self, tx_id: usize) { diff --git a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs index ec8dd809..641a3dcf 100644 --- a/bridge-proxy/tests/bridge_proxy_blackbox_test.rs +++ b/bridge-proxy/tests/bridge_proxy_blackbox_test.rs @@ -955,17 +955,6 @@ fn bridge_proxy_refund_tx_test() { .check_account(USER_ADDRESS) .esdt_balance(BRIDGE_TOKEN_ID, BigUint::from(INITIAL_BALANCE)); - test.world - .tx() - .from(USER_ADDRESS) - .to(BRIDGE_PROXY_ADDRESS) - .typed(bridge_proxy_contract_proxy::BridgeProxyContractProxy) - .execute_refund_transaction(1u32) - .returns(ExpectError(4, "Refund executed too early!")) - .run(); - - test.set_block_round(DELAY_BEFORE_OWNER_CAN_REFUND_TRANSACTION + 1); - test.world .tx() .from(USER_ADDRESS)