Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integrated rln-v2 into wakuRlnRegistry #11

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

feat: integrated rln-v2 into wakuRlnRegistry #11

wants to merge 10 commits into from

Conversation

rymnc
Copy link

@rymnc rymnc commented Jan 24, 2024

Integrates rln-v2 into WakuRln.sol and WakuRlnRegistry. yet to add more test vectors.

@rymnc
Copy link
Author

rymnc commented Jan 24, 2024

contracts are deployed, sepolia etherscan is under maintenance so will verify after.

Copy link

LCOV of commit 20318a7 during CI #30

Summary coverage rate:
  lines......: 91.4% (32 of 35 lines)
  functions..: 84.6% (11 of 13 functions)
  branches...: 62.5% (10 of 16 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        |94.1%     17|83.3%     6|75.0%      4
  contracts/WakuRlnRegistry.sol|88.9%     18|85.7%     7|58.3%     12

Copy link

LCOV of commit bf07ca7 during CI #31

Summary coverage rate:
  lines......: 91.4% (32 of 35 lines)
  functions..: 84.6% (11 of 13 functions)
  branches...: 62.5% (10 of 16 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        |94.1%     17|83.3%     6|75.0%      4
  contracts/WakuRlnRegistry.sol|88.9%     18|85.7%     7|58.3%     12

Copy link

LCOV of commit 48cf089 during CI #32

Summary coverage rate:
  lines......: 94.3% (33 of 35 lines)
  functions..: 92.3% (12 of 13 functions)
  branches...: 68.8% (11 of 16 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        | 100%     17| 100%     6| 100%      4
  contracts/WakuRlnRegistry.sol|88.9%     18|85.7%     7|58.3%     12

Copy link

LCOV of commit be4b10b during CI #33

Summary coverage rate:
  lines......: 100.0% (33 of 33 lines)
  functions..: 100.0% (13 of 13 functions)
  branches...: 100.0% (12 of 12 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        | 100%     17| 100%     6| 100%      4
  contracts/WakuRlnRegistry.sol| 100%     16| 100%     7| 100%      8

Copy link

LCOV of commit 6c7e59d during CI #34

Summary coverage rate:
  lines......: 100.0% (33 of 33 lines)
  functions..: 100.0% (13 of 13 functions)
  branches...: 100.0% (12 of 12 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        | 100%     17| 100%     6| 100%      4
  contracts/WakuRlnRegistry.sol| 100%     16| 100%     7| 100%      8

@rymnc rymnc marked this pull request as ready for review January 24, 2024 13:52
@rymnc rymnc requested a review from 0x-r4bbit January 24, 2024 13:53
@rymnc rymnc self-assigned this Jan 24, 2024
Copy link

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looking good. Left a minor comment.

I would wait to merge until it is clearer the way to go with RLN.

uint256 len = idCommitments.length;
for (uint256 i = 0; i < len; ) {
_register(idCommitments[i]);
function register(uint256[] calldata commitments, uint256[] calldata limits)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps nitpick:
register(uint256[] calldata idCommitments, uint256[] calldata userMessageLimits)

instead of commitments, limits

so its easier to see that it maps to
register(uint256 idCommitment, uint256 userMessageLimit)

  • idCommitment -> idCommitments
  • userMessageLimit -> userMessageLimits

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will make that change 👍

unchecked {
++i;
}
}
}

function register(uint256 idCommitment) external payable override {
revert NotImplemented();
function register(uint256 idCommitment, uint256 userMessageLimit) external payable override {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The business logic here is still very unclear, but perhaps we should support a fixed a mount of values? eg require userMessageLimit to be [100, 1000, 10000] and somehow connect it to the payable amount. eg 10000 is more expensive than 1000.

(just thinking out loud)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's how it's been implemented in rln-contract. it's a simple constructor value change if we decide to make it payable.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: tiers, is that a requirement from waku's side? if so, can add that. with rln-v2 the message limit is kept private when generating proofs so everyone is part of the same anonymity set

Copy link

LCOV of commit 886891b during CI #36

Summary coverage rate:
  lines......: 100.0% (33 of 33 lines)
  functions..: 100.0% (13 of 13 functions)
  branches...: 100.0% (12 of 12 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        | 100%     17| 100%     6| 100%      4
  contracts/WakuRlnRegistry.sol| 100%     16| 100%     7| 100%      8

@@ -1,5 +1,5 @@
{
"address": "0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4",
"address": "0xABd93f37833107eDbAb58633ad5463aDEa1F95F4",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho the point of having a proxy is that if we deploy a new contract, the proxy address does not change (nwaku nodes can point to the same address, with no changes) but the underlying implementation changes (points to new contract).

not sure its the case with this?

our rlnv1 proxy is 0xF471d71E9b1455bBF4b85d475afb9BB0954A29c4. can we keep that in future deployments and you change the contract that it points to? rlnv1, v2, or any other mod?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I needed to deploy a separate instance to test against without breaking the existing deployment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple skip: true is enough for it to use the old deployment

Copy link

LCOV of commit 2e828c3 during CI #37

Summary coverage rate:
  lines......: 100.0% (33 of 33 lines)
  functions..: 100.0% (13 of 13 functions)
  branches...: 100.0% (12 of 12 branches)

Files changed coverage rate:
                               |Lines       |Functions  |Branches    
  Filename                     |Rate     Num|Rate    Num|Rate     Num
  ===================================================================
  contracts/WakuRln.sol        | 100%     17| 100%     6| 100%      4
  contracts/WakuRlnRegistry.sol| 100%     16| 100%     7| 100%      8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants