Whenever I get errors deploying or interacting with a contract using ‘npx oz [command]’ all I ever get is “Error: The execution failed due to an exception.”
Why no more information than that? Where are my error messages from require()?
Whenever I get errors deploying or interacting with a contract using ‘npx oz [command]’ all I ever get is “Error: The execution failed due to an exception.”
Why no more information than that? Where are my error messages from require()?
Hi @CrackerHax,
Welcome to the community
I’m sorry that you are having an issue running npx oz [command]
.
Can you share an example of what commands you have tried?
Would you mind also sharing your current environment:
npx oz --version
)node --version
)npm --version
)Literally anything that ends up giving an error gives a totally uninformative error. I have posted about this before but never seem to get a clear answer as to why we cannot get actual errors returned from a contract. This makes oz pretty much useless if there is no way to debug, especially if you start getting errors trying to upgrade contracts.
Hi @CrackerHax,
If you can help me to reproduce this then I can see how we can improve this.
It’s easy to reproduce. Try making a contract with a require that fails intentionally and see if you can get anything other than “Error: The execution failed due to an exception.”
Here try this:
function errorTest() public
{
bool b = false;
require(b, "here is an error!");
}
then use npx oz call
on it.
Hi @CrackerHax,
I deployed the following contract to ganache-cli
using OpenZeppelin CLI 2.8.
When I send a transaction I get notified of the revert reason.
What versions are you using and what do you see?
✖ Calling: 'errorTest' with no arguments
Error while trying to send transaction to 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab.
Error: Returned error: VM Exception while processing transaction: revert here is an error!
pragma solidity ^0.5.0;
contract Test {
function errorTest() public {
bool b = false;
require(b, "here is an error!");
}
}
$ npx oz deploy
✓ Compiled contracts with solc 0.5.17 (commit.d19bba13)
Compilation warnings:
contracts/Test.sol:4:5: Warning: Function state mutability can be restricted to pure
function errorTest() public {
^ (Relevant source part starts here and spans across multiple lines).
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy Test
✓ Deployed instance of Test
0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab
$ npx oz send-tx
? Pick a network development
? Pick an instance Test at 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab
? Select which function errorTest()
✖ Calling: 'errorTest' with no arguments
Error while trying to send transaction to 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab.
Error: Returned error: VM Exception while processing transaction: revert here is an error!
oz 2.6, ill try 2.8 and see if that helps
Nope, still getting “Error while trying to send transaction to 0x…” “Error: Error: The execution failed due to an exception.” with oz 2.8
Also there is no “npx oz deploy”…
“Invalid command: deploy
See --help for a list of available commands.”
node v10.18.1
npm v6.13.4
Hi @CrackerHax,
Can you check your version of OpenZeppelin CLI? Deploy is a new command in 2.8.
$ npx oz --version
2.8.0
I am using Ganache CLI v6.9.1
Ganache CLI v6.9.1 (ganache-core: 2.10.2)
It was still 2.6 but after upgrading to 2.8 it is still the exact same thing.
“Error while trying to send transaction to 0x… Error: Error: The execution failed due to an exception.”
Not using ganache, using a live testnet.
Hi @CrackerHax,
My understanding is that neither Geth nor OpenEth (Parity) yet support obtaining revert reasons unfortunately.
So we can see revert reasons with ganache-cli
only currently.