Skip to content

Improve eth_gasPrice basefee lookup #16613

@mattsse

Description

@mattsse

Describe the feature

currently, this fetches the entire block:

let header = self.recovered_block(BlockNumberOrTag::Latest.into());

but we only need the most recent header which we could fethc from

/// Returns the latest block header if available
///
/// Note: This returns a [`SealedHeader`] because it's expected that this is sealed by the
/// provider and the caller does not know the hash.
fn latest_header(&self) -> ProviderResult<Option<SealedHeader<Self::Header>>> {
self.sealed_header_by_id(BlockNumberOrTag::Latest.into())
}

but the trait bounds currently only require BlockReader

pub trait RpcNodeCoreExt: RpcNodeCore<Provider: BlockReader> {

but we need BlockReaderIdExt for this

TODO

  • extend the Provider bound in LoadFee trait to BlockReaderIdExt
  • use latest_header for fetching the fee

we could maybe even bump the trait bound here entirely:

pub trait RpcNodeCoreExt: RpcNodeCore<Provider: BlockReader> {

which is maybe easier long term but more invasive

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-rpcRelated to the RPC implementationC-enhancementNew feature or requestD-good-first-issueNice and easy! A great choice to get started

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions