96 Commits

Author SHA1 Message Date
tyshko-rostyslav
a372053047
Remove height 32 from RLN (#239)
* rm tree height from circuit

* rm corresponding logic from ffi

* fm from tests

* rm height 32 resources

* remove `TEST_PARAMETERS_INDEX` and related comments
2024-04-29 18:26:29 +05:30
Aaryamann Challani
30d5f94181
chore(rln): return empty metadata if it doesnt exist (#230)
* chore(rln): return empty metadata if it doesnt exist

* fix: clippy
2024-03-07 02:22:37 +05:30
Aaryamann Challani
ccd2ead847
chore(rln): infallible conversions (#229) 2024-01-23 19:47:54 +05:30
tyshko-rostyslav
25f822e779
Refactoring (#219)
* public_api_tests module

* add tests to new module

* rm tests

* fmt

* rm redundunt code

* fmt
2023-10-30 09:37:17 +01:00
Aaryamann Challani
0997d15d33
fix(rln): use tree_height_20 artifacts from ceremony (#218)
* fix(rln): use artifacts from ceremony

* chore: Release
2023-10-04 13:22:51 +05:30
Aaryamann Challani
8614b2a33a
feat: rln-v2 (#204)
* feat(rln-v2): update serde for rln-v2 (#202)

* feat(rln-v2): update serde for rln-v2

* fix: public tests that needed to append the new fields

* s/id_commitments/rate_commitments (#205)

* feat: rename public, protocol and update tests to use rate_commitments

* fix: into()

* `message_id` range check (#210)

* feature: range check added

* fmt

* feature: message_id_range_check

* fix: corresponding change of types

* comments: function level

* fmt

* fix(rln): tests (#212)

* most changes

* fix

* fix protocol tests

* fmt

* ffi tests fix

* feat(rln-v2): new artifacts, removed older ones (#211)

* feat(rln-v2): new artifacts, removed older ones

* wip: working branch

* fix: remove more refs to epoch + rln_identifier

* Updated serde in RLN proof verification

* Updated artifacts

* chore: update

* chore: update

* hardcoded test works

* fix: proof generation and verification

* fix: rln-wasm tests

* fix: ffi tests

* fix: rln-wasm test

* fix: recover_id_secret

* Fix message (#217)



---------

Co-authored-by: rymnc <43716372+rymnc@users.noreply.github.com>

* chore: Release

---------

Co-authored-by: tyshko-rostyslav <122977916+tyshko-rostyslav@users.noreply.github.com>
2023-10-03 21:28:21 +05:30
Aaryamann Challani
f73c83b571
fix(rln): if only a single insertion, dont use batch_insert (#215)
* fix(rln): if only a single insertion, dont use batch_insert

* fix: more optimizations
2023-09-14 14:10:53 +05:30
Aaryamann Challani
f8fc455d08
chore(rln): expose leaves_set api (#213) 2023-09-12 14:44:33 +05:30
Aaryamann Challani
c6c1bfde91
chore(rln): expose seq_atomic_operation api (#206) 2023-08-21 12:07:57 +05:30
richΛrd
99966d1a6e
feat: print to stderr any error obtained while executing functions via FFI (#200) 2023-08-09 14:35:33 +05:30
Richard Ramos
7d63912ace chore: accept tree_config in new_with_params 2023-08-07 08:48:41 -04:00
Aaryamann Challani
ecb4d9307f
chore: docs cleanup (#196) 2023-08-01 22:33:08 +05:30
Aaryamann Challani
d1414a44c5
fix(rln): atomic operation edge case (#195)
* fix(rln): atomic operation edge case

* fmt

* fix: bug

* test: new batching mechanism

* Revert "test: new batching mechanism"

This reverts commit 396c2ec342fbd0a776e494ed46de1e4f27d8f93e.

* fix: end should be max index + 1

* fix: optimization

* fix: apply cleanup

* fix: idiomatic leaf setting

* fix: abstract out logic

* fix: type aliasing for verbose types

* fix: remove_indices_and_set_leaves fn
2023-08-01 18:06:52 +05:30
Aaryamann Challani
9d4ed68450
fix: rename close_db_connection to flush (#192) 2023-07-26 11:20:33 +05:30
Aaryamann Challani
23d2331b78
feat(rln): close db connection before dropping rln object (#187) 2023-07-25 15:22:55 +05:30
Aaryamann Challani
be88a432d7
fix(rln): tree_config parsing (#180)
* fix(rln): tree_config parsing

* fix(rln): clippy
2023-06-16 15:49:56 +05:30
Aaryamann Challani
8cfd83de54
feat(rln-wasm): set/get metadata api (#179)
* feat(rln-wasm): set/get metadata api

* fix(rln): imports
2023-06-16 09:48:26 +05:30
Aaryamann Challani
2793fe0e24
feat(rln): expose set_metadata and get_metadata public and ffi apis (#178) 2023-06-15 20:35:49 +05:30
Aaryamann Challani
0d35571215
feat(rln): get_leaf ffi and public api (#177) 2023-06-08 21:33:09 +05:30
Aaryamann Challani
9cc86e526e
fix(rln): error out when temporary=true and path is exists (#176)
* fix(rln): error out when temporary=true and path is exists

* fix(rln): should error out when temp=true and path exists

* fix(rln): clippy
2023-06-07 16:58:39 +05:30
Aaryamann Challani
96497db7c5
test(rln): sled db config change (#174)
* test(rln): sled db config change

* fix: increase cache_capacity
2023-06-06 22:41:38 +05:30
Aaryamann Challani
c2d386cb74
feat(rln): public, ffi for atomic ops (#162) 2023-05-16 10:00:32 +05:30
Aaryamann Challani
8f2c9e3586
combined batch operations (insert + delete) (#160)
* fix(rln): clippy error

* feat: batch ops in ZerokitMerkleTree

* chore: bump pmtree

* fix: upstream root calc
2023-05-15 07:11:43 +05:30
Aaryamann Challani
584c2cf4c0
fix(rln): clippy error (#159) 2023-05-06 18:30:58 +05:30
Aaryamann Challani
2c4b399126
feat(rln): ability to pass rln tree config in ffi (#150)
* feat(rln): pass config in rln ffi

* fix: for rln-wasm

* fix: ffi tests

* fix: clippy

* fix: test cursor
2023-05-05 15:15:33 +05:30
RichΛrd
c4b699ddff
fix: len().to_le_bytes().to_vec() contains 4 bytes on 32b and should contain 8 (#154) 2023-05-04 15:23:53 +05:30
Richard Ramos
33d3732922 fix: u64 to usize conversion
usize::from_le_bytes will take an array of length 2, 4 or 8 bytes depending on the target pointer size. Since wasm uses 32b, there was a failure while reading serialized values due to the number of bytes read being incorrect. I also update version rln-wasm to 0.0.9 (npm package needs to be updated to include this fix)
2023-05-03 09:53:11 -04:00
Aaryamann Challani
fd7d7d9318
Integrate pmtree into rln (#147)
* feat: integrate pmtree with zerokit

* fix: tests
2023-04-28 10:02:21 +05:30
tyshko-rostyslav
4f98fd8028
chore(rln): bring hash functions under a single module (#146) 2023-04-20 16:24:29 +05:30
Aaryamann Challani
0fb7e0bbcb
feat: abstract shared behaviour into ZerokitMerkleTree (#142)
* feat: abstract shared behaviour into ZerokitMerkleTree

* fix: tests
2023-04-11 16:46:13 +05:30
Aaryamann Challani
1f983bb232
fix(rln): move std::path to cfg_if block (#138) 2023-03-24 09:31:01 +05:30
tyshko-rostyslav
8cd4baba8a
leave our fork of ark-circom (#132)
* leave our fork of `ark-circom`

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-03-22 07:01:24 +01:00
Aaryamann Challani
c319f32a1e
feat(rln): package rln w/ resources into a static lib (#118)
* feat(rln): package resources into lib

* fix(rln): use Path

* fix(rln): fmt

* fix(rln): trailing slash
2023-03-07 18:15:06 +05:30
tyshko-rostyslav
c423bdea61
chore(rln): update pmtree implementation (#125)
* most changes

* fmt

* hide tests back under feature

* grooming

* changed `SledConfig`

* requested change: rm `dbpath`

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-03-03 10:33:39 +05:30
Carlos Pérez
5eb98d4b33
change: Replace u64 for usize for length vars (#94)
* change: Replace `u64` for `usize` for length vars

Resolves: #39

* fix(rln): usize instead of u64 in tests

* fix(rln): linter

* fix: outlier u64 usage

* fix(rln|rln-wasm): serde of usize types

---------

Co-authored-by: Aaryamann Challani <43716372+rymnc@users.noreply.github.com>
2023-03-02 19:15:58 +05:30
tyshko-rostyslav
55b00fd653
Code quality (#114)
* to color_eyre::Result 1st part

* tests and seconds batch

* third batch

* rln fixes + multiplier

* rln-wasm, assert rln, multiplier

* io to color_eyre

* fmt + clippy

* fix lint

* temporary fix of `ark-circom`

* fix ci after merge

* fmt

* fix rln tests

* minor

* fix tests

* imports

* requested change

* report + commented line + requested change

* requested changes

* fix build

* lint fixes

* better comments

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-02-27 11:46:16 +05:30
Aaryamann Challani
a6145ab201
feat(rln): expose poseidon to ffi (#112) 2023-02-16 13:26:13 +05:30
tyshko-rostyslav
7aba62ff51
Add rust-clippy to CI (#108)
Convert clippy warnings to errors, fix them 

---------

Co-authored-by: tyshkor <tyshko1@gmail.com>
2023-02-06 05:54:59 +01:00
Rahul Ghangas
cbf8c541c2
test: separate out tests (#103)
* test: move tests for rln, multiplier and private-settlements to tests folder

* test: fix rln test for poseiden tree

* test: move tests for rln-wasn to standalone tests folder

* test: move tests for semaphore and utils to standalone tests folder

* chore: cargo fmt

* test: rename test files

* test: move tests out from rln/src/public to test folder

* test: fix rln tests, move tests accessign private fields back to relevant source file

* chor: run cargo fmt

* test: move all semaphore tests to tests folder

* chore: cargo fmt
2023-01-31 21:27:28 +05:30
tyshko-rostyslav
01fdba6d88
feat(rln): Abstract ffi APIs structure with a helper function (#102)
Added macros to do the following:

read the input passed to the FFI API;
cast it to a byte sequence;
pass the byte sequence to the corresponding public function;
cast the output of the public function to Buffer(if any) and write it into the FFI caller ´output_buffer` variable;
erase memory from any temporarily allocated data structure;
return true if everything went fine, false otherwise.
2023-01-31 09:43:41 +01:00
G
89ea87a98a
feat(rln): integrate pmtree for MT persistance (#86)
* feat(rln): integrate pmtree for MT persistance

* fix(rln): address reviewers comments

* refactor(rln): move pmtree tests under pmtree flag
2022-12-13 20:00:27 +01:00
G
32f3202e9d
feat(rln): add extended keygen APIs for Semaphore-compatible credentials (#85)
* refactor(rln): update APIs based on updated rln circuit design

* chore(rln): update rln vendor submodule

* fix(ci): update ci to not ignore rln resources changes

* feat(rln): add extended keygen APIs

* refactor(rln): rename id_secret/id_key to identity_secret_hash as per RFC

* fix(rln): cargo fmt
2022-12-12 00:48:22 +01:00
G
9e1355d36a
refactor(rln): update APIs after circuit update (#84)
* refactor(rln): update APIs based on updated rln circuit design

* chore(rln): update rln vendor submodule

* fix(ci): update ci to not ignore rln resources changes
2022-12-09 17:19:55 +01:00
G
60e3369621
feat(rln): add recover identity secret API (#80)
* feat(rln): add API to recover id_secret when a user is slashed

* feat(rln): add RLN API for recovering id_secret

* feat(rln): add recover_id_secret FFI API; update public API docs

* fix(rln): address reviewers' comments

* fix(rln): removing ; for clippy
2022-11-28 12:05:33 +01:00
G
284e51483c
feat(rln): add example usage tutorial and expand documentation for RLN (WIP) (#74)
* feat(rln): expand documentation with minimal public API usage example

* refactor(rln): ease RLN interaction with new APIs

* feat(rln): expand API docs

* fix(rln): disable doctest for rln
2022-11-25 10:54:17 +01:00
G
bc69e25359
feat(rln): add few serialization APIs to ease user interaction (#75)
* feat(rln): add few serialization APIs to ease user interaction

* fix(rln): cargo fmt
2022-11-21 17:55:08 +01:00
Aaryamann Challani
fba905f45d
fix(rln): throw if attempting to insert out of bounds (#67)
* fix(rln): throw if attempting to insert out of bounds

* chore(rln): better error msg

* fix(merkle-tree): make it mimic OptimalMerkleTree impl

* chore(rln): return result as is
2022-11-10 22:41:44 +05:30
Aaryamann Challani
490206aa44
feat(rln): ability to set leaves from a given index (#63)
* feat(rln): ability to set leaves from a given index

* style(rln): fmt

* fix(rln): bubble the error

* revert: "fix(rln): bubble the error"

This reverts commit 40265082ba888f0a583c4e4d0b7abab9da9b7da8.

* fix(rln): replace ark::std::Zero with default

* fix(rln): ordering of ffi api

* fix(rln): use PoseidonHash::default_leaf

* chore(rln): add ffi test for batching

* docs(rln): add entry to changelog

* fix(rln): address reviews

* fix(changelog): fmt

* fix(rln): safe conversion

* fix(rln): reset tree with init func,  add comments

* chore(rln): add comment about init_tree_with_leaves

* fix(rln): comment
2022-11-03 17:49:30 +05:30
G
afa4a09bba
Update public.rs
fix(rln): remove unnecessary print
2022-10-10 08:52:36 +02:00
G
b77facc5e9
feat(RLN): Proof verification using provided roots (#61)
* chore(rln): better comments

* feat(rln): add verification with roots
2022-10-07 18:04:48 +02:00