100 Commits

Author SHA1 Message Date
Ryan Orendorff
d7f58b39c1 Link to redeployed BFV docs (#398) 2025-05-07 23:27:35 +00:00
Ryan Orendorff
5ab19fb39c Update README (#397) 2025-05-07 17:24:09 +00:00
rickwebiii
f741fa1743 Export OverlaySize trait (#393) 2025-02-28 21:16:40 +00:00
Ryan Orendorff
64913a934c Fix clippy warnings for Rust 1.83 (#385)
Co-authored-by: Rick Weber <rick@sunscreen.tech>
2024-12-05 20:01:04 -07:00
Ryan Orendorff
5eba25a961 Fix clippy warnings (#381) 2024-11-20 23:33:25 +00:00
Ryan Orendorff
6d9639e886 Fix lint issues (#380)
Also fixes a flaky test (can_approx_multiply_large_polynomials_fft limit to 1.5-9).
2024-07-02 13:10:14 -06:00
rickwebiii
bf99f2119e Rweber/bug fixes (#374)
Fix bug when users tried to reuse LWE ciphertexts across encryptions
2024-04-04 19:24:48 -04: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
e9125df70d Allow insecure params for tests (#344) 2024-02-11 16:03:00 -05:00
Sam Tay
ae42ab7199 Disallow repeating linked inputs (#345) 2024-02-11 16:01:58 -05:00
Sam Tay
b0df5e7c37 Expose symmetric encryptions (#343) 2024-02-11 15:14:57 +00:00
Sam Tay
c3cbf3781e Fix linked proof commitments (#342) 2024-02-07 17:46:00 -05:00
Sam Tay
a4f1cf6647 Link unsigned and rational FHE types (#341) 2024-02-05 14:22:10 -05: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
Sexosexosexo
150fd11dd4 Fix ToUInt: 2^n doesn't fit n bits (#323) 2023-10-25 16:24:59 -04:00
rickwebiii
59da8edb8c Rweber/asserts (#326) 2023-10-18 12:59:30 -07:00
Sam Tay
d9f64f4283 Bump all versions to 0.8.1 (#314) 2023-09-11 21:39:56 +00:00
Sam Tay
cbfa03bafe Fix odd type inference issue (#312) 2023-09-06 14:02:16 -04:00
Sam Tay
cbbe0bafbe Bump all versions to 0.8.0 (#305) 2023-08-22 19:40:54 -04:00
Sam Tay
1c825db46e Make sure docs.rs builds with bulletproofs (#304) 2023-08-22 18:39:26 -04:00
Ryan Orendorff
e90c11910c Add deterministic encryption (#303)
* Add deterministic encryption

* Add deterministic encryption flag, runtime

* Fix clippy

* Address PR comments
2023-08-21 17:57:43 -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
641bf96bd4 Rweber/deps (#295)
Move all deps to [workspace.dependencies]
2023-08-04 17:23:06 -07:00
Sam Tay
8fe63d6e88 Fix benchmark (#289) 2023-08-01 16:24:25 -04:00
Sam Tay
b8521c70e4 Fix doc comment (#284) 2023-07-18 20:26:19 -04: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
Sam Tay
951ea237ee Playground bump (#281)
* Bump playground

* Re-bump playground

To up node version

* Bump playground again

* Ensure playground loads with zkp backends
2023-07-17 22:23:32 -04:00
rickwebiii
3c50ee477b Rweber/field spec (#283)
Rename NativeField<BackendField> to Field<FieldSpec>
2023-07-17 18:18:50 -07:00
rickwebiii
f05ce704b1 transparent-ciphertexts feature (#280) 2023-07-11 12:16:42 -07:00
Sam Tay
363734ff38 Properly factor inserting literal plaintexts (#278)
Throughout the const arthimetic operations. Not sure why I didnt do this in the initial PR
2023-07-10 13:39:14 -05: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
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
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
Sam Tay
9346677d5d Expose ZkpContextOps 2023-03-29 10:08:52 -07:00
rickwebiii
8b43c6db24 chi sq and unshield proofs (#225)
chi sq and unshield proofs
2023-03-09 13:46:09 -08:00
rickwebiii
af4849ddb5 Time shield circuits (#224)
* Time shield/unshield circuits
2023-03-08 19:19:59 -08:00
rickwebiii
c034f761e7 Rweber/zkp (#223)
* Add smart FHE TX benchmark
2023-03-08 17:49:08 -08:00
rickwebiii
8930295453 Rweber/zkp (#219)
* Add ZKP benchmarks for comparing fractional values
2023-03-03 09:49:51 -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
48ebc52576 Rweber/zkp (#211)
Metal GPU accelerated scalar multiplication
2023-02-16 14:31:55 -08:00