Skip to content

Introduce eth_getAccountInfo #16027

Closed
@mattsse

Description

@mattsse

Describe the feature

for evm fork testing we currently need to send 3 requests: balance,code,nonce

https://github.com/foundry-rs/foundry-fork-db/blob/5b03d6e9320d502daa3a6687298e59a51967de3e/src/backend.rs#L286-L289

It would be more useful to have this info in a dedicated endpoint.

there is eth_getAccount, but this returns the trie account, with codehash and storageroot which is not quite what we need for fork testing.

we basically need this info type as an rpc response

pub struct AccountInfo {
    /// Account balance
    pub balance: U256,
    /// Account nonce
    pub nonce: u64,
    /// Account code
    pub code: Bytes,
}

TODO

Once we have that, we can add this to reth by

  1. adding support for this like
    /// Handler for: `eth_getAccount`
    async fn get_account(
    &self,
    address: Address,
    block: BlockId,
    ) -> RpcResult<Option<alloy_rpc_types_eth::Account>> {
    trace!(target: "rpc::eth", "Serving eth_getAccount");
    Ok(EthState::get_account(self, address, block).await?)
    }

Additional context

No response

Metadata

Metadata

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