From d396b769c75372c737f38f1e5f70b3e35c812ebc Mon Sep 17 00:00:00 2001 From: Vaclav Barta Date: Mon, 20 May 2024 17:40:20 +0200 Subject: [PATCH] fix: L2 gas price change (#285) --- e2e-tests/test/zks-apis.test.ts | 6 +++--- src/node/eth.rs | 2 +- src/node/fee_model.rs | 2 +- src/node/in_memory.rs | 8 ++++---- src/node/in_memory_ext.rs | 4 ++-- src/node/zks.rs | 6 +++--- src/testing.rs | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/e2e-tests/test/zks-apis.test.ts b/e2e-tests/test/zks-apis.test.ts index 1028573d..df7e7f6a 100644 --- a/e2e-tests/test/zks-apis.test.ts +++ b/e2e-tests/test/zks-apis.test.ts @@ -30,13 +30,13 @@ describe("zks_estimateFee", function () { // Act const response: Fee = await provider.send("zks_estimateFee", [transaction]); // Assert - expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("5448356"), "Unexpected gas_limit"); + expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("7203486"), "Unexpected gas_limit"); expect(ethers.BigNumber.from(response.gas_per_pubdata_limit)).to.eql( - ethers.BigNumber.from("37500"), + ethers.BigNumber.from("50000"), "Unexpected gas_per_pubdata_limit" ); expect(ethers.BigNumber.from(response.max_fee_per_gas)).to.eql( - ethers.BigNumber.from("50000000"), + ethers.BigNumber.from("37500000"), "Unexpected max_fee_per_gas" ); expect(ethers.BigNumber.from(response.max_priority_fee_per_gas)).to.eql( diff --git a/src/node/eth.rs b/src/node/eth.rs index 5c093408..1d2d329b 100644 --- a/src/node/eth.rs +++ b/src/node/eth.rs @@ -2226,7 +2226,7 @@ mod tests { .await .expect("failed getting filter changes") { - FilterChanges::Logs(result) => assert_eq!(2, result.len()), + FilterChanges::Logs(result) => assert_eq!(3, result.len()), changes => panic!("unexpected filter changes: {:?}", changes), } diff --git a/src/node/fee_model.rs b/src/node/fee_model.rs index a39ff0b0..dedbeb81 100644 --- a/src/node/fee_model.rs +++ b/src/node/fee_model.rs @@ -4,7 +4,7 @@ use zksync_types::fee_model::{FeeModelConfigV2, FeeParams, FeeParamsV2}; use zksync_types::L1_GAS_PER_PUBDATA_BYTE; pub const CONFIG: FeeModelConfigV2 = FeeModelConfigV2 { - minimal_l2_gas_price: 50_000_000, + minimal_l2_gas_price: 20_000_000, compute_overhead_part: 0.0, pubdata_overhead_part: 1.0, batch_overhead_l1_gas: 800000, diff --git a/src/node/in_memory.rs b/src/node/in_memory.rs index 2d6ab60f..5e558dd1 100644 --- a/src/node/in_memory.rs +++ b/src/node/in_memory.rs @@ -79,8 +79,8 @@ pub const TEST_NODE_NETWORK_ID: u32 = 260; /// L1 Gas Price. pub const L1_GAS_PRICE: u64 = 50_000_000_000; // TODO: for now, that's fine, as computation overhead is set to zero, but we may consider using calculated fee input everywhere. -/// L2 Gas Price (0.05 gwei). -pub const L2_GAS_PRICE: u64 = 50_000_000; +/// L2 Gas Price. +pub const L2_GAS_PRICE: u64 = 25_000_000; /// L1 Gas Price Scale Factor for gas estimation. pub const ESTIMATE_GAS_PRICE_SCALE_FACTOR: f64 = 1.5; /// Acceptable gas overestimation limit. @@ -1897,10 +1897,10 @@ mod tests { hex::decode("bbf55335").unwrap(), // keccak selector for "transact_retrieve1()" Nonce(1), Fee { - gas_limit: U256::from(815563), + gas_limit: U256::from(4_000_000), max_fee_per_gas: U256::from(250_000_000), max_priority_fee_per_gas: U256::from(250_000_000), - gas_per_pubdata_limit: U256::from(25000), + gas_per_pubdata_limit: U256::from(50000), }, U256::from(0), zksync_basic_types::L2ChainId::from(260), diff --git a/src/node/in_memory_ext.rs b/src/node/in_memory_ext.rs index 2f0d2182..77c25e62 100644 --- a/src/node/in_memory_ext.rs +++ b/src/node/in_memory_ext.rs @@ -447,10 +447,10 @@ mod tests { vec![], Nonce(0), Fee { - gas_limit: U256::from(1_000_000), + gas_limit: U256::from(100_000_000), max_fee_per_gas: U256::from(50_000_000), max_priority_fee_per_gas: U256::from(50_000_000), - gas_per_pubdata_limit: U256::from(25000), + gas_per_pubdata_limit: U256::from(50000), }, to_impersonate, U256::one(), diff --git a/src/node/zks.rs b/src/node/zks.rs index 2bdf243a..eb4486b0 100644 --- a/src/node/zks.rs +++ b/src/node/zks.rs @@ -590,10 +590,10 @@ mod tests { let result = node.estimate_fee(mock_request).await.unwrap(); - assert_eq!(result.gas_limit, U256::from(6793236)); - assert_eq!(result.max_fee_per_gas, U256::from(50000000)); + assert_eq!(result.gas_limit, U256::from(8970736)); + assert_eq!(result.max_fee_per_gas, U256::from(37500000)); assert_eq!(result.max_priority_fee_per_gas, U256::from(0)); - assert_eq!(result.gas_per_pubdata_limit, U256::from(37500)); + assert_eq!(result.gas_per_pubdata_limit, U256::from(50000)); } #[tokio::test] diff --git a/src/testing.rs b/src/testing.rs index d67ee0db..9572f722 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -373,7 +373,7 @@ impl Default for TransactionBuilder { Self { tx_hash: H256::repeat_byte(0x01), from_account_private_key: K256PrivateKey::from_bytes(H256::random()).unwrap(), - gas_limit: U256::from(2_000_000), + gas_limit: U256::from(4_000_000), max_fee_per_gas: U256::from(50_000_000), max_priority_fee_per_gas: U256::from(50_000_000), } @@ -414,7 +414,7 @@ impl TransactionBuilder { gas_limit: self.gas_limit, max_fee_per_gas: self.max_fee_per_gas, max_priority_fee_per_gas: self.max_priority_fee_per_gas, - gas_per_pubdata_limit: U256::from(25000), + gas_per_pubdata_limit: U256::from(50000), }, U256::from(1), L2ChainId::from(260), @@ -512,7 +512,7 @@ pub fn deploy_contract( data.to_vec(), nonce, Fee { - gas_limit: U256::from(92511299), + gas_limit: U256::from(400_000_000), max_fee_per_gas: U256::from(50_000_000), max_priority_fee_per_gas: U256::from(50_000_000), gas_per_pubdata_limit: U256::from(50000),