From 81af06f9b4c1cc740e0c0154c85e795ea23f7e29 Mon Sep 17 00:00:00 2001 From: Joaquin Carletti Date: Fri, 2 Feb 2024 16:46:43 -0300 Subject: [PATCH] add variable to .toml --- core/lib/config/src/configs/eth_sender.rs | 2 ++ core/lib/env_config/src/eth_sender.rs | 1 + core/lib/zksync_core/src/fee_model.rs | 2 -- core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs | 3 +-- core/lib/zksync_core/src/l1_gas_price/gas_adjuster/tests.rs | 1 + core/lib/zksync_core/src/state_keeper/io/tests/tester.rs | 1 + etc/env/base/eth_sender.toml | 1 + 7 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/lib/config/src/configs/eth_sender.rs b/core/lib/config/src/configs/eth_sender.rs index cd44daed17f..f5b43af7481 100644 --- a/core/lib/config/src/configs/eth_sender.rs +++ b/core/lib/config/src/configs/eth_sender.rs @@ -45,6 +45,7 @@ impl ETHSenderConfig { internal_enforced_l1_gas_price: None, poll_period: 5, max_l1_gas_price: None, + l1_gas_per_pubdata_byte: 17, }, } } @@ -135,6 +136,7 @@ pub struct GasAdjusterConfig { pub poll_period: u64, /// Max number of l1 gas price that is allowed to be used in state keeper. pub max_l1_gas_price: Option, + pub l1_gas_per_pubdata_byte: u64, } impl GasAdjusterConfig { diff --git a/core/lib/env_config/src/eth_sender.rs b/core/lib/env_config/src/eth_sender.rs index f0ee6030b02..c510395c3bb 100644 --- a/core/lib/env_config/src/eth_sender.rs +++ b/core/lib/env_config/src/eth_sender.rs @@ -64,6 +64,7 @@ mod tests { internal_enforced_l1_gas_price: None, poll_period: 15, max_l1_gas_price: Some(100000000), + l1_gas_per_pubdata_byte: 17, }, } } diff --git a/core/lib/zksync_core/src/fee_model.rs b/core/lib/zksync_core/src/fee_model.rs index 2fffd6fc9e5..e6d027cfa4a 100644 --- a/core/lib/zksync_core/src/fee_model.rs +++ b/core/lib/zksync_core/src/fee_model.rs @@ -65,12 +65,10 @@ impl BatchFeeModelInputProvider for MainNodeFeeInputProvider { l1_gas_price: self.provider.estimate_effective_gas_price(), }), FeeModelConfig::V2(config) => { - let validium_mode = std::env::var("VALIDIUM_MODE") == Ok("true".to_owned()); FeeParams::V2(FeeParamsV2 { config, l1_gas_price: self.provider.estimate_effective_gas_price(), l1_pubdata_price: self.provider.estimate_effective_pubdata_price() - * !validium_mode as u64, }) } } diff --git a/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs b/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs index ac5d0413438..97be31c3a49 100644 --- a/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs +++ b/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs @@ -8,7 +8,6 @@ use std::{ use tokio::sync::watch; use zksync_config::GasAdjusterConfig; use zksync_eth_client::{Error, EthInterface}; -use zksync_system_constants::L1_GAS_PER_PUBDATA_BYTE; use self::metrics::METRICS; use super::{L1GasPriceProvider, L1TxParamsProvider}; @@ -130,7 +129,7 @@ impl L1GasPriceProvider for GasAdjuster { fn estimate_effective_pubdata_price(&self) -> u64 { // For now, pubdata is only sent via calldata, so its price is pegged to the L1 gas price. - self.estimate_effective_gas_price() * L1_GAS_PER_PUBDATA_BYTE as u64 + self.estimate_effective_gas_price() * self.config.l1_gas_per_pubdata_byte } } diff --git a/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/tests.rs b/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/tests.rs index 2feb65f1cbd..473b77da98c 100644 --- a/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/tests.rs +++ b/core/lib/zksync_core/src/l1_gas_price/gas_adjuster/tests.rs @@ -44,6 +44,7 @@ async fn kept_updated() { internal_enforced_l1_gas_price: None, poll_period: 5, max_l1_gas_price: None, + l1_gas_per_pubdata_byte: 17, }, ) .await diff --git a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs index 27261f4e36c..ce41a1e9fb1 100644 --- a/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs +++ b/core/lib/zksync_core/src/state_keeper/io/tests/tester.rs @@ -52,6 +52,7 @@ impl Tester { internal_enforced_l1_gas_price: None, poll_period: 10, max_l1_gas_price: None, + l1_gas_per_pubdata_byte: 17, }; GasAdjuster::new(eth_client, gas_adjuster_config) diff --git a/etc/env/base/eth_sender.toml b/etc/env/base/eth_sender.toml index bfea2d2479b..b3cfcbd3295 100644 --- a/etc/env/base/eth_sender.toml +++ b/etc/env/base/eth_sender.toml @@ -63,3 +63,4 @@ internal_l1_pricing_multiplier=0.8 # Node polling period in seconds. poll_period=5 internal_enforced_l1_gas_price=45_000_000_000 +l1_gas_per_pubdata_byte=0