@@ -5,8 +5,7 @@ use super::{
5
5
use database:: State ;
6
6
use indicatif:: { ProgressBar , ProgressDrawTarget } ;
7
7
use inspector:: {
8
- inspector_context:: InspectorContext , inspector_handler, inspectors:: TracerEip3155 ,
9
- InspectorMainEvm ,
8
+ inspect_main_commit, inspector_context:: InspectorContext , inspectors:: TracerEip3155 ,
10
9
} ;
11
10
use revm:: {
12
11
bytecode:: Bytecode ,
@@ -17,10 +16,9 @@ use revm::{
17
16
Cfg ,
18
17
} ,
19
18
database_interface:: EmptyDB ,
20
- handler:: EthHandler ,
21
19
primitives:: { keccak256, Bytes , TxKind , B256 } ,
22
20
specification:: { eip4844:: TARGET_BLOB_GAS_PER_BLOCK_CANCUN , hardfork:: SpecId } ,
23
- Context , DatabaseCommit , EvmCommit , MainEvm ,
21
+ transact_main_commit , Context ,
24
22
} ;
25
23
use serde_json:: json;
26
24
use statetest_types:: { SpecName , Test , TestSuite } ;
@@ -361,7 +359,6 @@ pub fn execute_test_suite(
361
359
}
362
360
363
361
for ( index, test) in tests. into_iter ( ) . enumerate ( ) {
364
- // TODO : TX TYPE needs to be set
365
362
let Some ( tx_type) = unit. transaction . tx_type ( test. indexes . data ) else {
366
363
if test. expect_exception . is_some ( ) {
367
364
continue ;
@@ -416,35 +413,29 @@ pub fn execute_test_suite(
416
413
. with_cached_prestate ( cache)
417
414
. with_bundle_update ( )
418
415
. build ( ) ;
419
- let mut evm = MainEvm :: new (
420
- Context :: builder ( )
421
- . with_block ( & block)
422
- . with_tx ( & tx)
423
- . with_cfg ( & cfg)
424
- . with_db ( & mut state) ,
425
- EthHandler :: default ( ) ,
426
- ) ;
416
+ let mut ctx = Context :: builder ( )
417
+ . with_block ( & block)
418
+ . with_tx ( & tx)
419
+ . with_cfg ( & cfg)
420
+ . with_db ( & mut state) ;
427
421
428
422
// Do the deed
429
423
let ( e, exec_result) = if trace {
430
- let mut evm = InspectorMainEvm :: new (
431
- InspectorContext :: new (
432
- Context :: builder ( )
433
- . with_block ( & block)
434
- . with_tx ( & tx)
435
- . with_cfg ( & cfg)
436
- . with_db ( & mut state) ,
437
- TracerEip3155 :: new ( Box :: new ( stderr ( ) ) ) . without_summary ( ) ,
438
- ) ,
439
- inspector_handler ( ) ,
424
+ let mut ctx = & mut InspectorContext :: new (
425
+ Context :: builder ( )
426
+ . with_block ( & block)
427
+ . with_tx ( & tx)
428
+ . with_cfg ( & cfg)
429
+ . with_db ( & mut state) ,
430
+ TracerEip3155 :: new ( Box :: new ( stderr ( ) ) ) . without_summary ( ) ,
440
431
) ;
441
432
442
433
let timer = Instant :: now ( ) ;
443
- let res = evm . exec_commit ( ) ;
434
+ let res = inspect_main_commit ( & mut ctx ) ;
444
435
* elapsed. lock ( ) . unwrap ( ) += timer. elapsed ( ) ;
445
436
446
437
let spec = cfg. spec ( ) ;
447
- let db = evm . context . inner . journaled_state . database ;
438
+ let db = & mut ctx . inner . journaled_state . database ;
448
439
// Dump state and traces if test failed
449
440
let output = check_evm_execution (
450
441
& test,
@@ -461,11 +452,11 @@ pub fn execute_test_suite(
461
452
( e, res)
462
453
} else {
463
454
let timer = Instant :: now ( ) ;
464
- let res = evm . exec_commit ( ) ;
455
+ let res = transact_main_commit ( & mut ctx ) ;
465
456
* elapsed. lock ( ) . unwrap ( ) += timer. elapsed ( ) ;
466
457
467
458
let spec = cfg. spec ( ) ;
468
- let db = evm . context . journaled_state . database ;
459
+ let db = ctx . journaled_state . database ;
469
460
// Dump state and traces if test failed
470
461
let output = check_evm_execution (
471
462
& test,
@@ -503,30 +494,23 @@ pub fn execute_test_suite(
503
494
504
495
println ! ( "\n Traces:" ) ;
505
496
506
- let mut evm = InspectorMainEvm :: new (
507
- InspectorContext :: new (
508
- Context :: builder ( )
509
- . with_db ( & mut state)
510
- . with_block ( & block)
511
- . with_tx ( & tx)
512
- . with_cfg ( & cfg) ,
513
- TracerEip3155 :: new ( Box :: new ( stderr ( ) ) ) . without_summary ( ) ,
514
- ) ,
515
- inspector_handler ( ) ,
497
+ let mut ctx = InspectorContext :: new (
498
+ Context :: builder ( )
499
+ . with_db ( & mut state)
500
+ . with_block ( & block)
501
+ . with_tx ( & tx)
502
+ . with_cfg ( & cfg) ,
503
+ TracerEip3155 :: new ( Box :: new ( stderr ( ) ) ) . without_summary ( ) ,
516
504
) ;
517
505
518
- let res = evm. transact ( ) ;
519
- let _ = res. map ( |r| {
520
- evm. context . inner . journaled_state . database . commit ( r. state ) ;
521
- r. result
522
- } ) ;
506
+ let _ = inspect_main_commit ( & mut ctx) ;
523
507
524
508
println ! ( "\n Execution result: {exec_result:#?}" ) ;
525
509
println ! ( "\n Expected exception: {:?}" , test. expect_exception) ;
526
510
println ! ( "\n State before: {cache_state:#?}" ) ;
527
511
println ! (
528
512
"\n State after: {:#?}" ,
529
- evm . context . inner. journaled_state. database. cache
513
+ ctx . inner. journaled_state. database. cache
530
514
) ;
531
515
println ! ( "\n Specification: {:?}" , cfg. spec) ;
532
516
println ! ( "\n Tx: {tx:#?}" ) ;
0 commit comments