Skip to content

Commit

Permalink
feat: remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SuccinctPaul committed Nov 2, 2023
1 parent 245b62f commit f9368dc
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 172 deletions.
56 changes: 0 additions & 56 deletions starky/src/compressor12/compressor12_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ use crate::compressor12::plonk_setup::PlonkSetup;
use crate::compressor12_pil::CompressorNameSpace::*;
use crate::compressor12_pil::CompressorPolName::a;
use crate::errors::EigenError;
use crate::io_utils::read_vec_from_file;
use crate::pilcom::{compile_pil_from_path, compile_pil_from_str};
use crate::polsarray::{PolKind, PolsArray};
use num_traits::Zero;
use plonky::ff::PrimeField;
use plonky::field_gl::Fr as FGL;
use plonky::witness::{load_input_for_witness, WitnessCalculator};
use std::fmt::format;
use std::fs::File;
use std::io::Write;
use std::path::Path;
Expand Down Expand Up @@ -105,56 +102,3 @@ pub fn exec(
log::debug!("files Generated Correctly");
Ok(())
}

#[deprecated]
fn read_exec_file(exec_file: &str) -> (usize, usize, Vec<u64>, Vec<u64>) {
let mut buff = read_vec_from_file(exec_file).unwrap();

let mut new_buff = buff.split_off(2);
let adds_len = buff[0] as usize;
let s_map_column_len = buff[1] as usize;

let size = adds_len * 4 + s_map_column_len * 12;
assert_eq!(new_buff.len(), size);

let s_map = new_buff.split_off(adds_len * 4);
let adds = new_buff;

(adds_len, s_map_column_len, adds, s_map)
}

#[cfg(test)]
mod test {
use super::*;
use crate::compressor12_setup::write_exec_file;

#[test]
fn test_write_and_read_exec_file() {
let file_path = String::from("/tmp/test_write_and_read_exec_file.txt");

let target_adds = vec![
// PlonkAdd()
];

let target_s_map = vec![
vec![1, 2, 4],
vec![2, 3, 42],
vec![1, 1, 3],
vec![4, 5, 2],
vec![3, 4, 5],
vec![1, 2, 4],
vec![2, 3, 42],
vec![1, 1, 3],
vec![4, 5, 2],
vec![3, 4, 5],
vec![3, 4, 5],
vec![3, 4, 5],
];

write_exec_file(&file_path, &target_adds, &target_s_map);

let (adds_len, _s_map_column_len, _adds, _s_map) = read_exec_file(&file_path);

assert_eq!(adds_len, target_adds.len());
}
}
36 changes: 0 additions & 36 deletions starky/src/compressor12/compressor12_setup.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#![allow(non_snake_case)]
use crate::compressor12::plonk_setup::PlonkSetup;
use crate::errors::EigenError;
use crate::io_utils::write_vec_to_file;
use crate::r1cs2plonk::PlonkAdd;
use algebraic::reader::load_r1cs;
use plonky::field_gl::GL;
use std::fs::File;
use std::io::Write;

pub type Result<T> = std::result::Result<T, EigenError>;

Expand All @@ -32,35 +28,3 @@ pub fn setup(r1cs_file: &str, const_file: &str, force_n_bits: usize) -> Result<P

Ok(res)
}

// construct and save ExecFile: plonk additions + sMap -> BigUint64Array
#[deprecated]
pub(super) fn write_exec_file(exec_file: &str, adds: &Vec<PlonkAdd>, s_map: &Vec<Vec<u64>>) {
let adds_len = adds.len();
let s_map_row_len = s_map.len();
let s_map_column_len = s_map[0].len();

assert_eq!(s_map_row_len, 12, "s_map should have 12 rows");
let size = 2 + adds_len * 4 + s_map_row_len * s_map_column_len;

let mut buff = vec![0; size];

buff[0] = adds_len as u64;
buff[1] = s_map_column_len as u64;

for i in 0..adds_len {
buff[2 + i * 4] = adds[i].0 as u64;
buff[2 + i * 4 + 1] = adds[i].1 as u64;
buff[2 + i * 4 + 2] = adds[i].2.into();
buff[2 + i * 4 + 3] = adds[i].3.into();
}

// TODO: Should this be a fixed constant or use the s_map_row_len.
for c in 0..12 {
for i in 0..s_map_column_len {
buff[2 + adds_len * 4 + 12 * i + c] = s_map[c][i];
}
}

write_vec_to_file(exec_file, &buff).unwrap();
}
6 changes: 0 additions & 6 deletions starky/src/compressor12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@ pub fn compress12(
commit_file: &str,
pil_json_file: &str,
) -> Result<()> {
// setup phase:
// input: .r1cs
// output: .pil, .const, .exec,
let plonk_setup = setup(r1cs_file, const_file, force_n_bits)?;

// exec phase:
// input files: .wasm, .exec, .pil, zkin.json(input file),
// output: .cm, .pil.json
exec(
plonk_setup,
input_file,
Expand Down
19 changes: 0 additions & 19 deletions test/recursive_proof_to_snark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,6 @@ mkdir -p $RUNDIR/circuits && node $RUNDIR/$PILEXECJS -w $RUNDIR/circuits -i $TAS

../target/release/eigen-zkit compile -p goldilocks -i $WORKSPACE/circuits/$C12_VERIFIER.circom -l $RUNDIR/node_modules/pil-stark/circuits.gl --O2=full -o $WORKSPACE/$TASK_NO

## generate the pil files and const constant polynomial files
## input files : $C12_VERIFIER.r1cs
## output files : $C12_VERIFIER.exec, $C12_VERIFIER.const $C12_VERIFIER.pil
#../target/release/eigen-zkit compressor12_setup \
# --r $WORKSPACE/$C12_VERIFIER.r1cs \
# --c $WORKSPACE/$C12_VERIFIER.const \
# --p $WORKSPACE/$C12_VERIFIER.pil \
# --e $WORKSPACE/$C12_VERIFIER.exec
#
## generate the commit polynomials files
## input files : $CIRCUIT.c12.wasm $C12_VERIFIER.zkin.json $C12_VERIFIER.pil $C12_VERIFIER.exec
## output files : $C12_VERIFIER.cm
#../target/release/eigen-zkit compressor12_exec \
# --w $WORKSPACE/$C12_VERIFIER"_js"/$CIRCUIT.c12.wasm \
# --i $WORKSPACE/circuits/$C12_VERIFIER.zkin.json \
# --p $WORKSPACE/$C12_VERIFIER.pil \
# --e $WORKSPACE/$C12_VERIFIER.exec \
# --m $WORKSPACE/$C12_VERIFIER.cm

../target/release/eigen-zkit compressor12 \
--r $WORKSPACE/$C12_VERIFIER.r1cs \
--w $WORKSPACE/$C12_VERIFIER"_js"/$CIRCUIT.c12.wasm \
Expand Down
14 changes: 0 additions & 14 deletions test/simple_bls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ npm run $CIRCUIT

../target/release/eigen-zkit compile -p goldilocks -i circuits/$CIRCUIT.verifier.circom -l node_modules/pil-stark/circuits.gl --O2=full -o /tmp/

# Circom to Stark
#../target/release/eigen-zkit compressor12_setup \
# --r /tmp/$CIRCUIT.verifier.r1cs \
# --c /tmp/c12.const \
# --p /tmp/c12.pil \
# --e /tmp/c12.exec
#
#../target/release/eigen-zkit compressor12_exec \
# --w /tmp/$CIRCUIT.verifier_js/$CIRCUIT.verifier.wasm \
# --i circuits/$CIRCUIT.verifier.zkin.json \
# --p /tmp/c12.pil \
# --e /tmp/c12.exec \
# --m /tmp/c12.cm

../target/release/eigen-zkit compressor12 \
--r /tmp/$CIRCUIT.verifier.r1cs \
--w /tmp/$CIRCUIT.verifier_js/$CIRCUIT.verifier.wasm \
Expand Down
41 changes: 0 additions & 41 deletions test/stark_aggregation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,6 @@ fi
echo "2. combine input1.zkin.json with input2.zkin.json "
${ZKIT} join_zkin --zkin1 $input0/input.zkin.json --zkin2 $input1/input.zkin.json --zkinout $input0/r1_input.zkin.json


#echo "3. generate the pil files and const polynomicals files "
## generate the pil files and const polynomicals files
## input files : $C12_VERIFIER.r1cs
## output files : $C12_VERIFIER.const $C12_VERIFIER.pil $C12_VERIFIER.exec
#if [ $first_run = "yes" ]; then
# ${ZKIT} compressor12_setup \
# --r $WORKSPACE/$RECURSIVE_CIRCUIT.r1cs \
# --c $WORKSPACE/$RECURSIVE_CIRCUIT.const \
# --p $WORKSPACE/$RECURSIVE_CIRCUIT.pil \
# --e $WORKSPACE/$RECURSIVE_CIRCUIT.exec
#fi
#
#echo "4. generate the commit polynomicals files "
## generate the commit polynomicals files
## input files : $CIRCUIT.c12.wasm $C12_VERIFIER.zkin.json $C12_VERIFIER.pil $C12_VERIFIER.exec
## output files : $C12_VERIFIER.cm
#${ZKIT} compressor12_exec \
# --w $WORKSPACE/$RECURSIVE_CIRCUIT"_js"/$RECURSIVE_CIRCUIT.wasm \
# --i $input0/r1_input.zkin.json \
# --p $WORKSPACE/$RECURSIVE_CIRCUIT.pil \
# --e $WORKSPACE/$RECURSIVE_CIRCUIT.exec \
# --m $WORKSPACE/$RECURSIVE_CIRCUIT.cm

echo "3.compressor12. generate commit/const poly and pil.json "
../target/release/eigen-zkit compressor12 \
--r $WORKSPACE/$RECURSIVE_CIRCUIT.r1cs \
Expand Down Expand Up @@ -115,23 +91,6 @@ else
echo "1.no need compile circom : "$WORKSPACE/$RECURSIVE2_CIRCUIT.r1cs" already generated"
fi


#echo "2. generate the pil files and const polynomicals files "
#if [ $first_run = "yes" ]; then
# ${ZKIT} compressor12_setup \
# --r $WORKSPACE/$RECURSIVE2_CIRCUIT.r1cs \
# --c $WORKSPACE/$RECURSIVE2_CIRCUIT.const \
# --p $WORKSPACE/$RECURSIVE2_CIRCUIT.pil \
# --e $WORKSPACE/$RECURSIVE2_CIRCUIT.exec
#fi
#
#echo "3. generate the commit polynomicals files "
#${ZKIT} compressor12_exec \
# --w $WORKSPACE/$RECURSIVE2_CIRCUIT"_js"/$RECURSIVE2_CIRCUIT.wasm \
# --i $WORKSPACE/aggregation/$RECURSIVE2_CIRCUIT/r2_input.zkin.json \
# --p $WORKSPACE/$RECURSIVE2_CIRCUIT.pil \
# --e $WORKSPACE/$RECURSIVE2_CIRCUIT.exec \
# --m $WORKSPACE/$RECURSIVE2_CIRCUIT.cm
echo "2.compressor12. generate commit/const poly and pil.json "
../target/release/eigen-zkit compressor12 \
--r $WORKSPACE/$RECURSIVE2_CIRCUIT.r1cs \
Expand Down

0 comments on commit f9368dc

Please sign in to comment.