Skip to content

Commit

Permalink
fix: simplify kzg-commit (#780)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-camuto authored Apr 24, 2024
1 parent ae03b65 commit 924f7c0
Show file tree
Hide file tree
Showing 13 changed files with 2 additions and 21 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,6 @@ jobs:
with:
crate: cargo-nextest
locked: true
- name: Download MNIST
run: sh data.sh
- name: Examples
run: cargo nextest run --release tests_examples

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
target
pkg
data
*.csv
!examples/notebooks/eth_price.csv
*.ipynb_checkpoints
Expand Down
11 changes: 0 additions & 11 deletions data.sh

This file was deleted.

1 change: 1 addition & 0 deletions examples/conv2d_mnist/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ pub fn runconv() {
tst_lbl: _,
..
} = MnistBuilder::new()
.base_path("examples/data")
.label_format_digit()
.training_set_length(50_000)
.validation_set_length(10_000)
Expand Down
Binary file added examples/data/t10k-images-idx3-ubyte
Binary file not shown.
Binary file added examples/data/t10k-labels-idx1-ubyte
Binary file not shown.
Binary file added examples/data/train-images-idx3-ubyte
Binary file not shown.
Binary file added examples/data/train-labels-idx1-ubyte
Binary file not shown.
3 changes: 1 addition & 2 deletions src/circuit/modules/polycommit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ impl PolyCommitChip {
/// Commit to the message using the KZG commitment scheme
pub fn commit<Scheme: CommitmentScheme<Scalar = Fp, Curve = G1Affine>>(
message: Vec<Scheme::Scalar>,
degree: u32,
num_unusable_rows: u32,
params: &Scheme::ParamsProver,
) -> Vec<G1Affine> {
let k = params.k();
let domain = halo2_proofs::poly::EvaluationDomain::new(degree, k);
let domain = halo2_proofs::poly::EvaluationDomain::new(2, k);
let n = 2_u64.pow(k) - num_unusable_rows as u64;
let num_poly = (message.len() / n as usize) + 1;
let mut poly = vec![domain.empty_lagrange(); num_poly];
Expand Down
1 change: 0 additions & 1 deletion src/graph/modules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ impl GraphModules {
let commitments = inputs.iter().fold(vec![], |mut acc, x| {
let res = PolyCommitChip::commit::<Scheme>(
x.to_vec(),
vk.cs().degree() as u32,
(vk.cs().blinding_factors() + 1) as u32,
srs,
);
Expand Down
2 changes: 0 additions & 2 deletions src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,6 @@ fn kzg_commit(

let output = PolyCommitChip::commit::<KZGCommitmentScheme<Bn256>>(
message,
vk.cs().degree() as u32,
(vk.cs().blinding_factors() + 1) as u32,
&srs,
);
Expand Down Expand Up @@ -606,7 +605,6 @@ fn ipa_commit(

let output = PolyCommitChip::commit::<IPACommitmentScheme<G1Affine>>(
message,
vk.cs().degree() as u32,
(vk.cs().blinding_factors() + 1) as u32,
&srs,
);
Expand Down
1 change: 0 additions & 1 deletion src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ pub fn kzgCommit(

let output = PolyCommitChip::commit::<KZGCommitmentScheme<Bn256>>(
message,
vk.cs().degree() as u32,
(vk.cs().blinding_factors() + 1) as u32,
&params,
);
Expand Down
1 change: 0 additions & 1 deletion tests/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ mod wasm32 {
serde_json::from_slice(&commitment_ser[..]).unwrap();
let reference_commitment = PolyCommitChip::commit::<KZGCommitmentScheme<Bn256>>(
message,
vk.cs().degree() as u32,
(vk.cs().blinding_factors() + 1) as u32,
&params,
);
Expand Down

0 comments on commit 924f7c0

Please sign in to comment.