Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified Recursion Circuit for Multi-Degree Starky Proof Verification #1635

Merged
merged 39 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
56bc632
add test
sai-deng Oct 26, 2024
3d7c443
wip
sai-deng Oct 30, 2024
78d3851
update witness util
sai-deng Oct 30, 2024
b4213bb
degree_bits: usize->target
sai-deng Oct 31, 2024
fc46e07
wip
sai-deng Nov 1, 2024
99c3ccb
fix
sai-deng Nov 1, 2024
8561399
opt
sai-deng Nov 1, 2024
8ea1952
passed 3 tests
sai-deng Nov 1, 2024
c231038
fix
sai-deng Nov 1, 2024
cff4da4
convert g to g_ext
sai-deng Nov 1, 2024
13801e4
hack observe final poly coeffs
sai-deng Nov 2, 2024
de75e83
wip
sai-deng Nov 6, 2024
33836d5
poc works
sai-deng Nov 6, 2024
e685b9a
wip
sai-deng Nov 7, 2024
02548a0
pass tests
sai-deng Nov 7, 2024
c9ea54c
more in test
sai-deng Nov 7, 2024
999532c
better test
sai-deng Nov 8, 2024
9667294
fix ci
sai-deng Nov 8, 2024
773b695
clippy
sai-deng Nov 8, 2024
58196b8
fix
sai-deng Nov 8, 2024
dcd973d
fix
sai-deng Nov 8, 2024
b9c3365
start on multi steps
sai-deng Nov 9, 2024
1eb7053
wip
sai-deng Nov 9, 2024
d94800f
set all zeros
sai-deng Nov 9, 2024
104ed57
wip
sai-deng Nov 9, 2024
a6fbf7c
challenge passes
sai-deng Nov 10, 2024
6368726
work
sai-deng Nov 12, 2024
309ecaa
poc done
sai-deng Nov 12, 2024
de1c230
fix non std build
sai-deng Nov 12, 2024
9508927
add comments
sai-deng Nov 12, 2024
bafcf74
update stark verifier
sai-deng Nov 15, 2024
1e3c8b9
fix clippy
sai-deng Nov 15, 2024
f31babe
fix test build
sai-deng Nov 15, 2024
8572c81
fix tests
sai-deng Nov 15, 2024
93ba39c
add comments
sai-deng Nov 15, 2024
853acb4
add checks
sai-deng Nov 15, 2024
281d738
polish the checks
sai-deng Nov 15, 2024
1e32adf
more checks
sai-deng Nov 15, 2024
32314ea
comments
sai-deng Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update witness util
  • Loading branch information
sai-deng committed Oct 30, 2024
commit 78d3851992a52e54c92cbb0a800cf15407a580dd
72 changes: 54 additions & 18 deletions plonky2/src/fri/witness_util.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use anyhow::Result;
use anyhow::{anyhow, Result};
use itertools::Itertools;
use plonky2_field::types::Field;

use crate::field::extension::Extendable;
use crate::fri::proof::{FriProof, FriProofTarget};
use crate::hash::hash_types::RichField;
use crate::hash::hash_types::{HashOut, RichField};
use crate::iop::witness::WitnessWrite;
use crate::plonk::config::AlgebraicHasher;

Expand All @@ -20,13 +21,26 @@ where
{
witness.set_target(fri_proof_target.pow_witness, fri_proof.pow_witness)?;

for (&t, &x) in fri_proof_target
.final_poly
.0
.iter()
.zip_eq(&fri_proof.final_poly.coeffs)
{
witness.set_extension_target(t, x)?;
let target_len = fri_proof_target.final_poly.0.len();
let coeffs_len = fri_proof.final_poly.coeffs.len();

if target_len < coeffs_len {
return Err(anyhow!(
"fri_proof->final_poly's target length is less than the proof length"
));
}

// Set overlapping elements
for i in 0..coeffs_len {
witness.set_extension_target(
fri_proof_target.final_poly.0[i],
fri_proof.final_poly.coeffs[i],
)?;
}

// Set remaining elements in target to ZERO if target is longer
for i in coeffs_len..target_len {
witness.set_extension_target(fri_proof_target.final_poly.0[i], F::Extension::ZERO)?;
}

for (t, x) in fri_proof_target
Expand All @@ -51,22 +65,44 @@ where
for (&t, &x) in at.0.iter().zip_eq(&a.0) {
witness.set_target(t, x)?;
}
for (&t, &x) in at.1.siblings.iter().zip_eq(&a.1.siblings) {
witness.set_hash_target(t, x)?;
let target_len = at.1.siblings.len();
let siblings_len = a.1.siblings.len();

if target_len < siblings_len {
return Err(anyhow!("fri_proof->query_round_proofs->initial_trees_proof->evals_proofs->siblings' target length is less than the proof length"));
}

// Set overlapping elements
for i in 0..siblings_len {
witness.set_hash_target(at.1.siblings[i], a.1.siblings[i])?;
}

// Set remaining elements in target to ZERO if target is longer
for i in siblings_len..target_len {
witness.set_hash_target(at.1.siblings[i], HashOut::ZERO)?;
}
}

for (st, s) in qt.steps.iter().zip_eq(&q.steps) {
for (&t, &x) in st.evals.iter().zip_eq(&s.evals) {
witness.set_extension_target(t, x)?;
}
for (&t, &x) in st
.merkle_proof
.siblings
.iter()
.zip_eq(&s.merkle_proof.siblings)
{
witness.set_hash_target(t, x)?;

let target_len = st.merkle_proof.siblings.len();
let siblings_len = s.merkle_proof.siblings.len();

if target_len < siblings_len {
return Err(anyhow!("fri_proof->query_round_proofs->steps->merkle_proof->siblings' target length is less than the proof length"));
}

// Set overlapping elements
for i in 0..siblings_len {
witness.set_hash_target(st.merkle_proof.siblings[i], s.merkle_proof.siblings[i])?;
}

// Set remaining elements in target to ZERO if target is longer
for i in siblings_len..target_len {
witness.set_hash_target(st.merkle_proof.siblings[i], HashOut::ZERO)?;
}
}
}
Expand Down