Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Unable to deploy to Vyper smart contract to Ganache CLI, only works so far with Truffle Develop and a Geth Node #1026

Closed
ltfschoen opened this issue Apr 20, 2018 · 1 comment

Comments

@ltfschoen
Copy link

Summary of Issue

I'm trying to integrate support for Vyper smart contract programming language into Truffle's suite.
I've created this repo https://github.com/ltfschoen/vyper-test that includes a script https://github.com/ltfschoen/vyper-test/blob/master/scripts/main.py and instructions in the README.md. I've written it in the latest Web3.py 4.1.0 that allows you to compile Vyper smart contracts, and I'm using Web3.py to connect to either a private Geth Node using IPC provider, or to connect to Truffle's in-built blockchain with truffle develop --log by using HTTP provider with port 9545, and then it deploys the smart contract to the blockchain. If I use Truffle's in-built blockchain it's mined automatically, but if I used the Geth Node I have to manually use Geth JavaScript Console to mine the transaction of the deployed contract miner.start(1) before it returns the transaction receipt containing the address where it was deployed so I can call functions and interact with it.

What's missing is the ability to to deploy the contract to Ganache CLI.
I thought it would be as simple as starting Ganache CLI with the following, and that it would be picked up by the HTTP provider on port 9545 the same way that Truffle Develop successfully does in the script here on Line 19 https://github.com/ltfschoen/vyper-test/blob/master/scripts/main.py#L19, as I've specified the port 9545 in the flags:

ganache-cli \
    --account="0x0000000000000000000000000000000000000000000000000000000000000001, 2471238800000000000" \
    --account="0x0000000000000000000000000000000000000000000000000000000000000002, 4471238800000000000" \
    --unlock "0x0000000000000000000000000000000000000000000000000000000000000001" \
    --unlock "0x0000000000000000000000000000000000000000000000000000000000000002" \
    --blocktime 0 \
    --deterministic true \
    --port 9545 \
    --hostname localhost \
    --seed 'blah' \
    --debug true \
    --mem true \
    --mnemonic 'something' \
    --db './db/chain_database' \
    --verbose \
    --networkId=1000 \
    --gasLimit=7984452 \
    --gasPrice=20000000000;

However, it only outputs up to Line 89 https://github.com/ltfschoen/vyper-test/blob/master/scripts/main.py#L89 and then it hangs. It never outputs the accounts on on Line 96 or Line 100. Then after about 30 seconds shows errors as shown below:

$ python3 scripts/main.py

Failed to import bitcoin. This is not a fatal error but does
mean that you will not be able to determine the address from
your wallet file.
OS Platform: darwin
Web3 provider: <web3.main.Web3 object at 0x110578240>
Initializing chain from provided state
ABI: %s [{'name': '__init__', 'outputs': [], 'inputs': [{'type': 'address', 'name': '_beneficiary'}, {'type': 'int128', 'name': '_bidding_time'}], 'constant': False, 'payable': False, 'type': 'constructor'}, {'name': 'bid', 'outputs': [], 'inputs': [], 'constant': False, 'payable': True, 'type': 'function', 'gas': 76241}, {'name': 'end_auction', 'outputs': [], 'inputs': [], 'constant': False, 'payable': False, 'type': 'function', 'gas': 56101}, {'name': 'beneficiary', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 543}, {'name': 'auction_start', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 573}, {'name': 'auction_end', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 603}, {'name': 'highest_bidder', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 633}, {'name': 'highest_bid', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 663}, {'name': 'ended', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 693}]
Address: %s b'\xd6\xf0\x84\xee\x15\xe3\x8cO~\t\x1f\x8d\xd0\xfeo\xe4\xa0\xe2\x03\xef'
Contract Instance: %s <ethereum.tools.tester.ABIContract object at 0x111f84390>
Contract Instance with Web3: %s <ethereum.tools.tester.ABIContract object at 0x111f84390>
Traceback (most recent call last):
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    httplib_response = conn.getresponse()
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 388, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 308, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='127.0.0.1', port=9545): Read timed out. (read timeout=10)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "scripts/main.py", line 94, in <module>
    if web3.personal.listAccounts:
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/personal.py", line 24, in listAccounts
    "personal_listAccounts", [],
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/manager.py", line 103, in request_blocking
    response = self._make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/manager.py", line 86, in _make_request
    return request_func(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/gas_price_strategy.py", line 18, in middleware
    return make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/formatting.py", line 23, in middleware
    response = make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/attrdict.py", line 18, in middleware
    response = make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/formatting.py", line 23, in middleware
    response = make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/normalize_errors.py", line 9, in middleware
    result = make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/validation.py", line 46, in middleware
    return make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/formatting.py", line 23, in middleware
    response = make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/middleware/exception_retry_request.py", line 80, in middleware
    return make_request(method, params)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/providers/rpc.py", line 67, in make_request
    **self.get_request_kwargs()
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/web3/utils/request.py", line 21, in make_post_request
    response = session.post(endpoint_uri, data=data, *args, **kwargs)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Users/Ls/.pyenv/versions/3.6.2/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 521, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=9545): Read timed out. (read timeout=10)

Whereas if I'm running truffle develop --log instead using HTTP on port 9545 or the Geth Node with mining activated, it returns:

$ python3 scripts/main.py

OS Platform: darwin
Web3 provider: <web3.main.Web3 object at 0x10ebb6160>
Initializing chain from provided state
ABI: %s [{'name': '__init__', 'outputs': [], 'inputs': [{'type': 'address', 'name': '_beneficiary'}, {'type': 'int128', 'name': '_bidding_time'}], 'constant': False, 'payable': False, 'type': 'constructor'}, {'name': 'bid', 'outputs': [], 'inputs': [], 'constant': False, 'payable': True, 'type': 'function', 'gas': 76241}, {'name': 'end_auction', 'outputs': [], 'inputs': [], 'constant': False, 'payable': False, 'type': 'function', 'gas': 56101}, {'name': 'beneficiary', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 543}, {'name': 'auction_start', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 573}, {'name': 'auction_end', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 603}, {'name': 'highest_bidder', 'outputs': [{'type': 'address', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 633}, {'name': 'highest_bid', 'outputs': [{'type': 'int128', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 663}, {'name': 'ended', 'outputs': [{'type': 'bool', 'name': 'out'}], 'inputs': [], 'constant': True, 'payable': False, 'type': 'function', 'gas': 693}]
Address: %s b'\xd6\xf0\x84\xee\x15\xe3\x8cO~\t\x1f\x8d\xd0\xfeo\xe4\xa0\xe2\x03\xef'
Contract Instance: %s <ethereum.tools.tester.ABIContract object at 0x1105aa5c0>
Contract Instance with Web3: %s <ethereum.tools.tester.ABIContract object at 0x1105aa5c0>
Accounts: %s 0x487F2778Ec7D0747d6E26AF80148Ec471a08b339
Default Account: %s 0x487F2778Ec7D0747d6E26AF80148Ec471a08b339
Unlocked Default Account: %s True
Deployed Contract Tx Hash: %d b'\tk\xfb.k\xe5\x94\x1f\x152\xb3\x14d\x1dN6T\xf5\x97v(d\xa4\xd6DW\x93\xf2r\xe1\xe7\xfc'
Mined Transaction Receipt: %s AttributeDict({'blockHash': HexBytes('0x74c26c73f9021c8aae1a6df1e283c13a2045f3c3a2b9aab1689307b1bc40c12b'), 'blockNumber': 3755, 'contractAddress': '0xc071ef1FE2f3d9b8D59C4106391b7fe417593cfa', 'cumulativeGasUsed': 273163, 'from': '0x487f2778ec7d0747d6e26af80148ec471a08b339', 'gasUsed': 273163, 'logs': [], 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'root': '0xb5b377e641e9850d2f10d631251b5431a4f34a7745aafddca52b7654fb7bb60f', 'to': None, 'transactionHash': HexBytes('0x096bfb2e6be5941f1532b314641d4e3654f597762864a4d6445793f272e1e7fc'), 'transactionIndex': 0})
Transaction Receipt: %s AttributeDict({'blockHash': HexBytes('0x74c26c73f9021c8aae1a6df1e283c13a2045f3c3a2b9aab1689307b1bc40c12b'), 'blockNumber': 3755, 'contractAddress': '0xc071ef1FE2f3d9b8D59C4106391b7fe417593cfa', 'cumulativeGasUsed': 273163, 'from': '0x487f2778ec7d0747d6e26af80148ec471a08b339', 'gasUsed': 273163, 'logs': [], 'logsBloom': HexBytes('0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), 'root': '0xb5b377e641e9850d2f10d631251b5431a4f34a7745aafddca52b7654fb7bb60f', 'to': None, 'transactionHash': HexBytes('0x096bfb2e6be5941f1532b314641d4e3654f597762864a4d6445793f272e1e7fc'), 'transactionIndex': 0})
Contract Instance: %s <web3.utils.datatypes.Contract object at 0x10f151a20>
Called Getter method of beneficiary from Deployed Contract Instance: %s 0x487F2778Ec7D0747d6E26AF80148Ec471a08b339
Called Getter method of auction_end from Deployed Contract Instance: %s 1524192662
  • I asked about this on gitter: [ ] - NO, because there's too much content and I don't want to spam the group

Expected Behavior

I expect a Ganache CLI blockchain that's running a HTTP provider on port 9545 to not fail with the errors shown above. I expect it to process the deployment successfully the same way that Truffle Develop processes the requests that I deploy with HTTP provider on port 9545

Current Behavior

See the current behaviour summarised in the "Summary of Issue" section above

Possible Solution

Ideally Ganache CLI would process the deployment successfully the same way that Truffle Develop does. Ultimately my goal is to update the Truffle CLI commands to support compiling, migrating/deploying Vyper instead of just Solidity.

Steps to Reproduce (for bugs)

  1. Read the "Summary of Issue" section included at the top of this Issue
  2. Follow these setup instructions in my repo https://github.com/ltfschoen/vyper-test#chapter-0---setup-without-docker- install PyEnv and switch to Python version 3.6.2 to install the Vyper language, then clone my repo, install all the necessary dependencies, check that you can compile the Vyper contract included in my repo, then use NPM to install Truffle, run Truffle Develop built-in blockchain, and then run my main.py script to deploy and interact with the contract

Context

Truffle would be the perfect tool to deploy both Solidity and Vyper smart contracts.

The Vyper team are meeting on the 23 April 2018 and we'd like this to be part of the agenda. vyperlang/vyper#788

Your Environment

  • Version used:
    • Ganache CLI
$ ganache-cli version
Ganache CLI v6.1.0 (ganache-core: 2.1.0)
  • Version of Truffle/Remix/Other tools used:
    • Truffle version
$ truffle version
Truffle v4.1.7 (core: 4.1.7)
Solidity v0.4.23 (solc-js)
  • Python 3.6.2

  • Vyper version 0.0.4

  • NodeJS Version: [ ] 6.x, [ ] 7.x (unsupported), [ ] 8.x, [X] 9.x

  • Operating System and version (include distro if Linux): macOS 10.12.6

  • Link to your project or repro gist: https://github.com/ltfschoen/vyper-test

  • Commit hash to use with above link for reproduction: N/A

  • I intend to submit a pull request to fix this issue: [X] (if only I could figure out how to fix it....)

@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Aug 19, 2021
@leeftk
Copy link

leeftk commented Oct 27, 2021

Closing this for issue maintenance. However, Truffle does support Vyper now if you want to upgrade and check it out. Thanks!

@leeftk leeftk closed this as completed Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants