Skip to content

Feature/get revert reason - #98

Open
compojoom wants to merge 3 commits into
masterfrom
feature/get_revert_reason
Open

compojoom wants to merge 3 commits into
masterfrom
feature/get_revert_reason

Conversation

@compojoom

Copy link
Copy Markdown
Contributor

I was failing to transact with a contract and the "TransactionFailure" exception was not particularly helpful.

It turns out that the latest web3 version has the ability to output the revert reason so, we are now trying to get it before raising a "TransactionFailure" exception.

We try to get the more information for failed transaction and output it instead of just throwing a TransactionFailed exception
@compojoom

Copy link
Copy Markdown
Contributor Author

I tried to write a test for this, but eth_tester and a real chain doesn't seem to behave the same way.

When a transaction fails in eth_tester we actually get the revert reason:
https://github.com/ethereum/eth-tester/blob/c99194cf6162a26a176f016239407988e3a0bc53/eth_tester/backends/pyevm/main.py#L539

because eth_tester tries to get it for us.

Also what I notice is that in the tests get_transaction returns a dict with a data prop, but in real life we get an input prop:
https://web3py.readthedocs.io/en/stable/examples.html#looking-up-transactions

@cducrest - any ideas, or should we just ignore?

@cducrest

cducrest commented Jun 29, 2021

Copy link
Copy Markdown
Contributor

Looks fine, you should update web3 to the same requirements in the contracts and relay though. Otherwise if we need a new feature of the contract-deploy-tools there, we may not be able to use it before additional dependency work. (also fix mypy)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants