Skip to content

Commit

Permalink
write output srs
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenfeizhang committed Sep 18, 2023
1 parent 3340807 commit 07cd585
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dotenv = "0.15.0"
env_logger = "0.10.0"
ethers-providers = "1.0"
itertools = "0.10.5"
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "develop"}
log = "0.4"
log4rs = { version = "1.2.0", default_features = false, features = ["console_appender", "file_appender"] }
rand = "0.8"
Expand Down
14 changes: 10 additions & 4 deletions bin/src/re_rand_srs.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use std::{fs::File, io::BufWriter};

use anyhow::Result;
use clap::Parser;
use halo2_proofs::poly::commitment::Params;
use prover::utils::{load_params, re_randomize_srs};
use tiny_keccak::{Hasher, Keccak};

Expand All @@ -26,15 +29,18 @@ fn main() -> Result<()> {

log::info!("Re-randomize SRS in file: {}", args.input_param);
log::info!("Degree of SRS: {}", args.degree);
log::info!("Using seed: {}", args.seed);
log::info!("Output new SRS to: {}", args.output_param);

let mut old_param = load_params(&args.input_param, args.degree as u32, None)?;
let mut param = load_params(&args.input_param, args.degree as u32, None)?;

log::info!("Using seed: {}", args.seed);
let mut hasher = Keccak::v256();
hasher.update(args.seed.as_bytes());
let mut seed = [0u8; 32];
hasher.finalize(&mut seed);
re_randomize_srs(&mut old_param, &seed);
re_randomize_srs(&mut param, &seed);

log::info!("Output new SRS to: {}", args.output_param);
param.write(&mut BufWriter::new(File::create(args.output_param)?))?;

log::info!("SRS re-randomization finished");
Ok(())
Expand Down

0 comments on commit 07cd585

Please sign in to comment.