diff --git a/.circleci/config.yml b/.circleci/config.yml index 3c2b7b6d05..815a0d1da6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -80,12 +80,13 @@ geth_steps: &geth_steps name: build geth if missing command: | mkdir -p $HOME/.ethash - pip install --user py-geth>=1.10.1 + pip install --user py-geth>=2.4.0 export GOROOT=/usr/local/go + echo $GETH_VERSION export GETH_BINARY="$HOME/.py-geth/geth-$GETH_VERSION/bin/geth" if [ ! -e "$GETH_BINARY" ]; then - curl -O https://storage.googleapis.com/golang/go1.9.7.linux-amd64.tar.gz - tar xvf go1.9.7.linux-amd64.tar.gz + curl -O https://storage.googleapis.com/golang/go1.14.2.linux-amd64.tar.gz + tar xvf go1.14.2.linux-amd64.tar.gz sudo chown -R root:root ./go sudo mv go /usr/local sudo ln -s /usr/local/go/bin/go /usr/local/bin/go @@ -188,29 +189,29 @@ jobs: # Please don't use this key for any shenanigans WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22 - py36-integration-goethereum-ipc-1.9.7: + py36-integration-goethereum-ipc-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.6 environment: TOXENV: py36-integration-goethereum-ipc - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py36-integration-goethereum-http-1.9.7: + py36-integration-goethereum-http-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.6 environment: TOXENV: py36-integration-goethereum-http - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py36-integration-goethereum-ws-1.9.7: + py36-integration-goethereum-ws-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.6 environment: TOXENV: py36-integration-goethereum-ws - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 py36-integration-parity-ipc: <<: *parity_steps @@ -278,29 +279,29 @@ jobs: # Please don't use this key for any shenanigans WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22 - py37-integration-goethereum-ipc-1.9.7: + py37-integration-goethereum-ipc-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.7 environment: TOXENV: py37-integration-goethereum-ipc - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py37-integration-goethereum-http-1.9.7: + py37-integration-goethereum-http-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.7 environment: TOXENV: py37-integration-goethereum-http - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py37-integration-goethereum-ws-1.9.7: + py37-integration-goethereum-ws-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.7 environment: TOXENV: py37-integration-goethereum-ws - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 py37-integration-parity-ipc: <<: *parity_steps @@ -368,29 +369,29 @@ jobs: # Please don't use this key for any shenanigans WEB3_INFURA_PROJECT_ID: 7707850c2fb7465ebe6f150d67182e22 - py38-integration-goethereum-ipc-1.9.7: + py38-integration-goethereum-ipc-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.8 environment: TOXENV: py38-integration-goethereum-ipc - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py38-integration-goethereum-http-1.9.7: + py38-integration-goethereum-http-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.8 environment: TOXENV: py38-integration-goethereum-http - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 - py38-integration-goethereum-ws-1.9.7: + py38-integration-goethereum-ws-1.9.19: <<: *geth_steps docker: - image: circleci/python:3.8 environment: TOXENV: py38-integration-goethereum-ws - GETH_VERSION: v1.9.7 + GETH_VERSION: v1.9.19 py38-integration-parity-ipc: <<: *parity_steps @@ -442,14 +443,13 @@ workflows: - py36-core - py37-core - py38-core - - lint - docs - py36-ens - py36-ethpm - - py36-integration-goethereum-ipc-1.9.7 - - py36-integration-goethereum-http-1.9.7 - - py36-integration-goethereum-ws-1.9.7 + - py36-integration-goethereum-ipc-1.9.19 + - py36-integration-goethereum-http-1.9.19 + - py36-integration-goethereum-ws-1.9.19 - py36-integration-parity-ipc - py36-integration-parity-http - py36-integration-parity-ws @@ -457,9 +457,9 @@ workflows: - py36-wheel-cli - py37-ens - py37-ethpm - - py37-integration-goethereum-ipc-1.9.7 - - py37-integration-goethereum-http-1.9.7 - - py37-integration-goethereum-ws-1.9.7 + - py37-integration-goethereum-ipc-1.9.19 + - py37-integration-goethereum-http-1.9.19 + - py37-integration-goethereum-ws-1.9.19 - py37-integration-parity-ipc - py37-integration-parity-http - py37-integration-parity-ws @@ -467,9 +467,9 @@ workflows: - py37-wheel-cli - py38-ens - py38-ethpm - - py38-integration-goethereum-ipc-1.9.7 - - py38-integration-goethereum-http-1.9.7 - - py38-integration-goethereum-ws-1.9.7 + - py38-integration-goethereum-ipc-1.9.19 + - py38-integration-goethereum-http-1.9.19 + - py38-integration-goethereum-ws-1.9.19 - py38-integration-parity-ipc - py38-integration-parity-http - py38-integration-parity-ws diff --git a/docs/web3.geth.rst b/docs/web3.geth.rst index 286aaf1df0..157aed2448 100644 --- a/docs/web3.geth.rst +++ b/docs/web3.geth.rst @@ -126,7 +126,7 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und .. Warning:: This method has been removed from Geth -.. py:method:: start_rpc(host='localhost', port='8545', cors="", apis="eth,net,web3") +.. py:method:: start_rpc(host='localhost', port=8545, cors="", apis="eth,net,web3") * Delegates to ``admin_startRPC`` RPC Method @@ -141,13 +141,13 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und True -.. py:method:: startRPC(host='localhost', port='8545', cors="", apis="eth,net,web3") +.. py:method:: startRPC(host='localhost', port=8545, cors="", apis="eth,net,web3") .. warning:: Deprecated: This method is deprecated in favor of :meth:`~web3.geth.admin.start_rpc()` -.. py:method:: start_ws(host='localhost', port='8546', cors="", apis="eth,net,web3") +.. py:method:: start_ws(host='localhost', port=8546, cors="", apis="eth,net,web3") * Delegates to ``admin_startWS`` RPC Method @@ -162,7 +162,7 @@ The ``web3.geth.admin`` object exposes methods to interact with the RPC APIs und True -.. py:method:: startWS(host='localhost', port='8546', cors="", apis="eth,net,web3") +.. py:method:: startWS(host='localhost', port=8546, cors="", apis="eth,net,web3") .. warning:: Deprecated: This method is deprecated in favor of :meth:`~web3.geth.admin.start_ws()` diff --git a/newsfragments/1708.misc.rst b/newsfragments/1708.misc.rst new file mode 100644 index 0000000000..329f2e0119 --- /dev/null +++ b/newsfragments/1708.misc.rst @@ -0,0 +1 @@ +Upgrade Geth integration tests to run against v1.9.19 diff --git a/setup.py b/setup.py index 86d055d04a..b210e39dfb 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ extras_require = { 'tester': [ "eth-tester[py-evm]==v0.5.0-beta.1", - "py-geth>=2.2.0,<3", + "py-geth>=2.4.0,<3", ], 'linter': [ "flake8==3.4.1", @@ -21,7 +21,7 @@ "click>=5.1", "configparser==3.5.0", "contextlib2>=0.5.4", - "py-geth>=2.2.0,<3", + "py-geth>=2.4.0,<3", "py-solc>=0.4.0", "pytest>=4.4.0,<5.0.0", "sphinx>=2.4.4,<3", diff --git a/tests/integration/common.py b/tests/integration/common.py index 6ce2a8812b..6b0ece0fea 100644 --- a/tests/integration/common.py +++ b/tests/integration/common.py @@ -13,5 +13,5 @@ def test_websocket_max_size_error(self, web3, endpoint_uri): w3 = Web3(Web3.WebsocketProvider( endpoint_uri=endpoint_uri, websocket_kwargs={'max_size': 1}) ) - with pytest.raises(ConnectionClosed): + with pytest.raises((OSError, ConnectionClosed)): w3.eth.getBlock(0) diff --git a/tests/integration/geth-1.9.19-fixture.zip b/tests/integration/geth-1.9.19-fixture.zip new file mode 100644 index 0000000000..13acb7b02c Binary files /dev/null and b/tests/integration/geth-1.9.19-fixture.zip differ diff --git a/tests/integration/geth-1.9.7-fixture.zip b/tests/integration/geth-1.9.7-fixture.zip deleted file mode 100644 index 3ad9672115..0000000000 Binary files a/tests/integration/geth-1.9.7-fixture.zip and /dev/null differ diff --git a/tests/integration/go_ethereum/common.py b/tests/integration/go_ethereum/common.py index 5fad5784bc..3155e80a6e 100644 --- a/tests/integration/go_ethereum/common.py +++ b/tests/integration/go_ethereum/common.py @@ -10,8 +10,6 @@ Web3ModuleTest, ) -VERSIONS_WITHOUT_ETH_SUBMITHASH = ['v1.9.7'] - class GoEthereumTest(Web3ModuleTest): def _check_web3_clientVersion(self, client_version): @@ -19,6 +17,11 @@ def _check_web3_clientVersion(self, client_version): class GoEthereumEthModuleTest(EthModuleTest): + @pytest.mark.xfail(reason='eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate') + def test_eth_submitHashrate(self, web3): + # https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7 + super().test_eth_submitHashrate(web3) + def test_eth_replaceTransaction_already_mined(self, web3, unlocked_account_dual_type): web3.geth.miner.start() super().test_eth_replaceTransaction_already_mined(web3, unlocked_account_dual_type) @@ -32,12 +35,6 @@ def test_eth_estimateGas_with_block(self, web3, unlocked_account_dual_type ) - def test_eth_submitHashrate(self, web3): - if any([v in web3.clientVersion for v in VERSIONS_WITHOUT_ETH_SUBMITHASH]): - # https://github.com/ethereum/go-ethereum/commit/51db5975cc5fb88db6a0dba1826b534fd4df29d7 - pytest.xfail('eth_submitHashrate deprecated in 1.8.22 for ethash_submitHashRate') - super().test_eth_submitHashrate(web3) - @pytest.mark.xfail(reason='eth_signTypedData has not been released in geth') def test_eth_signTypedData(self, web3, diff --git a/tests/integration/go_ethereum/conftest.py b/tests/integration/go_ethereum/conftest.py index 24359c457b..4c567ab6aa 100644 --- a/tests/integration/go_ethereum/conftest.py +++ b/tests/integration/go_ethereum/conftest.py @@ -19,7 +19,7 @@ KEYFILE_PW = 'web3py-test' -GETH_197_ZIP = 'geth-1.9.7-fixture.zip' +GETH_1919_ZIP = 'geth-1.9.19-fixture.zip' @pytest.fixture(scope='module') @@ -70,7 +70,7 @@ def base_geth_command_arguments(geth_binary, datadir): @pytest.fixture(scope="module") def geth_zipfile_version(get_geth_version): if get_geth_version.major == 1 and get_geth_version.minor == 9: - return GETH_197_ZIP + return GETH_1919_ZIP raise AssertionError("Unsupported geth version") diff --git a/tests/integration/go_ethereum/test_goethereum_http.py b/tests/integration/go_ethereum/test_goethereum_http.py index dc44699d09..5112d2d908 100644 --- a/tests/integration/go_ethereum/test_goethereum_http.py +++ b/tests/integration/go_ethereum/test_goethereum_http.py @@ -35,9 +35,9 @@ def _geth_command_arguments(rpc_port, yield from base_geth_command_arguments if geth_version.major == 1: yield from ( - '--rpc', - '--rpcport', rpc_port, - '--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner', + '--http', + '--http.port', rpc_port, + '--http.api', 'admin,eth,net,web3,personal,shh,miner', '--ipcdisable', '--allow-insecure-unlock' ) @@ -77,14 +77,6 @@ def test_admin_peers(web3): def test_admin_start_stop_rpc(web3): super().test_admin_start_stop_rpc(web3) - @pytest.mark.xfail(reason='Only one RPC endpoint is allowed to be active at any time') - def test_admin_startRPC(web3): - super().test_admin_stopRPC(web3) - - @pytest.mark.xfail(reason='Only one RPC endpoint is allowed to be active at any time') - def test_admin_stopRPC(web3): - super().test_admin_stopRPC(web3) - class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest): pass diff --git a/tests/integration/go_ethereum/test_goethereum_ipc.py b/tests/integration/go_ethereum/test_goethereum_ipc.py index 1b65618fce..7f1586a3d2 100644 --- a/tests/integration/go_ethereum/test_goethereum_ipc.py +++ b/tests/integration/go_ethereum/test_goethereum_ipc.py @@ -68,6 +68,10 @@ class TestGoEthereumAdminModuleTest(GoEthereumAdminModuleTest): def test_admin_peers(web3): super().test_admin_peers(web3) + @pytest.mark.xfail(reason="websockets aren't enabled with our IPC flags") + def test_admin_start_stop_ws(web3): + super().test_admin_start_stop_ws(web3) + class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest): pass diff --git a/tests/integration/go_ethereum/test_goethereum_ws.py b/tests/integration/go_ethereum/test_goethereum_ws.py index e81239de9c..169b9eeead 100644 --- a/tests/integration/go_ethereum/test_goethereum_ws.py +++ b/tests/integration/go_ethereum/test_goethereum_ws.py @@ -37,9 +37,9 @@ def _geth_command_arguments(ws_port, if geth_version.major == 1: yield from ( '--ws', - '--wsport', ws_port, - '--wsapi', 'admin,db,eth,net,shh,web3,personal,miner', - '--wsorigins', '*', + '--ws.port', ws_port, + '--ws.api', 'admin,eth,net,shh,web3,personal,miner', + '--ws.origins', '*', '--ipcdisable', '--allow-insecure-unlock', ) @@ -83,14 +83,6 @@ def test_admin_peers(web3): def test_admin_start_stop_ws(web3): super().test_admin_start_stop_ws(web3) - @pytest.mark.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time') - def test_admin_startWS(self, web3): - super().test_admin_startWS(web3) - - @pytest.mark.xfail(reason='Only one WebSocket endpoint is allowed to be active at any time') - def test_admin_stopWS(self, web3): - super().test_admin_stopWS(web3) - class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest): pass diff --git a/web3/_utils/admin.py b/web3/_utils/admin.py index 52a50eef35..6c298762be 100644 --- a/web3/_utils/admin.py +++ b/web3/_utils/admin.py @@ -26,8 +26,8 @@ def admin_start_params_munger( - module: Module, host: str='localhost', port: str='8546', cors: str='', apis: str='eth,net,web3' -) -> Tuple[str, str, str, str]: + module: Module, host: str='localhost', port: int=8546, cors: str='', apis: str='eth,net,web3' +) -> Tuple[str, int, str, str]: return (host, port, cors, apis) diff --git a/web3/_utils/module_testing/go_ethereum_admin_module.py b/web3/_utils/module_testing/go_ethereum_admin_module.py index d6cc7d5b20..2158992754 100644 --- a/web3/_utils/module_testing/go_ethereum_admin_module.py +++ b/web3/_utils/module_testing/go_ethereum_admin_module.py @@ -46,18 +46,29 @@ def test_admin_peers(self, web3: "Web3") -> None: assert len(result) == 1 def test_admin_start_stop_rpc(self, web3: "Web3") -> None: - start = web3.geth.admin.start_rpc("localhost", 8545) - assert start - stop = web3.geth.admin.stop_rpc() - assert stop + assert stop is True - def test_admin_start_stop_ws(self, web3: "Web3") -> None: - start = web3.geth.admin.start_ws("localhost", 8546) - assert start + start = web3.geth.admin.start_rpc('localhost', 8548) + assert start is True + with pytest.warns(DeprecationWarning): + stop = web3.geth.admin.stopRPC() + assert stop is True + + start = web3.geth.admin.startRPC() + assert start is True + + def test_admin_start_stop_ws(self, web3: "Web3") -> None: stop = web3.geth.admin.stop_ws() - assert stop + assert stop is True + + start = web3.geth.admin.start_ws('localhost', 8548) + assert start is True + + with pytest.warns(DeprecationWarning): + stop = web3.geth.admin.stopWS() + assert stop is True # # Deprecated @@ -83,35 +94,3 @@ def test_admin_nodeInfo(self, web3: "Web3") -> None: }) # Test that result gives at least the keys that are listed in `expected` assert not set(expected.keys()).difference(result.keys()) - - def test_admin_startRPC(self, web3: "Web3") -> None: - with pytest.warns(DeprecationWarning): - start = web3.geth.admin.startRPC('localhost', 8545) - assert start - - stop = web3.geth.admin.stop_rpc() - assert stop - - def test_admin_stopRPC(self, web3: "Web3") -> None: - start = web3.geth.admin.start_rpc('localhost', 8545) - assert start - - with pytest.warns(DeprecationWarning): - stop = web3.geth.admin.stopRPC() - assert stop - - def test_admin_startWS(self, web3: "Web3") -> None: - with pytest.warns(DeprecationWarning): - start = web3.geth.admin.startWS('localhost', 8546) - assert start - - stop = web3.geth.admin.stop_ws() - assert stop - - def test_admin_stopWS(self, web3: "Web3") -> None: - start = web3.geth.admin.start_ws('localhost', 8546) - assert start - - with pytest.warns(DeprecationWarning): - stop = web3.geth.admin.stopWS() - assert stop