-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: constraint on bn254 values #26
Conversation
3b50f0c
to
cca45ef
Compare
LCOV of commit
|
@@ -10,7 +10,7 @@ import "forge-std/console.sol"; | |||
|
|||
contract RlnApp is RlnBase { | |||
uint256 public constant allowedIdCommitment = | |||
21888242871839275222246405745257275088548364400416034343698204186575808495617; | |||
19014214495641488759237505126948346942972912379615652741039992445865937985820; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exactly has this been changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it was earlier the order of the field, i.e p = 21888242871839275222246405745257275088548364400416034343698204186575808495617
, and no number in the field can exceed it. switched it out to make sure people dont get confused about it
uint256 badDepositAmount = MEMBERSHIP_DEPOSIT - 1; | ||
vm.expectRevert(abi.encodeWithSelector(InsufficientDeposit.selector, MEMBERSHIP_DEPOSIT, badDepositAmount)); | ||
rln.register{value: badDepositAmount}(idCommitment); | ||
} | ||
|
||
function test__InvalidRegistration__FullSet(uint256 idCommitmentSeed) public { | ||
vm.assume(idCommitmentSeed < 2 ** 255 - SET_SIZE); | ||
function test__InvalidRegistration__FullSet() public { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for me to understand: why did we move away from a fuzz test here? Has anything changed with regards to the seed that we can't/aren't relying on it anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically we are not testing any logic here, we're just checking if an error is thrown based on the size of the tree - thats why we dont need to fuzz id commitments here
LCOV of commit
|
LCOV of commit
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done and thanks for the prompt update!
Addresses waku-org#3 (comment)