108 Commits

Author SHA1 Message Date
Ryan Orendorff
5eba25a961 Fix clippy warnings (#381) 2024-11-20 23:33:25 +00:00
Sam Tay
d2dfd45347 Misc updates from linked-docs (#364) 2024-03-01 01:47:49 +00:00
Sam Tay
20c3b1a09a Add fresh encoding constraints (#356)
Co-authored-by: Ryan Orendorff <12442942+ryanorendorff@users.noreply.github.com>
2024-02-22 21:36:15 -05:00
Sam Tay
cb20e8d030 Decrypt statements (#348) 2024-02-20 22:55:49 +00:00
Sam Tay
14ce61f5bf Diverge link methods (#346) 2024-02-13 16:24:01 +00:00
Sam Tay
ae42ab7199 Disallow repeating linked inputs (#345) 2024-02-11 16:01:58 -05:00
Sam Tay
191536e5e7 Avoid extra CI builds (#340) 2024-02-08 00:22:36 +00:00
Sam Tay
18ea59b542 Proof linking (#339) 2024-02-03 20:01:24 +00:00
Sam Tay
94b7d0bd31 Generating SDLP for BFV statements (#337) 2024-01-17 18:22:47 +00:00
Ryan Orendorff
bc7cfb2ce2 Linked prove and verify functions (#328) 2023-10-25 16:20:20 -06:00
Sam Tay
5b3ee93b3b Fixup api docs a bit (#300)
* Fixup api docs a bit

* FieldSpec should live in types::zkp along with Field
2023-08-17 13:48:00 -04: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
Ryan Orendorff
fc892c1727 Clippy fixes (#286) 2023-07-24 15:30:02 -06: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
rickwebiii
3c50ee477b Rweber/field spec (#283)
Rename NativeField<BackendField> to Field<FieldSpec>
2023-07-17 18:18:50 -07: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
aadde9d162 Offer a simpler API for runtime creation (#246)
* Offer a simpler API for runtime creation

* Update docs and examples to use `FheRuntime::new`
2023-06-06 18:56:46 -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
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
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
3543b88387 Rweber/zkp (#187)
Refactor APIs to support ZKPs
2022-11-22 15:44:00 -08:00
Sam Tay
2db8e90a8d Allow type complexity for macro generated code 2022-10-31 15:30:34 -07:00
Sam Tay
5fcba12967 Simplify example code 2022-10-31 15:30:34 -07:00
Sam Tay
e2e5da3f60 Manually fix the rest of the clippy warnings 2022-10-31 15:30:34 -07:00
Sam Tay
4b53103953 Auto fix clippy warnings 2022-10-31 15:30:34 -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
3d5385fdd9 Cargo fmt 2022-08-09 16:08:57 -07:00
rickwebiii
7d4495859d Remove unwraps 2022-08-09 16:08:28 -07:00
rickwebiii
18c9b62b1d Add mean_variance example 2022-08-09 14:38:13 -07:00
rickwebiii
121e7be325 Rweber/multiprogram (#130)
Allow compiling multiple FHE programs to use the same parameters.
2022-07-06 17:04:43 -07:00
Rick Weber
12d1b9da5e Add assertion to example 2022-04-26 16:13:40 -07:00
Rick Weber
c15a8c2a1f WASM works 2022-04-25 17:48:54 -07:00
Rick Weber
6387e52acd Move SEAL bench to seperate repo 2022-04-25 10:33:16 -07:00
Rick Weber
18131f5646 PIR 2022-04-23 18:21:15 -07:00
Rick Weber
70b843bc1e Rename compiled_query 2022-04-18 11:34:52 -07:00
Rick Weber
813630a28c cargo fmt 2022-04-14 16:05:55 -07:00
Rick Weber
ab71f63403 Fix comments 2022-04-13 10:24:31 -07:00
Rick Weber
0c9e23b573 Add PIR example 2022-04-13 09:59:30 -07:00
Rick Weber
ad930251dc Add array support 2022-04-12 11:09:59 -07:00
Rick Weber
325ea85354 Fix simple_multiply, AMM comments 2022-04-04 15:37:34 -07:00
Rick Weber
945996f4ba FheProgramNode 2022-04-04 13:38:26 -07:00
Rick Weber
26d7d1438d Remove plain modulus from simple_multiply example 2022-04-04 13:14:13 -07:00
Rick Weber
cc13dee263 Use ? 2022-04-01 15:29:46 -07:00
Rick Weber
d7c579e561 Remove unwrap 2022-04-01 15:14:44 -07:00
Rick Weber
40e0a18097 Remove most unwraps 2022-04-01 15:14:44 -07:00
Rick Weber
72f430fdd1 Use ? 2022-03-31 16:43:38 -07:00