diff --git a/src/test/identity-manager/WorldIDIdentityManagerDataQuery.t.sol b/src/test/identity-manager/WorldIDIdentityManagerDataQuery.t.sol index fa32ab9..74a107f 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerDataQuery.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerDataQuery.t.sol @@ -49,12 +49,8 @@ contract WorldIDIdentityManagerDataQuery is WorldIDIdentityManagerTest { vm.assume(SimpleVerify.isValidInput(uint256(prf[0]))); vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length <= 1000); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -92,12 +88,8 @@ contract WorldIDIdentityManagerDataQuery is WorldIDIdentityManagerTest { vm.assume(newPreRoot != newPostRoot); vm.assume(SimpleVerify.isValidInput(uint256(prf[0]))); vm.assume(identities.length <= 1000); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length])); makeNewIdentityManager( treeDepth, newPreRoot, diff --git a/src/test/identity-manager/WorldIDIdentityManagerGettersSetters.t.sol b/src/test/identity-manager/WorldIDIdentityManagerGettersSetters.t.sol index d3a7d45..f131d8f 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerGettersSetters.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerGettersSetters.t.sol @@ -49,11 +49,10 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { /// identity registration proofs. function testCanSetRegisterIdentitiesVerifierLookupTable() public { // Setup - (VerifierLookupTable insertionVerifiers,,,) = - makeVerifierLookupTables(TC.makeDynArray([40])); - address newVerifiersAddress = address(insertionVerifiers); + (insertVerifiers,,,) = makeVerifierLookupTables(TC.makeDynArray([40])); + address newVerifiersAddress = address(insertVerifiers); bytes memory callData = abi.encodeCall( - ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (insertionVerifiers) + ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (insertVerifiers) ); bytes memory checkCallData = abi.encodeCall(ManagerImplV1.getRegisterIdentitiesVerifierLookupTableAddress, ()); @@ -74,10 +73,9 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { { // Setup vm.assume(notOwner != address(this) && notOwner != address(0x0)); - (VerifierLookupTable insertionVerifiers,,,) = - makeVerifierLookupTables(TC.makeDynArray([40])); + (insertVerifiers,,,) = makeVerifierLookupTables(TC.makeDynArray([40])); bytes memory callData = abi.encodeCall( - ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (insertionVerifiers) + ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (insertVerifiers) ); bytes memory errorData = encodeStringRevert("Ownable: caller is not the owner"); vm.prank(notOwner); @@ -90,12 +88,11 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { /// identity registration unless called via the proxy. function testCannotSetRegisterIdentitiesVerifierLookupTableUnlessViaProxy() public { // Setup - (VerifierLookupTable insertionVerifiers,,,) = - makeVerifierLookupTables(TC.makeDynArray([40])); + (insertVerifiers,,,) = makeVerifierLookupTables(TC.makeDynArray([40])); vm.expectRevert("Function must be called through delegatecall"); // Test - managerImplV2.setRegisterIdentitiesVerifierLookupTable(insertionVerifiers); + managerImplV2.setRegisterIdentitiesVerifierLookupTable(insertVerifiers); } /// @notice Checks that it is possible to get the address of the contract currently being used @@ -124,8 +121,7 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { /// identity deletion proofs. function testCanSetDeleteIdentitiesVerifierLookupTable() public { // Setup - (,, VerifierLookupTable deletionVerifiers,) = - makeVerifierLookupTables(TC.makeDynArray([40])); + (,, deletionVerifiers,) = makeVerifierLookupTables(TC.makeDynArray([40])); address newVerifiersAddress = address(deletionVerifiers); bytes memory callData = abi.encodeCall(ManagerImpl.setDeleteIdentitiesVerifierLookupTable, (deletionVerifiers)); @@ -146,8 +142,7 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { function testCannotSetDeleteIdentitiesVerifierLookupTableUnlessOwner(address notOwner) public { // Setup vm.assume(notOwner != address(this) && notOwner != address(0x0)); - (,, VerifierLookupTable deletionVerifiers,) = - makeVerifierLookupTables(TC.makeDynArray([40])); + (,, deletionVerifiers,) = makeVerifierLookupTables(TC.makeDynArray([40])); bytes memory callData = abi.encodeCall( ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (deletionVerifiers) ); @@ -162,8 +157,7 @@ contract WorldIDIdentityManagerGettersSetters is WorldIDIdentityManagerTest { /// identity deletion unless called via the proxy. function testCannotSetDeleteIdentitiesVerifierLookupTableUnlessViaProxy() public { // Setup - (,, VerifierLookupTable deletionVerifiers,) = - makeVerifierLookupTables(TC.makeDynArray([40])); + (,, deletionVerifiers,) = makeVerifierLookupTables(TC.makeDynArray([40])); vm.expectRevert("Function must be called through delegatecall"); // Test diff --git a/src/test/identity-manager/WorldIDIdentityManagerIdentityDeletion.t.sol b/src/test/identity-manager/WorldIDIdentityManagerIdentityDeletion.t.sol index af666f5..e055393 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerIdentityDeletion.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerIdentityDeletion.t.sol @@ -36,12 +36,8 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { function testDeleteIdentitiesWithCorrectInputsFromKnown() public { // Setup ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([40])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([40])); deletionVerifiers.addVerifier(deletionBatchSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -85,12 +81,8 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { vm.assume(packedDeletionIndices.length <= 125); vm.assume(packedDeletionIndices.length % 4 == 0); vm.assume(identityOperator != nullAddress && identityOperator != thisAddress); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([packedDeletionIndices.length / 4])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([packedDeletionIndices.length / 4])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -132,12 +124,8 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { bytes memory secondIndices = abi.encodePacked(uint32(0), uint32(2), uint32(4), uint32(6)); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([deletionBatchSize, secondIndices.length / 4])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([deletionBatchSize, secondIndices.length / 4])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -180,12 +168,7 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { vm.assume(newPreRoot != newPostRoot); vm.assume(packedDeletionIndices.length > 4); vm.assume(packedDeletionIndices.length % 4 == 0); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = // the -1 offsets the correct batch size by 1 thus causing the error makeVerifierLookupTables(TC.makeDynArray([(packedDeletionIndices.length / 4) - 1])); makeNewIdentityManager( @@ -220,12 +203,8 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { vm.assume(newPreRoot != newPostRoot); ITreeVerifier actualVerifier = new TreeVerifier(); uint32 indicesLength = uint32(packedDeletionIndices.length / 4); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); deletionVerifiers.addVerifier(indicesLength, actualVerifier); makeNewIdentityManager( treeDepth, @@ -253,12 +232,8 @@ contract WorldIDIdentityManagerIdentityDeletion is WorldIDIdentityManagerTest { // Setup vm.assume(newPostRoot != deletionPostRoot && newPostRoot < SNARK_SCALAR_FIELD); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); deletionVerifiers.addVerifier(deletionBatchSize, actualVerifier); makeNewIdentityManager( treeDepth, diff --git a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration.t.sol b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration.t.sol index c08e8e5..03c8e78 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration.t.sol @@ -37,12 +37,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes function testRegisterIdentitiesWithCorrectInputsFromKnown() public { // Setup ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([40])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([40])); insertVerifiers.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -87,12 +83,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length <= 1000); vm.assume(identityOperator != nullAddress && identityOperator != thisAddress); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -136,12 +128,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length <= 1000 && identities.length > 0); uint256 secondIdentsLength = identities.length / 2; - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length, secondIdentsLength])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length, secondIdentsLength])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -190,12 +178,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes vm.assume(SimpleVerify.isValidInput(uint256(prf[0]))); vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length > 0); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length - 1])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length - 1])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -228,12 +212,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes // Setup vm.assume(!SimpleVerify.isValidInput(uint256(prf[0]))); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers.addVerifier(identityCommitments.length, actualVerifier); makeNewIdentityManager( treeDepth, @@ -260,12 +240,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes // Setup vm.assume(newStartIndex != startIndex); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -304,12 +280,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes uint256[] memory identities = cloneArray(identityCommitments); identities[invalidSlot] = identity; ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -338,11 +310,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes managerImplV2 = new ManagerImpl(); managerImplV2Address = address(managerImplV2); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers,) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers.addVerifier(identityCommitmentsSize, actualVerifier); bytes memory callData = abi.encodeCall( @@ -429,12 +398,8 @@ contract WorldIDIdentityManagerIdentityRegistration is WorldIDIdentityManagerTes vm.assume(identitiesLength != 0 && identitiesLength <= 1000); vm.assume(zeroPosition < identitiesLength && zeroPosition > 0); uint256[] memory identities = new uint256[](identitiesLength); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identitiesLength])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identitiesLength])); makeNewIdentityManager( treeDepth, initialRoot, diff --git a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol index 748436a..afada13 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol @@ -37,12 +37,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage function testRegisterIdentitiesWithCorrectInputsFromKnown() public { // Setup ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([40])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([40])); insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -104,12 +100,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length <= 1000); vm.assume(identityOperator != nullAddress && identityOperator != thisAddress); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -169,12 +161,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length <= 1000 && identities.length > 0); uint256 secondIdentsLength = identities.length / 2; - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length, secondIdentsLength])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length, secondIdentsLength])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -242,12 +230,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage vm.assume(SimpleVerify.isValidInput(uint256(prf[0]))); vm.assume(newPreRoot != newPostRoot); vm.assume(identities.length > 0); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identities.length - 1])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identities.length - 1])); makeNewIdentityManager( treeDepth, newPreRoot, @@ -296,12 +280,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage // Setup vm.assume(!SimpleVerify.isValidInput(uint256(prf[0]))); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers4844.addVerifier(identityCommitments.length, actualVerifier); makeNewIdentityManager( treeDepth, @@ -344,12 +324,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage // Setup vm.assume(newStartIndex != startIndex); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -398,12 +374,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage uint256[] memory identities = cloneArray(identityCommitments); identities[invalidSlot] = identity; ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, @@ -448,12 +420,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage managerImplV2 = new ManagerImpl(); managerImplV2Address = address(managerImplV2); ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([70])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([70])); insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); bytes memory callData = abi.encodeCall( @@ -596,12 +564,8 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage vm.assume(identitiesLength != 0 && identitiesLength <= 1000); vm.assume(zeroPosition < identitiesLength && zeroPosition > 0); uint256[] memory identities = new uint256[](identitiesLength); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(TC.makeDynArray([identitiesLength])); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([identitiesLength])); makeNewIdentityManager( treeDepth, initialRoot, @@ -672,18 +636,14 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage function testRegisterIdentitiesWithBadKzgProof() public { // Setup ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertionVerifier4844 - ) = makeVerifierLookupTables(TC.makeDynArray([40])); - insertionVerifier4844.addVerifier(identityCommitmentsSize, actualVerifier); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([40])); + insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, insertionPreRoot, insertVerifiers, - insertionVerifier4844, + insertVerifiers4844, deletionVerifiers, updateVerifiers, semaphoreVerifier @@ -720,18 +680,14 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage function testRegisterIdentitiesWithBadKzgCommitment() public { // Setup ITreeVerifier actualVerifier = new TreeVerifier(); - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertionVerifier4844 - ) = makeVerifierLookupTables(TC.makeDynArray([40])); - insertionVerifier4844.addVerifier(identityCommitmentsSize, actualVerifier); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(TC.makeDynArray([40])); + insertVerifiers4844.addVerifier(identityCommitmentsSize, actualVerifier); makeNewIdentityManager( treeDepth, insertionPreRoot, insertVerifiers, - insertionVerifier4844, + insertVerifiers4844, deletionVerifiers, updateVerifiers, semaphoreVerifier diff --git a/src/test/identity-manager/WorldIDIdentityManagerTest.sol b/src/test/identity-manager/WorldIDIdentityManagerTest.sol index 1739bbe..f1e2be5 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerTest.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerTest.sol @@ -141,6 +141,10 @@ contract WorldIDIdentityManagerTest is WorldIDTest { VerifierLookupTable4844 internal defaultInsertVerifiers4844; VerifierLookupTable internal defaultDeletionVerifiers; VerifierLookupTable internal defaultUpdateVerifiers; + VerifierLookupTable insertVerifiers; + VerifierLookupTable deletionVerifiers; + VerifierLookupTable updateVerifiers; + VerifierLookupTable4844 insertVerifiers4844; /////////////////////////////////////////////////////////////////////////////// /// TEST ORCHESTRATION /// @@ -274,31 +278,25 @@ contract WorldIDIdentityManagerTest is WorldIDTest { /// @dev It is initialised in the globals. /// /// @param actualPreRoot The pre-root to use. - /// @param insertVerifiers The insertion verifier lookup table. - /// @param insertVerifiers4844 The insertion verifier lookup table for EIP-4844 proofs. - /// @param updateVerifiers The udpate verifier lookup table. - /// @param actualSemaphoreVerifier The Semaphore verifier instance to use. + /// @param insertVer The insertion verifier lookup table. + /// @param insertVer4844 The insertion verifier lookup table for EIP-4844 proofs. + /// @param updateVer The update verifier lookup table. + /// @param actualSemaphoreVer The Semaphore verifier instance to use. function makeNewIdentityManager( uint8 actualTreeDepth, uint256 actualPreRoot, - VerifierLookupTable insertVerifiers, - VerifierLookupTable4844 insertVerifiers4844, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - ISemaphoreVerifier actualSemaphoreVerifier + VerifierLookupTable insertVer, + VerifierLookupTable4844 insertVer4844, + VerifierLookupTable deletionVer, + VerifierLookupTable updateVer, + ISemaphoreVerifier actualSemaphoreVer ) public { managerImplV1 = new ManagerImplV1(); managerImplV1Address = address(managerImplV1); bytes memory initCallData = abi.encodeCall( ManagerImplV1.initialize, - ( - actualTreeDepth, - actualPreRoot, - insertVerifiers, - updateVerifiers, - actualSemaphoreVerifier - ) + (actualTreeDepth, actualPreRoot, insertVer, updateVer, actualSemaphoreVer) ); identityManager = new IdentityManager(managerImplV1Address, initCallData); @@ -308,7 +306,7 @@ contract WorldIDIdentityManagerTest is WorldIDTest { managerImplV2 = new ManagerImpl(); managerImplV2Address = address(managerImplV2); - bytes memory initCallV2 = abi.encodeCall(managerImplV2.initializeV2, (deletionVerifiers)); + bytes memory initCallV2 = abi.encodeCall(managerImplV2.initializeV2, (deletionVer)); bytes memory upgradeCallV2 = abi.encodeCall( UUPSUpgradeable.upgradeToAndCall, (address(managerImplV2Address), initCallV2) ); @@ -320,7 +318,7 @@ contract WorldIDIdentityManagerTest is WorldIDTest { managerImplV3 = new ManagerImplV3(); managerImplV3Address = address(managerImplV3); - bytes memory initCallV3 = abi.encodeCall(managerImplV3.initializeV3, (insertVerifiers4844)); + bytes memory initCallV3 = abi.encodeCall(managerImplV3.initializeV3, (insertVer4844)); bytes memory upgradeCallV3 = abi.encodeCall( UUPSUpgradeable.upgradeToAndCall, (address(managerImplV3Address), initCallV3) ); @@ -339,12 +337,8 @@ contract WorldIDIdentityManagerTest is WorldIDTest { /// @custom:reverts string If any batch size exceeds 1000. /// @custom:reverts string If `batchSizes` is empty. function makeNewIdentityManager(uint256 actualPreRoot, uint256[] calldata batchSizes) public { - ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 - ) = makeVerifierLookupTables(batchSizes); + (insertVerifiers, deletionVerifiers, updateVerifiers, insertVerifiers4844) = + makeVerifierLookupTables(batchSizes); defaultInsertVerifiers = insertVerifiers; defaultDeletionVerifiers = deletionVerifiers; defaultUpdateVerifiers = updateVerifiers; @@ -366,10 +360,10 @@ contract WorldIDIdentityManagerTest is WorldIDTest { /// @param batchSizes The batch sizes to create verifiers for. Verifiers will be created for /// both insertions and updates. Must be non-empty and contain no duplicates. /// - /// @return insertVerifiers The insertion verifier lookup table. - /// @return deletionVerifiers The deletion verifier lookup table. - /// @return updateVerifiers The update verifier lookup table. - /// @return insertVerifiers4844 The insertion verifier lookup table for EIP-4844 proofs. + /// @return insertVer The insertion verifier lookup table. + /// @return deletionVer The deletion verifier lookup table. + /// @return updateVer The update verifier lookup table. + /// @return insertVer4844 The insertion verifier lookup table for EIP-4844 proofs. /// /// @custom:reverts VerifierExists If `batchSizes` contains a duplicate. /// @custom:reverts string If any batch size exceeds 1000. @@ -377,10 +371,10 @@ contract WorldIDIdentityManagerTest is WorldIDTest { function makeVerifierLookupTables(uint256[] memory batchSizes) public returns ( - VerifierLookupTable insertVerifiers, - VerifierLookupTable deletionVerifiers, - VerifierLookupTable updateVerifiers, - VerifierLookupTable4844 insertVerifiers4844 + VerifierLookupTable insertVer, + VerifierLookupTable deletionVer, + VerifierLookupTable updateVer, + VerifierLookupTable4844 insertVer4844 ) { // Construct the verifier LUTs from the provided `batchSizes` info. @@ -390,10 +384,10 @@ contract WorldIDIdentityManagerTest is WorldIDTest { if (batchSizes[0] > 1000) { revert("batch size greater than 1000."); } - insertVerifiers = new VerifierLookupTable(); - deletionVerifiers = new VerifierLookupTable(); - updateVerifiers = new VerifierLookupTable(); - insertVerifiers4844 = new VerifierLookupTable4844(); + insertVer = new VerifierLookupTable(); + deletionVer = new VerifierLookupTable(); + updateVer = new VerifierLookupTable(); + insertVer4844 = new VerifierLookupTable4844(); for (uint256 i = 0; i < batchSizes.length; ++i) { uint256 batchSize = batchSizes[i]; if (batchSize > 1000) { @@ -401,12 +395,12 @@ contract WorldIDIdentityManagerTest is WorldIDTest { } ITreeVerifier batchVerifier = new SimpleVerifier(batchSize); - insertVerifiers.addVerifier(batchSize, batchVerifier); - deletionVerifiers.addVerifier(batchSize, batchVerifier); - updateVerifiers.addVerifier(batchSize, batchVerifier); + insertVer.addVerifier(batchSize, batchVerifier); + deletionVer.addVerifier(batchSize, batchVerifier); + updateVer.addVerifier(batchSize, batchVerifier); ITreeVerifier4844 batchVerifier4844 = new SimpleVerifier4844(batchSize); - insertVerifiers4844.addVerifier(batchSize, batchVerifier4844); + insertVer4844.addVerifier(batchSize, batchVerifier4844); } } diff --git a/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol b/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol index bb580ce..e64927a 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol @@ -123,7 +123,7 @@ contract WorldIDIdentityManagerUninit is WorldIDIdentityManagerTest { function testShouldNotCallSetRegisterIdentitiesVerifierLookupTableWhileUninit() public { // Setup makeUninitIdentityManager(); - (VerifierLookupTable insertVerifiers,,,) = makeVerifierLookupTables(TC.makeDynArray([75])); + (insertVerifiers,,,) = makeVerifierLookupTables(TC.makeDynArray([75])); bytes memory callData = abi.encodeCall( ManagerImplV1.setRegisterIdentitiesVerifierLookupTable, (insertVerifiers) ); @@ -153,8 +153,7 @@ contract WorldIDIdentityManagerUninit is WorldIDIdentityManagerTest { function testShouldNotCallSetDeleteIdentitiesVerifierLookupTableWhileUninit() public { // Setup makeUninitIdentityManager(); - (,, VerifierLookupTable deletionVerifiers,) = - makeVerifierLookupTables(TC.makeDynArray([75])); + (,, deletionVerifiers,) = makeVerifierLookupTables(TC.makeDynArray([75])); bytes memory callData = abi.encodeCall(ManagerImpl.setDeleteIdentitiesVerifierLookupTable, (deletionVerifiers)); bytes memory expectedError =