From dbf6ef05150d9f51a1cd39074193dcc4977d28ec Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 26 Jan 2017 00:15:21 +0100 Subject: [PATCH 1/4] Utilize pyeth changes for solc >= 0.4.9 --- raiden/network/rpc/client.py | 1 + raiden/tests/fixtures/blockchain.py | 1 + .../tests/integration/test_blockchainservice.py | 11 +++++++++-- raiden/ui/console.py | 4 +++- requirements.txt | 7 +++++-- setup.py | 4 +++- tools/deploy.py | 1 + tools/init_blockchain.py | 17 +++++++++++------ 8 files changed, 34 insertions(+), 12 deletions(-) diff --git a/raiden/network/rpc/client.py b/raiden/network/rpc/client.py index a9476c9dc8..cf48d46d9f 100644 --- a/raiden/network/rpc/client.py +++ b/raiden/network/rpc/client.py @@ -266,6 +266,7 @@ def deploy_contract(self, contract_name, contract_file, constructor_parameters=N contracts, dict(), constructor_parameters, + contract_path=contract_path, gasprice=default_gasprice, timeout=self.poll_timeout, ) diff --git a/raiden/tests/fixtures/blockchain.py b/raiden/tests/fixtures/blockchain.py index b820cc6db3..fca4230bf4 100644 --- a/raiden/tests/fixtures/blockchain.py +++ b/raiden/tests/fixtures/blockchain.py @@ -366,6 +366,7 @@ def _jsonrpc_services( registry_contracts, dict(), tuple(), + contract_path=registry_path, gasprice=default_gasprice, timeout=poll_timeout, ) diff --git a/raiden/tests/integration/test_blockchainservice.py b/raiden/tests/integration/test_blockchainservice.py index 1dd746d6e6..39aa0570de 100644 --- a/raiden/tests/integration/test_blockchainservice.py +++ b/raiden/tests/integration/test_blockchainservice.py @@ -5,7 +5,7 @@ import pytest from ethereum import _solidity -from ethereum._solidity import compile_file +from ethereum._solidity import compile_file, solidity_get_contract_data from ethereum.utils import denoms from pyethapp.rpc_client import JSONRPCClient from pyethapp.jsonrpc import default_gasprice @@ -191,6 +191,7 @@ def test_blockchain( humantoken_contracts, dict(), (total_asset, 'raiden', 2, 'Rd'), + contract_path=humantoken_path, gasprice=default_gasprice, timeout=poll_timeout, ) @@ -203,6 +204,7 @@ def test_blockchain( registry_contracts, dict(), tuple(), + contract_path=registry_path, gasprice=default_gasprice, timeout=poll_timeout, ) @@ -257,8 +259,13 @@ def test_blockchain( assert channel_manager_address == event['channel_manager_address'].decode('hex') assert token_proxy.address == event['asset_address'].decode('hex') + contract_data = solidity_get_contract_data( + registry_contracts, + get_contract_path('ChannelManagerContract.sol'), + 'ChannelManagerContract' + ) channel_manager_proxy = jsonrpc_client.new_contract_proxy( - registry_contracts['ChannelManagerContract']['abi'], + contract_data['abi'], channel_manager_address, ) diff --git a/raiden/ui/console.py b/raiden/ui/console.py index d471e8d51b..3d5c51217b 100644 --- a/raiden/ui/console.py +++ b/raiden/ui/console.py @@ -179,12 +179,14 @@ def create_token( Returns: token_address: the hex encoded address of the new token/asset. """ + contract_path = get_contract_path('HumanStandardToken.sol') # Deploy a new ERC20 token token_proxy = self._chain.client.deploy_solidity_contract( self._raiden.address, 'HumanStandardToken', - compile_file(get_contract_path('HumanStandardToken.sol')), + compile_file(contract_path), dict(), (initial_alloc, name, decimals, symbol), + contract_path=contract_path, gasprice=gasprice, timeout=timeout) token_address = token_proxy.address.encode('hex') diff --git a/requirements.txt b/requirements.txt index 63bd33ee71..d3362bd34c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,16 @@ pysha3 # temporary until https://github.com/ethereum/pyethapp/pull/184 comes upstream (see also setup.py) --e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp +#-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp +# temporary until new version of pyethereum is released, that supports solc >= v0.4.9 +-e git+https://github.com/LefterisJP/pyethapp@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=pyethapp ipython<5.0.0 rlp>=0.4.3,<=0.4.6 secp256k1==0.12.1 pycryptodome>=3.4.3 miniupnpc networkx -ethereum>=1.3.2 +# temporary until new version of pyethereum is released, that supports solc >= v0.4.9 +-e git+https://github.com/LefterisJP/pyethereum@43d184ee74df1caaf5f4ffd06343938db3839005#egg=ethereum ethereum-serpent repoze.lru gevent-websocket==0.9.4 diff --git a/setup.py b/setup.py index 2e64a619c5..0322785d7a 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,9 @@ def run_tests(self): install_requires_replacements = { - "-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp": "pyethapp" +# "-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp": "pyethapp", + "-e git+https://github.com/LefterisJP/pyethapp@8d856c9351fb0a2dd42bc1eec8167e6e6b2fd204#egg=pyethapp": "pyethapp", + "-e git+https://github.com/LefterisJP/pyethereum@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=ethereum": "ethereum" } install_requires = list(set( diff --git a/tools/deploy.py b/tools/deploy.py index baa4799d28..b6efb026e6 100755 --- a/tools/deploy.py +++ b/tools/deploy.py @@ -45,6 +45,7 @@ def deploy_files(contract_files, client): compiled_contracts, libraries, '', + contract_path=c, gasprice=default_gasprice ) libraries[name] = proxy.address diff --git a/tools/init_blockchain.py b/tools/init_blockchain.py index 4cb818a33d..fd6363a76b 100644 --- a/tools/init_blockchain.py +++ b/tools/init_blockchain.py @@ -22,19 +22,23 @@ def connect(host='127.0.0.1', return client -def create_and_distribute_token(client, receivers, - amount_per_receiver=1000, - name=None, - gasprice=default_gasprice, - timeout=120): +def create_and_distribute_token( + client, + receivers, + amount_per_receiver=1000, + name=None, + gasprice=default_gasprice, + timeout=120 +): """Create a new ERC-20 token and distribute it among `receivers`. If `name` is None, the name will be derived from hashing all receivers. """ name = name or sha3(''.join(receivers)).encode('hex') + contract_path = get_contract_path('HumanStandardToken.sol') token_proxy = client.deploy_solidity_contract( client.sender, 'HumanStandardToken', - compile_file(get_contract_path('HumanStandardToken.sol')), + compile_file(contract_path), dict() ( len(receivers) * amount_per_receiver, @@ -42,6 +46,7 @@ def create_and_distribute_token(client, receivers, 2, # decimals name[:4].upper() # symbol ), + contract_path=contract_path, gasprice=gasprice, timeout=timeout ) From 85d22929a6beb2fa7f33dc6a4bc45d6f533e4a7d Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 26 Jan 2017 10:18:28 +0100 Subject: [PATCH 2/4] Correct install_requires_replacements Also skip lines starting with # --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 0322785d7a..ebe9d0ab97 100755 --- a/setup.py +++ b/setup.py @@ -31,13 +31,13 @@ def run_tests(self): install_requires_replacements = { # "-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp": "pyethapp", - "-e git+https://github.com/LefterisJP/pyethapp@8d856c9351fb0a2dd42bc1eec8167e6e6b2fd204#egg=pyethapp": "pyethapp", - "-e git+https://github.com/LefterisJP/pyethereum@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=ethereum": "ethereum" + "-e git+https://github.com/LefterisJP/pyethapp@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=pyethapp": "pyethapp", + "-e git+https://github.com/LefterisJP/pyethereum@43d184ee74df1caaf5f4ffd06343938db3839005#egg=ethereum": "ethereum" } install_requires = list(set( install_requires_replacements.get(requirement.strip(), requirement.strip()) - for requirement in open('requirements.txt') + for requirement in open('requirements.txt') if not requirement.lstrip().startswith('#') )) test_requirements = [] From 3280d0a149ce0a0ef20feae2bf0e83c1b39c46f9 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 26 Jan 2017 10:46:06 +0100 Subject: [PATCH 3/4] Replace py/ethapp-ethereum hotfix with branch names --- requirements.txt | 4 ++-- setup.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index d3362bd34c..8877052a44 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ pysha3 # temporary until https://github.com/ethereum/pyethapp/pull/184 comes upstream (see also setup.py) #-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp # temporary until new version of pyethereum is released, that supports solc >= v0.4.9 --e git+https://github.com/LefterisJP/pyethapp@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=pyethapp +-e git+https://github.com/LefterisJP/pyethapp@use_new_solc_combinedjson_key#egg=pyethapp ipython<5.0.0 rlp>=0.4.3,<=0.4.6 secp256k1==0.12.1 @@ -10,7 +10,7 @@ pycryptodome>=3.4.3 miniupnpc networkx # temporary until new version of pyethereum is released, that supports solc >= v0.4.9 --e git+https://github.com/LefterisJP/pyethereum@43d184ee74df1caaf5f4ffd06343938db3839005#egg=ethereum +-e git+https://github.com/LefterisJP/pyethereum@fix_solidity_key_combinedjson#egg=ethereum ethereum-serpent repoze.lru gevent-websocket==0.9.4 diff --git a/setup.py b/setup.py index ebe9d0ab97..d8d3fc3db8 100755 --- a/setup.py +++ b/setup.py @@ -31,8 +31,8 @@ def run_tests(self): install_requires_replacements = { # "-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp": "pyethapp", - "-e git+https://github.com/LefterisJP/pyethapp@d1c9f39313d1facd54ee2a27d0ff6e8550ae2d64#egg=pyethapp": "pyethapp", - "-e git+https://github.com/LefterisJP/pyethereum@43d184ee74df1caaf5f4ffd06343938db3839005#egg=ethereum": "ethereum" + "-e git+https://github.com/LefterisJP/pyethapp@use_new_solc_combinedjson_key#egg=pyethapp": "pyethapp", + "-e git+https://github.com/LefterisJP/pyethereum@fix_solidity_key_combinedjson#egg=ethereum": "ethereum" } install_requires = list(set( From a9f37d0dc4175e7dd1a41cf70ecd476c41cffa1f Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 26 Jan 2017 17:04:27 +0100 Subject: [PATCH 4/4] Use channel_manager ABI from blockchain module Also remove commented out requirement --- raiden/tests/integration/test_blockchainservice.py | 10 +++------- requirements.txt | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/raiden/tests/integration/test_blockchainservice.py b/raiden/tests/integration/test_blockchainservice.py index 39aa0570de..6e42e2db9c 100644 --- a/raiden/tests/integration/test_blockchainservice.py +++ b/raiden/tests/integration/test_blockchainservice.py @@ -5,13 +5,14 @@ import pytest from ethereum import _solidity -from ethereum._solidity import compile_file, solidity_get_contract_data +from ethereum._solidity import compile_file from ethereum.utils import denoms from pyethapp.rpc_client import JSONRPCClient from pyethapp.jsonrpc import default_gasprice from raiden.network.rpc.client import decode_topic, patch_send_transaction from raiden.utils import privatekey_to_address, get_contract_path +from raiden.blockchain.abi import CHANNEL_MANAGER_ABI solidity = _solidity.get_solidity() # pylint: disable=invalid-name @@ -259,13 +260,8 @@ def test_blockchain( assert channel_manager_address == event['channel_manager_address'].decode('hex') assert token_proxy.address == event['asset_address'].decode('hex') - contract_data = solidity_get_contract_data( - registry_contracts, - get_contract_path('ChannelManagerContract.sol'), - 'ChannelManagerContract' - ) channel_manager_proxy = jsonrpc_client.new_contract_proxy( - contract_data['abi'], + CHANNEL_MANAGER_ABI, channel_manager_address, ) diff --git a/requirements.txt b/requirements.txt index 8877052a44..a33017d971 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ pysha3 -# temporary until https://github.com/ethereum/pyethapp/pull/184 comes upstream (see also setup.py) -#-e git+https://github.com/konradkonrad/pyethapp@71f940c6d287b98a35ef524f4c5e3c13d530bfc5#egg=pyethapp # temporary until new version of pyethereum is released, that supports solc >= v0.4.9 -e git+https://github.com/LefterisJP/pyethapp@use_new_solc_combinedjson_key#egg=pyethapp ipython<5.0.0