Skip to content

Commit

Permalink
Fallback to eth_call
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed May 3, 2024
1 parent a4c8351 commit 26e635f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .idea/boa-zksync.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions boa_zksync/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from boa.environment import _AddressType
from boa.interpret import json
from boa.network import NetworkEnv, _EstimateGasFailed
from boa.rpc import RPC, EthereumRPC, to_hex
from boa.rpc import RPC, EthereumRPC, to_hex, RPCError
from boa.util.abi import Address
from eth.exceptions import VMError
from eth_account import Account
Expand Down Expand Up @@ -114,8 +114,13 @@ def execute_code(
sender = self._check_sender(self._get_sender(sender))
args = ZksyncMessage(sender, to_address, gas or 0, value, data)

trace_call = self._rpc.fetch("debug_traceCall", [args.as_json_dict(), "latest"])
traced_computation = ZksyncComputation.from_trace(trace_call)
try:
trace_call = self._rpc.fetch("debug_traceCall", [args.as_json_dict(), "latest"])
traced_computation = ZksyncComputation.from_trace(trace_call)
except RPCError:
output = self._rpc.fetch("eth_call", [args.as_json_dict(), "latest"])
traced_computation = ZksyncComputation(args, output)

if is_modifying:
try:
receipt, trace = self._send_txn(**args.as_tx_params())
Expand Down

0 comments on commit 26e635f

Please sign in to comment.