30
30
}
31
31
32
32
# from ethereum.slogging import LogRecorder, configure_logging, set_level
33
- # config_string = ':info,eth.vm.log:trace,eth.vm.op:trace,eth.vm.stack:trace,eth.vm.exit:trace,eth.pb.msg:trace'
33
+ # config_string = ':info,eth.vm.log:trace,eth.vm.op:trace,eth.vm.stack:trace,eth.vm.exit:trace,eth.pb.msg:trace,eth.pb.tx:debug '
34
34
# configure_logging(config_string=config_string)
35
35
36
36
FILL = 1
@@ -157,7 +157,7 @@ def run_vm_test(params, mode, profiler=None):
157
157
for k , v in h ['storage' ].items ():
158
158
blk .set_storage_data (address ,
159
159
utils .big_endian_to_int (decode_hex (k [2 :])),
160
- zpad ( decode_hex (v [2 :]), 32 ))
160
+ decode_hex (v [2 :]))
161
161
162
162
# execute transactions
163
163
sender = decode_hex (exek ['caller' ]) # a party that originates a call
@@ -297,6 +297,7 @@ def run_state_test(params, mode):
297
297
gas_limit = parse_int_or_hex (env ['currentGasLimit' ]),
298
298
timestamp = parse_int_or_hex (env ['currentTimestamp' ]))
299
299
blk = blocks .Block (header , env = db_env )
300
+ blk .config ['HOMESTEAD_FORK_BLKNUM' ] = 1000000
300
301
301
302
# setup state
302
303
for address , h in list (pre .items ()):
@@ -309,7 +310,7 @@ def run_state_test(params, mode):
309
310
for k , v in h ['storage' ].items ():
310
311
blk .set_storage_data (address ,
311
312
utils .big_endian_to_int (decode_hex (k [2 :])),
312
- zpad ( decode_hex (v [2 :]), 32 ))
313
+ decode_hex (v [2 :]))
313
314
314
315
for address , h in list (pre .items ()):
315
316
address = decode_hex (address )
@@ -360,15 +361,22 @@ def blkhash(n):
360
361
assert False
361
362
362
363
time_pre = time .time ()
364
+ blk .commit_state ()
365
+ snapshot = blk .snapshot ()
363
366
try :
364
367
print ('trying' )
365
368
success , output = pb .apply_transaction (blk , tx )
369
+ assert success
366
370
blk .commit_state ()
367
371
print ('success' , blk .get_receipts ()[- 1 ].gas_used )
368
372
except InvalidTransaction :
369
373
success , output = False , b''
370
374
blk .commit_state ()
371
375
pass
376
+ except AssertionError :
377
+ success , output = False , b''
378
+ blk .commit_state ()
379
+ pass
372
380
time_post = time .time ()
373
381
374
382
if tx .to == b'' :
@@ -392,11 +400,13 @@ def blkhash(n):
392
400
compare_post_states (shouldbe , reallyis )
393
401
for k in ['pre' , 'exec' , 'env' , 'callcreates' ,
394
402
'out' , 'gas' , 'logs' , 'postStateRoot' ]:
395
- shouldbe = params1 .get (k , None )
396
- reallyis = params2 .get (k , None )
397
- if shouldbe != reallyis :
403
+ _shouldbe = params1 .get (k , None )
404
+ _reallyis = params2 .get (k , None )
405
+ if _shouldbe != _reallyis :
406
+ print 's' , shouldbe
407
+ print 'r' , reallyis
398
408
raise Exception ("Mismatch: " + k + ':\n shouldbe %r\n reallyis %r' %
399
- (shouldbe , reallyis ))
409
+ (_shouldbe , _reallyis ))
400
410
401
411
elif mode == TIME :
402
412
return time_post - time_pre
0 commit comments