waku-org / js-rln

Browser library providing the cryptographic functions for Waku RLN Relay https://rfc.vac.dev/spec/17/
Apache License 2.0
5 stars 1 forks source link

feat: use identity credentials, and expose hash, bulk insert and delete members functions #58

Closed richard-ramos closed 1 year ago

richard-ramos commented 1 year ago

Requires:

richard-ramos commented 1 year ago

@rymnc, While testing these changes, I wasnt able to generate/validate proofs with latest zerokit master. This commit https://github.com/vacp2p/zerokit/commit/5eb98d4b330e1107ed18c22856707110302263e4 ended being the culprit, because once I git revert it locally, my tests passed. I believe that there are some parts of the code that is using usize byte length instead of 8 bytes. I'll try to figure out tomorrow where that is happening.

Also, something slightly concerning is that executing all the test units is taking a lot of time. The whole test suite takes now 4 minutes.

Chrome Headless 101.0.4950.0 (Linux x86_64): Executed 13 of 13 SUCCESS (4 mins 13.007 secs / 4 mins 12.974 secs)
rymnc commented 1 year ago

@richard-ramos we could revert the offending commit. Are the tests slow with a working version of zerokit?

richard-ramos commented 1 year ago

@richard-ramos we could revert the offending commit. Are the tests slow with a working version of zerokit?

This PR https://github.com/vacp2p/zerokit/pull/153 reverts the specific lines causing the issue. I'll try to identify which PR slows down the tests

richard-ramos commented 1 year ago

@rymnc, The following commit introduce slowness into js-rln: https://github.com/vacp2p/zerokit/commit/8cd4baba8ac73b0ef71e2fb6049409a8a349347f
it takes a single test from 3 seconds to ~23s

To test this out I did the following:

  1. Checkout this PR, and execute npm install
  2. In a terminal, execute the following, replacing the path in the last line by the location where js-rln was cloned
    git clone https://github.com/vacp2p/zerokit
    cd zerokit
    git checkout 8cd4baba8ac73b0ef71e2fb6049409a8a349347f
    git revert 5eb98d4b330e1107ed18c22856707110302263e4
    cd rln-wasm
    cargo make build
    cp pkg/* /path/to/js-rln/node_modules/@waku/zerokit-rln-wasm/.
  3. In the folder where js-rln is located npm run test

To speed up the testing process, you can remove all .spec.ts files except for index.spec.ts

richard-ramos commented 1 year ago

This PR is ready for reviewing now! :)