-
Notifications
You must be signed in to change notification settings - Fork 106
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
added srs_cache cli arg #2940
base: master
Are you sure you want to change the base?
added srs_cache cli arg #2940
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
use ark_ff::UniformRand; | ||
use clap::Parser; | ||
use kimchi::circuits::domains::EvaluationDomains; | ||
use kimchi::{circuits::domains::EvaluationDomains, precomputed_srs::TestSRS}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of the scope of this PR: it would be nice to move this structure |
||
use log::debug; | ||
use mina_curves::pasta::{Fp, Vesta, VestaParameters}; | ||
use mina_poseidon::{ | ||
|
@@ -48,10 +48,37 @@ pub fn cannon_main(args: cli::cannon::RunArgs) { | |
let start = Start::create(state.step as usize); | ||
|
||
let domain_fp = EvaluationDomains::<Fp>::create(DOMAIN_SIZE).unwrap(); | ||
let srs: SRS<Vesta> = { | ||
let srs = SRS::create(DOMAIN_SIZE); | ||
srs.get_lagrange_basis(domain_fp.d1); | ||
srs | ||
let srs: SRS<Vesta> = match &args.srs_cache { | ||
Some(cache) => { | ||
debug!("Loading SRS from cache {}", cache); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would check that the SRS is of the expected size ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the requirement that |
||
let file_path = Path::new(cache); | ||
let file = File::open(file_path).expect("Error opening SRS cache file"); | ||
let srs: SRS<Vesta> = { | ||
// By convention, proof systems serializes a TestSRS with filename 'test_<CURVE_NAME>.srs'. | ||
// The benefit of using this is you don't waste time verifying the SRS. | ||
if file_path | ||
.file_name() | ||
.unwrap() | ||
.to_str() | ||
.unwrap() | ||
.starts_with("test_") | ||
{ | ||
let test_srs: TestSRS<Vesta> = rmp_serde::from_read(&file).unwrap(); | ||
From::from(test_srs) | ||
} else { | ||
rmp_serde::from_read(&file).unwrap() | ||
} | ||
}; | ||
debug!("SRS loaded successfully from cache"); | ||
srs | ||
} | ||
None => { | ||
debug!("No SRS cache provided. Creating SRS from scratch"); | ||
let srs = SRS::create(DOMAIN_SIZE); | ||
srs.get_lagrange_basis(domain_fp.d1); | ||
debug!("SRS created successfully"); | ||
srs | ||
} | ||
}; | ||
|
||
// Initialize the environments | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe simply
srs
orsrs_filename
orsrs_path
?