feat(anvil): add eth_simulateV1 rpc call #10030
Draft
+203
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
#9593
Solution
A
simulate
function was added to the memory backend which calls upon the existing snapshot, revert, and block mining functionalities to replicate the behavior ofeth_simulateV1
. Alloy conveniently provides most of the needed types foreth_simulateV1
, so its mostly just a matter of type conversion.This is probably not the most efficient or beautiful solution, but for my surface level knowledge of the repo it seemed like a reasonable enough approach. Please let me know if there is some way better.
I am not a professional rust developer, so I probably did some unusual things. Please point out what I should do to improve!
Currently missing features of
eth_simulateV1
on this PR:Additional issues:
gas_limit
is not specified, what should be used as the gas limit? should it be auto set to the block max limit, or should the block gas limit be set higher somehow?PR Checklist