From 3da4f795babff984cfede7c37cb470a884861345 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Wed, 18 Dec 2024 13:09:13 +0100 Subject: [PATCH] return old config name --- core/lib/config/src/configs/eth_sender.rs | 16 ++++++++++------ core/lib/config/src/testonly.rs | 4 ++-- core/lib/env_config/src/eth_sender.rs | 4 ++-- core/lib/protobuf_config/src/eth.rs | 10 +++++----- .../src/proto/config/eth_sender.proto | 4 ++-- .../src/l1_gas_price/gas_adjuster/mod.rs | 4 ++-- .../src/l1_gas_price/gas_adjuster/tests.rs | 4 ++-- core/node/fee_model/src/lib.rs | 2 +- core/node/state_keeper/src/io/tests/tester.rs | 4 ++-- docs/src/guides/advanced/07_fee_model.md | 4 ++-- etc/env/base/eth_sender.toml | 2 +- etc/env/file_based/general.yaml | 2 +- etc/env/file_based/overrides/mainnet.yaml | 2 +- etc/env/file_based/overrides/testnet.yaml | 2 +- .../src/commands/chain/gateway_upgrade.rs | 9 --------- 15 files changed, 34 insertions(+), 39 deletions(-) diff --git a/core/lib/config/src/configs/eth_sender.rs b/core/lib/config/src/configs/eth_sender.rs index f9ccd178952a..66bbc5a77835 100644 --- a/core/lib/config/src/configs/eth_sender.rs +++ b/core/lib/config/src/configs/eth_sender.rs @@ -50,8 +50,8 @@ impl EthConfig { max_base_fee_samples: 10000, pricing_formula_parameter_a: 1.5, pricing_formula_parameter_b: 1.0005, - internal_sl_pricing_multiplier: 0.8, - internal_enforced_sl_gas_price: None, + internal_l1_pricing_multiplier: 0.8, + internal_enforced_l1_gas_price: None, internal_enforced_pubdata_price: None, poll_period: 5, max_l1_gas_price: None, @@ -196,10 +196,14 @@ pub struct GasAdjusterConfig { /// Parameter of the transaction base_fee_per_gas pricing formula #[serde(default = "GasAdjusterConfig::default_pricing_formula_parameter_b")] pub pricing_formula_parameter_b: f64, - /// Parameter by which the base fee will be multiplied for internal purposes - pub internal_sl_pricing_multiplier: f64, - /// If equal to Some(x), then it will always provide `x` as the L1 gas price - pub internal_enforced_sl_gas_price: Option, + /// Parameter by which the base fee will be multiplied for internal purposes. + /// TODO(EVM-920): Note, that while the name says "L1", this same parameter is actually used for + /// any settlement layer. + pub internal_l1_pricing_multiplier: f64, + /// If equal to Some(x), then it will always provide `x` as the L1 gas price. + /// TODO(EVM-920): Note, that while the name says "L1", this same parameter is actually used for + /// any settlement layer. + pub internal_enforced_l1_gas_price: Option, /// If equal to Some(x), then it will always provide `x` as the pubdata price pub internal_enforced_pubdata_price: Option, /// Node polling period in seconds diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index 4b2a162369cb..97ca6e4835f4 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -433,8 +433,8 @@ impl Distribution for EncodeDist { max_base_fee_samples: self.sample(rng), pricing_formula_parameter_a: self.sample(rng), pricing_formula_parameter_b: self.sample(rng), - internal_sl_pricing_multiplier: self.sample(rng), - internal_enforced_sl_gas_price: self.sample(rng), + internal_l1_pricing_multiplier: self.sample(rng), + internal_enforced_l1_gas_price: self.sample(rng), internal_enforced_pubdata_price: self.sample(rng), poll_period: self.sample(rng), max_l1_gas_price: self.sample(rng), diff --git a/core/lib/env_config/src/eth_sender.rs b/core/lib/env_config/src/eth_sender.rs index 17fecda24c85..498aa29e28c3 100644 --- a/core/lib/env_config/src/eth_sender.rs +++ b/core/lib/env_config/src/eth_sender.rs @@ -83,8 +83,8 @@ mod tests { max_base_fee_samples: 10000, pricing_formula_parameter_a: 1.5, pricing_formula_parameter_b: 1.0005, - internal_sl_pricing_multiplier: 0.8, - internal_enforced_sl_gas_price: None, + internal_l1_pricing_multiplier: 0.8, + internal_enforced_l1_gas_price: None, internal_enforced_pubdata_price: None, poll_period: 15, max_l1_gas_price: Some(100000000), diff --git a/core/lib/protobuf_config/src/eth.rs b/core/lib/protobuf_config/src/eth.rs index 0d45dc48f153..ad60273dde20 100644 --- a/core/lib/protobuf_config/src/eth.rs +++ b/core/lib/protobuf_config/src/eth.rs @@ -176,9 +176,9 @@ impl ProtoRepr for proto::GasAdjuster { .unwrap_or(&Self::Type::default_pricing_formula_parameter_a()), pricing_formula_parameter_b: *required(&self.pricing_formula_parameter_b) .unwrap_or(&Self::Type::default_pricing_formula_parameter_b()), - internal_sl_pricing_multiplier: *required(&self.internal_sl_pricing_multiplier) - .context("internal_sl_pricing_multiplier")?, - internal_enforced_sl_gas_price: self.internal_enforced_sl_gas_price, + internal_l1_pricing_multiplier: *required(&self.internal_l1_pricing_multiplier) + .context("internal_l1_pricing_multiplier")?, + internal_enforced_l1_gas_price: self.internal_enforced_l1_gas_price, internal_enforced_pubdata_price: self.internal_enforced_pubdata_price, poll_period: *required(&self.poll_period).context("poll_period")?, max_l1_gas_price: self.max_l1_gas_price, @@ -207,8 +207,8 @@ impl ProtoRepr for proto::GasAdjuster { max_base_fee_samples: Some(this.max_base_fee_samples.try_into().unwrap()), pricing_formula_parameter_a: Some(this.pricing_formula_parameter_a), pricing_formula_parameter_b: Some(this.pricing_formula_parameter_b), - internal_sl_pricing_multiplier: Some(this.internal_sl_pricing_multiplier), - internal_enforced_sl_gas_price: this.internal_enforced_sl_gas_price, + internal_l1_pricing_multiplier: Some(this.internal_l1_pricing_multiplier), + internal_enforced_l1_gas_price: this.internal_enforced_l1_gas_price, internal_enforced_pubdata_price: this.internal_enforced_pubdata_price, poll_period: Some(this.poll_period), max_l1_gas_price: this.max_l1_gas_price, diff --git a/core/lib/protobuf_config/src/proto/config/eth_sender.proto b/core/lib/protobuf_config/src/proto/config/eth_sender.proto index 2437e8bdb86b..4a9bad0acc10 100644 --- a/core/lib/protobuf_config/src/proto/config/eth_sender.proto +++ b/core/lib/protobuf_config/src/proto/config/eth_sender.proto @@ -62,8 +62,8 @@ message GasAdjuster { optional uint64 max_base_fee_samples = 2; // required; optional double pricing_formula_parameter_a = 3; // required optional double pricing_formula_parameter_b = 4; // required - optional double internal_sl_pricing_multiplier = 5; // required - optional uint64 internal_enforced_sl_gas_price = 6; // optional; wei + optional double internal_l1_pricing_multiplier = 5; // required + optional uint64 internal_enforced_l1_gas_price = 6; // optional; wei optional uint64 internal_enforced_pubdata_price = 12; // optional; wei optional uint64 poll_period = 7; // required; s optional uint64 max_l1_gas_price = 8; // optional; wei? 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 80795a90fd3c..6fce46f77225 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 @@ -244,14 +244,14 @@ impl GasAdjuster { /// Returns the sum of base and priority fee, in wei, not considering time in mempool. /// Can be used to get an estimate of current gas price. pub(crate) fn estimate_effective_gas_price(&self) -> u64 { - if let Some(price) = self.config.internal_enforced_sl_gas_price { + if let Some(price) = self.config.internal_enforced_l1_gas_price { return price; } let effective_gas_price = self.get_base_fee(0) + self.get_priority_fee(); let calculated_price = - (self.config.internal_sl_pricing_multiplier * effective_gas_price as f64) as u64; + (self.config.internal_l1_pricing_multiplier * effective_gas_price as f64) as u64; // Bound the price if it's too high. self.bound_gas_price(calculated_price) diff --git a/core/node/fee_model/src/l1_gas_price/gas_adjuster/tests.rs b/core/node/fee_model/src/l1_gas_price/gas_adjuster/tests.rs index 378534456415..ab649e2d7c90 100644 --- a/core/node/fee_model/src/l1_gas_price/gas_adjuster/tests.rs +++ b/core/node/fee_model/src/l1_gas_price/gas_adjuster/tests.rs @@ -64,8 +64,8 @@ fn test_config(settlement_mode: SettlementMode) -> GasAdjusterConfig { max_base_fee_samples: 5, pricing_formula_parameter_a: 1.5, pricing_formula_parameter_b: 1.0005, - internal_sl_pricing_multiplier: 0.8, - internal_enforced_sl_gas_price: None, + internal_l1_pricing_multiplier: 0.8, + internal_enforced_l1_gas_price: None, internal_enforced_pubdata_price: None, poll_period: 5, max_l1_gas_price: None, diff --git a/core/node/fee_model/src/lib.rs b/core/node/fee_model/src/lib.rs index 8b84b4c08d31..380a279cccc1 100644 --- a/core/node/fee_model/src/lib.rs +++ b/core/node/fee_model/src/lib.rs @@ -362,7 +362,7 @@ mod tests { mock.advance_block_number(2); // Ensure we have enough blocks for the fee history let gas_adjuster_config = GasAdjusterConfig { - internal_enforced_sl_gas_price: Some(l1_gas_price), + internal_enforced_l1_gas_price: Some(l1_gas_price), internal_enforced_pubdata_price: Some(l1_pubdata_price), max_base_fee_samples: 1, // Ensure this is less than the number of blocks num_samples_for_blob_base_fee_estimate: 2, diff --git a/core/node/state_keeper/src/io/tests/tester.rs b/core/node/state_keeper/src/io/tests/tester.rs index c66e2dc83cb1..32a746eecdfb 100644 --- a/core/node/state_keeper/src/io/tests/tester.rs +++ b/core/node/state_keeper/src/io/tests/tester.rs @@ -74,8 +74,8 @@ impl Tester { max_base_fee_samples: 10, pricing_formula_parameter_a: 1.0, pricing_formula_parameter_b: 1.0, - internal_sl_pricing_multiplier: 1.0, - internal_enforced_sl_gas_price: None, + internal_l1_pricing_multiplier: 1.0, + internal_enforced_l1_gas_price: None, internal_enforced_pubdata_price: None, poll_period: 10, max_l1_gas_price: None, diff --git a/docs/src/guides/advanced/07_fee_model.md b/docs/src/guides/advanced/07_fee_model.md index 5a53bf746553..4592c5007ea2 100644 --- a/docs/src/guides/advanced/07_fee_model.md +++ b/docs/src/guides/advanced/07_fee_model.md @@ -154,8 +154,8 @@ decentralized, more deterministic rules will be established for this price. The L1 gas price is fetched by querying L1 every 20 seconds. This is managed by the [`GasAdjuster`][gas_adjuster], which calculates the median price from recent blocks and enables more precise price control via the config (for example, -adjusting the price with `internal_sl_pricing_multiplier` or setting a specific value using -`internal_enforced_sl_gas_price`). +adjusting the price with `internal_l1_pricing_multiplier` or setting a specific value using +`internal_enforced_l1_gas_price`). ### Overhead gas diff --git a/etc/env/base/eth_sender.toml b/etc/env/base/eth_sender.toml index 0bacf9509399..29a4a14e9640 100644 --- a/etc/env/base/eth_sender.toml +++ b/etc/env/base/eth_sender.toml @@ -63,6 +63,6 @@ max_base_fee_samples = 10_000 # To confirm, see core/bin/zksync_core/src/eth_sender/gas_adjuster/mod.rs pricing_formula_parameter_a = 1.5 pricing_formula_parameter_b = 1.0005 -internal_sl_pricing_multiplier = 0.8 +internal_l1_pricing_multiplier = 0.8 # Node polling period in seconds. poll_period = 5 diff --git a/etc/env/file_based/general.yaml b/etc/env/file_based/general.yaml index 3297c79ca122..03cb090376b3 100644 --- a/etc/env/file_based/general.yaml +++ b/etc/env/file_based/general.yaml @@ -109,7 +109,7 @@ eth: max_base_fee_samples: 100 pricing_formula_parameter_a: 1.5 pricing_formula_parameter_b: 1.001 - internal_sl_pricing_multiplier: 0.8 + internal_l1_pricing_multiplier: 0.8 num_samples_for_blob_base_fee_estimate: 10 internal_pubdata_pricing_multiplier: 1.0 poll_period: 5 diff --git a/etc/env/file_based/overrides/mainnet.yaml b/etc/env/file_based/overrides/mainnet.yaml index ed628507a30e..847f9ae98aa6 100644 --- a/etc/env/file_based/overrides/mainnet.yaml +++ b/etc/env/file_based/overrides/mainnet.yaml @@ -15,7 +15,7 @@ eth: wait_confirmations: null gas_adjuster: pricing_formula_parameter_a: 1.06 - internal_sl_pricing_multiplier: 1 + internal_l1_pricing_multiplier: 1 internal_pubdata_pricing_multiplier: 1.50 poll_period: 60 watcher: diff --git a/etc/env/file_based/overrides/testnet.yaml b/etc/env/file_based/overrides/testnet.yaml index 141c0baeda9d..4643a963ed7f 100644 --- a/etc/env/file_based/overrides/testnet.yaml +++ b/etc/env/file_based/overrides/testnet.yaml @@ -15,7 +15,7 @@ eth: wait_confirmations: null gas_adjuster: pricing_formula_parameter_a: 1.1 - internal_sl_pricing_multiplier: 1 + internal_l1_pricing_multiplier: 1 poll_period: 60 watcher: confirmations_for_eth_event: 10 diff --git a/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs b/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs index 90a8bf5728c7..1eb67b4b2a17 100644 --- a/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs +++ b/zkstack_cli/crates/zkstack/src/commands/chain/gateway_upgrade.rs @@ -175,15 +175,6 @@ async fn adapt_config(shell: &Shell, chain_config: ChainConfig) -> anyhow::Resul )); contracts_config.save_with_base_path(shell, &chain_config.configs)?; - - replace_in_file( - chain_config - .path_to_general_config() - .to_str() - .context("failed to get general config path")?, - "internal_l1_pricing_multiplier", - "internal_sl_pricing_multiplier", - )?; println!("Done"); Ok(())