Skip to content

Commit

Permalink
todo debug exec.rs#70
Browse files Browse the repository at this point in the history
  • Loading branch information
SuccinctPaul committed Nov 2, 2023
1 parent 22d7c28 commit 462de48
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
13 changes: 7 additions & 6 deletions starkjs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ RUST_LOG=debug ../target/release/eigen-zkit compressor12 \
--r /tmp/$CIRCUIT.verifier.r1cs \
--w /tmp/$CIRCUIT.verifier_js/$CIRCUIT.verifier.wasm\
--i circuits/$CIRCUIT.verifier.zkin.json \
--c /tmp/c12.const \
--m /tmp/c12.cm

--c /tmp/c12_new.const \
--m /tmp/c12_new.cm \
--p /tmp/c12_new.pil.json

RUST_LOG=debug ../target/release/eigen-zkit stark_prove -s ../starky/data/c12.starkStruct.bn128.json \
-p /tmp/c12.pil.json \
--o /tmp/c12.const \
--m /tmp/c12.cm -c circuits/circuit.circom --i circuits/circuit.zkin.json --norm_stage
-p /tmp/c12_new.pil.json \
--o /tmp/c12_new.const \
--m /tmp/c12_new.cm -c circuits/circuit.circom --i circuits/circuit.zkin.json --norm_stage
```

### Top Layer: Snark proof
Expand Down
5 changes: 4 additions & 1 deletion starky/src/compressor12/compressor12_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn exec(
plonk_setup: PlonkSetup,
input_file: &str,
wasm_file: &str,
// pil_file: &str,
pil_json_file: &str,
// exec_file: &str,
commit_file: &str,
) -> Result<()> {
Expand All @@ -41,6 +41,9 @@ pub fn exec(
// let input = serde_json::to_string(&pil_json).unwrap();
// write!(file, "{}", input).unwrap();
let pil_json = plonk_setup.pil_json;
let mut file = File::create(Path::new(pil_json_file)).unwrap();
let input = serde_json::to_string(&pil_json).unwrap();
write!(file, "{}", input).unwrap();

// 2. construct cmPol: .pil.json -> .cm
let mut cm_pols = PolsArray::new(&pil_json, PolKind::Commit);
Expand Down
8 changes: 5 additions & 3 deletions starky/src/compressor12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ pub(crate) mod plonk_setup;

// compress12 phase:
// input: .r1cs, .wasm, zkin.json(input_file)
// output: .const, .cm
// output: .const, .cm, pil.json
pub fn compress12(
force_n_bits: usize,
r1cs_file: &str,
wasm_file: &str,
input_file: &str,
const_file: &str,
commit_file: &str,
pil_json_file: &str,
) -> Result<()> {
// todo remove the pil_file and exec_file.

Expand All @@ -38,12 +39,13 @@ pub fn compress12(

// exec phase:
// input files: .wasm, .exec, .pil, zkin.json(input file),
// output: .cm
// output: .cm, .pil.json
exec(
plonk_setup,
input_file,
wasm_file,
// pil_file, exec_file,
pil_json_file,
// exec_file,
commit_file,
)
}
3 changes: 3 additions & 0 deletions zkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ struct Compressor12Opt {
const_file: String, // Output file required to build the constants
#[arg(long = "m", default_value = "mycircuit.c12.cm")]
commit_file: String,
#[arg(long = "p", default_value = "mycircuit.c12.pil.json")]
pil_json_file: String,
}

/// Exec compressor12 for converting R1CS to PIL
Expand Down Expand Up @@ -491,6 +493,7 @@ fn main() {
&args.input_file,
&args.const_file,
&args.commit_file,
&args.pil_json_file,
)
.map_err(|_| EigenError::from("compreesor12 error".to_string())),

Expand Down

0 comments on commit 462de48

Please sign in to comment.