contract deploy function returns `brownie.exceptions.VirtualMachineError: revert`
See original GitHub issueEnvironment information
brownie
Version: 1.14.6ganache-cli
Version: 6.12.2vyper
Version: 0.2.12+commit.2c6842c- Python Version: 3.9.4
- OS: osx
What was wrong?
in my conftest.py
file i have:
import pytest
import brownie
from brownie import accounts, contract_name
# deploy contract
@pytest.fixture(scope="module")
def deploy(contract_name, accounts):
return contract_name.deploy({'from':accounts[0]}) # yes, the contract constructor takes no args
# clean chain for each function, ensures clean working environment
@pytest.fixture(autouse=True)
def shared_setup(fn_isolation):
pass
and then in my tests/some_test_file.py
i have:
import pytest
import brownie
from brownie import accounts
from brownie.test import given, strategy
@given(amount_sent = strategy('uint256', max_value=10**18, min_value=2))
def test_tax_amount_deducted_from_party_balances(amount_sent, deploy):
# do stuff
running brownie test tests/some_test_file.py
or any test for that matter returns this error:
Brownie v1.14.6 - Python development framework for Ethereum
======================================================== test session starts ========================================================
platform darwin -- Python 3.9.4, pytest-6.2.3, py-1.10.0, pluggy-0.13.1
rootdir: /Users/REDACTED/Desktop/file/another_file
plugins: eth-brownie-1.14.6, hypothesis-6.10.0, xdist-1.34.0, forked-1.3.0, web3-5.18.0
collected 1 item
Launching 'ganache-cli --port 8545 --gasLimit 12000000 --accounts 10 --hardfork istanbul --mnemonic brownie'...
tests/test_tax.py E [100%]
============================================================== ERRORS ===============================================================
__________________________________ ERROR at setup of test_tax_amount_deducted_from_party_balances ___________________________________
contract_name = <brownie.network.contract.ContractContainer object at 0x7ffbcdc44c10>
accounts = <brownie.network.account.Accounts object at 0x7ffbcb881880>
@pytest.fixture(scope="module")
def deploy(contract_name, accounts):
> return contract_name.deploy({'from':accounts[0]})
E brownie.exceptions.VirtualMachineError: revert
tests/conftest.py:8: VirtualMachineError
====================================================== short test summary info ======================================================
ERROR tests/test_tax.py::test_tax_amount_deducted_from_party_balances - brownie.exceptions.VirtualMachineError: revert
========================================================= 1 error in 10.91s =========================================================
Terminating local RPC client...
odd because it was working before i put it into the conftest, but moving it back to the individual test file makes no difference so not the cause
thanks in advance for the help, brownie is awesome i much prefer it to truffle
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
ERROR Brownie Mainnet Fork Testing `brownie.exceptions ...
I am following 16 hours Solidity course of 'freecodecamp` which is presented by Patrick Collins. SOLIDITY CODE: //SPDX-License-Identifier: MIT ...
Read more >VirtualMachineError: revert - Ethereum Stack Exchange
it will deploy a mock version of that contract, and return that mock contract. #Args: contract_name (string). #REturns: #brownie.network.
Read more >brownie.exceptions - Read the Docs
Raised when attempting to access a Contract object that no longer exists because the local network was reverted. exception brownie.exceptions.
Read more >eth-brownie/community - Gitter
Hi ! I got this error when i try to compile my contract. Its compiling fine on remix... been trying various things over...
Read more >Error: VM Exception while processing transaction: revert.
In the run tab there is a drop down under the value field, where you can select your contract and then either enter...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@skellet0r actually, you made a good point that there was an assumption in the constructor, I was attempting to set a variable in the contract with an interface call, commenting out lead to a different issue, but the issue described here is fixed, thanks
output from deploying with
contract_name.deploy({'from':accounts[0]})