-
Notifications
You must be signed in to change notification settings - Fork 20
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
runtime-sdk/modules/evm: Add support for simulating CREATE #1669
Conversation
✅ Deploy Preview for oasisprotocol-oasis-sdk canceled.
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1669 +/- ##
==========================================
- Coverage 65.34% 65.33% -0.01%
==========================================
Files 114 114
Lines 8365 8380 +15
==========================================
+ Hits 5466 5475 +9
- Misses 2899 2905 +6 ☔ View full report in Codecov by Sentry. |
fb2417a
to
da8c76e
Compare
da8c76e
to
c9b9a9d
Compare
c9b9a9d
to
44eaec5
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.
It seems errors & reversions aren't being handled when simulating a contract creation via eth_call.
Oh, my bad, need to update oasis-web3-gateway to specify nil as the to
field.
I need to test against updated oasis-web3-gateway
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.
…ostko/feature/evm-simulate-create runtime-sdk/modules/evm: Add support for simulating CREATE a9c70cb
Story: oasisprotocol/oasis-web3-gateway#543 (comment)
Problem:
Performing an
eth_call
to simulate contract creation is currently not possible.This is used by
hardhat-ignition
(a deterministic deployment framework) to determine if creating the contract will be possible.In oasis web3 gateway the
EstimateGas
function calls eitherevm.Create
orevm.Call
depending on if theto
field is empty. I initially made a workaround in oasis-web3-gateway by setting theto
field to the zero address, however this will erroneously succeed (as calls to unknown addresses succeed so transfers can be made to previously unknown EOAs). So while that silences the error inhardhat-ignition
the behavior is incorrect.For the correct behavior the
evm.SimulateCall
function would be modified to handle contract creation with EVM semantics (noto
address = create contract & run init code). Theevm.SimulateCall
function would make theaddress
parameter optional. This would then have to be invoked with a signed query to faithfully replicate EVM semantics.The initial workaround (setting
to=0
) is broken and shouldn't be used.Example RPC call performed by
hardhat-ignition
:Suggested modification to
SimulateCallQuery
struct:Suggested modification in
oasis-web3-gateway/rpc/eth/api.go
:Suggested modification in
runtime-sdk/modules/evm/src/lib.rs
:evm.Create
tofn simulate_call
evm.SimulateCreate
which can be invoked from oasis-web3-gateway instead ofevm.Call
This PR
... solves this.