fix: full tree test

This commit is contained in:
rymnc 2024-05-24 14:34:33 +05:30
parent 77421e6615
commit 9042b8be35
No known key found for this signature in database
GPG Key ID: AAA088D5C68ECD34
2 changed files with 4 additions and 7 deletions

View File

@ -32,7 +32,7 @@ contract WakuRlnV2 {
uint8 public constant DEPTH = 20;
/// @notice The size of the merkle tree, i.e 2^depth
uint32 public SET_SIZE;
uint32 public immutable SET_SIZE;
/// @notice The index of the next member to be registered
uint32 public idCommitmentIndex = 0;

View File

@ -109,13 +109,10 @@ contract WakuRlnV2Test is Test {
function test__InvalidRegistration__FullTree() external {
uint32 userMessageLimit = 2;
// we modify the set_size to be small so the test can run faster
stdstore.target(address(w)).sig("SET_SIZE()").checked_write(1);
vm.pauseGasMetering();
w.register(1, userMessageLimit);
vm.resumeGasMetering();
// we progress the tree to the last leaf
stdstore.target(address(w)).sig("idCommitmentIndex()").checked_write(1 << w.DEPTH());
vm.expectRevert(FullTree.selector);
w.register(2, userMessageLimit);
w.register(1, userMessageLimit);
}
function test__InvalidPaginationQuery__StartIndexGTEndIndex() external {