@@ -3,12 +3,16 @@ use ckb_vm::cost_model::constant_cycles;
33use ckb_vm:: machine:: asm:: { AsmCoreMachine , AsmMachine } ;
44use ckb_vm:: machine:: { DefaultMachineBuilder , VERSION2 } ;
55use ckb_vm:: snapshot;
6- use ckb_vm:: { Bytes , Error , SupportMachine , ISA_A , ISA_B , ISA_IMC , ISA_MOP } ;
6+ use ckb_vm:: { Bytes , DefaultMachineRunner , Error , SupportMachine , ISA_A , ISA_B , ISA_IMC , ISA_MOP } ;
77use libfuzzer_sys:: fuzz_target;
88
99fuzz_target ! ( |data: & [ u8 ] | {
1010 let mut machine1 = {
11- let asm_core = AsmCoreMachine :: new( ISA_IMC | ISA_A | ISA_B | ISA_MOP , VERSION2 , 200_000 ) ;
11+ let asm_core = <Box <AsmCoreMachine > as SupportMachine >:: new(
12+ ISA_IMC | ISA_A | ISA_B | ISA_MOP ,
13+ VERSION2 ,
14+ 200_000 ,
15+ ) ;
1216 let machine = DefaultMachineBuilder :: <Box <AsmCoreMachine >>:: new( asm_core)
1317 . instruction_cycle_func( Box :: new( constant_cycles) )
1418 . build( ) ;
@@ -25,8 +29,11 @@ fuzz_target!(|data: &[u8]| {
2529
2630 let half_cycles = machine1. machine. cycles( ) / 2 ;
2731 let mut machine2 = {
28- let asm_core =
29- AsmCoreMachine :: new( ISA_IMC | ISA_A | ISA_B | ISA_MOP , VERSION2 , half_cycles) ;
32+ let asm_core = <Box <AsmCoreMachine > as SupportMachine >:: new(
33+ ISA_IMC | ISA_A | ISA_B | ISA_MOP ,
34+ VERSION2 ,
35+ half_cycles,
36+ ) ;
3037 let machine = DefaultMachineBuilder :: <Box <AsmCoreMachine >>:: new( asm_core)
3138 . instruction_cycle_func( Box :: new( constant_cycles) )
3239 . build( ) ;
@@ -38,8 +45,11 @@ fuzz_target!(|data: &[u8]| {
3845 let snap = snapshot:: make_snapshot( & mut machine2. machine) . unwrap( ) ;
3946
4047 let mut machine3 = {
41- let asm_core =
42- AsmCoreMachine :: new( ISA_IMC | ISA_A | ISA_B | ISA_MOP , VERSION2 , half_cycles) ;
48+ let asm_core = <Box <AsmCoreMachine > as SupportMachine >:: new(
49+ ISA_IMC | ISA_A | ISA_B | ISA_MOP ,
50+ VERSION2 ,
51+ half_cycles,
52+ ) ;
4353 let machine = DefaultMachineBuilder :: <Box <AsmCoreMachine >>:: new( asm_core)
4454 . instruction_cycle_func( Box :: new( constant_cycles) )
4555 . build( ) ;
0 commit comments