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: support pending block in feeHistory endpoint #11800

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

Conversation

malik672
Copy link
Contributor

should close #11795

@malik672 malik672 marked this pull request as draft October 16, 2024 15:35
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

cool, overall this looks right, some suggestions, though not 100% sure all are feasible

crates/rpc/rpc-eth-api/src/helpers/fee.rs Show resolved Hide resolved
crates/rpc/rpc-eth-api/src/helpers/fee.rs Outdated Show resolved Hide resolved
crates/rpc/rpc-eth-api/src/helpers/fee.rs Outdated Show resolved Hide resolved
@malik672 malik672 requested a review from mattsse October 18, 2024 12:46
@malik672 malik672 marked this pull request as ready for review October 21, 2024 11:53
@malik672
Copy link
Contributor Author

@mattsse I think this should be ready

@onbjerg onbjerg added the C-bug An unexpected or incorrect behavior label Oct 23, 2024
@onbjerg onbjerg changed the title chore: Support pending block in feeHistory endpoint fix: support pending block in feeHistory endpoint Oct 23, 2024
@onbjerg onbjerg added the A-rpc Related to the RPC implementation label Oct 23, 2024
@@ -87,6 +98,9 @@ pub trait EthFees: LoadFee {
.map_err(Self::Error::from_eth_err)?
.ok_or(EthApiError::HeaderNotFound(newest_block.into()))?;

let pending_block =
if newest_block.is_pending() { self.local_pending_block().await? } else { None };
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like it is unreachable because of

if newest_block.is_pending() {
// cap the target block since we don't have fee history for the pending block
newest_block = BlockNumberOrTag::Latest;
// account for missing pending block
block_count = block_count.saturating_sub(1);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@klkvr
Copy link
Collaborator

klkvr commented Oct 25, 2024

let fee_entries = self.fee_history_cache().get_history(start_block, end_block).await;

this also seems problematic because fee history cache won't contain a pending block

I'd prefer us to have a test for this. we've just added a simple fee history e2e test in #12058, so you can use it as reference

@malik672
Copy link
Contributor Author

let fee_entries = self.fee_history_cache().get_history(start_block, end_block).await;

this also seems problematic because fee history cache won't contain a pending block

I'd prefer us to have a test for this. we've just added a simple fee history e2e test in #12058, so you can use it as reference

this would be hard to use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support pending block in feeHistory endpoint
4 participants