I followed the open-sourced error message decoder by etherscan. The code I modified is contained in this PR (which supports parity nodes).
The following steps are compatible with the testing workflow of the pymaker and MakerDao keepers. It will print out the RAW
and Decoded
error message to the CLI of a failed transaction on a local Parity testchain
- Modify lib/pymaker/init.py to mine a failing transaction
- Note the
txhash
on the failed test - Add
debuggingRevert.js
to the directory that holds the python code with the failing - Update
debuggingRevert.js
with the txhash
We are going to call debuggingRevert.js
through the python code, right after the failed (but now successfully mined) transaction. To do this, I followed this stackoverflow answer.
After Naked is imported via from Naked.toolshed.shell import execute_js, muterun_js
, here's an example of how I called debuggingRevert.js
after spell.cast()
was failing in Chief-Keeper:
spell.cast().transact(gas_price=self.gas_price())
response = muterun_js('debuggingRevert.js')
if response.exitcode == 0:
print(response.stdout)
else:
print(response.stderr)
# sys.stderr.write(response.stderr)
Which yeilds the following console log within a pytest session:
b'RAW result: 0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001b64732d70617573652d64656c656761746563616c6c2d6572726f720000000000\n\nDecoded reason: "ds-pause-delegatecall-error"\n'