@@ -273,6 +273,14 @@ def fixture_vm_class(fixture_data):
273
273
raise ValueError ("Unknown Fork Name: {0}" .format (fork_name ))
274
274
275
275
276
+ PRE_STATE_CLEARING_VMS = (
277
+ FrontierVMForTesting ,
278
+ HomesteadVMForTesting ,
279
+ TangerineWhistleVMForTesting ,
280
+ SpuriousDragonVMForTesting ,
281
+ )
282
+
283
+
276
284
def test_state_fixtures (fixture , fixture_vm_class ):
277
285
header = BlockHeader (
278
286
coinbase = fixture ['env' ]['currentCoinbase' ],
@@ -320,26 +328,30 @@ def test_state_fixtures(fixture, fixture_vm_class):
320
328
r = r ,
321
329
s = s ,
322
330
)
331
+ else :
332
+ raise Exception ("Invariant: No transaction specified" )
323
333
324
334
try :
325
335
header , receipt , computation = vm .apply_transaction (vm .block .header , transaction )
326
- transactions = vm .block .transactions + (transaction , )
327
- receipts = vm .block .get_receipts (chaindb ) + (receipt , )
328
- block = vm .set_block_transactions (vm .block , header , transactions , receipts )
329
336
except ValidationError as err :
330
- # This feels terribly wrong
331
- coinbase_balance = state . account_db . get_balance ( vm . block . header . coinbase )
332
- if coinbase_balance == 0 :
333
- state .account_db .set_balance (vm .block .header .coinbase , 0 )
337
+ # Transaction is fully invalid....
338
+ # INSANITY: https://github.com/ethereum/go-ethereum/commit/32f28a9360d26a661d55915915f12fd3c70f012b#diff-f53696be8527ac422b8d4de7c8e945c1R149
339
+ if isinstance ( vm , PRE_STATE_CLEARING_VMS ) :
340
+ state .account_db .touch_account (vm .block .header .coinbase )
334
341
state .account_db .persist ()
335
342
vm .block = vm .block .copy (header = vm .block .header .copy (state_root = state .state_root ))
336
343
344
+ logger .warning ("Got transaction error" , exc_info = True )
337
345
block = vm .block
346
+
338
347
transaction_error = err
339
- logger .warning ("Got transaction error" , exc_info = True )
340
348
else :
341
349
transaction_error = False
342
350
351
+ transactions = vm .block .transactions + (transaction , )
352
+ receipts = vm .block .get_receipts (chaindb ) + (receipt , )
353
+ block = vm .set_block_transactions (vm .block , header , transactions , receipts )
354
+
343
355
if not transaction_error :
344
356
log_entries = computation .get_log_entries ()
345
357
actual_logs_hash = hash_log_entries (log_entries )
0 commit comments