smart-contracts icon indicating copy to clipboard operation
smart-contracts copied to clipboard

Always getting "No contracts found" exception

Open gleb-urvanov opened this issue 8 years ago • 22 comments

While trying to deploy example contracts to testnet I'm always getting "populus.contracts.exceptions.UnknownContract" exception. Here are logs for example.yml:

(venv) anonymous@anonymous-machine:~/workspace/ico$ deploy-contracts --deployment-file=crowdsales/example.yml --deployment-name=testnet --address=0x064300880ab8864630beefff444dbd8981812621
Web3 provider is RPC connection http://127.0.0.1:8545
Owner address is 0x064300880ab8864630beefff444dbd8981812621
Owner balance is 7720 ETH
Already deployed contract, team_multisig 0x40a05d4ce308bf600cb275d7a3e9113518f59c54
Traceback (most recent call last):
  File "/home/anonymous/workspace/ico/venv/bin/deploy-contracts", line 9, in <module>
    load_entry_point('ico', 'console_scripts', 'deploy-contracts')()
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/anonymous/workspace/ico/ico/cmd/deploycontracts.py", line 31, in main
    deploy_crowdsale_from_file(project, deployment_file, deployment_name, address)
  File "/home/anonymous/workspace/ico/ico/deploy.py", line 288, in deploy_crowdsale_from_file
    return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
  File "/home/anonymous/workspace/ico/ico/deploy.py", line 272, in _deploy_contracts
    runtime_data, statistics, contracts = deploy_crowdsale(project, chain, yaml_filename, chain_data, deploy_address)
  File "/home/anonymous/workspace/ico/ico/deploy.py", line 117, in deploy_crowdsale
    Contract = get_contract_by_name(chain, contract_name)
  File "/home/anonymous/workspace/ico/ico/utils.py", line 130, in get_contract_by_name
    contract_data = chain.provider.get_contract_data(name)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/populus/contracts/provider.py", line 171, in get_contract_data
    contract_identifier,
populus.contracts.exceptions.UnknownContract: No contracts found for the contract identifier 'MultiSigWallet'

What is missing and how to build and deploy the contracts properly?

gleb-urvanov avatar Dec 14 '17 15:12 gleb-urvanov

Can you try to run populus compile before running the command? It should show what contracts it compiles and what are available.

miohtama avatar Dec 14 '17 15:12 miohtama

Sure, here is the output:

(venv) anonymous@anonymous-machine:~/workspace/ico$ populus compile
Traceback (most recent call last):
  File "/home/anonymous/workspace/ico/venv/bin/populus", line 11, in <module>
    sys.exit(main())
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/populus/cli/compile_cmd.py", line 40, in compile_cmd
    _, compiled_contracts = compile_project_contracts(project)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/populus/compilation/__init__.py", line 56, in compile_project_contracts
    compiled_contracts = post_process_compiled_contracts(base_compiled_contracts)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/populus/utils/compile.py", line 155, in post_process_compiled_contracts
    add_full_dependencies_to_compiled_contracts,
  File "cytoolz/functoolz.pyx", line 586, in cytoolz.functoolz.pipe (cytoolz/functoolz.c:10663)
  File "cytoolz/functoolz.pyx", line 562, in cytoolz.functoolz.c_pipe (cytoolz/functoolz.c:10494)
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/eth_utils/functional.py", line 33, in inner
    return callback(fn(*args, **kwargs))
  File "/home/anonymous/workspace/ico/venv/lib/python3.5/site-packages/populus/utils/compile.py", line 122, in add_direct_dependencies_to_compiled_contracts
    in itertools.chain(contract_data['linkrefs'], contract_data['linkrefs_runtime'])
KeyError: 'linkrefs'

gleb-urvanov avatar Dec 14 '17 15:12 gleb-urvanov

Are you installing ico package as per README instructions? I believe you might have some sort of version conflict in your Python dependency packages.

miohtama avatar Dec 14 '17 16:12 miohtama

Yes, did the installation as described here: https://ico.readthedocs.io/en/latest/install.html, already tried to do the same from a scratch, the result is the same. I'm running clean Ubuntu 16.04 on a virtual machine, if it matters. Do you have any idea about the direction I should dig in to find the solution?

gleb-urvanov avatar Dec 14 '17 16:12 gleb-urvanov

Here is the list of versions of tools mentioned in installation instructions:

build-essential ---------------- 12.1ubuntu2
libssl-dev --------------------- 1.0.2g-1ubuntu4.10
python3 ------------------------ 3.5.1-3
python3-venv ------------------- 3.5.1-3
python3-setuptools ------------- 20.7.0-1
python3-dev -------------------- 3.5.1-3
cmake -------------------------- 3.5.1-1ubuntu3
libboost-all-dev --------------- 1.58.0.1ubuntu1

gleb-urvanov avatar Dec 14 '17 17:12 gleb-urvanov

@gleb-urvanov Can you do pip freeze to show all your package versions?

miohtama avatar Dec 19 '17 19:12 miohtama

hey folks - exactly same situation here !

zatmonkey avatar Dec 20 '17 07:12 zatmonkey

@miohtama here's my pip freeze - basically fresh install on ubuntu on Windows

anyconfig==0.9.3 argh==0.26.2 bitcoin==1.1.42 certifi==2017.7.27.1 cffi==1.10.0 chardet==3.0.4 click==6.7 contextlib2==0.5.5 cytoolz==0.9.0 eth-testrpc==1.3.0 ethereum==1.6.1 ethereum-abi-utils==0.4.0 ethereum-utils==0.3.2 -e [email protected]:alexksso/ico.git@9e48fab4ef683f6e1e9fc86f34cb7555589f2d57#egg=ico idna==2.5 Jinja2==2.9.6 json-rpc==1.10.3 jsonschema==2.6.0 MarkupSafe==1.0 pathtools==0.1.2 pbkdf2==1.3 pkg-resources==0.0.0 populus==1.9.0 py==1.4.34 py-geth==1.9.0 py-solc==1.4.0 pycparser==2.18 pycryptodome==3.4.6 pyethash==0.1.27 pylru==1.0.9 pysha3==1.0.2 pytest==3.2.0 PyYAML==3.12 repoze.lru==0.6 requests==2.18.3 rlp==0.5.1 ruamel.yaml==0.15.23 scrypt==0.8.0 secp256k1==0.13.2 semantic-version==2.6.0 toolz==0.8.2 toposort==1.5 urllib3==1.22 watchdog==0.8.3 web3==3.11.1 Werkzeug==0.12.2

zatmonkey avatar Dec 20 '17 07:12 zatmonkey

Here is the good know version set from Travis:

anyconfig==0.9.3

apipkg==1.4

argh==0.26.2

bitcoin==1.1.42

certifi==2017.7.27.1

cffi==1.10.0

chardet==3.0.4

click==6.7

contextlib2==0.5.5

cytoolz==0.9.0

eth-testrpc==1.3.0

ethereum==1.6.1

ethereum-abi-utils==0.4.0

ethereum-utils==0.3.2

execnet==1.5.0

-e git+https://github.com/TokenMarketNet/ico.git@f98ab14566fda8b2bcb4c9308c542ee2eb794187#egg=ico

idna==2.5

Jinja2==2.9.6

json-rpc==1.10.3

jsonschema==2.6.0

MarkupSafe==1.0

pathtools==0.1.2

pbkdf2==1.3

populus==1.9.0

py==1.4.34

py-geth==1.9.0

py-solc==1.4.0

pycparser==2.18

pycryptodome==3.4.6

pyethash==0.1.27

pylru==1.0.9

pysha3==1.0.2

pytest==3.2.0

pytest-forked==0.2

pytest-xdist==1.20.1

PyYAML==3.12

repoze.lru==0.6

requests==2.18.3

rlp==0.5.1

ruamel.yaml==0.15.23

scrypt==0.8.0

secp256k1==0.13.2

semantic-version==2.6.0

toolz==0.8.2

toposort==1.5

urllib3==1.22

watchdog==0.8.3

web3==3.11.1

Werkzeug==0.12.2

miohtama avatar Dec 20 '17 09:12 miohtama

Can you run which populus to make sure it runs Populus command from within the virtual environment and not from somewhere else?

miohtama avatar Dec 20 '17 09:12 miohtama

hello. same issue here as well. running Ubuntu 16.04. updated the requirements.txt, same output populus running from /home/default/ico/venv/bin/populus

jonasjuan avatar Dec 20 '17 13:12 jonasjuan

There's some fixes for populus for solidity v0.4.18 and v0.4.19.

I am able to compile now.

jonasjuan avatar Dec 20 '17 14:12 jonasjuan

@jonasjuan yes it's good: ~/git/ico(master*) » which populus alex@KssoXPS13 /mnt/c/Users/alex/Documents/git/ico/venv/bin/populus

Sooo ... what was the trick to make it work?

zatmonkey avatar Dec 20 '17 17:12 zatmonkey

@alexksso I was reading this https://github.com/ethereum/populus/pull/399 and kinda follow through. Some new settings in solc v0.4.19.

jonasjuan avatar Dec 20 '17 17:12 jonasjuan

Ah, so it is specific to the solc version. This is why it was so hard to track down.

miohtama avatar Dec 23 '17 09:12 miohtama

@jonasjuan Could you submit a pull request and change this line and test it with solc 0.4.19:

https://github.com/TokenMarketNet/ico/blob/master/populus.json#L178

miohtama avatar Dec 23 '17 09:12 miohtama

@miohtama Okay im new at this. I created the branceh, tried pushing from terminal and i got permission denied.

EDIT: i think i figured out the push thing. thanks.

EDIT: Hmm, Im not really sure what to do now. Comparing the files yield identical thus no pull request.

Also, is the empty zeppelin folder meant to be filled with the current ones from openzepplin? i'm assuming thats the case so i did so all this while.

jonasjuan avatar Dec 23 '17 12:12 jonasjuan

@jonasjuan zeppelin folder is git submodule - if you do git clone --recursive it is automatically populated, otherwise you need to do some git submodule magic

miohtama avatar Dec 27 '17 19:12 miohtama

@jonasjuan You should be able to open PR when you do git push to your own forked Github repository. Then Create pull request button appears on your own Github repository.

miohtama avatar Dec 27 '17 20:12 miohtama

I've submitted a pull request #93

Fonger avatar Dec 29 '17 03:12 Fonger

@Fonger for some reason your PR makes no difference for me... I just got the raw file and replaced my populous.json

UPDATE: actually I downloaded the json to the wrong folder heh. I did have to update the chain, but seems to work now.

dpnova avatar Jan 12 '18 06:01 dpnova