diff --git a/core/lib/dal/src/eth_sender_dal.rs b/core/lib/dal/src/eth_sender_dal.rs index c76547422d8f..2266d6fb60f9 100644 --- a/core/lib/dal/src/eth_sender_dal.rs +++ b/core/lib/dal/src/eth_sender_dal.rs @@ -413,8 +413,8 @@ impl EthSenderDal<'_, '_> { WHERE id = $2 "#, - eth_tx_id as i32, chain_id as i64, + eth_tx_id as i32, ) .execute(self.storage.conn()) .await?; diff --git a/core/node/eth_sender/src/eth_tx_aggregator.rs b/core/node/eth_sender/src/eth_tx_aggregator.rs index 7d6a6b234742..7f304e2f72b7 100644 --- a/core/node/eth_sender/src/eth_tx_aggregator.rs +++ b/core/node/eth_sender/src/eth_tx_aggregator.rs @@ -383,8 +383,14 @@ impl EthTxAggregator { ); return Ok(()); } + let is_gateway = self.settlement_mode.is_gateway(); let tx = self - .save_eth_tx(storage, &agg_op, contracts_are_pre_shared_bridge, false) + .save_eth_tx( + storage, + &agg_op, + contracts_are_pre_shared_bridge, + is_gateway, + ) .await?; Self::report_eth_tx_saving(storage, &agg_op, &tx).await; } @@ -556,9 +562,9 @@ impl EthTxAggregator { // We may be using a custom sender for commit transactions, so use this // var whatever it actually is: a `None` for single-addr operator or `Some` // for multi-addr operator in 4844 mode. - let sender_addr = match op_type { - AggregatedActionType::Commit => self.custom_commit_sender_addr, - _ => None, + let sender_addr = match (op_type, is_gateway) { + (AggregatedActionType::Commit, false) => self.custom_commit_sender_addr, + (_, _) => None, }; let nonce = self.get_next_nonce(&mut transaction, sender_addr).await?; let encoded_aggregated_op = diff --git a/core/node/eth_sender/src/eth_tx_manager.rs b/core/node/eth_sender/src/eth_tx_manager.rs index a97aed88a0a5..0d78ab71c62d 100644 --- a/core/node/eth_sender/src/eth_tx_manager.rs +++ b/core/node/eth_sender/src/eth_tx_manager.rs @@ -49,13 +49,18 @@ impl EthTxManager { gas_adjuster, max_acceptable_priority_fee_in_gwei: config.max_acceptable_priority_fee_in_gwei, }; + let l1_interface = Box::new(RealL1Interface { + ethereum_gateway, + ethereum_gateway_blobs, + l2_gateway, + wait_confirmations: config.wait_confirmations, + }); + tracing::info!( + "Started eth_tx_manager supporting {:?} operators", + l1_interface.supported_operator_types() + ); Self { - l1_interface: Box::new(RealL1Interface { - ethereum_gateway, - ethereum_gateway_blobs, - l2_gateway, - wait_confirmations: config.wait_confirmations, - }), + l1_interface, config, fees_oracle: Box::new(fees_oracle), pool, @@ -257,10 +262,10 @@ impl EthTxManager { } pub(crate) fn operator_address(&self, operator_type: OperatorType) -> Option
{ - if operator_type == OperatorType::NonBlob { - None - } else { + if operator_type == OperatorType::Blob { self.l1_interface.get_blobs_operator_account() + } else { + None } } // Monitors the in-flight transactions, marks mined ones as confirmed, @@ -519,9 +524,10 @@ impl EthTxManager { tracing::info!("Stop signal received, eth_tx_manager is shutting down"); break; } + let operator_to_track = self.l1_interface.supported_operator_types()[0]; let l1_block_numbers = self .l1_interface - .get_l1_block_numbers(OperatorType::Blob) + .get_l1_block_numbers(operator_to_track) .await?; METRICS.track_block_numbers(&l1_block_numbers); @@ -643,7 +649,7 @@ impl EthTxManager { .get_l1_block_numbers(operator_type) .await .unwrap(); - tracing::info!( + tracing::debug!( "Loop iteration at block {} for {operator_type:?} operator", l1_block_numbers.latest ); diff --git a/core/node/fee_model/src/l1_gas_price/gas_adjuster/mod.rs b/core/node/fee_model/src/l1_gas_price/gas_adjuster/mod.rs index 4ed9cf1330ea..e6842b92fdba 100644 --- a/core/node/fee_model/src/l1_gas_price/gas_adjuster/mod.rs +++ b/core/node/fee_model/src/l1_gas_price/gas_adjuster/mod.rs @@ -86,7 +86,7 @@ impl GasAdjuster { anyhow::ensure!( matches!(pubdata_sending_mode, PubdataSendingMode::RelayedL2Calldata), - "Only relayed L2 calldata is available for L2 mode" + "Only relayed L2 calldata is available for L2 mode, got: {pubdata_sending_mode:?}" ); } else { anyhow::ensure!(!client.gateway_mode, "Must be L1 client in L1 mode"); diff --git a/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs b/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs index cfe701326bd6..310580aeb3a3 100644 --- a/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs +++ b/core/node/node_framework/src/implementations/layers/eth_sender/aggregator.rs @@ -8,10 +8,7 @@ use zksync_types::{commitment::L1BatchCommitmentMode, settlement::SettlementMode use crate::{ implementations::resources::{ circuit_breakers::CircuitBreakersResource, - eth_interface::{ - BoundEthInterfaceForBlobsResource, BoundEthInterfaceForL2Resource, - BoundEthInterfaceResource, - }, + eth_interface::{BoundEthInterfaceForBlobsResource, BoundEthInterfaceResource}, object_store::ObjectStoreResource, pools::{MasterPool, PoolResource, ReplicaPool}, }, @@ -55,7 +52,6 @@ pub struct Input { pub replica_pool: PoolResource, pub eth_client: Option, pub eth_client_blobs: Option, - pub eth_client_l2: Option, pub object_store: ObjectStoreResource, #[context(default)] pub circuit_breakers: CircuitBreakersResource, @@ -100,11 +96,6 @@ impl WiringLayer for EthTxAggregatorLayer { let master_pool = input.master_pool.get().await.unwrap(); let replica_pool = input.replica_pool.get().await.unwrap(); - let eth_client = if self.settlement_mode.is_gateway() { - input.eth_client_l2.context("l2_client must be provided")?.0 - } else { - input.eth_client.context("l1_client must be provided")?.0 - }; let eth_client_blobs = input.eth_client_blobs.map(|c| c.0); let object_store = input.object_store.0; @@ -125,7 +116,7 @@ impl WiringLayer for EthTxAggregatorLayer { master_pool.clone(), config.clone(), aggregator, - eth_client.clone(), + input.eth_client.unwrap().0, self.contracts_config.validator_timelock_addr, self.contracts_config.l1_multicall3_addr, self.contracts_config.diamond_proxy_addr, diff --git a/core/node/node_framework/src/implementations/layers/eth_sender/manager.rs b/core/node/node_framework/src/implementations/layers/eth_sender/manager.rs index d6989d8db72b..5462fa575f94 100644 --- a/core/node/node_framework/src/implementations/layers/eth_sender/manager.rs +++ b/core/node/node_framework/src/implementations/layers/eth_sender/manager.rs @@ -6,10 +6,7 @@ use zksync_eth_sender::EthTxManager; use crate::{ implementations::resources::{ circuit_breakers::CircuitBreakersResource, - eth_interface::{ - BoundEthInterfaceForBlobsResource, BoundEthInterfaceForL2Resource, - BoundEthInterfaceResource, - }, + eth_interface::{BoundEthInterfaceForBlobsResource, BoundEthInterfaceResource}, gas_adjuster::GasAdjusterResource, pools::{MasterPool, PoolResource, ReplicaPool}, }, @@ -48,7 +45,6 @@ pub struct Input { pub replica_pool: PoolResource, pub eth_client: BoundEthInterfaceResource, pub eth_client_blobs: Option, - pub l2_client: Option, pub gas_adjuster: GasAdjusterResource, #[context(default)] pub circuit_breakers: CircuitBreakersResource, @@ -81,9 +77,10 @@ impl WiringLayer for EthTxManagerLayer { let master_pool = input.master_pool.get().await.unwrap(); let replica_pool = input.replica_pool.get().await.unwrap(); - let eth_client = input.eth_client.0; + let settlement_mode = self.eth_sender_config.gas_adjuster.unwrap().settlement_mode; + let eth_client = input.eth_client.0.clone(); let eth_client_blobs = input.eth_client_blobs.map(|c| c.0); - let l2_client = input.l2_client.map(|c| c.0); + let l2_client = input.eth_client.0; let config = self.eth_sender_config.sender.context("sender")?; @@ -93,9 +90,21 @@ impl WiringLayer for EthTxManagerLayer { master_pool, config, gas_adjuster, - Some(eth_client), - eth_client_blobs, - l2_client, + if !settlement_mode.is_gateway() { + Some(eth_client) + } else { + None + }, + if !settlement_mode.is_gateway() { + eth_client_blobs + } else { + None + }, + if settlement_mode.is_gateway() { + Some(l2_client) + } else { + None + }, ); // Insert circuit breaker.