Skip to content
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

Feature/get revert reason #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

compojoom
Copy link
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
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
Copy link
Contributor

cducrest commented Jun 29, 2021

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