54 Commits

Author SHA1 Message Date
Bryan Li
f5b62b4192 merge 1/2 2023-08-11 12:26:55 -07:00
mliu24
f66aa69b62 basically the whole debugger project (#269)
* added support for group id's in nodeinfo struct and modified new/add_node methods

* addedd support for group counter to fheprograms

* added support for group ids for zkp backend

* aded support for group id's in fhe and zkp programs

* finished support for group id in zkp programs

* added new function signature for creating new nodeinfo with debugger featuer on

* updated zkp jit compilation to support constructing nodes with group id

* added support for node group ids in fhe compiler

* format changes

* fixed clippy issues

* added a stacktrie struct

* added a function to add a stack trace. need to figure outhow to get group id's into the stacktrie

* Update rust.yml

* style fixes

* added structure for StackFrameLookup and stackframes trait

* support to add stack traces and updated dependencies

* clippy fixes

* clippy fixes

* created stackframeinfo struct, added get_stack_trace which has lifetime issues

* clippy fixes

* implementation for stackframelookup

* insertion and getting work

* formatting and documentation

* updated stackframeinfo constructor to not panic with no values

* changed it so trie stores stackframeinfo instead of backtraces

* format and clippy fixes

* started some work with fheprograms

* single frame insert test

* single backtrace insert

* single backtrace insert

* fixed minor loggic error in test single backtrace insert

* some more tests

* programcontext/programgroup structs defined

* more programgroup

* added a get for stackframelookup, added clone to programgroup

* infrastructure for groups

* fixed references of .0 into .graph and enabled conditional compilation of debugging structs, but this broke fhe_program proc macro

* cleaned up some conditional compilation logic in context, also formatting fixes

* fixed context compilation errors

* fixed dependency issues and can now return graph information of basic fhe program

* format fixes

* remains to figure out how to display graphs with rationals

* can display graph for given rational operations

* displays serialized graph strings

* added run_impl and debug_fhe_program, also added debuginfo struct and added parameter for secret key in run unchecked

* fixed compilation errors for tests in run file, now does tests with secret key

* updated measuredmodel call to run_program_unchecked with a secret key

* clippy and format fixes

* doc fixes

* fixed some fhe program tests based on changes to compilationresult data structure

* format fixes

* modified tests in validation.rs

* sessions file + data structure:

* documentation for sessions

* documentation, removed some unused dependencies

* format and clippy fix

* moved sessions to runtime

* rick's coimments/changes

* implemented set_data, also added calls to set_data in run unchecked

* fixed compilation rrors in tests for run.rs

* more compilation error fixes + moved fhe-debugger into debugger module

* added fhe-debugger files as modules

* fxied remaining compilation issues in run

* removed nodes file from debugger

* created start web server function

* fixed some depenendcy issues to enable debugger feature across workspace, now going to fix compilation results/add support with debugger feature

* enabled debugger in zkp backend

* compilation errors in graph construction test, enabled debugger feature in sunscreen_fhe_program

* fixed more compilation errors and enabled debugger feature in sunscreen_backend. next step: figure out secret vs privatekey and change debug_fhe_program accordingly

* modified visibility of sealsecretkey in privatekey struct to be public

* format

* modified debug_fhe_program to not return anything

* fixed compilation errors based on conditional dependencies when debugger not enabled

* fixed errors due to conditional compilation with debugger feature in fhe_program_tests

* managed to get webserver up and running. remains to figure out how to get the graph data

* can now support dynamic paths but currently web server is not set up in a way that you can debug multiple programs

* moved code from sessions.rs to server.rs

* server file

* added support for cors so frontend can now grab data from backend. currently it only grabs a string that allows the frontend to construct a graph

* proc macro updates to be able to get source code of an fhe program with .source()

* added support for fhe program source code. in debug mode, run.rs tests wont compile because debug_fhe_program now asks for 7 arguments instead of 6

* fmt fixes

* clippy fixes

* get fhe node data impleented, still doesnt ocmpile. need to figure out how to handle sealdata stuff

* fixed async issues, now can support multiple sessions

* rick fixes

* updated fhe_program_tests to have metadata fields and group_id. need to fix construction of graph so that group ids are updated

* fhe program tests now pass with debugger feature enabled, updated group counter when assigning ids to nodes

* passes tests with debugger feature enabled and disabled

* fmt fixes

* clippy fixes

* addressed race conditions in run tests, now pass those tests with and without debugger feature

* removed changes to settings.json

* removed unncessary comments from fhe_program_tests

* removed some unnecessary TODO

* removed more unnecessary comments

* removed group struct, defined Group type as a String

* modifying interface for lookup data structures

* removed unnecessary prints

* remove more prints

* removed secretkey from debug_fhe_program, now uses privatekey instead

* removed conditional compilation from a functoin that shouldnt have it

* removed group counter updates from common_subexpression_elimination test. graphs can be isomorphic even if group id's don't match up exactly

* clippy and fmt

* undid some clippy changes so that code compiles

* error handling for get_fhe_node_data and implemented idlookup trait for stackframelookup

* stack id for nodeinfo

* stack id for node info and context changes

* removed serialization of sealdata, instead created serializedsealdata struct which contains debugger info about cipher/plaintexts

* removed unnecessary todos

* skeleton for getting cipher/plaintext data

* modified visibility of Error field in lookup, cloned some values in server

* sunscreen fhe znd zkp support for stack ids on ndoes

* fmt

* clippy

* can now see dummy node data

* removed some old/dead code from server and added backtrace to compiler crate

* dependency updates

* put multiplicative depth on nodeinfo, also updated operationtrait

* enabled internal tagging with conditional compilation with debugger feature

* compile fixes, added multiplicative_depth field to nodeinfos

* attempted to allow for multiplicative depth ... this currently does not work. also group ids dont seem to be assigned correctly

* two changes: modified Operation enum to be struct instead of tuple variants and fixed associated compilation errors, also removed multiplicaitve depth field from NOdeInfo and fixed corresponding compilation errors

* more compilation errors for struct variants of Operatio nenum fixed

* moved group and stack counters off context and onto metadata ... maybe should move this onto the lookup structs themselves?

* skeleton for idlookup trait for grouplookup

* moved lookup to compiler ocmmon from runtime

* moved lookup into src

* documentation for lookup

* attempting naive multiplicative depth algorithm

* removed get_mult_depth that didn't function, currently returns 0

* can display coefficients for plaintexts

* moved build to sunscreen_runtime directory from debugger

* WIP

* rick's changes

* fixed webpack errors

* progress towards coefficients

* Don't ship dist folder

* WIP

* fmt changes. also can display coefficients of plaintexts

* attempting to debug ciphertext coefficient info

* removed groups.rs file

* conditional compilation for dependency import to stop clippy complaints

* more clippy fixes

* more conditional compilation for dependncies

* fmt

* implemented default trait for lookup structures

* combine 2 dependency imports

* just allowed for unused imports

* updated serialization types

* changed serializable enums to be internally tagged

* capturing stack traces

* format

* added sleep calls in infinite loop to reduce cpu usage

* remove default cals from chi_sq example

* format

* allow for insertion of ids/keys in lookup structure

* added a 2nd call to mad for debugging example. also inserted some dummy keys for stack lookup

* attempts to debug decryption of coefficients with seal:

* removed dbg from seal file

* added a stacktrace endpoint, but it doesnt display anything useful yet

* fmt

* can now display coefficients

* clippy fix

* fmt

* noise budget is nullable

* named cipher and plaintexts

* removed some unnecesasry comments

* error handling for run program unchecked

* remove internal tagging so that literals work

* format

* unnecessary comments removed

* get_mult_depth works in some cases, need to write tests

* singular empty etst

* attempt to redesign stack frame lookup -- this is a very inefficeint way of doing it, but should work

* added support to capture stack traces, but there's an issue with the data not being saved so it can be served to the frontend

* fmt

* clippy

* default implementation for gorup and stacklookup

* fmt

* can now display stack traces

* fmt

* clippy

* fmt

* refactoring code to change serializedsealdata to bfvnodetype

* comment out dead code

* start zkp sessions

* moved decrypt seal logic to a new function

* wrote polynomial multiplication functions

* zkpsession and imports

* overflow for polynomials

* overflow can now only be true for ciphertexts that are the output of an arithmetic operation

* examples for overflow and chaining

* remove some unnecssary imports

* server now supports serializing zkp data

* zkp now returns bigint as a string

* set up params that cause noise budget exceeded in debugger example

* remove tests from lookup

* added name metadata to zkp programs

* updated construction of expected graphs for fhe_program_tests

* modified tests for validation to account for struct variants

* added session provider

* SessionProvider

* added gorup and stack id for some validation tests

* Fix a test

* Fix tests

* Fix feature plumbing

* Fix lookup

* fuck off

* changed generic to Box of dyn

* functional zkp debugger

* clippy

* clippy

* fmt

* clippy

* fmt

* janky a solution to conditional compilation keeping variables out of scope

* fmt

* conditioanl compilation for debugdata

* remove print debug from measured model

* remove unnecssary comment

* remove todo

* removed serialize function for stackframeinfo, instead hashed it

* remove unnecessary conditional compilation in common subexpression eliminioatno

* change fhe program macro to preserve white space

* changed get_mult_depth to iterative bfs

* add functions to modularize overflow calculation

* overflow code now compiles but needs to actually be implemented

* can extract coefficients from innerplaintext

* implemented overflow detection for fhe programs

* modified checks for overflow

* remove internal tagging comments

* clippy

* removed unwrap or else and turned into expect

* clippy actually likes unwrap or else

* fmt

* gate some imports

* fix gating issues

* removed some gating

* removed gating from debugger module; zkp runtime uses it

* fmt

---------

Co-authored-by: Bryan Li <bryanyuezhouli@gmail.com>
Co-authored-by: rickwebiii <rick.weber.iii@gmail.com>
Co-authored-by: Bryan Li <51716784+bryanyli@users.noreply.github.com>
2023-07-30 18:14:22 -07:00
rickwebiii
f05ce704b1 transparent-ciphertexts feature (#280) 2023-07-11 12:16:42 -07:00
Ryan Orendorff
95721487a8 Mixed bounds in logproof (#276)
This enables some small performance increase for smaller proofs (up to approximately 75%). Additionally this enables the prover and verifier to agree on which components may or may not be interesting by specifying a
bounds of zero.
2023-07-07 12:37:12 -06:00
rickwebiii
1089e00d1b Separate OpenCL shaders into multiple files (#239)
* Separate OpenCL shaders into multiple files
2023-05-12 17:06:53 -07:00
rickwebiii
6f713d6750 Rweber/zkp (#218)
Private tx range proof
2023-03-02 15:16:45 -08:00
rickwebiii
48ebc52576 Rweber/zkp (#211)
Metal GPU accelerated scalar multiplication
2023-02-16 14:31:55 -08:00
rickwebiii
d03207e67e Rweber/zkp (#196)
Add BFV playground, Polynomial addition
2022-12-19 12:00:23 -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
3cdd0a5193 Add chaining docs (#177)
* Port over docs changes from docs-preliminary

* Fix casing and typos

* Fix failing docs tests
2022-10-17 14:34:45 -07:00
rickwebiii
334355067a Rweber/chaining (#171)
Chaining
2022-08-15 13:58:22 -07:00
rickwebiii
e0f5b126a8 Add debug to launch.json 2022-08-09 15:06:52 -07:00
rickwebiii
4bbd0e4388 Add invariant noise (#166) 2022-08-08 12:26:34 -07:00
rickwebiii
5e9c1d99af With code hacks, you can now use canonical embedding norm model (#162)
* With code hacks, you can now use canonical embedding norm model

* Cargo fmt
2022-07-22 16:48:05 +01:00
rickwebiii
0b86d5dfad Rweber/model (#161)
Add support for noise models in determining parameter selection
2022-07-22 15:56:39 +01:00
rickwebiii
1c8e8dddbb Add debug target (#159) 2022-07-18 16:50:13 +01: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
917c0efc82 WIP 2022-04-26 13:52:10 -07:00
Rick Weber
18131f5646 PIR 2022-04-23 18:21:15 -07:00
Rick Weber
48301f780f WIP 2022-04-21 23:39:54 -07:00
Rick Weber
ad930251dc Add array support 2022-04-12 11:09:59 -07:00
Rick Weber
13c1e7545d Fix more rational division issues 2022-03-23 14:34:33 -07:00
Rick Weber
01ee12d7f5 AMM example works 2022-03-23 11:39:45 -07:00
Rick Weber
5639f3c16b Rename sunscreen_compiler to sunscreen 2022-03-22 14:29:35 -07:00
Rick Weber
ac1bae3e62 Permit unused inputs 2022-02-16 20:32:15 -08:00
Rick Weber
274d2234e9 Update launch.json 2022-02-02 10:34:09 -08:00
Rick Weber
a08eb1f5a6 Rename SIMD to Batched 2022-02-01 16:45:34 -08:00
Rick Weber
13bee724ec Rename circuit to FHE program 2022-02-01 16:35:45 -08:00
Rick Weber
904d34e3b2 Fix relin bug. Add chi squared example 2022-01-28 19:32:38 -08:00
Rick Weber
b7ab182039 dot product example 2022-01-28 12:33:41 -08:00
Rick Weber
628c0036a7 Can create SIMD types 2022-01-26 15:43:01 -08:00
Rick Weber
c19edf33fa Can encode/decode SIMD type 2022-01-26 14:33:05 -08:00
Rick Weber
46c9e26b0e Can divide fractional by constant 2022-01-24 13:18:21 -08:00
Rick Weber
3dc12031be Add tests for signed values. Fix a bug in signed encoder 2022-01-24 10:21:47 -08:00
Rick Weber
5a9f1d125b Can now add literals 2022-01-21 14:01:09 -08:00
Rick Weber
2b51b85c84 Add is_encrypted to Type 2022-01-20 11:59:18 -08:00
Rick Weber
2aeeb9393b Can add Fractionals 2022-01-13 13:54:36 -08:00
Rick Weber
0890ff3c0a Check return types on circuits 2022-01-13 13:35:13 -08:00
Rick Weber
568194c7d9 Fractional WIP 2022-01-13 12:55:31 -08:00
Rick Weber
0c20afbeb8 Calculator works 2021-12-16 17:21:35 -08:00
Rick Weber
88b757fbbc WIP 2021-12-15 22:53:04 -08:00
Rick Weber
87d1505409 Pack integers into multiple coefficients, encoders are dead. 2021-12-08 19:38:19 -08:00
Rick Weber
ebc7fdb880 Remove encoders WIP 2021-12-08 17:15:58 -08:00
Rick Weber
b1a7aad82c megarefactor parameter selection to frontend 2021-11-30 20:48:52 -08:00
Rick Weber
feae81a051 Can collect outputs 2021-11-30 12:34:04 -08:00
Rick Weber
c44b60a00d Can auto-pick params for circuit. 2021-11-22 20:35:04 -08:00
Rick Weber
e144b3f8ec Runtime works. 2021-11-19 17:15:09 -08:00
Rick Weber
665596edcf Tree shaking works, added a bunch of tests 2021-11-18 12:02:53 -08:00