-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: Adapt co-noir binary to handle public noir inputs correctly (#216)
BREAKING CHANGE: co-noir now stores shared inputs in a different format (`BTreeMap<String, Rep3AcvmType<ark_bn254::Fr>>` instead of `BTreeMap<String, Rep3PrimeFieldShare<ark_bn254::Fr>>`)
- Loading branch information
Showing
16 changed files
with
165 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# split input into shares | ||
cargo run --release --bin co-noir -- split-input --circuit test_vectors/add3/add3.json --input test_vectors/add3/Alice.toml --protocol REP3 --out-dir test_vectors/add3 | ||
cargo run --release --bin co-noir -- split-input --circuit test_vectors/add3/add3.json --input test_vectors/add3/Bob.toml --protocol REP3 --out-dir test_vectors/add3 | ||
cargo run --release --bin co-noir -- split-input --circuit test_vectors/add3/add3.json --input test_vectors/add3/Davina.toml --protocol REP3 --out-dir test_vectors/add3 | ||
# merge inputs into single input file | ||
cargo run --release --bin co-noir -- merge-input-shares --inputs test_vectors/add3/Alice.toml.0.shared --inputs test_vectors/add3/Bob.toml.0.shared --inputs test_vectors/add3/Davina.toml.0.shared --protocol REP3 --out test_vectors/add3/Prover.toml.0.shared | ||
cargo run --release --bin co-noir -- merge-input-shares --inputs test_vectors/add3/Alice.toml.2.shared --inputs test_vectors/add3/Bob.toml.2.shared --inputs test_vectors/add3/Davina.toml.2.shared --protocol REP3 --out test_vectors/add3/Prover.toml.2.shared | ||
cargo run --release --bin co-noir -- merge-input-shares --inputs test_vectors/add3/Alice.toml.1.shared --inputs test_vectors/add3/Bob.toml.1.shared --inputs test_vectors/add3/Davina.toml.1.shared --protocol REP3 --out test_vectors/add3/Prover.toml.1.shared | ||
# run witness extension in MPC | ||
cargo run --release --bin co-noir -- generate-witness --input test_vectors/add3/Prover.toml.0.shared --circuit test_vectors/add3/add3.json --protocol REP3 --config configs/party1.toml --out test_vectors/add3/add3.gz.0.shared & | ||
cargo run --release --bin co-noir -- generate-witness --input test_vectors/add3/Prover.toml.1.shared --circuit test_vectors/add3/add3.json --protocol REP3 --config configs/party2.toml --out test_vectors/add3/add3.gz.1.shared & | ||
cargo run --release --bin co-noir -- generate-witness --input test_vectors/add3/Prover.toml.2.shared --circuit test_vectors/add3/add3.json --protocol REP3 --config configs/party3.toml --out test_vectors/add3/add3.gz.2.shared | ||
# run proving in MPC | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.0.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party1.toml --out proof.0.proof --public-input public_input.json & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.1.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party2.toml --out proof.1.proof & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.2.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party3.toml --out proof.2.proof | ||
# Create verification key | ||
cargo run --release --bin co-noir -- create-vk --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --vk test_vectors/add3/verification_key | ||
# verify proof | ||
cargo run --release --bin co-noir -- verify --proof proof.0.proof --vk test_vectors/add3/verification_key --crs test_vectors/bn254_g2.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# split input into shares | ||
cargo run --release --bin co-noir -- split-witness --witness test_vectors/add3/add3.gz --circuit test_vectors/add3/add3.json --protocol REP3 --out-dir test_vectors/add3 | ||
# run proving in MPC | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.0.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party1.toml --out proof.0.proof --public-input public_input.json & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.1.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party2.toml --out proof.1.proof & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.2.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol REP3 --config configs/party3.toml --out proof.2.proof | ||
# Create verification key | ||
cargo run --release --bin co-noir -- create-vk --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --vk test_vectors/add3/verification_key | ||
# verify proof | ||
cargo run --release --bin co-noir -- verify --proof proof.0.proof --vk test_vectors/add3/verification_key --crs test_vectors/bn254_g2.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# split input into shares | ||
cargo run --release --bin co-noir -- split-witness --witness test_vectors/add3/add3.gz --circuit test_vectors/add3/add3.json --protocol SHAMIR --out-dir test_vectors/add3 | ||
# run proving in MPC | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.0.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol SHAMIR --config configs/party1.toml --out proof.0.proof --public-input public_input.json & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.1.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol SHAMIR --config configs/party2.toml --out proof.1.proof & | ||
cargo run --release --bin co-noir -- generate-proof --witness test_vectors/add3/add3.gz.2.shared --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --protocol SHAMIR --config configs/party3.toml --out proof.2.proof | ||
# Create verification key | ||
cargo run --release --bin co-noir -- create-vk --circuit test_vectors/add3/add3.json --crs test_vectors/bn254_g1.dat --vk test_vectors/add3/verification_key | ||
# verify proof | ||
cargo run --release --bin co-noir -- verify --proof proof.0.proof --vk test_vectors/add3/verification_key --crs test_vectors/bn254_g2.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x = "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
y = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
z = "3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[package] | ||
name = "simple_add" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = ">=0.33.0" | ||
|
||
[dependencies] |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"noir_version":"0.33.0+325dac54efb6f99201de9fdeb0a507d45189607d","hash":3433527208697688045,"abi":{"parameters":[{"name":"x","type":{"kind":"field"},"visibility":"private"},{"name":"y","type":{"kind":"field"},"visibility":"public"},{"name":"z","type":{"kind":"field"},"visibility":"public"}],"return_type":{"abi_type":{"kind":"field"},"visibility":"public"},"error_types":{}},"bytecode":"H4sIAAAAAAAA/62RSwqAMAxE+/FASZPYZOdVLNb7H0HRCgXd2QdhIIEHYby7ied492ZqubQkmJlrThUJV0hWVIClzIqKorIlJarKmq1YBkOmirsY7XAz0uUHukLngn9gHOe6fnw66PsJ3S50t+g+OAApYh7N5QEAAA==","debug_symbols":"TclRCoAgDADQu+y7E3SViJimMZAtSoMYu7uCfvj5eApncOU6iKO8sG4KSTxmEm5SW+DDh9ClMBgL+2nzf/ex3So=","file_map":{},"names":["main"]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
fn main(x: Field, y: pub Field, z: pub Field) -> pub Field { | ||
x + y + z | ||
} | ||
|
||
#[test] | ||
fn test_main() { | ||
let addition = main(1, 2, 3); | ||
assert(addition == 6); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.