File tree Expand file tree Collapse file tree 4 files changed +83
-15
lines changed Expand file tree Collapse file tree 4 files changed +83
-15
lines changed Original file line number Diff line number Diff line change @@ -78,16 +78,6 @@ def VM(request):
78
78
return request .param
79
79
80
80
81
- @pytest .fixture
82
- def block_reward (VM ):
83
- if VM == ByzantiumVM :
84
- return 3 * (10 ** 18 )
85
- elif VM == ConstantinopleVM :
86
- return 2 * (10 ** 18 )
87
- else :
88
- return 5 * (10 ** 18 )
89
-
90
-
91
81
@pytest .fixture
92
82
def base_db ():
93
83
return AtomicDB ()
Original file line number Diff line number Diff line change 3
3
)
4
4
from tests .core .helpers import (
5
5
new_transaction ,
6
+ # vm_specific_chain,
6
7
)
7
8
8
9
from eth_utils import (
15
16
from eth .exceptions import (
16
17
InvalidInstruction ,
17
18
OutOfGas ,
19
+ Revert ,
20
+ )
21
+
22
+ from eth .vm .forks import (
23
+ FrontierVM ,
24
+ HomesteadVM ,
25
+ TangerineWhistleVM ,
26
+ SpuriousDragonVM ,
27
+ ByzantiumVM ,
28
+ ConstantinopleVM ,
18
29
)
19
30
20
31
@@ -120,24 +131,87 @@ def test_get_transaction_result(
120
131
121
132
122
133
@pytest .mark .parametrize (
123
- 'signature, expected' ,
134
+ 'vm, signature, expected' ,
124
135
(
125
136
(
137
+ FrontierVM ,
138
+ 'doRevert()' ,
139
+ InvalidInstruction ,
140
+ ),
141
+ (
142
+ FrontierVM ,
143
+ 'useLotsOfGas()' ,
144
+ OutOfGas ,
145
+ ),
146
+
147
+ (
148
+ HomesteadVM .configure (
149
+ support_dao_fork = False ,
150
+ ),
151
+ 'doRevert()' ,
152
+ InvalidInstruction ,
153
+ ),
154
+ (
155
+ HomesteadVM .configure (
156
+ support_dao_fork = False ,
157
+ ),
158
+ 'useLotsOfGas()' ,
159
+ OutOfGas ,
160
+ ),
161
+
162
+ (
163
+ TangerineWhistleVM ,
164
+ 'doRevert()' ,
165
+ InvalidInstruction ,
166
+ ),
167
+ (
168
+ TangerineWhistleVM ,
169
+ 'useLotsOfGas()' ,
170
+ OutOfGas ,
171
+ ),
172
+
173
+ (
174
+ SpuriousDragonVM ,
126
175
'doRevert()' ,
127
176
InvalidInstruction ,
128
177
),
129
178
(
179
+ SpuriousDragonVM ,
180
+ 'useLotsOfGas()' ,
181
+ OutOfGas ,
182
+ ),
183
+
184
+ (
185
+ ByzantiumVM ,
186
+ 'doRevert()' ,
187
+ Revert ,
188
+ ),
189
+ (
190
+ ByzantiumVM ,
191
+ 'useLotsOfGas()' ,
192
+ OutOfGas ,
193
+ ),
194
+
195
+ (
196
+ ConstantinopleVM ,
197
+ 'doRevert()' ,
198
+ Revert ,
199
+ ),
200
+ (
201
+ ConstantinopleVM ,
130
202
'useLotsOfGas()' ,
131
203
OutOfGas ,
132
204
),
133
205
),
134
206
)
135
207
def test_get_transaction_result_revert (
136
- chain ,
208
+ vm ,
209
+ chain_from_vm ,
137
210
simple_contract_address ,
138
211
signature ,
139
212
expected ):
140
213
214
+ chain = chain_from_vm (vm )
141
215
function_selector = function_signature_to_4byte_selector (signature )
142
216
call_txn = new_transaction (
143
217
chain .get_vm (),
Original file line number Diff line number Diff line change @@ -31,7 +31,8 @@ def new_transaction(
31
31
private_key = None ,
32
32
gas_price = 10 ,
33
33
gas = 100000 ,
34
- data = b'' ):
34
+ data = b'' ,
35
+ chain_id = None ):
35
36
"""
36
37
Create and return a transaction sending amount from <from_> to <to>.
37
38
@@ -47,7 +48,10 @@ def new_transaction(
47
48
data = data ,
48
49
)
49
50
if private_key :
50
- return tx .as_signed_transaction (private_key , chain_id = 1 )
51
+ if chain_id is None :
52
+ return tx .as_signed_transaction (private_key )
53
+ else :
54
+ return tx .as_signed_transaction (private_key , chain_id = chain_id )
51
55
else :
52
56
return SpoofTransaction (tx , from_ = from_ )
53
57
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def test_mine_block_issues_block_reward(chain):
47
47
block = chain .mine_block ()
48
48
vm = chain .get_vm ()
49
49
coinbase_balance = vm .state .account_db .get_balance (block .header .coinbase )
50
- assert coinbase_balance == constants . BLOCK_REWARD
50
+ assert coinbase_balance == vm . get_block_reward ()
51
51
52
52
53
53
def test_import_block (chain , funded_address , funded_address_private_key ):
You can’t perform that action at this time.
0 commit comments