111 Commits

Author SHA1 Message Date
Sam Tay
cbbe0bafbe Bump all versions to 0.8.0 (#305) 2023-08-22 19:40:54 -04:00
Ryan Orendorff
c0ef426ca0 Export components used in BFV, prove BFV is valid in SDLP (#285) 2023-08-10 12:13:29 -06:00
rickwebiii
480453fe13 Update dependencies (#296)
Update dependencies
2023-08-04 22:44:23 -07:00
rickwebiii
641bf96bd4 Rweber/deps (#295)
Move all deps to [workspace.dependencies]
2023-08-04 17:23:06 -07:00
rickwebiii
7049199a29 Rweber/zq (#293)
Add Barret reduction for Ring type
2023-08-04 14:36:32 -07:00
Sam Tay
badb8f9c8f ZKP tweaks (#279)
* Export type alias for bulletproof backend fields

Also, keep bulletproof stuff namespaced to a `bulletproofs` module.

* Change sudoku to use pub over const

* Docs updates

* Rename / clean up sudoku

* Export `Proof` type

Basically required for being able to deserialize a proof

* Add zkp/serde workspace example

* Drive by cleaning

* Exports necessary for gadget impls

* Rename compute_inputs to compute_hidden_inputs

* Add prove/verify builders

* Export the builder types

This isnt strictly necessary but it would be weird for these to not show up in the cargo docs

* Clippy fix

* Add helper .compile() & .runtime() methods to fhe prog fns

I do wonder if these should be defined in a separate trait, just so that they don't live next to the more internal functions in documentation.

* Use new swag to simplify the front-facing api docs example

* Add some whitespace

* Switch to an extension trait

* Add an extension to ZkpProgramFn

* Take an owned ZkpBackend, rather than reference

Its typical to have the caller handle cloning, rather than taking a reference, requiring Clone impl, and forcing clone. Plus, as of now the only backend is a zero size null struct, so nothing to be gained by using a reference. It also just looks weird to always pass `&BulletproofsBackend::new()`

* Update sudoku to use new swag

* Target second attribute in multi attribute error

* Enforce ordering zkp inputs: constants,public,private

Honestly this feels a little unnatural to me. Might want to reverse: private, public, constant and then change all the prove/verify methods to that ordering

* Build whitelist example in CI

* Reorder constant->public->private to private->public->constant

* Fix trailing ws

* Fix example

* Make .runtime() more consistent with .compile()

* Get rid of some boilerplate impls

* Add custom zkp type example

* Move example run checks into example tests

Should speed up CI a bit

* Change whitelist -> allowlist
2023-07-18 15:15:51 -04:00
Ryan Orendorff
a91c7291fb Add CSV stdout for logproof bench (#274) 2023-07-06 10:36:27 -06:00
Sam Tay
5faf981178 Hackathon; or, various compiler improvements (#272)
* Misc doc fixes

* Fix sunscreen zkp exports

* Fix broken api doc reference

* Add starter zkp example

* Use ZkpRuntime::new in sudoku example

* Use ? over unwrap in zkp examples

* Refactor pattern matching

No functionality changes

* Disallow `mut` args in fhe/zkp programs

* Play around with allowing cipher|plain values

* Allow user-declared plain|cipher values

NOTE: Not fully implemented. Will not work on Rational types until we
factor out literal->plaintext into a proper trait.

This allows, e.g.

```rust
fn simple_sum(a: Cipher<Signed>, b: Cipher<Signed>) -> Cipher<Signed> {
    let mut sum = fhe_var(0);
    sum = sum + a;
    sum = sum + b;
    fhe_out(sum)
}
````

* Refactor array::output()

* More targeted compiler error messages on invalid return values

* Add option for var.into() rather than fhe_out(var)

* Fix incorrect macro invocation

* Add trait for inserting const as plaintext

* Impl all arithmetic operations for indeterminate nodes

* Offer an `fhe_var!` macro

* Offer a zkp_var! macro

* Offer a (safe) debug impl for zkp program nodes

* Fix tests

* Add test for fhe_var!

* Simplify tf out of sudoku

* Simplify fhe input() codegen

* Marginally better compiler error messages on invalid fhe program arg types

* Fix error for fhe program argument attributes

* Throw appropriate compiler error on generics

* Silence clippy warnings in generated code

These I think are typically ignored by default when consuming proc macros but might as well be explicit

* Fixup quote_spanned invocations

Unsure how important this is, but see here: https://docs.rs/quote/latest/quote/macro.quote_spanned.html#syntax

* Automatically call `.into()` on fhe prog return values

* Factor fhe_program_impl

* Further factor fhe_program_impl

So that token generation happens in helper methods, and the ultimate output() func is readable

* Fix doctests

* Fix clippy warnings

* Remove TODOs

* Add missing example runs to CI

* Oops: fix 232 > 64

* Allow arbitrary expressions in fhe_var!

* Use custom "into" to support impls on []

* Support explicit #[private] params

* Remove `backend = "bulletproofs"` attribute

* Address PR reveiw
2023-07-05 17:07:21 -05:00
Sam Tay
036b782a69 Misc typos / Fix lib exports (#265)
* Misc doc fixes

* Fix sunscreen zkp exports

* Fix broken api doc reference
2023-06-27 19:43:20 -06:00
Bryan Li
82d83cf238 Added Sudoku ZKP Example (#253)
* added sudoku zkp example

* edited main

* fixed style

* refactored code

* fixed formatting

* fixed lint
2023-06-13 10:36:38 -07:00
Sam Tay
66211f75b1 Fix 64-bit pointer assumptions (#243)
* Fix 64-bit pointer assumptions

* Appease clippy

* Bump proc-macro2

(Fixes wasm build)
2023-05-30 11:59:20 -07:00
rickwebiii
09ecc0a57d Update syn and a bunch of packages (#242) 2023-05-24 15:28:52 -07:00
rickwebiii
1089e00d1b Separate OpenCL shaders into multiple files (#239)
* Separate OpenCL shaders into multiple files
2023-05-12 17:06:53 -07:00
Sam Tay
60b345cc5e Make gadgets sync (#237)
* Make gadgets send/sync

This lets Application types be send/sync

* Bump curve25519 to appease clippy

* Speed up unsigned tests a tiny bit
2023-05-01 17:45:25 -07:00
Sam Tay
ace6d97140 Add a bfv::Unsigned type (#236)
* Add a bfv::Unsigned type

* Fix decoding from polynomial?

* Add prop test for addition

* Proptest sub, mul, and mixed cipher/plaintexts

* Reduce code dupe

* Add test for 0 - 1

* Add a few more tests
2023-04-24 11:57:33 -07:00
rickwebiii
ee5d6d9cdc Rweber/cuda (#235)
CUDA implementation
2023-04-10 19:54:24 +01:00
rickwebiii
9785670ae0 Cargo update (#233) 2023-03-30 12:59:01 -07:00
rickwebiii
06e9c1cb2b Rweber/opencl (#230)
OpenCL implementation of curve25519 operations
2023-03-22 14:30:45 -07:00
rickwebiii
af4849ddb5 Time shield circuits (#224)
* Time shield/unshield circuits
2023-03-08 19:19:59 -08:00
rickwebiii
d29f18fbee Rweber/zkp (#221)
* Speed up scalar inversion, move linear relation to criterion benchmark
2023-03-08 16:29:26 -08:00
rickwebiii
55dfdda88c Rweber/zkp (#220)
WebGPU implementation WIP
2023-03-05 16:39:31 -08:00
rickwebiii
6f713d6750 Rweber/zkp (#218)
Private tx range proof
2023-03-02 15:16:45 -08:00
rickwebiii
6604afbf95 ZKP array inputs (#217)
* ZKP array inputs
2023-03-01 13:33:14 -08:00
rickwebiii
745b9b6996 Rweber/zkp (#216)
* GPU accelerate Scalar inversion
* CPU-GPU work sharing
2023-02-28 09:16:07 -08:00
rickwebiii
ee830d6d70 Rweber/zkp (#215)
Bring logproofs into monorepo
2023-02-17 14:44:03 -08:00
rickwebiii
48ebc52576 Rweber/zkp (#211)
Metal GPU accelerated scalar multiplication
2023-02-16 14:31:55 -08:00
rickwebiii
a8be112cb8 Randomness range proof in R1CS now correct (#208)
* Randomness range proof now correct
2023-01-25 11:06:13 -08:00
rickwebiii
61032735f8 Rweber/zkp (#205)
Can create pure R1CS BFV proof.
2023-01-20 13:38:04 -08:00
rickwebiii
2f9acb39a7 Upgrade deps (#201) 2023-01-15 14:01:07 -08:00
rickwebiii
38a67b7d97 Can encode negative numbers onto native fields (#198)
* Can encode negative numbers onto native fields
2023-01-05 15:38:18 -08:00
rickwebiii
d03207e67e Rweber/zkp (#196)
Add BFV playground, Polynomial addition
2022-12-19 12:00:23 -08:00
rickwebiii
18fb031953 Rweber/zkp (#195)
Can now use #[constant] and #[public] inputs
2022-12-09 16:21:34 -08:00
rickwebiii
85e3a60e35 Rweber/zkp (#194)
Add to_unsigned gadget and test
2022-12-08 17:57:31 -08:00
rickwebiii
2e5b7e834b Rweber/refactor (#190)
Refactor sunscreen_fhe_program to use types and functions in sunscreen_compiler_common
2022-11-30 18:02:45 -08:00
rickwebiii
72f00391ea Rweber/zkp (#188)
ZKP works E2E
2022-11-29 13:47:29 -08:00
rickwebiii
f79e2312af Rweber/clippy (#189)
Improve Errors (use thiserror and reduce their size). Fix clippy errors.
2022-11-29 13:18:45 -08:00
rickwebiii
d847021858 Rweber/zkp (#186)
Add ZKP backend for Bulletproofs
2022-11-18 20:06:48 -08:00
rickwebiii
28ea71118f Rweber/zkp (#185)
Start ZKP compiler and refactor common code.
2022-11-15 12:43:04 -08:00
rickwebiii
390a27b1cd Refactor some code to be shared (#184)
* Refactor some code to be shared

* Kill warnings

* Regenerate launch.json

* Add documentation

* CR comments

* Fix doc issues

* cargo fmt

* CR comments

* CR comments

* Fix warning

* argh clippy
2022-11-11 15:56:09 -08:00
rickwebiii
0ca0052018 Rweber/release 0.7 (#178)
* 0.7 release

* Fix docs links
2022-10-17 14:56:27 -07:00
rickwebiii
c2b1850fab Rweber/maint (#176)
Fix security vulnerability warning for unmaintained ansi_term.
2022-09-22 11:55:59 -07:00
rickwebiii
989fe1c578 Update mean/variance example to use serialization (#173)
* Update mean/variance example to use serialization

* cargo fmt
2022-09-02 15:38:03 -07:00
rickwebiii
18c9b62b1d Add mean_variance example 2022-08-09 14:38:13 -07:00
rickwebiii
2e70480e63 Add benchmark (#163) 2022-08-04 11:48:02 -07:00
rickwebiii
0b86d5dfad Rweber/model (#161)
Add support for noise models in determining parameter selection
2022-07-22 15:56:39 +01:00
rickwebiii
136d03f081 Rweber/crateupdate (#152)
* Fix broken links

* Bump packages
2022-07-14 11:37:27 -07:00
rickwebiii
37bec208b3 Rweber/crateupdate (#151)
* Update crate info

* Update crates-io.md

* bump

Co-authored-by: ravital <47154865+ravital@users.noreply.github.com>
2022-07-14 11:16:08 -07:00
rickwebiii
123da60636 Rweber/packages (#150)
* No network during build

* Bump packages
2022-07-13 18:47:54 -07:00
rickwebiii
f071cf6248 Bump sunscreen_runtime 2022-06-24 10:35:40 -07:00
rickwebiii
51cfc595aa Update deps 2022-06-24 10:16:32 -07:00