Skip to content

Commit

Permalink
update invalid nullifier leading zeros test
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKitsune committed Dec 30, 2024
1 parent 3ffb260 commit 5ec753e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion contracts/src/helpers/PBHExternalNullifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import "@BokkyPooBahsDateTimeLibrary/BokkyPooBahsDateTimeLibrary.sol";
/// - Bits 0-7: Version

//TODO: move this to a lib dir
// TODO:
library PBHExternalNullifier {
/// @notice Thrown when the provided external nullifier doesn't
/// contain the correct leading zeros
Expand Down
7 changes: 5 additions & 2 deletions contracts/test/PBHExternalNullifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ contract PBHExternalNullifierTest is Test {
PBHExternalNullifier.verify(encoded, maxPbh);
}

// TODO:
function testFuzz_verify_RevertIf_InvalidNullifierLeadingZeros() public {}
function testFuzz_verify_RevertIf_InvalidNullifierLeadingZeros(uint256 encoded) public {
vm.assume(encoded > type(uint40).max);
vm.expectRevert(PBHExternalNullifier.InvalidExternalNullifierLeadingZeros.selector);
PBHExternalNullifier.verify(encoded, 30);
}

function testFuzz_verify_RevertIf_InvalidExternalNullifierVersion(uint8 pbhVersion) public {
vm.assume(pbhVersion != PBHExternalNullifier.V1);
Expand Down

0 comments on commit 5ec753e

Please sign in to comment.