We have almost the same code in ceno_zkvm/examples/riscv_opcodes.rs and ceno_zkvm/examples/fibonacci_elf.rs. Let's deduplicate some of that, and make it accessible for other parts of our code base as well.
Eg something like the following would be a useful helper function, instead of copy-and-pasting it wherever we need the functionality:
let halt_record = all_records
.iter()
.rev()
.find(|record| {
record.insn().codes().kind == EANY
&& record.rs1().unwrap().value == CENO_PLATFORM.ecall_halt()
})
.expect("halt record not found");
We have almost the same code in
ceno_zkvm/examples/riscv_opcodes.rs
andceno_zkvm/examples/fibonacci_elf.rs
. Let's deduplicate some of that, and make it accessible for other parts of our code base as well.Eg something like the following would be a useful helper function, instead of copy-and-pasting it wherever we need the functionality:
Look for more instances of these things.