-
Notifications
You must be signed in to change notification settings - Fork 40
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-322: feat: Add HostEvmEnv::extend
method for merging environments
#420
Conversation
HostEvmEnv::extend
method for merging environmentsHostEvmEnv::extend
method for merging environments
/// Extends the `ProofDb` with the contents of another `ProofDb`. It panics if they are not | ||
/// consistent. |
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 ProofDb
is linked to a single state (commitment) ya? So trying to merge the ProofDb
for two different blocks will panic here. I can see how, if written correctly, this will never fail. It also seems like an common enough mistake that panicking is perhaps too extreme, and could result in DoS in cases where e.g. someone is running a service that produces Steel proofs, if an error can cause the service to go down.
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 changed it so that the public extend now returns an error if the header config does not match. This could be a user error.
If the actual hash maps are extended, the panic is kept because this should not be possible without fraudulent RPC nodes. Also, this would be unrecoverable since the DB has already been modified.
This PR adds the ability to merge multiple
HostEvmEnv
instances, enabling parallel preflight execution of contract calls.Changes
extend
method toHostEvmEnv
for merging environmentsextend_checked
helper function for safe HashMap mergingUsage Example
Implementation Details
Testing
The functionality is demonstrated through doctest examples. Additional integration tests would be valuable to add in a follow-up PR.