-
Notifications
You must be signed in to change notification settings - Fork 521
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
Access StorageData for eth_getBalance #43
Access StorageData for eth_getBalance #43
Conversation
Still TODO the support for all In this PR I just adapted the previously supported |
rpc/src/lib.rs
Outdated
return Ok( | ||
self.client | ||
.runtime_api() | ||
.account_decode(&BlockId::Hash(header.hash()), data.0) |
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.
If we are reading the raw account data, what's the reason still calling into runtime?
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.
Not adding the pallet-evm as a dependency for accessing the EvmAccount (as it's a dependency for the Runtime anyways).
If we are OK adding that dep, then it would make no sense of course.
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.
Also as a side note, Decode::decode
cannot infer the data type, in this case pallet-evm::Account needs to be declared as the result type.
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.
The round trip call to runtime API is the main consumption of performance. If we still call in runtime I'm not sure how this PR brings improvements, TBH.
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.
Indeed. As in the RPC module we already have the frontier-rpc-primitives
dep, we could do a public re-export of the pallet-evm::Account
from there, and avoid calling the Runtime doing that. Let me update the PR with that.
As talked with @sorpaas, we probably are good just calling the Runtime Api impls passing the past BlockId as an argument. It is less efficient but way more easy to implement and it just fulfills our requirements. Closing. |
rel #7
eth_getBalance
StorageKey
forEVM::Accounts
.client.storage
to accessEVM::Accounts
for a givenBlockId
.account_decode
for Runtime API toDecode
StorageData back topallet-evm::Account
type.