From 9042b8be35dc9611865c1bbc592b68a179a886d1 Mon Sep 17 00:00:00 2001 From: rymnc <43716372+rymnc@users.noreply.github.com> Date: Fri, 24 May 2024 14:34:33 +0530 Subject: [PATCH] fix: full tree test --- src/WakuRlnV2.sol | 2 +- test/WakuRlnV2.t.sol | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/WakuRlnV2.sol b/src/WakuRlnV2.sol index cc2127f..e1275b1 100644 --- a/src/WakuRlnV2.sol +++ b/src/WakuRlnV2.sol @@ -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; diff --git a/test/WakuRlnV2.t.sol b/test/WakuRlnV2.t.sol index 756c472..e9102d5 100644 --- a/test/WakuRlnV2.t.sol +++ b/test/WakuRlnV2.t.sol @@ -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 {