Skip to content

Commit

Permalink
temporary commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ShuangWu121 committed Oct 1, 2024
1 parent 4602eaa commit 996dcea
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 3 deletions.
Binary file added output/commits.bin
Binary file not shown.
Binary file added output/constants.bin
Binary file not shown.
11 changes: 11 additions & 0 deletions output/fibonacci_analyzed.pil
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let N: int = 262144;
namespace Fibonacci(262144);
col fixed ISLAST(i) { if i == N - 1 { 1 } else { 0 } };
col witness x;
col witness y;
Fibonacci::ISLAST * (Fibonacci::y' - 1) = 0;
Fibonacci::ISLAST * (Fibonacci::x' - 1) = 0;
(1 - Fibonacci::ISLAST) * (Fibonacci::x' - Fibonacci::y) = 0;
(1 - Fibonacci::ISLAST) * (Fibonacci::y' - (Fibonacci::x + Fibonacci::y)) = 0;
namespace ;
public out = Fibonacci::y(262143);
11 changes: 11 additions & 0 deletions output/fibonacci_opt.pil
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
let N: int = 262144;
namespace Fibonacci(262144);
col fixed ISLAST(i) { if i == N - 1 { 1 } else { 0 } };
col witness x;
col witness y;
Fibonacci::ISLAST * (Fibonacci::y' - 1) = 0;
Fibonacci::ISLAST * (Fibonacci::x' - 1) = 0;
(1 - Fibonacci::ISLAST) * (Fibonacci::x' - Fibonacci::y) = 0;
(1 - Fibonacci::ISLAST) * (Fibonacci::y' - (Fibonacci::x + Fibonacci::y)) = 0;
namespace ;
public out = Fibonacci::y(262143);
Binary file added output/fibonacci_proof.bin
Binary file not shown.
Empty file added output/vkey.bin
Empty file.
Empty file added params.bin
Empty file.
11 changes: 9 additions & 2 deletions plonky3/src/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
use p3_matrix::dense::RowMajorMatrix;

use core::fmt;
use std::iter::{once, repeat};
use std::sync::Arc;
use std::iter::{once, repeat};
use std::time::Instant;

use powdr_ast::analyzed::Analyzed;

Expand Down Expand Up @@ -187,6 +188,7 @@ where

let proving_key = self.proving_key.as_ref();

let start = Instant::now();
let proof = prove_with_key(
&config,
proving_key,
Expand All @@ -196,17 +198,20 @@ where
&circuit,
&stage_0_publics,
);
let duration = start.elapsed();
println!("plonky3 prove duration is {:?}", duration);

let mut challenger = T::get_challenger();

let verifying_key = self.verifying_key.as_ref();

let empty_public = vec![];
let public_values = once(&stage_0_publics)
.chain(repeat(&empty_public))
.take(self.analyzed.stage_count())
.collect();

let verificationstart = Instant::now();
verify_with_key(
&config,
verifying_key,
Expand All @@ -216,6 +221,8 @@ where
public_values,
)
.unwrap();
let verifyduration = verificationstart.elapsed();
println!("plonky3 verification duration is {:?}", verifyduration);
Ok(bincode::serialize(&proof).unwrap())
}

Expand Down
2 changes: 1 addition & 1 deletion test_data/pil/fibonacci.pil
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let N = 32;
let N = 262144;

// This uses the alternative nomenclature as well.

Expand Down

0 comments on commit 996dcea

Please sign in to comment.