Skip to content

Commit 11adfb6

Browse files
committed
test opcode programs in different scenarios
1 parent 2f2d356 commit 11adfb6

File tree

11 files changed

+1278
-0
lines changed

11 files changed

+1278
-0
lines changed

converted-ethereum-tests.txt

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,119 @@
1+
GeneralStateTests/stBadOpcode/opc0CDiffPlaces.json
2+
GeneralStateTests/stBadOpcode/opc0DDiffPlaces.json
3+
GeneralStateTests/stBadOpcode/opc0EDiffPlaces.json
4+
GeneralStateTests/stBadOpcode/opc0FDiffPlaces.json
5+
GeneralStateTests/stBadOpcode/opc1EDiffPlaces.json
6+
GeneralStateTests/stBadOpcode/opc1FDiffPlaces.json
7+
GeneralStateTests/stBadOpcode/opc2ADiffPlaces.json
8+
GeneralStateTests/stBadOpcode/opc2BDiffPlaces.json
9+
GeneralStateTests/stBadOpcode/opc2CDiffPlaces.json
10+
GeneralStateTests/stBadOpcode/opc2DDiffPlaces.json
11+
GeneralStateTests/stBadOpcode/opc2EDiffPlaces.json
12+
GeneralStateTests/stBadOpcode/opc2FDiffPlaces.json
13+
GeneralStateTests/stBadOpcode/opc4ADiffPlaces.json
14+
GeneralStateTests/stBadOpcode/opc4BDiffPlaces.json
15+
GeneralStateTests/stBadOpcode/opc4CDiffPlaces.json
16+
GeneralStateTests/stBadOpcode/opc4DDiffPlaces.json
17+
GeneralStateTests/stBadOpcode/opc4EDiffPlaces.json
18+
GeneralStateTests/stBadOpcode/opc4FDiffPlaces.json
19+
GeneralStateTests/stBadOpcode/opc5CDiffPlaces.json
20+
GeneralStateTests/stBadOpcode/opc5DDiffPlaces.json
21+
GeneralStateTests/stBadOpcode/opc5EDiffPlaces.json
22+
GeneralStateTests/stBadOpcode/opc5FDiffPlaces.json
23+
GeneralStateTests/stBadOpcode/opc21DiffPlaces.json
24+
GeneralStateTests/stBadOpcode/opc22DiffPlaces.json
25+
GeneralStateTests/stBadOpcode/opc23DiffPlaces.json
26+
GeneralStateTests/stBadOpcode/opc24DiffPlaces.json
27+
GeneralStateTests/stBadOpcode/opc25DiffPlaces.json
28+
GeneralStateTests/stBadOpcode/opc26DiffPlaces.json
29+
GeneralStateTests/stBadOpcode/opc27DiffPlaces.json
30+
GeneralStateTests/stBadOpcode/opc28DiffPlaces.json
31+
GeneralStateTests/stBadOpcode/opc29DiffPlaces.json
32+
GeneralStateTests/stBadOpcode/opc49DiffPlaces.json
33+
GeneralStateTests/stBadOpcode/opcA5DiffPlaces.json
34+
GeneralStateTests/stBadOpcode/opcA6DiffPlaces.json
35+
GeneralStateTests/stBadOpcode/opcA7DiffPlaces.json
36+
GeneralStateTests/stBadOpcode/opcA8DiffPlaces.json
37+
GeneralStateTests/stBadOpcode/opcA9DiffPlaces.json
38+
GeneralStateTests/stBadOpcode/opcAADiffPlaces.json
39+
GeneralStateTests/stBadOpcode/opcABDiffPlaces.json
40+
GeneralStateTests/stBadOpcode/opcACDiffPlaces.json
41+
GeneralStateTests/stBadOpcode/opcADDiffPlaces.json
42+
GeneralStateTests/stBadOpcode/opcAEDiffPlaces.json
43+
GeneralStateTests/stBadOpcode/opcAFDiffPlaces.json
44+
GeneralStateTests/stBadOpcode/opcB0DiffPlaces.json
45+
GeneralStateTests/stBadOpcode/opcB1DiffPlaces.json
46+
GeneralStateTests/stBadOpcode/opcB2DiffPlaces.json
47+
GeneralStateTests/stBadOpcode/opcB3DiffPlaces.json
48+
GeneralStateTests/stBadOpcode/opcB4DiffPlaces.json
49+
GeneralStateTests/stBadOpcode/opcB5DiffPlaces.json
50+
GeneralStateTests/stBadOpcode/opcB6DiffPlaces.json
51+
GeneralStateTests/stBadOpcode/opcB7DiffPlaces.json
52+
GeneralStateTests/stBadOpcode/opcB8DiffPlaces.json
53+
GeneralStateTests/stBadOpcode/opcB9DiffPlaces.json
54+
GeneralStateTests/stBadOpcode/opcBADiffPlaces.json
55+
GeneralStateTests/stBadOpcode/opcBBDiffPlaces.json
56+
GeneralStateTests/stBadOpcode/opcBCDiffPlaces.json
57+
GeneralStateTests/stBadOpcode/opcBDDiffPlaces.json
58+
GeneralStateTests/stBadOpcode/opcBEDiffPlaces.json
59+
GeneralStateTests/stBadOpcode/opcBFDiffPlaces.json
60+
GeneralStateTests/stBadOpcode/opcC0DiffPlaces.json
61+
GeneralStateTests/stBadOpcode/opcC1DiffPlaces.json
62+
GeneralStateTests/stBadOpcode/opcC2DiffPlaces.json
63+
GeneralStateTests/stBadOpcode/opcC3DiffPlaces.json
64+
GeneralStateTests/stBadOpcode/opcC4DiffPlaces.json
65+
GeneralStateTests/stBadOpcode/opcC5DiffPlaces.json
66+
GeneralStateTests/stBadOpcode/opcC6DiffPlaces.json
67+
GeneralStateTests/stBadOpcode/opcC7DiffPlaces.json
68+
GeneralStateTests/stBadOpcode/opcC8DiffPlaces.json
69+
GeneralStateTests/stBadOpcode/opcC9DiffPlaces.json
70+
GeneralStateTests/stBadOpcode/opcCADiffPlaces.json
71+
GeneralStateTests/stBadOpcode/opcCBDiffPlaces.json
72+
GeneralStateTests/stBadOpcode/opcCCDiffPlaces.json
73+
GeneralStateTests/stBadOpcode/opcCDDiffPlaces.json
74+
GeneralStateTests/stBadOpcode/opcCEDiffPlaces.json
75+
GeneralStateTests/stBadOpcode/opcCFDiffPlaces.json
76+
GeneralStateTests/stBadOpcode/opcD0DiffPlaces.json
77+
GeneralStateTests/stBadOpcode/opcD1DiffPlaces.json
78+
GeneralStateTests/stBadOpcode/opcD2DiffPlaces.json
79+
GeneralStateTests/stBadOpcode/opcD3DiffPlaces.json
80+
GeneralStateTests/stBadOpcode/opcD4DiffPlaces.json
81+
GeneralStateTests/stBadOpcode/opcD5DiffPlaces.json
82+
GeneralStateTests/stBadOpcode/opcD6DiffPlaces.json
83+
GeneralStateTests/stBadOpcode/opcD7DiffPlaces.json
84+
GeneralStateTests/stBadOpcode/opcD8DiffPlaces.json
85+
GeneralStateTests/stBadOpcode/opcD9DiffPlaces.json
86+
GeneralStateTests/stBadOpcode/opcDADiffPlaces.json
87+
GeneralStateTests/stBadOpcode/opcDBDiffPlaces.json
88+
GeneralStateTests/stBadOpcode/opcDCDiffPlaces.json
89+
GeneralStateTests/stBadOpcode/opcDDDiffPlaces.json
90+
GeneralStateTests/stBadOpcode/opcDEDiffPlaces.json
91+
GeneralStateTests/stBadOpcode/opcDFDiffPlaces.json
92+
GeneralStateTests/stBadOpcode/opcE0DiffPlaces.json
93+
GeneralStateTests/stBadOpcode/opcE1DiffPlaces.json
94+
GeneralStateTests/stBadOpcode/opcE2DiffPlaces.json
95+
GeneralStateTests/stBadOpcode/opcE3DiffPlaces.json
96+
GeneralStateTests/stBadOpcode/opcE4DiffPlaces.json
97+
GeneralStateTests/stBadOpcode/opcE5DiffPlaces.json
98+
GeneralStateTests/stBadOpcode/opcE6DiffPlaces.json
99+
GeneralStateTests/stBadOpcode/opcE7DiffPlaces.json
100+
GeneralStateTests/stBadOpcode/opcE8DiffPlaces.json
101+
GeneralStateTests/stBadOpcode/opcE9DiffPlaces.json
102+
GeneralStateTests/stBadOpcode/opcEADiffPlaces.json
103+
GeneralStateTests/stBadOpcode/opcEBDiffPlaces.json
104+
GeneralStateTests/stBadOpcode/opcECDiffPlaces.json
105+
GeneralStateTests/stBadOpcode/opcEDDiffPlaces.json
106+
GeneralStateTests/stBadOpcode/opcEEDiffPlaces.json
107+
GeneralStateTests/stBadOpcode/opcEFDiffPlaces.json
108+
GeneralStateTests/stBadOpcode/opcF6DiffPlaces.json
109+
GeneralStateTests/stBadOpcode/opcF7DiffPlaces.json
110+
GeneralStateTests/stBadOpcode/opcF8DiffPlaces.json
111+
GeneralStateTests/stBadOpcode/opcF9DiffPlaces.json
112+
GeneralStateTests/stBadOpcode/opcFBDiffPlaces.json
113+
GeneralStateTests/stBadOpcode/opcFCDiffPlaces.json
114+
GeneralStateTests/stBadOpcode/opcFEDiffPlaces.json
115+
116+
1117
([#748](https://github.com/ethereum/execution-spec-tests/pull/748))
2118
GeneralStateTests/stBadOpcode/badOpcodes.json
3119
GeneralStateTests/stBugs/evmBytecode.json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
Scenarios common import
3+
"""

tests/frontier/scenarios/common.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""
2+
Define Scenario class for test_scenarios test
3+
"""
4+
from typing import Optional
5+
6+
from ethereum_test_forks import Byzantium, Constantinople, Fork, Frontier, Homestead
7+
from ethereum_test_tools import Address
8+
from ethereum_test_tools.vm.opcode import Opcode
9+
from ethereum_test_tools.vm.opcode import Opcodes as Op
10+
11+
12+
class Scenario:
13+
"""
14+
Describe test scenario that will be run in test and it's conditions
15+
"""
16+
17+
name: str
18+
code: Address
19+
fork: Fork
20+
not_reverting: bool
21+
22+
def __init__(self, name: str, code: Address, fork: Fork, reverts: bool = False):
23+
self.name = name
24+
self.code = code
25+
self.fork = fork
26+
self.not_reverting = not reverts
27+
28+
29+
def get_valid_fork_for_call(call: Opcode, second_call: Optional[Opcode] = Op.CALL) -> Fork:
30+
"""Return fork for which this call will be valid"""
31+
if call == Op.CREATE2 or second_call == Op.CREATE2:
32+
return Constantinople
33+
if call == Op.STATICCALL or second_call == Op.STATICCALL:
34+
return Byzantium
35+
if call == Op.DELEGATECALL or second_call == Op.DELEGATECALL:
36+
return Homestead
37+
return Frontier

0 commit comments

Comments
 (0)