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

ZKP tweaks #279

Merged
merged 31 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
69ef1cf
Export type alias for bulletproof backend fields
samtay Jul 3, 2023
bbce98a
Change sudoku to use pub over const
samtay Jul 5, 2023
a83f10e
Docs updates
samtay Jul 5, 2023
b1101f3
Rename / clean up sudoku
samtay Jul 7, 2023
fe6ad34
Export `Proof` type
samtay Jul 7, 2023
00c15ca
Add zkp/serde workspace example
samtay Jul 7, 2023
c72ea21
Drive by cleaning
samtay Jul 10, 2023
13421e5
Exports necessary for gadget impls
samtay Jul 10, 2023
f7c6028
Rename compute_inputs to compute_hidden_inputs
samtay Jul 11, 2023
8efa1ae
Add prove/verify builders
samtay Jul 12, 2023
0e5b36b
Export the builder types
samtay Jul 12, 2023
f425b11
Clippy fix
samtay Jul 13, 2023
bee0e4d
Add helper .compile() & .runtime() methods to fhe prog fns
samtay Jul 14, 2023
f08e0e0
Use new swag to simplify the front-facing api docs example
samtay Jul 14, 2023
b1ba2df
Add some whitespace
samtay Jul 14, 2023
9b67f60
Switch to an extension trait
samtay Jul 15, 2023
cd4df85
Add an extension to ZkpProgramFn
samtay Jul 15, 2023
29ebaa6
Take an owned ZkpBackend, rather than reference
samtay Jul 15, 2023
d5474aa
Update sudoku to use new swag
samtay Jul 15, 2023
5dc513c
Target second attribute in multi attribute error
samtay Jul 15, 2023
2fd8c90
Enforce ordering zkp inputs: constants,public,private
samtay Jul 15, 2023
2d23542
Build whitelist example in CI
samtay Jul 16, 2023
35e0902
Reorder constant->public->private to private->public->constant
samtay Jul 16, 2023
1a0b724
Fix trailing ws
samtay Jul 16, 2023
c151f79
Fix example
samtay Jul 16, 2023
37f7535
Make .runtime() more consistent with .compile()
samtay Jul 17, 2023
874d909
Get rid of some boilerplate impls
samtay Jul 17, 2023
3d8c12b
Add custom zkp type example
samtay Jul 17, 2023
0871969
Merge remote-tracking branch 'origin/main' into samtay/zkp-tweaks
samtay Jul 18, 2023
50eb091
Move example run checks into example tests
samtay Jul 18, 2023
73c5f3b
Change whitelist -> allowlist
samtay Jul 18, 2023
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
24 changes: 4 additions & 20 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,10 @@ jobs:
run: cargo fmt --check
# Build and run the tests
- name: Build and run tests
run: cargo test --verbose --release
# Run our non-interactive examples and assert the complete without error
- name: Verify examples (amm)
samtay marked this conversation as resolved.
Show resolved Hide resolved
run: cargo run --release --bin amm
- name: Verify examples (bigint)
run: cargo run --release --bin bigint
- name: Verify examples (chi_sq)
run: cargo run --release --bin chi_sq
- name: Verify examples (dot_prod)
run: cargo run --release --bin dot_prod
- name: Verify examples (mean_variance)
run: cargo run --release --bin mean_variance
- name: Verify examples (ordering_zkp)
run: cargo run --release --bin ordering_zkp
- name: Verify examples (pir)
run: cargo run --release --bin pir
- name: Verify examples (simple_multiply)
run: cargo run --release --bin simple_multiply
- name: Verify examples (sudoku_zkp)
run: cargo run --release --bin sudoku_zkp
run: cargo test --workspace --verbose --release
- name: Verify examples outside of workspace (allowlist_zkp)
run: cargo test --workspace --verbose
working-directory: ./examples/allowlist_zkp
- name: Build sunscreen and bincode
run: cargo build --release --package sunscreen --package bincode
- name: Build mdBook
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 3 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ members = [
"sunscreen_compiler_common",
"sunscreen_zkp_backend",
]
exclude = [
"mdBook",
"rust-playground"
]
exclude = ["mdBook", "rust-playground", "examples/allowlist_zkp"]

[profile.release]
split-debuginfo="packed"
debug=true
split-debuginfo = "packed"
debug = true
8 changes: 4 additions & 4 deletions benchmarks/bfv_zkp/src/bfv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ pub fn prove_public_encryption(
encryption_data: &(Ciphertext, Noise, Poly),
public_key: &PublicKey,
) -> Proof {
let runtime = Runtime::new_zkp(&BulletproofsBackend::new()).unwrap();
let runtime = Runtime::new_zkp(BulletproofsBackend::new()).unwrap();

let prog = app.get_zkp_program(prove_enc).unwrap();

Expand All @@ -377,7 +377,7 @@ pub fn prove_public_encryption(
let const_args = public_bfv_proof_params(&ciphertext, public_key);

runtime
.prove(prog, const_args, vec![], private_args)
.prove(prog, private_args, vec![], const_args)
.unwrap()
}

Expand All @@ -387,13 +387,13 @@ pub fn verify_public_encryption(
ciphertext: &Ciphertext,
public_key: &PublicKey,
) {
let runtime = Runtime::new_zkp(&BulletproofsBackend::new()).unwrap();
let runtime = Runtime::new_zkp(BulletproofsBackend::new()).unwrap();

let const_args = public_bfv_proof_params(ciphertext, public_key);

let program = app.get_zkp_program(prove_enc).unwrap();

runtime.verify(program, proof, const_args, vec![]).unwrap();
runtime.verify(program, proof, vec![], const_args).unwrap();
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions examples/allowlist_zkp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
Loading