test: erasing non-existent membership

This commit is contained in:
Roman 2025-08-08 10:58:32 +02:00
parent 969d3ee22b
commit e62b1bd12a
No known key found for this signature in database
GPG Key ID: 583BDF43C238B83E

View File

@ -814,4 +814,21 @@ contract WakuRlnV2Test is Test {
);
assertEq(fetchedImpl, newImpl);
}
function test__ErasingNonExistentMembership() external {
uint256[] memory ids = new uint256[](1);
ids[0] = 999; // Non-existent
assertFalse(w.isInMembershipSet(999), "ID should not exist");
uint256 initialRoot = w.root();
uint256 initialNextFreeIndex = w.nextFreeIndex();
vm.expectRevert(abi.encodeWithSelector(MembershipDoesNotExist.selector, 999));
w.eraseMemberships(ids);
assertEq(w.root(), initialRoot, "Merkle root should not change");
assertEq(w.nextFreeIndex(), initialNextFreeIndex, "Next free index should not change");
}
}