Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/0xEigenLabs/eigen-zkit into…
Browse files Browse the repository at this point in the history
… main
  • Loading branch information
eigmax committed Oct 8, 2023
2 parents 2a21b4a + 89bf646 commit 3eba683
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
5 changes: 1 addition & 4 deletions starky/src/serializer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ impl<M: MerkleTree> Serialize for StarkProof<M> {
map.serialize_entry("finalPol", &self.fri_proof.last)?;
map.serialize_entry("publics", &self.publics)?;
if hashtype.as_str() == "BN128" || hashtype.as_str() == "BLS12381" {
map.serialize_entry(
"proverAddr",
"273030697313060285579891744179749754319274977764",
)?;
map.serialize_entry("proverAddr", &self.prover_addr)?;
}
map.end()
}
Expand Down
8 changes: 8 additions & 0 deletions starky/src/stark_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ pub struct StarkProof<M: MerkleTree> {
pub publics: Vec<F3G>,
pub rootC: Option<M::MTNode>,
pub stark_struct: StarkStruct,
pub prover_addr: String,
}

impl<'a, M: MerkleTree> StarkProof<M> {
Expand All @@ -193,6 +194,7 @@ impl<'a, M: MerkleTree> StarkProof<M> {
program: &Program,
_pil: &PIL,
stark_struct: &StarkStruct,
prover_addr: &String,
) -> Result<StarkProof<M>> {
let mut ctx = StarkContext::default();
//log::debug!("starkinfo: {}", starkinfo);
Expand Down Expand Up @@ -545,6 +547,7 @@ impl<'a, M: MerkleTree> StarkProof<M> {
evals: ctx.evals.clone(),
publics: ctx.publics.clone(),
stark_struct: stark_struct.clone(),
prover_addr: prover_addr.clone(),
})
}

Expand Down Expand Up @@ -1074,6 +1077,7 @@ pub mod tests {
&setup.program,
&pil,
&stark_struct,
&"273030697313060285579891744179749754319274977764".to_string(),
)
.unwrap();
log::debug!("verify the proof...");
Expand Down Expand Up @@ -1109,6 +1113,7 @@ pub mod tests {
&setup.program,
&pil,
&stark_struct,
&"273030697313060285579891744179749754319274977764".to_string(),
)
.unwrap();

Expand Down Expand Up @@ -1143,6 +1148,7 @@ pub mod tests {
&setup.program,
&pil,
&stark_struct,
&"273030697313060285579891744179749754319274977764".to_string(),
)
.unwrap();
log::debug!("verify the proof...");
Expand Down Expand Up @@ -1175,6 +1181,7 @@ pub mod tests {
&setup.program,
&pil,
&stark_struct,
&"273030697313060285579891744179749754319274977764".to_string(),
)
.unwrap();
log::debug!("verify the proof...");
Expand Down Expand Up @@ -1207,6 +1214,7 @@ pub mod tests {
&setup.program,
&pil,
&stark_struct,
&"273030697313060285579891744179749754319274977764".to_string(),
)
.unwrap();
log::debug!("verify the proof...");
Expand Down
4 changes: 3 additions & 1 deletion test/stark_aggregation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ echo "5. generate recursive2 proof"
$ZKIT stark_prove -s ../starky/data/r2.starkStruct.json \
-p $WORKSPACE/$RECURSIVE_CIRCUIT.pil.json \
--o $WORKSPACE/$RECURSIVE_CIRCUIT.const \
--m $WORKSPACE/$RECURSIVE_CIRCUIT.cm -c $RUNDIR/circuits/$RECURSIVE2_CIRCUIT.circom --i $WORKSPACE/aggregation/$RECURSIVE2_CIRCUIT/r2_input.zkin.json --norm_stage
--m $WORKSPACE/$RECURSIVE_CIRCUIT.cm -c $RUNDIR/circuits/$RECURSIVE2_CIRCUIT.circom \
--i $WORKSPACE/aggregation/$RECURSIVE2_CIRCUIT/r2_input.zkin.json --norm_stage \
--prover_addr 273030697313060285579891744179749754319274977764

aggregation_end=$(date +%s)

Expand Down
6 changes: 6 additions & 0 deletions zkit/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ struct StarkProveOpt {
circom_file: String,
#[arg(long = "i", default_value = "zkin.json")]
zkin: String,
#[arg(
long = "prover_addr",
default_value = "273030697313060285579891744179749754319274977764"
)]
prover_addr: String,
}

/// Check aggregation proof
Expand Down Expand Up @@ -446,6 +451,7 @@ fn main() {
&args.cm_pols,
&args.circom_file,
&args.zkin,
&args.prover_addr,
)
.map_err(|e| EigenError::from(format!("stark prove error {:?}", e))),

Expand Down
4 changes: 4 additions & 0 deletions zkit/src/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub fn prove(
cm_pol_file: &String,
circom_file: &String,
zkin: &String,
prover_addr: &String,
) -> Result<()> {
let mut pil = load_json::<PIL>(pil_file.as_str()).unwrap();
let mut const_pol = PolsArray::new(&pil, PolKind::Constant);
Expand All @@ -47,6 +48,7 @@ pub fn prove(
&setup.program,
&pil,
&stark_struct,
prover_addr,
)
.unwrap();

Expand Down Expand Up @@ -104,6 +106,7 @@ pub fn prove(
&setup.program,
&pil,
&stark_struct,
prover_addr,
)
.unwrap();
log::debug!("verify the proof...");
Expand Down Expand Up @@ -159,6 +162,7 @@ pub fn prove(
&setup.program,
&pil,
&stark_struct,
prover_addr,
)
.unwrap();
log::debug!("verify the proof...");
Expand Down

0 comments on commit 3eba683

Please sign in to comment.