-
Notifications
You must be signed in to change notification settings - Fork 36
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
WEB3-276: feat: Add Account query functionality to Steel #414
base: main
Are you sure you want to change the base?
Conversation
// limitations under the License. | ||
|
||
//! Types related to account queries. | ||
pub use revm::primitives::{AccountInfo, Bytecode}; |
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.
A Steel account query returns the corresponding revm::primitives::AccountInfo
. This is a bit closer to the actual (revm) EVM execution, but it does not return the storage root (which is also inaccessible from inside the EVM) and the code is returned as revm::primitives::Bytecode
instead of just Bytes
. Alternatively, it may be preferable to define and return our own new type:
pub struct AccountInfo {
pub nonce: u64,
pub balance: U256,
pub storage_root: B256,
pub code_hash: B256,
pub code: Option<Byte>,
}
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.
OK, I did a little research on this: The problem is the storage_root. Unfortunately, this is not accessible in EVM, so there is no easy way to get it from RPC or the revm DB. The only way is to call an eth_getProof
just to get this value. This is possible, but would require a bit more code.
So do we think the storage_root is necessary? Otherwise the existing alternative would be sufficient and easier.
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.
Let's move on without the storage root then. If there becomes a use case for this, we can revisit, possibly adding a helper function of some sort to specifically get the storage root.
817ba5d
to
713385c
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.
Lovely!
This PR adds the
Account
struct to enable querying Ethereum account information in both host and guest environments, similar to howContract
works for contract interactions.Changes
Account
struct with host/guest implementations for querying account infoUsage Example
Testing
Added integration test
account_info
that:Implementation Notes
Contract
with separate host/guest implementationsbytecode()
)try_info()
) and panicking (info()
) variantsThe implementation aims to provide a consistent interface alongside the existing
Contract
functionality while maintaining the same security and verification guarantees.Fixes #380, WEB3-276