Skip to content

Commit

Permalink
fix: fixed a bug where the constant for linear terms was ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
0xThemis authored and rw0x0 committed Nov 29, 2024
1 parent d44af1c commit 23883ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion co-noir/co-acvm/src/mpc/rep3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ impl<F: PrimeField, N: Rep3Network> NoirWitnessExtensionProtocol<F> for Rep3Acvm
}
(Rep3AcvmType::Public(public), Rep3AcvmType::Shared(shared))
| (Rep3AcvmType::Shared(shared), Rep3AcvmType::Public(public)) => {
Rep3AcvmType::Shared(arithmetic::mul_public(shared, public))
let mul = arithmetic::mul_public(shared, public);
Rep3AcvmType::Shared(arithmetic::mul_public(mul, c))
}
(Rep3AcvmType::Shared(lhs), Rep3AcvmType::Shared(rhs)) => {
let shared_mul = arithmetic::mul(lhs, rhs, &mut self.io_context)?;
Expand Down
16 changes: 16 additions & 0 deletions co-noir/co-noir/examples/run_full_quantized.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# split input into shares
cargo run --release --bin co-noir -- split-input --circuit test_vectors/quantized/quantized.json --input test_vectors/quantized/Prover.toml --protocol REP3 --out-dir test_vectors/quantized
# run witness extension in MPC
cargo run --release --bin co-noir -- generate-witness --input test_vectors/quantized/Prover.toml.0.shared --circuit test_vectors/quantized/quantized.json --protocol REP3 --config configs/party1.toml --out test_vectors/quantized/quantized.gz.0.shared &
cargo run --release --bin co-noir -- generate-witness --input test_vectors/quantized/Prover.toml.1.shared --circuit test_vectors/quantized/quantized.json --protocol REP3 --config configs/party2.toml --out test_vectors/quantized/quantized.gz.1.shared &
cargo run --release --bin co-noir -- generate-witness --input test_vectors/quantized/Prover.toml.2.shared --circuit test_vectors/quantized/quantized.json --protocol REP3 --config configs/party3.toml --out test_vectors/quantized/quantized.gz.2.shared
wait $(jobs -p)
# run proving in MPC
cargo run --release --bin co-noir -- build-and-generate-proof --witness test_vectors/quantized/quantized.gz.0.shared --circuit test_vectors/quantized/quantized.json --crs test_vectors/bn254_g1.dat --protocol REP3 --hasher KECCAK --config configs/party1.toml --out proof.0.proof --public-input public_input.json &
cargo run --release --bin co-noir -- build-and-generate-proof --witness test_vectors/quantized/quantized.gz.1.shared --circuit test_vectors/quantized/quantized.json --crs test_vectors/bn254_g1.dat --protocol REP3 --hasher KECCAK --config configs/party2.toml --out proof.1.proof &
cargo run --release --bin co-noir -- build-and-generate-proof --witness test_vectors/quantized/quantized.gz.2.shared --circuit test_vectors/quantized/quantized.json --crs test_vectors/bn254_g1.dat --protocol REP3 --hasher KECCAK --config configs/party3.toml --out proof.2.proof
wait $(jobs -p)
# Create verification key
cargo run --release --bin co-noir -- create-vk --circuit test_vectors/quantized/quantized.json --crs test_vectors/bn254_g1.dat --hasher KECCAK --vk test_vectors/quantized/verification_key
# verify proof
cargo run --release --bin co-noir -- verify --proof proof.0.proof --vk test_vectors/quantized/verification_key --hasher KECCAK --crs test_vectors/bn254_g2.dat

0 comments on commit 23883ff

Please sign in to comment.