Skip to content
Merged
81 changes: 81 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,30 @@ jobs:
TOXENV: py36-integration-goethereum-ws
GETH_VERSION: v1.8.22

py36-integration-goethereum-ipc-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ipc
GETH_VERSION: v1.9.7

py36-integration-goethereum-http-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-http
GETH_VERSION: v1.9.7

py36-integration-goethereum-ws-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.6
environment:
TOXENV: py36-integration-goethereum-ws
GETH_VERSION: v1.9.7

py36-integration-parity-ipc:
<<: *parity_steps
docker:
Expand Down Expand Up @@ -338,6 +362,30 @@ jobs:
TOXENV: py37-integration-goethereum-ws
GETH_VERSION: v1.8.22

py37-integration-goethereum-ipc-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ipc
GETH_VERSION: v1.9.7

py37-integration-goethereum-http-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-http
GETH_VERSION: v1.9.7

py37-integration-goethereum-ws-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.7
environment:
TOXENV: py37-integration-goethereum-ws
GETH_VERSION: v1.9.7

py37-integration-parity-ipc:
<<: *parity_steps
docker:
Expand Down Expand Up @@ -446,6 +494,30 @@ jobs:
TOXENV: py38-integration-goethereum-ws
GETH_VERSION: v1.8.22

py38-integration-goethereum-ipc-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ipc
GETH_VERSION: v1.9.7

py38-integration-goethereum-http-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-http
GETH_VERSION: v1.9.7

py38-integration-goethereum-ws-1.9.7:
<<: *geth_steps
docker:
- image: circleci/python:3.8
environment:
TOXENV: py38-integration-goethereum-ws
GETH_VERSION: v1.9.7

py38-integration-parity-ipc:
<<: *parity_steps
docker:
Expand Down Expand Up @@ -496,6 +568,9 @@ workflows:
- py36-integration-goethereum-ipc-1.8.22
- py36-integration-goethereum-http-1.8.22
- py36-integration-goethereum-ws-1.8.22
- py36-integration-goethereum-ipc-1.9.7
- py36-integration-goethereum-http-1.9.7
- py36-integration-goethereum-ws-1.9.7
- py36-integration-parity-ipc
- py36-integration-parity-http
- py36-integration-parity-ws
Expand All @@ -509,6 +584,9 @@ workflows:
- py37-integration-goethereum-ipc-1.8.22
- py37-integration-goethereum-http-1.8.22
- py37-integration-goethereum-ws-1.8.22
- py37-integration-goethereum-ipc-1.9.7
- py37-integration-goethereum-http-1.9.7
- py37-integration-goethereum-ws-1.9.7
- py37-integration-parity-ipc
- py37-integration-parity-http
- py37-integration-parity-ws
Expand All @@ -522,6 +600,9 @@ workflows:
- py38-integration-goethereum-ipc-1.8.22
- py38-integration-goethereum-http-1.8.22
- py38-integration-goethereum-ws-1.8.22
- py38-integration-goethereum-ipc-1.9.7
- py38-integration-goethereum-http-1.9.7
- py38-integration-goethereum-ws-1.9.7
- py38-integration-parity-ipc
- py38-integration-parity-http
- py38-integration-parity-ws
Expand Down
1 change: 1 addition & 0 deletions newsfragments/1521.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Upgrade Geth integration testing to support 1.9
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extras_require = {
'tester': [
"eth-tester[py-evm]==v0.2.0-beta.2",
"py-geth>=2.0.1,<3.0.0",
"py-geth>=2.2.0,<3",
],
'linter': [
"flake8==3.4.1",
Expand All @@ -21,7 +21,7 @@
"click>=5.1",
"configparser==3.5.0",
"contextlib2>=0.5.4",
"py-geth>=1.4.0",
"py-geth>=2.2.0,<3",
"py-solc>=0.4.0",
"pytest>=4.4.0,<5.0.0",
"sphinx",
Expand Down
11 changes: 6 additions & 5 deletions tests/generate_go_ethereum_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
valmap,
)

from tests.utils import (
from utils import (
get_open_port,
)
from web3 import Web3
from web3._utils.module_testing.emitter_contract import (
EMITTER_ABI,
EMITTER_BYTECODE,
CONTRACT_EMITTER_ABI,
CONTRACT_EMITTER_CODE,
EMITTER_ENUM,
)
from web3._utils.module_testing.math_contract import (
Expand Down Expand Up @@ -78,6 +78,7 @@
"config": {
"chainId": 131277322940537, # the string 'web3py' as an integer
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0
},
Expand Down Expand Up @@ -346,8 +347,8 @@ def setup_chain_state(web3):
# Emitter Contract
#
emitter_contract_factory = web3.eth.contract(
abi=EMITTER_ABI,
bytecode=EMITTER_BYTECODE,
abi=CONTRACT_EMITTER_ABI,
bytecode=CONTRACT_EMITTER_CODE,
)
emitter_deploy_receipt = deploy_contract(web3, 'emitter', emitter_contract_factory)
emitter_contract = emitter_contract_factory(emitter_deploy_receipt['contractAddress'])
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/generate_fixtures/go_ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
)
from web3 import Web3
from web3._utils.module_testing.emitter_contract import (
EMITTER_ABI,
EMITTER_BYTECODE,
CONTRACT_EMITTER_ABI,
CONTRACT_EMITTER_CODE,
EMITTER_ENUM,
)
from web3._utils.module_testing.math_contract import (
Expand Down Expand Up @@ -91,8 +91,8 @@ def setup_chain_state(web3):
# Emitter Contract
#
emitter_contract_factory = web3.eth.contract(
abi=EMITTER_ABI,
bytecode=EMITTER_BYTECODE,
abi=CONTRACT_EMITTER_ABI,
bytecode=CONTRACT_EMITTER_CODE,
)
emitter_deploy_receipt = common.deploy_contract(web3, 'emitter', emitter_contract_factory)
emitter_contract = emitter_contract_factory(emitter_deploy_receipt['contractAddress'])
Expand Down
Binary file added tests/integration/geth-1.9.7-fixture.zip
Binary file not shown.
26 changes: 14 additions & 12 deletions tests/integration/go_ethereum/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,47 @@
Web3ModuleTest,
)

OLDER_GETH_VERSIONS = ['v1.7.2', 'v1.8.22']
NEWER_GETH_VERSIONS = ['v1.8.22', 'v1.9.7']


class GoEthereumTest(Web3ModuleTest):
def _check_web3_clientVersion(self, client_version):
assert client_version.startswith('Geth/')


class GoEthereumEthModuleTest(EthModuleTest):
@pytest.mark.xfail(reason='Needs ability to efficiently control mining')
def test_eth_replaceTransaction(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction(web3, unlocked_account)

def test_eth_replaceTransaction_incorrect_nonce(self, web3, unlocked_account):
super().test_eth_replaceTransaction_incorrect_nonce(web3, unlocked_account)

def test_eth_replaceTransaction_gas_price_too_low(self, web3, unlocked_account):
super().test_eth_replaceTransaction_gas_price_too_low(web3, unlocked_account)

@pytest.mark.xfail(reason='Needs ability to efficiently control mining')
def test_eth_replaceTransaction_gas_price_defaulting_minimum(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_minimum(web3, unlocked_account)

@pytest.mark.xfail(reason='Needs ability to efficiently control mining')
def test_eth_replaceTransaction_gas_price_defaulting_strategy_higher(self,
web3,
unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_strategy_higher(
web3, unlocked_account
)

@pytest.mark.xfail(reason='Needs ability to efficiently control mining')
def test_eth_replaceTransaction_gas_price_defaulting_strategy_lower(self,
web3,
unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_replaceTransaction_gas_price_defaulting_strategy_lower(
web3, unlocked_account
)

@pytest.mark.xfail(reason='Needs ability to efficiently control mining')
def test_eth_modifyTransaction(self, web3, unlocked_account):
if any([v in web3.clientVersion for v in OLDER_GETH_VERSIONS]):
pytest.xfail(reason='Needs ability to efficiently control mining')
super().test_eth_modifyTransaction(web3, unlocked_account)

@pytest.mark.xfail(reason='Block identifier has not been implemented in geth')
Expand All @@ -60,7 +62,7 @@ def test_eth_estimateGas_with_block(self,
)

def test_eth_submitHashrate(self, web3):
if 'v1.8.22' in web3.clientVersion:
if any([v in web3.clientVersion for v in NEWER_GETH_VERSIONS]):
# 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)
Expand Down
28 changes: 23 additions & 5 deletions tests/integration/go_ethereum/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

GETH_17_ZIP = 'geth-17-fixture.zip'
GETH_1822_ZIP = 'geth-1.8.22-fixture.zip'
GETH_197_ZIP = 'geth-1.9.7-fixture.zip'


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -52,14 +53,31 @@ def absolute_datadir(directory_name):


@pytest.fixture(scope="module")
def geth_zipfile_version(geth_binary):
def get_geth_version(geth_binary):
from geth import get_geth_version
version = get_geth_version(geth_executable=os.path.expanduser(geth_binary))
if version.major == 1:
if version.minor == 7:
return get_geth_version(geth_executable=os.path.expanduser(geth_binary))


@pytest.fixture(scope="module")
def base_geth_command_arguments(geth_binary, datadir):
return (
geth_binary,
'--datadir', str(datadir),
'--shh',
'--nodiscover',
'--fakepow',
)


@pytest.fixture(scope="module")
def geth_zipfile_version(get_geth_version):
if get_geth_version.major == 1:
if get_geth_version.minor == 7:
return GETH_17_ZIP
elif version.minor == 8:
elif get_geth_version.minor == 8:
return GETH_1822_ZIP
elif get_geth_version.minor == 9:
return GETH_197_ZIP
assert False, "Unsupported geth version"


Expand Down
47 changes: 34 additions & 13 deletions tests/integration/go_ethereum/test_goethereum_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,36 @@ def endpoint_uri(rpc_port):


@pytest.fixture(scope='module')
def geth_command_arguments(geth_binary, datadir, rpc_port):
return (
geth_binary,
'--datadir', str(datadir),
'--shh',
'--nodiscover',
'--fakepow',
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,web3',
'--ipcdisable',
)
def geth_command_arguments(rpc_port,
base_geth_command_arguments,
get_geth_version):

if get_geth_version.major == 1:
if get_geth_version.minor == 9:
return (
base_geth_command_arguments +
(
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
'--ipcdisable',
'--allow-insecure-unlock',
)
)
elif get_geth_version.minor == 8 or get_geth_version.minor == 7:
return (
base_geth_command_arguments +
(
'--rpc',
'--rpcport', rpc_port,
'--rpcapi', 'admin,db,eth,net,web3,personal,shh,miner',
'--ipcdisable',
)
)
else:
assert False, "Unsupported geth version"
else:
assert False, "Unsupported geth version"


@pytest.fixture(scope="module")
Expand Down Expand Up @@ -74,7 +92,10 @@ def test_admin_stopRPC(web3):


class TestGoEthereumEthModuleTest(GoEthereumEthModuleTest):
pass
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)
web3.geth.miner.stop()


class TestGoEthereumVersionModuleTest(GoEthereumVersionModuleTest):
Expand Down
Loading