diff --git a/core/bin/zksync_core/src/eth_watch/client.rs b/core/bin/zksync_core/src/eth_watch/client.rs index 0f1e87a72b..4defc1f2f7 100644 --- a/core/bin/zksync_core/src/eth_watch/client.rs +++ b/core/bin/zksync_core/src/eth_watch/client.rs @@ -15,7 +15,6 @@ use zksync_types::{ethereum::CompleteWithdrawalsTx, Address, Nonce, PriorityOp, struct ContractTopics { new_priority_request: Hash, - complete_withdrawals_event: Hash, } impl ContractTopics { @@ -25,11 +24,6 @@ impl ContractTopics { .event("NewPriorityRequest") .expect("main contract abi error") .signature(), - - complete_withdrawals_event: zksync_contract - .event("PendingWithdrawalsComplete") - .expect("main contract abi error") - .signature(), } } } @@ -41,15 +35,8 @@ pub trait EthClient { from: BlockNumber, to: BlockNumber, ) -> anyhow::Result>; - async fn get_complete_withdrawals_event( - &self, - from: BlockNumber, - to: BlockNumber, - ) -> anyhow::Result>; async fn block_number(&self) -> anyhow::Result; async fn get_auth_fact(&self, address: Address, nonce: Nonce) -> anyhow::Result>; - async fn get_first_pending_withdrawal_index(&self) -> anyhow::Result; - async fn get_number_of_pending_withdrawals(&self) -> anyhow::Result; } pub struct EthHttpClient { @@ -116,24 +103,6 @@ impl EthClient for EthHttpClient { result } - async fn get_complete_withdrawals_event( - &self, - from: BlockNumber, - to: BlockNumber, - ) -> anyhow::Result> { - let start = Instant::now(); - - let result = self - .get_events(from, to, vec![self.topics.complete_withdrawals_event]) - .await; - - metrics::histogram!( - "eth_watcher.get_complete_withdrawals_event", - start.elapsed() - ); - result - } - async fn block_number(&self) -> anyhow::Result { Ok(self.web3.eth().block_number().await?.as_u64()) } @@ -150,35 +119,4 @@ impl EthClient for EthHttpClient { .await .map_err(|e| format_err!("Failed to query contract authFacts: {}", e)) } - - async fn get_first_pending_withdrawal_index(&self) -> anyhow::Result { - self.zksync_contract - .query( - "firstPendingWithdrawalIndex", - (), - None, - Options::default(), - None, - ) - .await - .map_err(|e| { - format_err!( - "Failed to query contract firstPendingWithdrawalIndex: {}", - e - ) - }) - } - - async fn get_number_of_pending_withdrawals(&self) -> anyhow::Result { - self.zksync_contract - .query( - "numberOfPendingWithdrawals", - (), - None, - Options::default(), - None, - ) - .await - .map_err(|e| format_err!("Failed to query contract numberOfPendingWithdrawals: {}", e)) - } } diff --git a/core/bin/zksync_core/src/eth_watch/tests.rs b/core/bin/zksync_core/src/eth_watch/tests.rs index f775b219bd..2e4488c892 100644 --- a/core/bin/zksync_core/src/eth_watch/tests.rs +++ b/core/bin/zksync_core/src/eth_watch/tests.rs @@ -104,22 +104,6 @@ impl EthClient for FakeEthClient { Ok(operations) } - async fn get_complete_withdrawals_event( - &self, - from: BlockNumber, - to: BlockNumber, - ) -> Result, anyhow::Error> { - let from = self.block_to_number(&from).await; - let to = self.block_to_number(&to).await; - let mut withdrawals = vec![]; - for number in from..=to { - if let Some(ops) = self.inner.read().await.withdrawals.get(&number) { - withdrawals.extend_from_slice(ops); - } - } - Ok(withdrawals) - } - async fn block_number(&self) -> Result { Ok(self.inner.read().await.last_block_number) } @@ -131,14 +115,6 @@ impl EthClient for FakeEthClient { ) -> Result, anyhow::Error> { unreachable!() } - - async fn get_first_pending_withdrawal_index(&self) -> Result { - unreachable!() - } - - async fn get_number_of_pending_withdrawals(&self) -> Result { - unreachable!() - } } fn create_watcher(client: T) -> EthWatch {