-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: implement eth_feeHistory
#2083
Conversation
eth_feeHistory
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #2083 +/- ##
==========================================
+ Coverage 72.14% 72.17% +0.02%
==========================================
Files 472 474 +2
Lines 57098 57295 +197
==========================================
+ Hits 41191 41350 +159
- Misses 15907 15945 +38
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 18 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
is this ready for review? |
It is not ready, because I have few questions
|
@mattsse what do you think? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay..
I skimmed it, I can follow for the most part.
@Rjected mind giving this a closer look and have a look at the geth impl for reference?
crates/rpc/rpc-types/src/eth/fee.rs
Outdated
/// gas used by a block | ||
pub gas_used: u128, | ||
/// minimum between max_priority_fee_per_gas or max_fee_per_gas - base_fee_for_block | ||
pub reward: u128 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these serialized as numbers or hex?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This struct just mirrors an internal geth struct so this shouldn't be serialized
Took this over to try to get this over the line and pass hive tests! Only thing TODO for this PR now:
|
Thanks for the help @Rjected |
On why |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm,
we need another feature that installs a task that inserts new items
@@ -278,6 +278,43 @@ impl Transaction { | |||
} | |||
} | |||
|
|||
// TODO: dedup with effective_tip_per_gas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh, I'd like to dedup this and unify, naming, because everything surrounding fee/price can be incredibly confusing
good with a followup for this
crates/rpc/rpc/src/eth/api/fees.rs
Outdated
let headers: Vec<Header> = self.inner.client.headers_range(header_range.clone())?; | ||
let transactions = self.inner.client.transactions_by_block_range(header_range)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is reasonable to always read them from disk, if we add a service task that inserts items to the cache for every new block we can prevent this for the majority of requests
Ref: #1782
Note: This PR implements
eth_feeHistory
Sources
Todo
max_priority_fee_per_gas
isNone
, decide between usinggas_price
or1
latest
block,pending
blocks aren't supported yet