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

chore: pass clippy check #420

Merged
merged 2 commits into from
Nov 28, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 32 additions & 30 deletions harness/macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,45 +59,47 @@ pub fn entrypoint(input: TokenStream) -> TokenStream {
};
}

#[cfg(feature = "sp1")]
let output = quote! {
// Set up a global allocator
use sp1_zkvm::heap::SimpleAlloc;
#[global_allocator]
static HEAP: SimpleAlloc = SimpleAlloc;
let output = if cfg!(feature = "sp1") {
quote! {
// Set up a global allocator
use sp1_zkvm::heap::SimpleAlloc;
#[global_allocator]
static HEAP: SimpleAlloc = SimpleAlloc;

#[cfg(test)]
#tests_entry
#[cfg(test)]
#tests_entry

#[cfg(not(test))]
const ZKVM_ENTRY: fn() = #main_entry;
#[cfg(test)]
const ZKVM_ENTRY: fn() = run_tests;
#[cfg(not(test))]
const ZKVM_ENTRY: fn() = #main_entry;
#[cfg(test)]
const ZKVM_ENTRY: fn() = run_tests;

mod zkvm_generated_main {
#[no_mangle]
fn main() {
super::ZKVM_ENTRY()
mod zkvm_generated_main {
#[no_mangle]
fn main() {
super::ZKVM_ENTRY()
}
}
}
};

#[cfg(feature = "risc0")]
let output = quote! {
#[cfg(test)]
#tests_entry
} else if cfg!(feature = "risc0") {
quote! {
#[cfg(test)]
#tests_entry

#[cfg(not(test))]
const ZKVM_ENTRY: fn() = #main_entry;
#[cfg(test)]
const ZKVM_ENTRY: fn() = run_tests;
#[cfg(not(test))]
const ZKVM_ENTRY: fn() = #main_entry;
#[cfg(test)]
const ZKVM_ENTRY: fn() = run_tests;

mod zkvm_generated_main {
#[no_mangle]
fn main() {
super::ZKVM_ENTRY()
mod zkvm_generated_main {
#[no_mangle]
fn main() {
super::ZKVM_ENTRY()
}
}
}
} else {
quote! {}
};

output.into()
Expand Down
2 changes: 1 addition & 1 deletion provers/risc0/driver/src/bonsai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub fn prove_locally(

let segment_dir = PathBuf::from("/tmp/risc0-cache");
if !segment_dir.exists() {
fs::create_dir(segment_dir.clone()).map_err(|e| ProverError::FileIo(e))?;
fs::create_dir(segment_dir.clone()).map_err(ProverError::FileIo)?;
}
let env = env_builder
.segment_path(segment_dir)
Expand Down
4 changes: 2 additions & 2 deletions provers/risc0/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Prover for Risc0Prover {
let proof_key = (
input.chain_spec.chain_id,
input.block.header.number,
output.hash.clone(),
output.hash,
RISC0_PROVER_CODE,
);

Expand Down Expand Up @@ -188,7 +188,7 @@ impl Prover for Risc0Prover {
proof: snark_proof,
receipt: serde_json::to_string(&receipt).unwrap(),
uuid: "".to_owned(),
input: B256::from_slice(&receipt.journal.digest().as_bytes()),
input: B256::from_slice(receipt.journal.digest().as_bytes()),
}
.into());

Expand Down
2 changes: 1 addition & 1 deletion provers/risc0/driver/src/snarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pub async fn verify_groth16_snark_impl(
tracing_info!("Verifying SNARK:");
tracing_info!("Seal: {}", hex::encode(&enc_seal));
tracing_info!("Image ID: {}", hex::encode(image_id.as_bytes()));
tracing_info!("Post State Digest: {}", hex::encode(&post_state_digest));
tracing_info!("Post State Digest: {}", hex::encode(post_state_digest));
tracing_info!("Journal Digest: {}", hex::encode(journal_digest));
let verify_call_res = IRiscZeroVerifier::new(groth16_verifier_addr, http_client)
.verify(
Expand Down
Loading