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

fix: fast fail for incorrect recursion mode #414

Closed
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
18 changes: 10 additions & 8 deletions provers/sp1/driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ impl Prover for Sp1Prover {
let param = Sp1Param::deserialize(config.get("sp1").unwrap()).unwrap();
let mode = param.prover.clone().unwrap_or_else(get_env_mock);

if matches!(param.recursion, RecursionMode::Compressed) {
return Err(ProverError::GuestError(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can not do that before we have a clear flag shows it is aggregation.

"Compressed proof is used in aggregation mode only".to_owned(),
));
}

println!("param: {param:?}");

let mut stdin = SP1Stdin::new();
Expand Down Expand Up @@ -136,7 +142,9 @@ impl Prover for Sp1Prover {
debug!("Proving locally with recursion mode: {:?}", param.recursion);
match param.recursion {
RecursionMode::Core => prove_action.run(),
RecursionMode::Compressed => prove_action.compressed().run(),
RecursionMode::Compressed => {
unreachable!("Compressed proof is used in aggregation mode only, checked above")
}
RecursionMode::Plonk => prove_action.plonk().run(),
}
.map_err(|e| ProverError::GuestError(format!("Sp1: local proving failed: {e}")))?
Expand Down Expand Up @@ -172,13 +180,7 @@ impl Prover for Sp1Prover {
.map_err(|e| ProverError::GuestError(format!("Sp1: network proof failed {e:?}")))?
};

let proof_bytes = match param.recursion {
RecursionMode::Compressed => {
info!("Compressed proof is used in aggregation mode only");
vec![]
}
_ => prove_result.bytes(),
};
let proof_bytes = prove_result.bytes();
if param.verify && !proof_bytes.is_empty() {
let time = Measurement::start("verify", false);
let pi_hash = prove_result
Expand Down
Loading