cli/commands/snark/precalculate_block_verifier_index_and_srs.rs
1// use std::fs;
2use std::path::PathBuf;
3
4// use node::snark::{
5// get_srs, srs_to_bytes, verifier_index_to_bytes, VerifierKind,
6// };
7// use sha2::{Digest, Sha256};
8
9#[derive(Debug, clap::Args)]
10/// Precalculate Block Verifier Index and SRS, to be quickly loaded ready to be used for block verification
11pub struct PrecalculateBlockVerifierIndexAndSrs {
12 #[arg(default_value = ".")]
13 pub out: PathBuf,
14}
15
16impl PrecalculateBlockVerifierIndexAndSrs {
17 pub fn run(self) -> anyhow::Result<()> {
18 unimplemented!()
19 // let verifier_index =
20 // verifier_index_to_bytes(&get_verifier_index(VerifierKind::Blockchain))?;
21 // let mut hasher = Sha256::new();
22 // hasher.update(&verifier_index);
23 // let index_hash = hex::encode(hasher.finalize());
24
25 // let srs = {
26 // let srs = get_srs();
27 // srs_to_bytes(&srs)
28 // };
29 // let mut hasher = Sha256::new();
30 // hasher.update(&srs);
31 // let srs_hash = hex::encode(hasher.finalize());
32
33 // let index_path = self.out.with_file_name("block_verifier_index.bin");
34 // let srs_path = self.out.with_file_name("block_verifier_srs.bin");
35
36 // fs::write(&index_path, verifier_index)?;
37 // fs::write(&srs_path, srs)?;
38
39 // eprintln!(
40 // "Precalculated Verifier Index: {:?}",
41 // fs::canonicalize(&index_path)?
42 // );
43 // eprintln!(
44 // "Precalculated Verifier SRS: {:?}",
45 // fs::canonicalize(&srs_path)?
46 // );
47 // eprintln!("Sha256 hashes represented as hex:");
48 // println!("{}", index_hash);
49 // println!("{}", srs_hash);
50
51 // Ok(())
52 }
53}