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

Remove SolidityError from eth-tester #1813

Merged
merged 3 commits into from
Jan 8, 2021

Conversation

kclowes
Copy link
Collaborator

@kclowes kclowes commented Dec 17, 2020

What was wrong?

This is a backwards incompatible bugfix that returns eth-tester functionality to what it was before 5.13.0

@fubuloubu pointed out that vyper tests were failing since web3 converts eth-tester's TransactionFailed error to a SolidityError, and we weren't handling the empty response message quite right. eth-tester couldn't decode the empty error message on a revert. I added logic to try and decode_single on the error message, and if that fails, just return the plain, undecoded error message. I also discovered that we didn't have any tests that check what happens if the revert error message is empty, so I added some.

When estimateGas gets reverted and doesn't have an error message, Parity returns a generic error message, so I opted to leave it as a ValueError, instead of catching it and returning a SolidityError, since I'm not sure we can reliably determine if it comes from a revert or not.

How was it fixed?

I did a couple things in this PR:

  • Added integration tests for the case where there is no error message that comes back from a revert
  • Added a new case for an empty error message in the raise_solidity_error_on_revert function
  • Eth-tester returns a TransactionFailed error again

Todo:

Cute Animal Picture

image

@kclowes kclowes requested a review from wolovim December 17, 2020 23:13
@kclowes kclowes changed the title [WIP] Remove SolidityError from eth-tester Remove SolidityError from eth-tester Dec 17, 2020
Copy link
Member

@wolovim wolovim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; thanks for the repair!

Copy link
Contributor

@fubuloubu fubuloubu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the issue introduced in v5.13.1 for Vyper (see vyperlang/vyper#2259)

raise SolidityError(f'execution reverted: {reason}')
except (InsufficientDataBytes, AttributeError):
reason = e.args[0]
raise TransactionFailed(f'execution reverted: {reason}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 of our test cases pick this up, but this can be fixed

I wish there were an ERC for revert reasons and how to handle them in web3 libraries

@kclowes kclowes merged commit eba67ce into ethereum:master Jan 8, 2021
@kclowes kclowes deleted the undo-eth-tester-behavior-change branch January 8, 2021 17:42
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.

3 participants