Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support insecure_skip_seal feature in guest #293

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion risc0/r0vm/tests/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::path::Path;
use anyhow::Result;
use assert_cmd::Command;
use assert_fs::{fixture::PathChild, TempDir};
use risc0_zkvm::{prove::insecure_skip_seal, Receipt};
use risc0_zkvm::{receipt::insecure_skip_seal, Receipt};

static EXPECTED_STDOUT: &str = "Hello world on stdout!\n";
static EXPECTED_STDERR: &str = "Hello world on stderr!\n";
Expand Down
14 changes: 7 additions & 7 deletions risc0/zkvm/src/prove/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod plonk;
#[cfg(feature = "profiler")]
pub mod profiler;

use std::{collections::HashMap, env, fmt::Debug, io::Write, rc::Rc};
use std::{collections::HashMap, fmt::Debug, io::Write, rc::Rc};

use anyhow::{bail, Result};
use risc0_zkp::{
Expand All @@ -33,12 +33,12 @@ use risc0_zkvm_platform::{
};

use self::elf::Program;
use crate::{method_id::MethodId, receipt::Receipt, sha::sha, CIRCUIT};

pub fn insecure_skip_seal() -> bool {
cfg!(feature = "insecure_skip_seal")
&& env::var("RISC0_INSECURE_SKIP_SEAL").unwrap_or_default() == "1"
}
use crate::{
method_id::MethodId,
receipt::{insecure_skip_seal, Receipt},
sha::sha,
CIRCUIT,
};

/// Options available to modify the prover's behavior.
pub struct ProverOpts<'a> {
Expand Down
14 changes: 12 additions & 2 deletions risc0/zkvm/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ use serde::{Deserialize, Serialize};

use crate::{method_id::MethodId, CIRCUIT};

#[cfg(not(target_os = "zkvm"))]
pub fn insecure_skip_seal() -> bool {
cfg!(feature = "insecure_skip_seal")
&& std::env::var("RISC0_INSECURE_SKIP_SEAL").unwrap_or_default() == "1"
}

#[cfg(target_os = "zkvm")]
pub fn insecure_skip_seal() -> bool {
cfg!(feature = "insecure_skip_seal")
}

#[derive(Deserialize, Serialize, ZeroioSerialize, ZeroioDeserialize, Clone, Debug)]
pub struct Receipt {
pub journal: Vec<u32>,
Expand Down Expand Up @@ -57,8 +68,7 @@ where
}
};

#[cfg(not(target_os = "zkvm"))]
if crate::prove::insecure_skip_seal() {
if insecure_skip_seal() {
return Ok(());
}

Expand Down