trailofbits / manticore

Symbolic execution tool
https://blog.trailofbits.com/2017/04/27/manticore-symbolic-execution-for-humans/
GNU Affero General Public License v3.0
3.66k stars 471 forks source link

Deployment Error with Hardhat Project #2523

Open rac-sri opened 2 years ago

rac-sri commented 2 years ago

Summary of the problem

Manticore version

0.3.6

Python version

3.8.10

OS / Environment

Ubuntu 20.4

Dependencies

apipkg==1.5 appdirs==1.4.4 APScheduler==3.6.3 apturl==0.5.2 asgiref==3.3.1 astroid==2.4.2 asttokens==2.0.4 attrs==20.3.0 AutoNode @ file:///home/rachit/harmony/auto-node base58==2.1.0 bcrypt==3.1.7 bech32==1.2.0 bitarray==1.2.2 black==19.10b0 blinker==1.4 Brlapi==0.7.0 brownie-token-tester==0.3.2 cached-property==1.5.1 capstone==4.0.2 certifi==2020.12.5 cffi==1.14.5 chardet==4.0.0 chrome-gnome-shell==0.0.0 click==7.1.2 colorama==0.4.3 command-not-found==0.3 cryptography==2.9.2 crytic-compile==0.2.0 cupshelpers==1.0 cycler==0.10.0 cytoolz==0.11.0 dbus-python==1.2.16 decorator==4.4.2 defer==1.0.6 distro==1.4.0 distro-info===0.23ubuntu1 Django==3.1.4 dnspython==1.16.0 docker==4.1.0 docker-compose==1.25.0 dockerpty==0.4.1 docopt==0.6.2 duplicity==0.8.12.0 entrypoints==0.3 eth-abi==2.1.1 eth-account==0.5.2 eth-brownie==1.14.5 eth-event==1.2.3 eth-hash==0.2.0 eth-keyfile==0.5.1 eth-keys==0.3.3 eth-rlp==0.2.1 eth-typing==2.2.2 eth-utils==1.9.5 etheno==0.2.4 execnet==1.8.0 fasteners==0.14.1 flake8==3.8.4 Flask==1.1.2 Flask-Cors==3.0.10 future==0.18.2 hexbytes==0.2.1 httplib2==0.14.0 hypothesis==5.41.3 idna==2.10 image==1.5.33 importlib-metadata==3.10.0 importlib-resources==5.1.2 incremental==17.5.0 inflection==0.5.0 iniconfig==1.1.1 intervaltree==3.1.0 ipfshttpclient==0.7.0 isort==5.7.0 itsdangerous==1.1.0 Jinja2==2.10.1 jsonschema==3.2.0 keyring==18.0.1 kiwisolver==1.2.0 language-selector==0.1 launchpadlib==1.10.13 lazr.restfulclient==0.14.2 lazr.uri==1.0.3 lazy-object-proxy==1.4.3 lockfile==0.12.2 louis==3.12.0 lru-dict==1.1.7 macaroonbakery==1.3.1 Mako==1.1.0 manticore==0.3.6 MarkupSafe==1.1.0 matplotlib==3.3.2 mccabe==0.6.1 monotonic==1.5 more-itertools==8.7.0 multiaddr==0.0.9 mythx-models==1.9.1 netaddr==0.8.0 netifaces==0.10.4 numpy==1.19.3 oauthlib==3.1.0 olefile==0.46 pandas==1.1.4 paramiko==2.6.0 parsimonious==0.8.1 pathspec==0.8.1 pexpect==4.8.0 Pillow==7.0.0 pluggy==0.13.1 ply==3.11 prettytable==2.1.0 prompt-toolkit==3.0.8 protobuf==3.15.6 proton-client==0.7.1 protonvpn-cli==3.10.1 protonvpn-nm-lib==3.6.1 psutil==5.8.0 ptyprocess==0.7.0 py==1.10.0 py-solc-ast==1.2.8 py-solc-x==1.1.0 py4j==0.10.9 pyaes==1.6.1 pyasn1==0.4.8 pycairo==1.16.2 pycodestyle==2.6.0 pycparser==2.20 pycryptodome==3.10.1 pycups==1.9.73 pyelftools==0.27 pyevmasm==0.2.3 pyflakes==2.2.0 Pygments==2.8.1 pygments-lexer-solidity==0.5.1 PyGObject==3.36.0 pyhmy==20.5.20 PyJWT==1.7.1 pylint==2.6.0 pymacaroons==0.13.0 pymongo==3.11.2 PyNaCl==1.3.0 pyOpenSSL==19.0.0 pyparsing==2.4.7 pyRFC3339==1.1 pyrsistent==0.17.3 pysha3==1.0.2 pyspark==3.1.2 pytest==6.0.1 pytest-forked==1.3.0 pytest-xdist==1.34.0 python-apt==2.0.0+ubuntu0.20.4.6 python-dateutil==2.8.1 python-debian===0.1.36ubuntu1 python-dotenv==0.16.0 python-gnupg==0.4.5 python-telegram-bot==13.1 pythondialog==3.4.0 pythx==1.6.1 pytz==2019.3 pyxdg==0.26 PyYAML==5.4.1 qrcode==6.1 regex==2020.11.13 reportlab==3.5.34 requests==2.25.1 requests-oauthlib==1.3.0 requests-unixsocket==0.2.0 rlp==1.2.0 rsa==4.6 screen-resolution-extra==0.0.0 SecretStorage==2.3.1 semantic-version==2.8.5 simplejson==3.16.0 six==1.15.0 slither-analyzer==0.8.0 sortedcontainers==2.3.0 sqlparse==0.4.1 systemd-python==234 Telethon==1.18.2 texttable==1.6.2 toml==0.10.2 toolz==0.11.1 tornado==6.1 tqdm==4.53.0 tweepy==3.9.0 typed-ast==1.4.2 typing-extensions==3.7.4.3 tzlocal==2.1 ubuntu-advantage-tools==27.4 ubuntu-drivers-common==0.0.0 ufw==0.36 unattended-upgrades==0.1 unicorn==1.0.2 urllib3==1.26.4 usb-creator==0.3.7 varint==1.0.2 vvm==0.1.0 vyper==0.2.12 wadllib==1.3.3 wasm==1.2 wcwidth==0.2.5 web3==5.11.1 websocket-client==0.53.0 websockets==8.1 Werkzeug==1.0.1 wrapt==1.12.1 xkit==0.0.0 z3-solver==4.8.10.0 zipp==3.4.1

Step to reproduce the behavior

Try using solidity_create_contract with a hardhat project. Failing for me for: weth_contract = m.solidity_create_contract(".", contract_name="MockWETH", owner=project_owner_account)

Expected behavior

Should execute and return an address of the contract.

Actual behavior

Program exits on the deployment script with the log below.

Any relevant logs

Traceback (most recent call last):
  File "manticore/manticore_flash_loan.py", line 22, in <module>
    weth_contract = m.solidity_create_contract(".", contract_name="MockWETH", owner=project_owner_account)
  File "/home/rachit/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 575, in solidity_create_contract
    compile_results = self._compile(
  File "/home/rachit/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 349, in _compile
    compilation_result = ManticoreEVM._compile_through_crytic_compile(
  File "/home/rachit/.local/lib/python3.8/site-packages/manticore/ethereum/manticore.py", line 274, in _compile_through_crytic_compile
    raise EthereumError(
manticore.exceptions.EthereumError: MockWETH is shared in multiple compilation units, please split the codebase to prevent the duplicate
Jovonni commented 2 years ago

Is the MockWETH contract code being used in several contracts that are all referenced?

Check to see your imports in your main contract, and if any of those are also using mockWETH.

rac-sri commented 2 years ago

Thanks for quick response @Jovonni . Nope. MockWeb3 is only used for my hardhat tests alone. There are three contracts I am trying to deploy under manticore, one mockWETH, one mockNFT, and one main contract. But its showing the same error for each of the contract. ALso, the project compiles properly using crytic-compile too when run directly.