From 50b0e2235fcd252acfabecae6a5a86178845c8c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Grze=C5=9Bkiewicz?= Date: Wed, 26 Jun 2024 15:06:53 +0200 Subject: [PATCH] fix(eth-sender): revert commit changing which type of txs we resend first (#2327) Signed-off-by: tomg10 --- core/node/eth_sender/src/eth_tx_manager.rs | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/core/node/eth_sender/src/eth_tx_manager.rs b/core/node/eth_sender/src/eth_tx_manager.rs index 44759728d7c..a69c5265133 100644 --- a/core/node/eth_sender/src/eth_tx_manager.rs +++ b/core/node/eth_sender/src/eth_tx_manager.rs @@ -250,35 +250,49 @@ impl EthTxManager { .l1_interface .get_operator_nonce(l1_block_numbers) .await?; + + let non_blob_tx_to_resend = self + .apply_inflight_txs_statuses_and_get_first_to_resend( + storage, + l1_block_numbers, + operator_nonce, + None, + ) + .await?; + let blobs_operator_nonce = self .l1_interface .get_blobs_operator_nonce(l1_block_numbers) .await?; let blobs_operator_address = self.l1_interface.get_blobs_operator_account(); + let mut blob_tx_to_resend = None; if let Some(blobs_operator_nonce) = blobs_operator_nonce { // need to check if both nonce and address are `Some` if blobs_operator_address.is_none() { panic!("blobs_operator_address has to be set its nonce is known; qed"); } - if let Some(res) = self - .monitor_inflight_transactions_inner( + blob_tx_to_resend = self + .apply_inflight_txs_statuses_and_get_first_to_resend( storage, l1_block_numbers, blobs_operator_nonce, blobs_operator_address, ) - .await? - { - return Ok(Some(res)); - } + .await?; } - self.monitor_inflight_transactions_inner(storage, l1_block_numbers, operator_nonce, None) - .await + // We have to resend non-blob transactions first, otherwise in case of a temporary + // spike in activity, all Execute and PublishProof would need to wait until all commit txs + // are sent, which may take some time. We treat them as if they had higher priority. + if non_blob_tx_to_resend.is_some() { + Ok(non_blob_tx_to_resend) + } else { + Ok(blob_tx_to_resend) + } } - async fn monitor_inflight_transactions_inner( + async fn apply_inflight_txs_statuses_and_get_first_to_resend( &mut self, storage: &mut Connection<'_, Core>, l1_block_numbers: L1BlockNumbers,