Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api_server): fix blob_gas length #2673

Merged
merged 8 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/node/api_server/src/web3/namespaces/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,8 @@ impl EthNamespace {
effective_pubdata_price_history.reverse();

let oldest_block = newest_l2_block.0 + 1 - base_fee_per_gas.len() as u32;
// `base_fee_per_gas` for next L2 block cannot be calculated, appending last fee as a placeholder.
perekopskiy marked this conversation as resolved.
Show resolved Hide resolved
base_fee_per_gas.push(*base_fee_per_gas.last().unwrap());
perekopskiy marked this conversation as resolved.
Show resolved Hide resolved
// We do not store gas used ratio for blocks, returns array of zeroes as a placeholder.
let gas_used_ratio = vec![0.0; base_fee_per_gas.len()];
// Effective priority gas price is currently 0.
Expand All @@ -701,8 +703,6 @@ impl EthNamespace {
let base_fee_per_blob_gas = vec![U256::zero(); base_fee_per_gas.len()];
let blob_gas_used_ratio = vec![0.0; base_fee_per_gas.len()];

// `base_fee_per_gas` for next L2 block cannot be calculated, appending last fee as a placeholder.
base_fee_per_gas.push(*base_fee_per_gas.last().unwrap());
Ok(FeeHistory {
inner: web3::FeeHistory {
oldest_block: zksync_types::web3::BlockNumber::Number(oldest_block.into()),
Expand Down
1 change: 1 addition & 0 deletions core/tests/ts-integration/tests/api/web3.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ describe('web3 API compatibility tests', () => {
const expectedBaseFee = (await alice.provider.getBlock(receipt.blockNumber - 1 + i)).baseFeePerGas;
expect(BigInt(response.baseFeePerGas[i])).toEqual(expectedBaseFee);
}
expect(response.baseFeePerBlobGas).toHaveLength(3);
});

test('Should check zks_getProtocolVersion endpoint', async () => {
Expand Down
Loading