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

Implement eth_feeHistory and eth_maxPriorityFeePerGas APIs #2221

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

saeed-zil
Copy link
Contributor

No description provided.

@saeed-zil saeed-zil linked an issue Jan 23, 2025 that may be closed by this pull request
@saeed-zil saeed-zil self-assigned this Jan 23, 2025
@saeed-zil saeed-zil marked this pull request as draft January 23, 2025 20:52
Copy link
Contributor

github-actions bot commented Jan 23, 2025

🐰 Bencher Report

Branch1512-implement-eth_feehistory-to-support-type-2-transactions
Testbedself-hosted
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
full-blocks-erc20-transfers/full-blocks-erc20-transfers📈 view plot
🚷 view threshold
1,258.60
(+1.15%)Baseline: 1,244.26
1,633.60
(77.04%)
full-blocks-evm-transfers/full-blocks-evm-transfers📈 view plot
🚷 view threshold
435.80
(-12.92%)Baseline: 500.48
719.34
(60.58%)
full-blocks-zil-transfers/full-blocks-zil-transfers📈 view plot
🚷 view threshold
3,373.00
(-13.97%)Baseline: 3,920.64
5,140.35
(65.62%)
process-empty/process-empty📈 view plot
🚷 view threshold
10.13
(+11.36%)Baseline: 9.10
11.41
(88.77%)
🐰 View full continuous benchmarking report in Bencher

@saeed-zil saeed-zil marked this pull request as ready for review January 24, 2025 09:35
…ment-eth_feehistory-to-support-type-2-transactions
zilliqa/src/api/types/eth.rs Outdated Show resolved Hide resolved
zilliqa/src/api/eth.rs Outdated Show resolved Hide resolved
zilliqa/src/api/eth.rs Show resolved Hide resolved
zilliqa/src/api/eth.rs Outdated Show resolved Hide resolved
zilliqa/src/api/eth.rs Outdated Show resolved Hide resolved
zilliqa/src/api/eth.rs Outdated Show resolved Hide resolved
zilliqa/src/api/eth.rs Outdated Show resolved Hide resolved
@JamesHinshelwood JamesHinshelwood changed the title feat: implement eth_feeHistory API method. Implement eth_feeHistory and eth_maxPriorityFeePerGas APIs Feb 11, 2025
@@ -196,6 +198,7 @@ impl Header {
.duration_since(SystemTime::UNIX_EPOCH)
.unwrap_or_default()
.as_secs(),
base_fee_per_gas: 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this zero? Shouldn't it be set to the gas price?

}

let newest_block: BlockNumberOrTag = params.next()?;
let reward_percentiles: Option<Vec<f64>> = params.optional_next()?.unwrap_or_default();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to add unwrap_or_default here? I believe this means the API is now expecting a Option<Option<Vec<f64>>> which doesn't make much sense.

let tx = node
.get_transaction_by_hash(*tx_hash)?
.ok_or_else(|| anyhow!("transaction not found: {}", tx_hash))?;
Ok(tx.tx.effective_priority_fee(block.header.base_fee_per_gas))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it correct to use the priority fee here? This will be zero for all non-EIP-1559 transactions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not, because if I call eth_feeHistory on a Ethereum mainnet block from before EIP-1559, there are non-zero values in reward.

Comment on lines +1099 to +1105
reward_percentiles
.iter()
.map(|x| {
let i = (x * fees_len / 100_f64) as usize;
effective_priority_fees.get(i).cloned().unwrap_or_default()
})
.collect()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments here would be nice. It took me a while to work out what this was doing and why it is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement eth_feeHistory to support type-2 transactions
2 participants