-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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(rpc): get_account #10369
feat(rpc): get_account #10369
Conversation
I couldn't find a place to add tests to this, I can add in another PR if this is something we would want. |
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.
account_nonce
, account_balance
and account_code
perform a call to basic_account
underneath. moreover, account_code
performs an additional database lookup to retrieve code by code hash which is already part of account info, so no need to hash it
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
.unwrap_or_default(); | ||
let balance = account.balance; | ||
let nonce = account.nonce; | ||
let code_hash = account.bytecode_hash.unwrap_or_default(); |
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.
actually, if None
this will be 0x000 whereas it should be KECCAK_EMPTY
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.
of course sorry for missing this
0435b5c
to
64d4ef1
Compare
64d4ef1
to
b691d99
Compare
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
// Provide a default `HashedStorage` value in order to | ||
// get the storage root hash of the current state. | ||
let storage_root = state | ||
.hashed_storage_root(address, Default::default()) | ||
.map_err(Self::Error::from_eth_err)?; |
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.
isn't this always the same? can it be const?
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'm not sure what you mean, which part could be a const
?
This PR adds the rpc endpoint
get_account
and solves #9625.Makes use of the
hashed_storage_root
method from theStateRootProvider
and passes an emptyHashedStorage
in order to only get the storage root of the current state for the provided account.