From 79af4473f0e37b6e4641b39baa229817c40ab053 Mon Sep 17 00:00:00 2001 From: Christoph Burgdorf Date: Tue, 14 Aug 2018 16:04:59 +0200 Subject: [PATCH] Enable Constantinople State tests --- .circleci/config.yml | 21 +++++++++++++++++++++ tests/json-fixtures/test_state.py | 13 ++++++++++++- tests/json-fixtures/test_transactions.py | 5 ++++- tox.ini | 3 ++- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 94678aac7f..1b008c6edf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,6 +108,12 @@ jobs: - image: circleci/python:3.5 environment: TOXENV: py35-native-state-byzantium + py35-native-state-constantinople: + <<: *common + docker: + - image: circleci/python:3.5 + environment: + TOXENV: py35-native-state-constantinople py35-native-state-frontier: <<: *common docker: @@ -175,6 +181,12 @@ jobs: - image: circleci/python:3.6 environment: TOXENV: py36-native-state-byzantium + py36-native-state-constantinople: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV: py36-native-state-constantinople py36-native-state-frontier: <<: *common docker: @@ -205,6 +217,12 @@ jobs: - image: circleci/python:3.6 environment: TOXENV: py36-rpc-state-byzantium + py36-rpc-state-constantinople: + <<: *common + docker: + - image: circleci/python:3.6 + environment: + TOXENV: py36-rpc-state-constantinople py36-rpc-state-frontier: <<: *common docker: @@ -341,11 +359,13 @@ workflows: - py37-beacon - py36-native-state-byzantium + - py36-native-state-constantinople - py36-native-state-frontier - py36-native-state-homestead - py36-native-state-eip150 - py36-native-state-eip158 - py36-rpc-state-byzantium + - py36-rpc-state-constantinople - py36-rpc-state-frontier - py36-rpc-state-homestead - py36-rpc-state-eip150 @@ -365,6 +385,7 @@ workflows: - py36-beacon - py35-native-state-byzantium + - py35-native-state-constantinople - py35-native-state-frontier - py35-native-state-homestead - py35-native-state-eip150 diff --git a/tests/json-fixtures/test_state.py b/tests/json-fixtures/test_state.py index b3855e41ee..fd8ab915f3 100644 --- a/tests/json-fixtures/test_state.py +++ b/tests/json-fixtures/test_state.py @@ -28,12 +28,14 @@ HomesteadVM, SpuriousDragonVM, ByzantiumVM, + ConstantinopleVM, ) from eth.vm.forks.tangerine_whistle.state import TangerineWhistleState from eth.vm.forks.frontier.state import FrontierState from eth.vm.forks.homestead.state import HomesteadState from eth.vm.forks.spurious_dragon.state import SpuriousDragonState from eth.vm.forks.byzantium.state import ByzantiumState +from eth.vm.forks.constantinople.state import ConstantinopleState from eth.rlp.headers import ( BlockHeader, @@ -224,6 +226,10 @@ def get_prev_hashes_testing(self, last_block_hash, db): __name__='ByzantiumStateForTesting', get_ancestor_hash=get_block_hash_for_testing, ) +ConstantinopleStateForTesting = ConstantinopleState.configure( + __name__='ConstantinopleStateForTesting', + get_ancestor_hash=get_block_hash_for_testing, +) FrontierVMForTesting = FrontierVM.configure( __name__='FrontierVMForTesting', @@ -250,6 +256,11 @@ def get_prev_hashes_testing(self, last_block_hash, db): _state_class=ByzantiumStateForTesting, get_prev_hashes=get_prev_hashes_testing, ) +ConstantinopleVMForTesting = ConstantinopleVM.configure( + __name__='ConstantinopleVMForTesting', + _state_class=ConstantinopleStateForTesting, + get_prev_hashes=get_prev_hashes_testing, +) @pytest.fixture @@ -266,7 +277,7 @@ def fixture_vm_class(fixture_data): elif fork_name == ForkName.Byzantium: return ByzantiumVMForTesting elif fork_name == ForkName.Constantinople: - pytest.skip("Constantinople VM has not been implemented") + return ConstantinopleVMForTesting elif fork_name == ForkName.Metropolis: pytest.skip("Metropolis VM has not been implemented") else: diff --git a/tests/json-fixtures/test_transactions.py b/tests/json-fixtures/test_transactions.py index 398d833380..4373238c71 100644 --- a/tests/json-fixtures/test_transactions.py +++ b/tests/json-fixtures/test_transactions.py @@ -26,6 +26,9 @@ from eth.vm.forks.byzantium.transactions import ( ByzantiumTransaction ) +from eth.vm.forks.constantinople.transactions import ( + ConstantinopleTransaction +) from eth_typing.enums import ( ForkName @@ -90,7 +93,7 @@ def fixture_transaction_class(fixture_data): elif fork_name == ForkName.Byzantium: return ByzantiumTransaction elif fork_name == ForkName.Constantinople: - pytest.skip("Constantinople Transaction class has not been implemented") + return ConstantinopleTransaction elif fork_name == ForkName.Metropolis: pytest.skip("Metropolis Transaction class has not been implemented") else: diff --git a/tox.ini b/tox.ini index f92f6fe755..cee901d41e 100644 --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ envlist= py{35,36}-{core,database,transactions,vm,native-blockchain} py{36}-{benchmark,p2p,trinity,lightchain_integration,beacon} py{36}-rpc-blockchain - py{36}-rpc-state-{frontier,homestead,eip150,eip158,byzantium,quadratic} + py{36}-rpc-state-{frontier,homestead,eip150,eip158,byzantium,constantinople,quadratic} py{35,36}-native-state-{frontier,homestead,eip150,eip158,byzantium,constantinople,metropolis} py37-{core,trinity,trinity-integration,beacon} py{35,36}-lint @@ -32,6 +32,7 @@ commands= beacon: pytest {posargs:tests/beacon/} # The following test seems to consume a lot of memory. Restricting to 3 processes reduces crashes rpc-state-byzantium: pytest -n3 {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and not stQuadraticComplexityTest and Byzantium'} + rpc-state-constantinople: pytest -n3 {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and not stQuadraticComplexityTest and Constantinople'} rpc-state-quadratic: pytest {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and stQuadraticComplexityTest'} transactions: pytest {posargs:tests/json-fixtures/test_transactions.py} vm: pytest {posargs:tests/json-fixtures/test_virtual_machine.py}