diff options
feat(zkvms/risc0): Implement elf encoding
Recently, RISC0 have added code to their SDK which adds magic bytes to
the (already compiled) ELF. Since we're taking another route than
intended, we'll need to replicate this step too.
We're doing things in a different fashion, because their SDK normally
compiles the guest, and doesn't allow you to supply a prebuilt ELF.
1 files changed, 11 insertions, 0 deletions
| -rw-r--r-- | zkvms/risc0/guest_elf_patch/src/main.rs | 11 |
diff --git a/zkvms/risc0/guest_elf_patch/src/main.rs b/zkvms/risc0/guest_elf_patch/src/main.rs new file mode 100644 index 0000000..6999ab4 --- /dev/null +++ b/zkvms/risc0/guest_elf_patch/src/main.rs @@ -0,0 +1,11 @@ +use risc0_binfmt::ProgramBinary; +use risc0_zkos_v1compat::V1COMPAT_ELF; + +static ELF: &[u8] = include_bytes!("../../host/src/guest"); + +// https://github.com/risc0/risc0/blob/fee2e19a3c49b3da492403de5e2d011c890e52de/risc0/build/src/lib.rs#L179-L187 +fn main() { + let binary = ProgramBinary::new(&ELF, V1COMPAT_ELF); + let elf = binary.encode(); + std::fs::write("../host/src/guest", &elf).expect("couldn't add magic bytes to elf!"); +} |
