Skip to content

Commit 39e52e9

Browse files
cburgdorfpipermerriam
authored andcommitted
Enable Constantinople State tests
1 parent 7d085bd commit 39e52e9

File tree

4 files changed

+40
-3
lines changed

4 files changed

+40
-3
lines changed

.circleci/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ jobs:
108108
- image: circleci/python:3.5
109109
environment:
110110
TOXENV: py35-native-state-byzantium
111+
py35-native-state-constantinople:
112+
<<: *common
113+
docker:
114+
- image: circleci/python:3.5
115+
environment:
116+
TOXENV: py35-native-state-constantinople
111117
py35-native-state-frontier:
112118
<<: *common
113119
docker:
@@ -175,6 +181,12 @@ jobs:
175181
- image: circleci/python:3.6
176182
environment:
177183
TOXENV: py36-native-state-byzantium
184+
py36-native-state-constantinople:
185+
<<: *common
186+
docker:
187+
- image: circleci/python:3.6
188+
environment:
189+
TOXENV: py36-native-state-constantinople
178190
py36-native-state-frontier:
179191
<<: *common
180192
docker:
@@ -205,6 +217,12 @@ jobs:
205217
- image: circleci/python:3.6
206218
environment:
207219
TOXENV: py36-rpc-state-byzantium
220+
py36-rpc-state-constantinople:
221+
<<: *common
222+
docker:
223+
- image: circleci/python:3.6
224+
environment:
225+
TOXENV: py36-rpc-state-constantinople
208226
py36-rpc-state-frontier:
209227
<<: *common
210228
docker:
@@ -340,11 +358,13 @@ workflows:
340358
- py37-beacon
341359

342360
- py36-native-state-byzantium
361+
- py36-native-state-constantinople
343362
- py36-native-state-frontier
344363
- py36-native-state-homestead
345364
- py36-native-state-eip150
346365
- py36-native-state-eip158
347366
- py36-rpc-state-byzantium
367+
- py36-rpc-state-constantinople
348368
- py36-rpc-state-frontier
349369
- py36-rpc-state-homestead
350370
- py36-rpc-state-eip150
@@ -364,6 +384,7 @@ workflows:
364384
- py36-beacon
365385

366386
- py35-native-state-byzantium
387+
- py35-native-state-constantinople
367388
- py35-native-state-frontier
368389
- py35-native-state-homestead
369390
- py35-native-state-eip150

tests/json-fixtures/test_state.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@
2828
HomesteadVM,
2929
SpuriousDragonVM,
3030
ByzantiumVM,
31+
ConstantinopleVM,
3132
)
3233
from eth.vm.forks.tangerine_whistle.state import TangerineWhistleState
3334
from eth.vm.forks.frontier.state import FrontierState
3435
from eth.vm.forks.homestead.state import HomesteadState
3536
from eth.vm.forks.spurious_dragon.state import SpuriousDragonState
3637
from eth.vm.forks.byzantium.state import ByzantiumState
38+
from eth.vm.forks.constantinople.state import ConstantinopleState
3739

3840
from eth.rlp.headers import (
3941
BlockHeader,
@@ -245,6 +247,10 @@ def get_prev_hashes_testing(self, last_block_hash, db):
245247
__name__='ByzantiumStateForTesting',
246248
get_ancestor_hash=get_block_hash_for_testing,
247249
)
250+
ConstantinopleStateForTesting = ConstantinopleState.configure(
251+
__name__='ConstantinopleStateForTesting',
252+
get_ancestor_hash=get_block_hash_for_testing,
253+
)
248254

249255
FrontierVMForTesting = FrontierVM.configure(
250256
__name__='FrontierVMForTesting',
@@ -271,6 +277,11 @@ def get_prev_hashes_testing(self, last_block_hash, db):
271277
_state_class=ByzantiumStateForTesting,
272278
get_prev_hashes=get_prev_hashes_testing,
273279
)
280+
ConstantinopleVMForTesting = ConstantinopleVM.configure(
281+
__name__='ConstantinopleVMForTesting',
282+
_state_class=ConstantinopleStateForTesting,
283+
get_prev_hashes=get_prev_hashes_testing,
284+
)
274285

275286

276287
@pytest.fixture
@@ -287,7 +298,7 @@ def fixture_vm_class(fixture_data):
287298
elif fork_name == ForkName.Byzantium:
288299
return ByzantiumVMForTesting
289300
elif fork_name == ForkName.Constantinople:
290-
pytest.skip("Constantinople VM has not been implemented")
301+
return ConstantinopleVMForTesting
291302
elif fork_name == ForkName.Metropolis:
292303
pytest.skip("Metropolis VM has not been implemented")
293304
else:

tests/json-fixtures/test_transactions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
from eth.vm.forks.byzantium.transactions import (
2929
ByzantiumTransaction
3030
)
31+
from eth.vm.forks.constantinople.transactions import (
32+
ConstantinopleTransaction
33+
)
3134

3235
from eth_typing.enums import (
3336
ForkName
@@ -92,7 +95,7 @@ def fixture_transaction_class(fixture_data):
9295
elif fork_name == ForkName.Byzantium:
9396
return ByzantiumTransaction
9497
elif fork_name == ForkName.Constantinople:
95-
pytest.skip("Constantinople Transaction class has not been implemented")
98+
return ConstantinopleTransaction
9699
elif fork_name == ForkName.Metropolis:
97100
pytest.skip("Metropolis Transaction class has not been implemented")
98101
else:

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ envlist=
33
py{35,36}-{core,database,transactions,vm,native-blockchain}
44
py{36}-{benchmark,p2p,trinity,lightchain_integration,beacon}
55
py{36}-rpc-blockchain
6-
py{36}-rpc-state-{frontier,homestead,eip150,eip158,byzantium,quadratic}
6+
py{36}-rpc-state-{frontier,homestead,eip150,eip158,byzantium,constantinople,quadratic}
77
py{35,36}-native-state-{frontier,homestead,eip150,eip158,byzantium,constantinople,metropolis}
88
py37-{core,trinity,trinity-integration,beacon}
99
py{35,36}-lint
@@ -32,6 +32,8 @@ commands=
3232
beacon: pytest {posargs:tests/beacon/}
3333
# The following test seems to consume a lot of memory. Restricting to 3 processes reduces crashes
3434
rpc-state-byzantium: pytest -n3 {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and not stQuadraticComplexityTest and Byzantium'}
35+
# Uncomment the next line + modify test_rpc_fixtures.py when Constantinople is included in the mainnet config
36+
# rpc-state-constantinople: pytest -n3 {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and not stQuadraticComplexityTest and Constantinople'}
3537
rpc-state-quadratic: pytest {posargs:tests/trinity/json-fixtures-over-rpc/test_rpc_fixtures.py -k 'GeneralStateTests and stQuadraticComplexityTest'}
3638
transactions: pytest {posargs:tests/json-fixtures/test_transactions.py}
3739
vm: pytest {posargs:tests/json-fixtures/test_virtual_machine.py}

0 commit comments

Comments
 (0)