Skip to content

Commit

Permalink
add variable to .toml
Browse files Browse the repository at this point in the history
  • Loading branch information
ColoCarletti committed Feb 2, 2024
1 parent 908097d commit 81af06f
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions core/lib/config/src/configs/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
}
Expand Down Expand Up @@ -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<u64>,
pub l1_gas_per_pubdata_byte: u64,
}

impl GasAdjusterConfig {
Expand Down
1 change: 1 addition & 0 deletions core/lib/env_config/src/eth_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
}
Expand Down
2 changes: 0 additions & 2 deletions core/lib/zksync_core/src/fee_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions core/lib/zksync_core/src/l1_gas_price/gas_adjuster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -130,7 +129,7 @@ impl<E: EthInterface> L1GasPriceProvider for GasAdjuster<E> {

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
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions core/lib/zksync_core/src/state_keeper/io/tests/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions etc/env/base/eth_sender.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 81af06f

Please sign in to comment.