Skip to content

Commit

Permalink
test: fix flaky fuzz tests hitting the default operator who is alread…
Browse files Browse the repository at this point in the history
…y registered (#256)
  • Loading branch information
stevennevins authored May 14, 2024
1 parent c5b419a commit a23de11
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions test/unit/BLSApkRegistryUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ contract BLSApkRegistryUnitTests_registerBLSPublicKey is

function testFuzz_registerOperator_Revert_WhenZeroPubkeyHash(
address operator
) public {
) public filterFuzzedAddressInputs(operator) {
pubkeyRegistrationParams.pubkeyG1.X = 0;
pubkeyRegistrationParams.pubkeyG1.Y = 0;
BN254.G1Point memory messageHash = registryCoordinator
Expand All @@ -365,7 +365,7 @@ contract BLSApkRegistryUnitTests_registerBLSPublicKey is

function testFuzz_registerOperator_Revert_WhenOperatorAlreadyRegistered(
address operator
) public {
) public filterFuzzedAddressInputs(operator) {
pubkeyRegistrationParams.pubkeyRegistrationSignature = _signMessage(
operator
);
Expand All @@ -392,7 +392,11 @@ contract BLSApkRegistryUnitTests_registerBLSPublicKey is
function testFuzz_registerOperator_Revert_WhenPubkeyAlreadyRegistered(
address operator,
address operator2
) public {
)
public
filterFuzzedAddressInputs(operator)
filterFuzzedAddressInputs(operator2)
{
cheats.assume(operator != address(0));
cheats.assume(operator != operator2);
BN254.G1Point memory messageHash = registryCoordinator
Expand Down Expand Up @@ -425,7 +429,11 @@ contract BLSApkRegistryUnitTests_registerBLSPublicKey is
function testFuzz_registerOperator_Revert_WhenInvalidSignature(
address operator,
address invalidOperator
) public {
)
public
filterFuzzedAddressInputs(operator)
filterFuzzedAddressInputs(invalidOperator)
{
cheats.assume(invalidOperator != operator);
BN254.G1Point memory messageHash = registryCoordinator
.pubkeyRegistrationMessageHash(operator);
Expand Down

0 comments on commit a23de11

Please sign in to comment.