Skip to content

Commit

Permalink
fix: l2 gas price was decreased (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
dutterbutter authored Mar 20, 2024
1 parent 574c0d8 commit 2442c4a
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 70 deletions.
61 changes: 31 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ categories = ["cryptography"]
publish = false # We don't want to publish our binaries.

[dependencies]
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "cd748e9593949222fe6516fc18c987b6cdf39882" }
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
multivm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "90dee732295d8eaf48a5308c39238a0f5838cc35" }
sha3 = "0.10.6"


Expand Down
4 changes: 2 additions & 2 deletions SUPPORTED_APIS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ The `status` options are:
| [`ETH`](#eth-namespace) | [`eth_chainId`](#eth_chainid) | `SUPPORTED` | Returns the currently configured chain id <br />_(default is `260`)_ |
| `ETH` | `eth_coinbase` | `NOT IMPLEMENTED` | Returns the client coinbase address |
| [`ETH`](#eth-namespace) | [`eth_estimateGas`](#eth_estimategas) | `SUPPORTED` | Generates and returns an estimate of how much gas is necessary for the transaction to complete |
| [`ETH`](#eth-namespace) | [`eth_feeHistory`](#eth_feehistory) | `SUPPORTED` | Returns a collection of historical block gas data <br />_(hardcoded with gas price of `250_000_000`)_ |
| [`ETH`](#eth-namespace) | [`eth_gasPrice`](#eth_gasprice) | `SUPPORTED` | Returns the current price per gas in wei <br />_(hardcoded to `250_000_000`)_ |
| [`ETH`](#eth-namespace) | [`eth_feeHistory`](#eth_feehistory) | `SUPPORTED` | Returns a collection of historical block gas data <br />_(hardcoded with gas price of `50_000_000`)_ |
| [`ETH`](#eth-namespace) | [`eth_gasPrice`](#eth_gasprice) | `SUPPORTED` | Returns the current price per gas in wei <br />_(hardcoded to `50_000_000`)_ |
| [`ETH`](#eth-namespace) | [`eth_getBalance`](#eth_getbalance) | `SUPPORTED` | Returns the balance of the account of given address |
| [`ETH`](#eth-namespace) | [`eth_getBlockByHash`](#eth_getblockbyhash) | `SUPPORTED` | Returns information about a block by block hash |
| [`ETH`](#eth-namespace) | [`eth_getBlockByNumber`](#eth_getblockbynumber) | `SUPPORTED` | Returns information about a block by block number |
Expand Down
7 changes: 3 additions & 4 deletions e2e-tests/test/zks-apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ 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("1447745"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_limit)).to.eql(ethers.BigNumber.from("2407036"), "Unexpected gas_limit");
expect(ethers.BigNumber.from(response.gas_per_pubdata_limit)).to.eql(
ethers.BigNumber.from("18750"),
ethers.BigNumber.from("32000"),
"Unexpected gas_per_pubdata_limit"
);
expect(ethers.BigNumber.from(response.max_fee_per_gas)).to.eql(
ethers.BigNumber.from("100000000"),
ethers.BigNumber.from("58593750"),
"Unexpected max_fee_per_gas"
);
expect(ethers.BigNumber.from(response.max_priority_fee_per_gas)).to.eql(
Expand Down
2 changes: 1 addition & 1 deletion src/http_fork_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ mod tests {
"executeTxHash": null,
"executedAt": null,
"l1GasPrice": 6156252068u64,
"l2FairGasPrice": 250000000u64,
"l2FairGasPrice": 50000000u64,
"baseSystemContractsHashes": {
"bootloader": "0x0100089b8a2f2e6a20ba28f02c9e0ed0c13d702932364561a0ea61621f65f0a8",
"default_aa": "0x0100067d16a5485875b4249040bf421f53e869337fe118ec747cf40a4c777e5f"
Expand Down
5 changes: 1 addition & 4 deletions src/node/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ impl<S: ForkSource + std::fmt::Debug + Clone + Send + Sync + 'static> DebugNames
return Err(into_jsrpc_error(error));
}
};

let execution_mode = multivm::interface::TxExecutionMode::EthCall;
let storage = StorageView::new(&inner.fork_storage).into_rc_ptr();

Expand Down Expand Up @@ -195,8 +194,8 @@ impl<S: ForkSource + std::fmt::Debug + Clone + Send + Sync + 'static> DebugNames

let call_tracer_result = Arc::new(OnceCell::default());
let tracer = CallTracer::new(call_tracer_result.clone()).into_tracer_pointer();
let tx_result = vm.inspect(tracer.into(), multivm::interface::VmExecutionMode::OneTx);

let tx_result = vm.inspect(tracer.into(), multivm::interface::VmExecutionMode::OneTx);
let call_traces = if only_top {
vec![]
} else {
Expand Down Expand Up @@ -295,7 +294,6 @@ mod tests {
let node = InMemoryNode::<HttpForkSource>::default();

let (primary_deployed_address, secondary_deployed_address) = deploy_test_contracts(&node);

// trace a call to the primary contract
let func = HumanReadableParser::parse_function("calculate(uint)").unwrap();
let calldata = func.encode_input(&[Token::Uint(U256::from(42))]).unwrap();
Expand Down Expand Up @@ -396,7 +394,6 @@ mod tests {

// call should revert
assert!(trace.revert_reason.is_some());

// find the call to primary contract in the trace
let contract_call = trace
.calls
Expand Down
Loading

0 comments on commit 2442c4a

Please sign in to comment.