-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-rpcRelated to the RPC implementationRelated to the RPC implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Description
Describe the feature
for evm fork testing we currently need to send 3 requests: balance,code,nonce
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
- we can first prototype this type in alloy-rpc-eth, replacing this type https://github.com/alloy-rs/alloy/blob/79e47906f8df58f2d0f69516374ea841c485bc39/crates/rpc-types-eth/src/account.rs#L9-L15
- then we can add provider function like https://github.com/alloy-rs/alloy/blob/79e47906f8df58f2d0f69516374ea841c485bc39/crates/provider/src/provider/trait.rs#L351-L355
Once we have that, we can add this to reth by
- adding support for this like
reth/crates/rpc/rpc-eth-api/src/core.rs
Lines 702 to 710 in 61a0345
/// 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
Assignees
Labels
A-rpcRelated to the RPC implementationRelated to the RPC implementationC-enhancementNew feature or requestNew feature or requestD-good-first-issueNice and easy! A great choice to get startedNice and easy! A great choice to get started
Type
Projects
Status
Done