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

Mega PR: First iteration of prover and verifier #13

Merged
merged 198 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 196 commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
a906bcb
add test for setup
luckyyang Nov 6, 2024
95dbc3f
add norm check
luckyyang Nov 6, 2024
5728ba1
calculate b^k
luckyyang Nov 6, 2024
8df18d1
generate b_l
luckyyang Nov 6, 2024
c30449b
update
luckyyang Nov 6, 2024
c9ed216
update
luckyyang Nov 6, 2024
cff925d
update
luckyyang Nov 7, 2024
8cdbf6b
refactor
luckyyang Nov 7, 2024
99b5d54
check matrix length
luckyyang Nov 7, 2024
5715029
update
luckyyang Nov 7, 2024
51add8d
add number to basis function
luckyyang Nov 7, 2024
06d3d5f
put least number to index 0
luckyyang Nov 7, 2024
63eadb8
convert basis for polynomial ring
luckyyang Nov 7, 2024
309a230
get t_i basis form
luckyyang Nov 7, 2024
de16827
refactor
luckyyang Nov 7, 2024
145efcb
do the basis sum for single row of t_i
luckyyang Nov 7, 2024
586ed1e
do the basis sum for all t_i
luckyyang Nov 7, 2024
b4df599
fix b constraint calculation
luckyyang Nov 7, 2024
6186a86
inner product for vector of ring polynomial
luckyyang Nov 8, 2024
f7edf2a
refactor with inner product method
luckyyang Nov 8, 2024
f47c573
fix: g should be a matrix of Rq (polynomial ring)
luckyyang Nov 8, 2024
43793f6
put t_i into a matrix
luckyyang Nov 8, 2024
2758a5f
add g_i_j matrix calculation
luckyyang Nov 8, 2024
0c2e113
fix t_i basis calculation
luckyyang Nov 8, 2024
b5e360d
polynomial add
luckyyang Nov 8, 2024
4b8ab51
refactor
luckyyang Nov 8, 2024
77272bd
fix index
luckyyang Nov 8, 2024
9e110b2
fix the calculation for g matrix
luckyyang Nov 8, 2024
c5f1696
calculate u1
luckyyang Nov 8, 2024
68364ec
text: update comments
luckyyang Nov 9, 2024
5422205
refactor: format code, delete unused code
luckyyang Nov 9, 2024
4122ae1
chore: add crate for profiler and fmt
SuccinctPaul Nov 11, 2024
dc7a9f4
text: add comment
luckyyang Nov 20, 2024
a2f9f17
text: delete unused comment
luckyyang Nov 20, 2024
aaaf8d1
text: update comment
luckyyang Nov 20, 2024
fbfd57a
text: update comments
luckyyang Nov 20, 2024
075553b
text: add comment
luckyyang Nov 21, 2024
1409332
text: add comment
luckyyang Nov 22, 2024
4065b9f
feat: add lambda constant
luckyyang Nov 22, 2024
01cf5ca
feat: add q
luckyyang Nov 23, 2024
989363b
feat: add gaussian distribution
luckyyang Dec 2, 2024
057bc08
refactor: rename
luckyyang Dec 2, 2024
fbfdcf1
feat: JL projection and do inner product with witness
luckyyang Dec 2, 2024
4a6aed4
fix JL projection inner product, p should be length of 256
luckyyang Dec 2, 2024
7812811
feat: generate random psi_k and omega_k for aggregation constant term…
luckyyang Dec 4, 2024
1128c50
feat: aggregation stage: aggregate quadratic coefficients for constan…
luckyyang Dec 10, 2024
dcc25c2
fix constraint data structure
luckyyang Dec 10, 2024
eaf27be
refactor
luckyyang Dec 10, 2024
c53d851
feat: add polynomial addition and multiplication with overload
luckyyang Dec 10, 2024
f168c60
fix test
luckyyang Dec 10, 2024
c82bf95
refactor: rename variables to improve the readibility
luckyyang Dec 10, 2024
58fc982
refactor: use smaller value for random to test to avoid adding overflow
luckyyang Dec 10, 2024
4604ffd
refactor: rename variables
luckyyang Dec 10, 2024
f7e1891
fix aggregation data structure
luckyyang Dec 10, 2024
51bd726
refactor: rename variable
luckyyang Dec 10, 2024
9e6c2dc
feat: aggregation of linear terms for constant term constraint, part 1
luckyyang Dec 10, 2024
13700de
feat: use modular q for sample value of Gaussian distribution
luckyyang Dec 10, 2024
971853c
feat: aggregation of linear terms for constant term constraint from G…
luckyyang Dec 10, 2024
abcc857
fix data structure for Gaussian distribution, should be done r times …
luckyyang Dec 10, 2024
c984430
feat: aggregate constant term constraints for linear terms
luckyyang Dec 10, 2024
cbc9117
fix phi constraint data structure
luckyyang Dec 10, 2024
04cd480
feat: aggregate to get b for constant term constraints
luckyyang Dec 10, 2024
5b0d4e6
feat: implement Zq
luckyyang Dec 11, 2024
8b82cae
feat: change all usize to Zq
luckyyang Dec 11, 2024
f8f3d8f
feat: calculate and check constant terms for aggregated constraints
luckyyang Dec 11, 2024
f35a983
feat: add degree bound for polynomial ring
luckyyang Dec 11, 2024
f6947ea
feat: add conjugation automorphism
luckyyang Dec 11, 2024
001f4d1
refactor: rename variables and methods
luckyyang Dec 11, 2024
c47238b
feat: add check for the result of JL projection
luckyyang Dec 11, 2024
4746e73
refactor: rename
luckyyang Dec 11, 2024
b1e4465
refactor: generate test polynomial with separate method
luckyyang Dec 11, 2024
d715c34
fix norm calculation
luckyyang Dec 11, 2024
877fe42
fix variable
luckyyang Dec 11, 2024
77ec221
fix add assign, should do modular
luckyyang Dec 12, 2024
89a13e0
refactor: improve code readability
luckyyang Dec 12, 2024
980fe13
refactor: replace for loop with map
luckyyang Dec 12, 2024
7a62525
feat: aggregation: split row p_j from gaussian_distribution_matrices …
luckyyang Dec 12, 2024
e0525cf
fix linear constraint aggregation, finish constant term constraint ag…
luckyyang Dec 12, 2024
d32d656
refactor: rename
luckyyang Dec 12, 2024
c072d25
refactor: do not need to clone
luckyyang Dec 12, 2024
7f2645c
refactor: replace for loop with map
luckyyang Dec 12, 2024
171a17b
feat: calculate b constraint
luckyyang Dec 12, 2024
e6c8a45
feat: aggregate quadratic terms
luckyyang Dec 12, 2024
6d0265b
feat: compute garbage polynomial h
luckyyang Dec 12, 2024
220d7f5
feat: decompose garbage polynomial h to t1 parts with basis
luckyyang Dec 12, 2024
79dc0d2
refactor: put decompose code into a function
luckyyang Dec 12, 2024
9b3440a
test: add test for decompose function
luckyyang Dec 12, 2024
8f1bb4e
refactor: rename
luckyyang Dec 12, 2024
e6b59db
refactor: use decompose function
luckyyang Dec 13, 2024
6dc16eb
refactor: rename
luckyyang Dec 13, 2024
ac492a4
refactor: generate matrix first then do calculation
luckyyang Dec 13, 2024
cc161d5
feat: calculate u2
luckyyang Dec 13, 2024
5168ab4
refactor: use + and * directly for polynomial calculation
luckyyang Dec 13, 2024
5449380
refactor: move code around
luckyyang Dec 13, 2024
897c466
refactor: move matrices generation to setup stage
luckyyang Dec 13, 2024
4e97ac0
feat: amortization to reduce the proof size
luckyyang Dec 13, 2024
2eb73a3
text: placeholder for trranscript
luckyyang Dec 13, 2024
317493a
fix: handle constant term
luckyyang Dec 13, 2024
177ec24
text: add todo
luckyyang Dec 13, 2024
9f80765
text: add comment
luckyyang Dec 13, 2024
29b7030
refactor: move A, B, C, D matrices generation to setup
luckyyang Dec 13, 2024
636d639
refactor: move relevant code to setup and algebra module
luckyyang Dec 13, 2024
86c96ff
refactor: move code from test to prove
luckyyang Dec 13, 2024
32b688a
refactor: use same logic to calculate garbage polynomial g and h
luckyyang Dec 16, 2024
86cf485
refactor: move code around
luckyyang Dec 16, 2024
0e987fc
refactor: rename variables
luckyyang Dec 16, 2024
d24b454
Merge branch 'main' into prover
luckyyang Dec 16, 2024
773f84f
fix merge errors
luckyyang Dec 16, 2024
4419a07
refactor: rename variables
luckyyang Dec 18, 2024
96421f4
feat: verify g and h are symmetric
luckyyang Dec 18, 2024
b3aa763
fix norm calculation
luckyyang Dec 18, 2024
f795a77
feat: add norm calculation for data structures with more dimension
luckyyang Dec 18, 2024
9aa0ab8
feat: larger beta
luckyyang Dec 18, 2024
a81d89e
refactor decomposition
luckyyang Dec 18, 2024
b3251f9
feat: update bata for prover to pass the test
luckyyang Dec 18, 2024
b10530f
feat: verifier to verify aggregated norm from z, t, g, h
luckyyang Dec 18, 2024
19a0b93
test: use 2 as random number to facilitate test
luckyyang Dec 19, 2024
48df596
fix matrix of polynomial times vector of polynomial
luckyyang Dec 19, 2024
163ff72
feat: add operations for vector of polynomial
luckyyang Dec 19, 2024
c5c8a8c
fix amortization calculation, c should be vector of polynomial
luckyyang Dec 19, 2024
22125af
feat: verifier to verify az = ct
luckyyang Dec 19, 2024
41770ce
test: add test for inner product between polynomial vector
luckyyang Dec 19, 2024
15a832f
test: check g value from j = 0
luckyyang Dec 19, 2024
0dfa6c1
refactor: add inner product between matrix of polynomial and vector o…
luckyyang Dec 19, 2024
7223d01
test: add test for inner product
luckyyang Dec 19, 2024
261f083
refactor: add length check for inner product
luckyyang Dec 19, 2024
87a14c7
fix parameter order issue
luckyyang Dec 19, 2024
70d94fc
feat: verifier to check: <z, z> ?= sum(g_ij * c_i * c_j), refer to pa…
luckyyang Dec 19, 2024
b65516c
refactor: rename
luckyyang Dec 19, 2024
badb5d9
refactor: extract aggregation code into functions
luckyyang Dec 19, 2024
2dd192d
refactor: use zero polynomial to simplify code
luckyyang Dec 20, 2024
9f2690b
refactor: rename function names
luckyyang Dec 20, 2024
cf8bff4
fix: Division should be divisible by other
luckyyang Dec 21, 2024
417b37b
refactor: remove unused code
luckyyang Dec 21, 2024
bb2ce46
feat: add functions to calculate aggregation for quadratic and consta…
luckyyang Dec 21, 2024
d0f241c
refactor: rename function, sort out code
luckyyang Dec 21, 2024
04336c4
refactor: update random number range
luckyyang Dec 21, 2024
60cd15f
fix: workaround for calculation h element that can not divide by 2
luckyyang Dec 21, 2024
0754be9
text: add comment
luckyyang Dec 21, 2024
1e9a669
feat: verifier to verify aggregated linear constraints
luckyyang Dec 21, 2024
a41db16
refactor: rename
luckyyang Dec 21, 2024
44bc68b
test: add test to check aggregation relation
luckyyang Dec 21, 2024
3667340
refactor polynomial
luckyyang Dec 21, 2024
d97523a
refactor: move algebra test to algebra module
luckyyang Dec 21, 2024
d443ff8
test: update test for polynomial multiplication overflow
luckyyang Dec 21, 2024
060c0e7
refactor: sort out code, add proper logs
luckyyang Dec 21, 2024
62e4dac
feat: verifier to check aggregation relation
luckyyang Dec 21, 2024
e3af99c
fix: workaround to make verifier pass the aggregation relation check
luckyyang Dec 21, 2024
3c5734c
test: update test
luckyyang Dec 22, 2024
484a467
refactor: rename
luckyyang Dec 22, 2024
498c648
test: add test for aggregation relation check
luckyyang Dec 22, 2024
0c715a1
refactor: change parameters
luckyyang Dec 22, 2024
a16ffc4
Update labrador/src/algebra.rs
luckyyang Dec 23, 2024
e9d1715
Update labrador/src/algebra.rs
luckyyang Dec 23, 2024
ecc081d
Update labrador/src/algebra.rs
luckyyang Dec 23, 2024
17375e4
Update algebra.rs
luckyyang Dec 23, 2024
0ceeafb
text: add todo
luckyyang Dec 23, 2024
f31feef
refactor
luckyyang Dec 23, 2024
567d428
refactor: update comments
luckyyang Dec 23, 2024
9828500
refactor: put outer commitment u2 calculation into a function
luckyyang Dec 23, 2024
d80e869
refactor: put outer commitment u1 calculation into a function
luckyyang Dec 23, 2024
0eaf3f5
text: update comment
luckyyang Dec 23, 2024
f3407d5
feat: verifier check outer commitment u1 and u2
luckyyang Dec 23, 2024
0ac1b31
Merge commit 'fc233a0fe0bceaacf581da9db4e9a2ae17aa49ae' into verifier
luckyyang Dec 23, 2024
e0d22be
fix build error
luckyyang Dec 23, 2024
c277624
test: rename function
luckyyang Dec 23, 2024
523a62a
feat: fmt and add githook tool
SuccinctPaul Dec 23, 2024
8ab2248
Merge branch 'main' into prover
SuccinctPaul Dec 23, 2024
a486995
test: add test for polynomial divisioin
luckyyang Dec 23, 2024
d821c45
text: update comment
luckyyang Dec 23, 2024
3f6133b
refactor: use inner product function to calculate
luckyyang Dec 23, 2024
a86e5ae
fix aggregation relation check. the trick is do not divide by 2 to ca…
luckyyang Dec 23, 2024
1f8c15a
test: fix test error
luckyyang Dec 23, 2024
4dd068f
format: cargo fmt
luckyyang Dec 24, 2024
b41ec44
text: update comment
luckyyang Dec 24, 2024
1ca51e6
refactor: no division for ring
luckyyang Dec 24, 2024
4772594
text: add comment
luckyyang Dec 24, 2024
e4a4361
Merge branch 'main' into verifier
SuccinctPaul Dec 25, 2024
a568ff3
Merge branch 'main' into prover
SuccinctPaul Dec 25, 2024
eb5b532
refactor: wip fix clippy
Junochiu Dec 25, 2024
9c608b4
refactor: wip fix clippy
Junochiu Dec 25, 2024
d6022d8
refactor: wip fix clippy
Junochiu Dec 25, 2024
8921e45
Merge pull request #21 from lattice-complete/fix_clippy
luckyyang Dec 25, 2024
057bd03
nostory: fix conflict
Junochiu Dec 25, 2024
76b0af5
refactor: wip, create algebra crate, separating files
Junochiu Dec 25, 2024
43ad816
refactor: cargo test passed
Junochiu Dec 25, 2024
092837f
wip: fix clippy
Junochiu Dec 25, 2024
b061cfe
wip: fix clippy
Junochiu Dec 25, 2024
ca0dc97
nostory: update structure naming
Junochiu Dec 25, 2024
d1adb02
refactor: fix all clippy errors
Junochiu Dec 26, 2024
d103d07
refactor: struct renaming
Junochiu Dec 26, 2024
51291c1
chore: trigger testing ci for all branches
Junochiu Dec 26, 2024
ce8d785
fix: remove redundant truncate in polynomial reduction
pinhaocrypto Dec 26, 2024
e203997
Merge pull request #16 from lattice-complete/verifier
Junochiu Dec 28, 2024
36466a1
Merge pull request #23 from lattice-complete/verifier_refactor
Junochiu Dec 28, 2024
3e1ff26
Merge pull request #24 from lattice-complete/verifier
Junochiu Dec 28, 2024
e49a161
Update algebra/src/zq.rs
Junochiu Jan 1, 2025
b77aa05
Update algebra/src/zq.rs
Junochiu Jan 1, 2025
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
6 changes: 2 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]


env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -41,7 +39,7 @@ jobs:
toolchain: $(cat rust-toolchain)
components: rustfmt, clippy

- name: Run clippy
- name: Run clippy
run: cargo clippy --all-features --all-targets -- -D warnings

cargo-fmt:
Expand All @@ -56,5 +54,5 @@ jobs:
toolchain: $(cat rust-toolchain)
components: rustfmt, clippy

- name: Run rustfmt
- name: Run rustfmt
run: cargo fmt --all --check
17 changes: 17 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,21 @@
[workspace]
resolver = "2"
members = [
"labrador",
"algebra"
]

[workspace.package]
version = "0.1.0"
edition = "2021"

[workspace.dependencies]
rand = "0.8"
rayon = "1.10.0"

# profiler deps
ark-std = { version = "0.4.0" }
profiler_macro = { git ="https://github.com/SuccinctPaul/profiler-rs.git", tag = "v0.1.0" }

[workspace.features]
profiler = ["ark-std/print-trace"]
12 changes: 12 additions & 0 deletions algebra/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "algebra"
version = { workspace = true }
edition = { workspace = true }

# Optional: Add a description, authors, license, etc.
description = ""
authors = [""]
license = "MIT OR Apache-2.0"

[dependencies]
rand = { workspace = true }
9 changes: 9 additions & 0 deletions algebra/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pub mod polynomial_ring;
pub mod rq_matrix;
pub mod utils;
pub mod zq;

pub use polynomial_ring::PolynomialRing;
pub use rq_matrix::RqMatrix;
pub use utils::*;
pub use zq::Zq;
Loading
Loading