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

[hardhat] brownie reverts context manager does not catch reverts #1027

Closed
BlinkyStitt opened this issue Mar 30, 2021 · 1 comment · Fixed by #1043
Closed

[hardhat] brownie reverts context manager does not catch reverts #1027

BlinkyStitt opened this issue Mar 30, 2021 · 1 comment · Fixed by #1043

Comments

@BlinkyStitt
Copy link
Collaborator

Environment information

  • brownie Version: 48d3f18
  • hardhat Version: 2.1.3-dtt.0 sha512-QWI3LbImf5vyshQzC2nGxzkgtMHsK5BovcWUMgNl3f/0QGCtVRLhTvkA6/FK0f8XhDkFCOHLsJmyRrt4Ao9grg==
  • solc Version: 0.8.3
  • Python Version: 3.9.2
  • OS: osx and linux

What was wrong?

I'm testing out swapping ganache-cli for hardhat@dtt on the argobytes repo.

One of my tests expects a revert, but it is not being caught.

        with brownie.reverts(""):
>           argobytes_proxy_clone.execute(action, {"from": accounts[1]})
E           ValueError: Transaction reverted without a reason

tests/test_argobytes_clone.py:26: ValueError

How can it be fixed?

My guess is that ganache errors were not ValueErrors like hardhat's are. Either change hardhat errors to match ganache, or update the context manager to catch ValueErrors.

@iamdefinitelyahuman
Copy link
Member

A quick solution (on the hardhat side) is to add this to the project config:

module.exports = {
   networks: {
      hardhat: {
         throwOnTransactionFailures: false,
         throwOnCallFailures: false
      }
   }
}

But surely we can find a solution in Brownie without requiring this.

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 a pull request may close this issue.

2 participants