diff --git a/core/bin/zksync_forced_exit_requests/src/eth_watch.rs b/core/bin/zksync_forced_exit_requests/src/eth_watch.rs index fd8259ff48..90f1719407 100644 --- a/core/bin/zksync_forced_exit_requests/src/eth_watch.rs +++ b/core/bin/zksync_forced_exit_requests/src/eth_watch.rs @@ -307,9 +307,13 @@ where return; }; + let block_to_watch_from = self + .last_viewed_block + .saturating_sub(self.config.forced_exit_requests.blocks_check_amount); + let events = self .eth_client - .get_funds_received_events(self.last_viewed_block + 1, last_confirmed_block) + .get_funds_received_events(block_to_watch_from, last_confirmed_block) .await; let events = match events { diff --git a/core/lib/config/src/configs/forced_exit_requests.rs b/core/lib/config/src/configs/forced_exit_requests.rs index 92c5051354..2d5243f271 100644 --- a/core/lib/config/src/configs/forced_exit_requests.rs +++ b/core/lib/config/src/configs/forced_exit_requests.rs @@ -26,6 +26,7 @@ struct ForcedExitRequestsInternalConfig { pub sender_eth_private_key: H256, pub sender_account_address: Address, pub expiration_period: u64, + pub blocks_check_amount: u64, pub eth_node_poll_interval: u64, } @@ -42,6 +43,7 @@ pub struct ForcedExitRequestsConfig { pub sender_eth_private_key: H256, pub sender_account_address: Address, pub expiration_period: u64, + pub blocks_check_amount: u64, pub eth_node_poll_interval: u64, } @@ -83,6 +85,7 @@ impl ForcedExitRequestsConfig { sender_eth_private_key: config.sender_eth_private_key, sender_account_address: config.sender_account_address, expiration_period: config.expiration_period, + blocks_check_amount: config.blocks_check_amount, eth_node_poll_interval: config.eth_node_poll_interval, } } diff --git a/etc/env/base/forced_exit_requests.toml b/etc/env/base/forced_exit_requests.toml index e0494ef16c..9e4d334701 100644 --- a/etc/env/base/forced_exit_requests.toml +++ b/etc/env/base/forced_exit_requests.toml @@ -37,5 +37,12 @@ withdrawal_threshold=1000000000000000000 # to set the same account as the one that sends the txs for retrieving the fees from the smart contract fee_receiver="0x1963917ba0b44A879cf6248387C1d51A0F11669d" + +# The amount of blocks we look into beyound the waiting confirmations +# Basically this ensures that we do not skip a transaction that has become too old due to a +# reorg +blocks_check_amount=10 + # How often we want to poll the Ethereum node (in milliseconds). eth_node_poll_interval=300 +