(
bin_file_path: &str,
trace_name: &str,
print_trace: bool,
call_data: Option<Vec<GoldilocksField>>,
)
| 23 | use std::io::{BufRead, BufReader, Write}; |
| 24 | |
| 25 | fn executor_run_test_program( |
| 26 | bin_file_path: &str, |
| 27 | trace_name: &str, |
| 28 | print_trace: bool, |
| 29 | call_data: Option<Vec<GoldilocksField>>, |
| 30 | ) { |
| 31 | let _ = env_logger::builder() |
| 32 | .filter_level(LevelFilter::Info) |
| 33 | .try_init(); |
| 34 | let file = File::open(bin_file_path).unwrap(); |
| 35 | |
| 36 | let reader = BufReader::new(file); |
| 37 | |
| 38 | let program: BinaryProgram = serde_json::from_reader(reader).unwrap(); |
| 39 | |
| 40 | let hash = ZkHasher::default(); |
| 41 | |
| 42 | let instructions = program.bytecode.split("\n"); |
| 43 | let code: Vec<_> = instructions |
| 44 | .clone() |
| 45 | .map(|e| GoldilocksField::from_canonical_u64(u64::from_str_radix(&e[2..], 16).unwrap())) |
| 46 | .collect(); |
| 47 | let code_hash = hash.hash_bytes(&code); |
| 48 | let mut prophets = HashMap::new(); |
| 49 | for item in program.prophets { |
| 50 | prophets.insert(item.host as u64, item); |
| 51 | } |
| 52 | |
| 53 | let mut program: Program = Program { |
| 54 | instructions: Vec::new(), |
| 55 | trace: Default::default(), |
| 56 | debug_info: program.debug_info, |
| 57 | prophets: prophets, |
| 58 | pre_exe_flag: false, |
| 59 | print_flag: false, |
| 60 | }; |
| 61 | |
| 62 | for inst in instructions { |
| 63 | program.instructions.push(inst.to_string()); |
| 64 | } |
| 65 | let mut process = Process::new(); |
| 66 | process.addr_storage = Address::default(); |
| 67 | |
| 68 | let tp_start = 0; |
| 69 | |
| 70 | let callee: Address = [ |
| 71 | GoldilocksField::from_canonical_u64(9), |
| 72 | GoldilocksField::from_canonical_u64(10), |
| 73 | GoldilocksField::from_canonical_u64(11), |
| 74 | GoldilocksField::from_canonical_u64(12), |
| 75 | ]; |
| 76 | let caller_addr = [ |
| 77 | GoldilocksField::from_canonical_u64(17), |
| 78 | GoldilocksField::from_canonical_u64(18), |
| 79 | GoldilocksField::from_canonical_u64(19), |
| 80 | GoldilocksField::from_canonical_u64(20), |
| 81 | ]; |
| 82 | let callee_exe_addr = [ |
no test coverage detected