wake icon indicating copy to clipboard operation
wake copied to clipboard

Reverts in constructor aren't correctly handled

Open hacker-DOM opened this issue 2 years ago • 2 comments

Consider:

// A.sol
contract A {
    constructor() { revert(); }
}
# script.py
from woke.testing import *
from pytypes.A import A

@default_chain.connect()
def script():
    default_chain.set_default_accounts(default_chain.accounts[0])
    with must_revert() as e:
        a = A.deploy()

script()

I would expect the error to be caught (correct me if my estimate is wrong). Instead, I get

Launching anvil --prune-history 100 --transaction-block-keeper 10 --steps-tracing --silent --port 59103
Traceback (most recent call last):
  File "script.py", line 10, in <module>
    script()
  ...
  File "/Users/dteiml/.virtualenvs/23-06-rs-sudoku/lib/python3.8/site-packages/woke/development/transactions.py", line 460, in raw_error
    self._trace_transaction[0]["result"]["output"][2:]
KeyError: 'output'

hacker-DOM avatar Jun 26 '23 13:06 hacker-DOM

This is a bug in Anvil (+ ethers-rs): https://github.com/foundry-rs/foundry/pull/4853 https://github.com/gakonst/ethers-rs/pull/2392

michprev avatar Jun 26 '23 13:06 michprev

Implemented a workaround in https://github.com/Ackee-Blockchain/woke/commit/0b7ba19ad36d4f65aa6967e861e22fa319d210f1 at a cost of decreased performance (we need to fetch debug_traceTransaction instead of trace_transaction).

michprev avatar Jul 22 '23 19:07 michprev