mirror of
https://github.com/logos-messaging/waku-rlnv1-contract.git
synced 2026-01-07 08:43:06 +00:00
fix: WakuRln test coverage
This commit is contained in:
parent
bf07ca719a
commit
48cf0899dd
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ artifacts
|
||||
cache_forge
|
||||
out
|
||||
lcov.info
|
||||
report
|
||||
|
||||
@ -67,10 +67,6 @@ contract WakuRln is Ownable, RlnBase {
|
||||
_register(idCommitment, userMessageLimit);
|
||||
}
|
||||
|
||||
function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {
|
||||
revert NotImplemented();
|
||||
}
|
||||
|
||||
function _validateRegistration(uint256 idCommitment, uint256 userMessageLimit)
|
||||
internal
|
||||
view
|
||||
@ -90,6 +86,10 @@ contract WakuRln is Ownable, RlnBase {
|
||||
revert NotImplemented();
|
||||
}
|
||||
|
||||
function slash(uint256 idCommitment, address payable receiver, uint256[8] calldata proof) external pure override {
|
||||
_validateSlash(idCommitment, receiver, proof);
|
||||
}
|
||||
|
||||
function withdraw() external pure override {
|
||||
revert NotImplemented();
|
||||
}
|
||||
|
||||
@ -74,6 +74,20 @@ Allows a user to register as a member
|
||||
| idCommitment | uint256 | The idCommitment of the member |
|
||||
| userMessageLimit | uint256 | The message limit of the member |
|
||||
|
||||
### \_validateRegistration
|
||||
|
||||
```solidity
|
||||
function _validateRegistration(uint256 idCommitment, uint256 userMessageLimit) internal view
|
||||
```
|
||||
|
||||
_Inheriting contracts MUST override this function_
|
||||
|
||||
### \_validateSlash
|
||||
|
||||
```solidity
|
||||
function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] proof) internal pure
|
||||
```
|
||||
|
||||
### slash
|
||||
|
||||
```solidity
|
||||
@ -90,20 +104,6 @@ _Allows a user to slash a member_
|
||||
| receiver | address payable | |
|
||||
| proof | uint256[8] | |
|
||||
|
||||
### \_validateRegistration
|
||||
|
||||
```solidity
|
||||
function _validateRegistration(uint256 idCommitment, uint256 userMessageLimit) internal view
|
||||
```
|
||||
|
||||
_Inheriting contracts MUST override this function_
|
||||
|
||||
### \_validateSlash
|
||||
|
||||
```solidity
|
||||
function _validateSlash(uint256 idCommitment, address payable receiver, uint256[8] proof) internal pure
|
||||
```
|
||||
|
||||
### withdraw
|
||||
|
||||
```solidity
|
||||
|
||||
@ -8,3 +8,4 @@ cache_path = 'cache_forge'
|
||||
# 5667: Unused function parameter. Remove or comment out the variable name to silence this warning.
|
||||
# 5740: Unreachable code.
|
||||
ignored_error_codes = [5667, 5740]
|
||||
memory_limit = 4355443200
|
||||
@ -44,6 +44,12 @@ contract WakuRlnTest is Test {
|
||||
wakuRln.register(commitments, limits);
|
||||
}
|
||||
|
||||
function test__ValidSingleRegistration() public {
|
||||
uint256 idCommitment = 1;
|
||||
uint256 userMessageLimit = 1;
|
||||
wakuRln.register(idCommitment, userMessageLimit);
|
||||
}
|
||||
|
||||
function test__InvalidRegistration__Duplicate() public {
|
||||
// Register a batch of commitments
|
||||
uint256[] memory commitments = new uint256[](2);
|
||||
@ -64,6 +70,24 @@ contract WakuRlnTest is Test {
|
||||
wakuRln.register(commitments, limits);
|
||||
}
|
||||
|
||||
function test__InvalidRegistration__FullTree() public {
|
||||
vm.pauseGasMetering();
|
||||
// Register a batch of commitments
|
||||
uint256[] memory commitments = new uint256[](SET_SIZE);
|
||||
uint256[] memory limits = new uint256[](SET_SIZE);
|
||||
|
||||
for (uint256 i = 0; i < commitments.length; i++) {
|
||||
commitments[i] = i + 1;
|
||||
limits[i] = 1;
|
||||
}
|
||||
|
||||
wakuRln.register(commitments, limits);
|
||||
|
||||
vm.resumeGasMetering();
|
||||
vm.expectRevert(FullTree.selector);
|
||||
wakuRln.register(SET_SIZE + 1, 1);
|
||||
}
|
||||
|
||||
function test__InvalidFeatures() public {
|
||||
uint256 idCommitment = 1;
|
||||
vm.expectRevert(NotImplemented.selector);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user