Skip to content

Commit

Permalink
refactor: update rangecheck template
Browse files Browse the repository at this point in the history
  • Loading branch information
curryrasul committed May 25, 2023
1 parent 5262116 commit b40dfa6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions circuits/rln.circom
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ template RLN(DEPTH, LIMIT_BIT_SIZE) {
root <== MerkleTreeInclusionProof(DEPTH)(rateCommitment, identityPathIndex, pathElements);

// messageId range check
signal rangeCheck <== RangeCheck(LIMIT_BIT_SIZE)(messageId, userMessageLimit);
rangeCheck === 1;
RangeCheck(LIMIT_BIT_SIZE)(messageId, userMessageLimit);

// SSS share calculations
signal a1 <== Poseidon(3)([identitySecret, externalNullifier, messageId]);
Expand Down
5 changes: 2 additions & 3 deletions circuits/utils.circom
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ template RangeCheck(LIMIT_BIT_SIZE) {
signal input messageId;
signal input limit;

signal output rangeCheck;

signal bitCheck[LIMIT_BIT_SIZE] <== Num2Bits(LIMIT_BIT_SIZE)(messageId);
rangeCheck <== LessThan(LIMIT_BIT_SIZE)([messageId, limit]);
signal rangeCheck <== LessThan(LIMIT_BIT_SIZE)([messageId, limit]);
rangeCheck === 1;
}

0 comments on commit b40dfa6

Please sign in to comment.