Commit Graph

50 Commits

Author SHA1 Message Date
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
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
mliu24
4fbac668d0 Update rust.yml (#266)
added test coverage to debugger branch for matthew and bryan
2023-06-26 17:06:25 -07:00
Sam Tay
c2ad1138c2 Fix broken doc links (#252)
* Fix broken doc links

* Fail CI on api doc warnings

* Fix broken api docs
2023-06-12 12:46:08 -07:00
rickwebiii
d847021858 Rweber/zkp (#186)
Add ZKP backend for Bulletproofs
2022-11-18 20:06:48 -08:00
Sam Tay
c525ee6d5d Separate clippy into separate job 2022-10-31 15:30:34 -07:00
Sam Tay
3452643546 Run clippy in CI 2022-10-31 15:30:34 -07:00
rickwebiii
4c8bddbc28 Website (#156)
* website deployment

* site
2022-07-15 12:32:48 -07:00
rickwebiii
3ed8f5b154 Break up caches (#155)
* Break up caches

* Typo
2022-07-15 11:44:40 -07:00
rickwebiii
414bf675dd Playground (#142)
Playground changes
2022-07-06 12:55:32 -07:00
rickwebiii
afc11c0e5d Prod (#141) 2022-07-05 17:22:28 -07:00
rickwebiii
1557bb039a Playground (#140)
Add playground deployment, dockerization and works with Elastic Beanstalk
2022-07-05 17:20:38 -07:00
rickwebiii
7ef8b5aad8 Remove tools from playground 2022-06-24 11:26:07 -07:00
rickwebiii
cdbab1bf89 Update s3 bucket 2022-05-18 17:39:50 -07:00
rickwebiii
e9911e1f9c Add default region 2022-05-18 15:26:44 -07:00
rickwebiii
4151022498 fix 2022-05-18 14:44:17 -07:00
rickwebiii
b2d48fea81 Fix 2022-05-18 14:37:34 -07:00
rickwebiii
905d69bd09 Add docs deployment 2022-05-18 14:36:29 -07:00
rickwebiii
c9966eda35 Playground works 2022-05-18 10:35:57 -07:00
rickwebiii
17ea255f4e Add playground, rename seal->seal_fhe 2022-05-16 16:09:07 -07:00
rickwebiii
4daba168ec Update CI 2022-05-10 22:41:03 -07:00
rickwebiii
38ae171ca3 playground 2022-05-10 22:37:08 -07:00
rickwebiii
b1bfe7fabc key pair 2022-05-10 18:58:25 -07:00
rickwebiii
fe5e328275 WIP 2022-05-10 18:51:47 -07:00
rickwebiii
d00fc7bf02 WIP 2022-05-10 18:41:23 -07:00
rickwebiii
c8c3b8d02f WIP 2022-05-10 18:31:20 -07:00
rickwebiii
403e65f083 Build playground 2022-05-10 16:56:16 -07:00
rickwebiii
5991d40f2a Fix frontend build 2022-05-10 16:50:14 -07:00
rickwebiii
911184382e playground workflow 2022-05-10 16:48:15 -07:00
rickwebiii
50ccf64d7c Cache 2022-05-02 21:48:34 -07:00
rickwebiii
54c79835a8 Update cwd 2022-05-02 21:24:03 -07:00
rickwebiii
aa6dab33e0 Readd API docs check 2022-05-02 19:17:11 -07:00
rickwebiii
9ff458cf00 Remove artifacts 2022-05-02 19:14:40 -07:00
Rick Weber
99283cbc6b Fix 2022-05-02 17:45:36 -07:00
Rick Weber
b189e807e6 Add caching 2022-05-02 17:41:40 -07:00
Rick Weber
6a3cd5a0d5 Add CI workflow to validate user docs examples 2022-05-02 15:54:28 -07:00
Rick Weber
45bd7caf8a Git checkout 2022-05-02 12:16:34 -07:00
Rick Weber
c3e55fc632 Separate api docs tests out 2022-05-02 12:14:32 -07:00
Rick Weber
f92f14b63e Fix badge 2022-04-15 11:20:29 -07:00
rickwebiii
c88d2c58f5 Cargo check 2022-04-14 17:11:11 -07:00
rickwebiii
870659a242 Test docs in CI 2022-04-14 16:59:00 -07:00
rickwebiii
1ff373531c Verify examples in CI 2022-04-14 16:56:38 -07:00
rickwebiii
61c4932371 CI 2022-04-14 16:46:05 -07:00
rickwebiii
6cbd26bdf3 CI 2022-04-14 16:26:23 -07:00
rickwebiii
3efd8ef8be WIP 2022-04-14 16:25:37 -07:00
rickwebiii
4e47a12dcd blah 2022-04-14 16:23:24 -07:00
rickwebiii
a1274f7333 Check format 2022-04-14 16:05:14 -07:00
rickwebiii
638c1e5b5d Submodules 2022-04-14 15:58:14 -07:00
rickwebiii
7d9f3d2cb7 Update 2022-04-14 15:52:57 -07:00
rickwebiii
5c6404c647 Crate rust.yml 2022-04-14 15:27:05 -07:00