Skip to content

Commit

Permalink
let dockerfile.zk print vk/image_id
Browse files Browse the repository at this point in the history
Signed-off-by: smtmfft <[email protected]>
  • Loading branch information
smtmfft committed Sep 15, 2024
1 parent 10448cc commit 07cd26a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Dockerfile.zk
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ ENV TARGET=sp1
RUN make install
RUN make guest
RUN cargo build --release ${BUILD_FLAGS} --features "sp1,risc0,bonsai-auto-scaling" --features "docker_build"
# print sp1 vk
RUN cargo test -r --package sp1-driver --lib --all-features -- test::test_show_sp1_elf_vk --exact --show-output --ignored
# print risc0 image id
RUN cargo test --package risc0-driver --lib -F enable -- test::test_show_risc0_image_id --exact --show-output --ignored

RUN mkdir -p \
./bin \
Expand Down
10 changes: 10 additions & 0 deletions provers/risc0/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl Prover for Risc0Prover {
#[cfg(test)]
mod test {
use super::*;
use methods::risc0_guest::RISC0_GUEST_ID;
use methods::test_risc0_guest::{TEST_RISC0_GUEST_ELF, TEST_RISC0_GUEST_ID};
use risc0_zkvm::{default_prover, ExecutorEnv};

Expand All @@ -141,4 +142,13 @@ mod test {
let receipt = prover.prove(env, TEST_RISC0_GUEST_ELF).unwrap();
receipt.receipt.verify(TEST_RISC0_GUEST_ID).unwrap();
}

#[ignore = "only to print image id for docker image build"]
#[test]
fn test_show_risc0_image_id() {
let image_id = RISC0_GUEST_ID
.map(|limp| hex::encode(limp.to_le_bytes()))
.concat();
println!("RISC0 IMAGE_ID: {}", image_id);
}
}
8 changes: 8 additions & 0 deletions provers/sp1/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,12 @@ mod test {
.verify(&proof, &vk)
.expect("Sp1: verification failed");
}

#[ignore = "This is for docker image build only"]
#[test]
fn test_show_sp1_elf_vk() {
let client = ProverClient::new();
let (_pk, vk) = client.setup(ELF);
println!("SP1 ELF VK: {:?}", vk.bytes32());
}
}

0 comments on commit 07cd26a

Please sign in to comment.