diff --git a/src/test/identity-manager/WorldIDIdentityManagerTest.sol b/src/test/identity-manager/WorldIDIdentityManagerTest.sol index b884145..b7e72da 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerTest.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerTest.sol @@ -60,6 +60,8 @@ contract WorldIDIdentityManagerTest is WorldIDTest { uint256 identityCommitmentsSize = 3; uint256[8] proof; + uint32[] deletionIndices = [0, 1, 2]; + // Needed for testing things. uint256 internal constant SNARK_SCALAR_FIELD = 21888242871839275222246405745257275088548364400416034343698204186575808495617; diff --git a/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol b/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol index 4161677..20ecb65 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerUninit.t.sol @@ -36,6 +36,22 @@ contract WorldIDIdentityManagerUninit is WorldIDIdentityManagerTest { assertCallFailsOn(identityManagerAddress, callData, expectedError); } + /// @notice Checks that it is impossible to call `deleteIdentities` while the contract is not + /// initialised. + function testShouldNotCallDeleteIdentitiesWhileUninit() public { + // Setup + makeUninitIdentityManager(); + bytes memory callData = abi.encodeCall( + ManagerImpl.deleteIdentities, + (proof, preRoot, deletionIndices, postRoot) + ); + bytes memory expectedError = + abi.encodeWithSelector(CheckInitialized.ImplementationNotInitialized.selector); + + // Test + assertCallFailsOn(identityManagerAddress, callData, expectedError); + } + /// @notice Checks that it is impossible to call `updateIdentities` while the contract is not /// initialised. function testShouldNotCallUpdateIdentitiesWhileUninit( @@ -118,7 +134,7 @@ contract WorldIDIdentityManagerUninit is WorldIDIdentityManagerTest { /// @notice Checks that it is impossible to call `getRegisterIdentitiesVerifierLookupTableAddress` /// while the contract is not initialized. - function testShouldNotCallgetRegisterIdentitiesVerifierLookupTableAddressWhileUninit() public { + function testShouldNotCallGetRegisterIdentitiesVerifierLookupTableAddressWhileUninit() public { // Setup makeUninitIdentityManager(); bytes memory callData = @@ -146,6 +162,36 @@ contract WorldIDIdentityManagerUninit is WorldIDIdentityManagerTest { assertCallFailsOn(identityManagerAddress, callData, expectedError); } + /// @notice Checks that it is impossible to call `getDeleteIdentitiesVerifierLookupTableAddress` + /// while the contract is not initialized. + function testShouldNotCallGetDeleteIdentitiesVerifierLookupTableAddressWhileUninit() public { + // Setup + makeUninitIdentityManager(); + bytes memory callData = + abi.encodeCall(ManagerImpl.getDeleteIdentitiesVerifierLookupTableAddress, ()); + bytes memory expectedError = + abi.encodeWithSelector(CheckInitialized.ImplementationNotInitialized.selector); + + // Test + assertCallFailsOn(identityManagerAddress, callData, expectedError); + } + + /// @notice Checks that it is impossible to call `setDeleteIdentitiesVerifierLookupTable` + /// while the contract is not initialized. + function testShouldNotCallSetDeleteIdentitiesVerifierLookupTableWhileUninit() public { + // Setup + makeUninitIdentityManager(); + (,VerifierLookupTable deletionVerifiers ,) = makeVerifierLookupTables(TC.makeDynArray([75])); + bytes memory callData = abi.encodeCall( + ManagerImpl.setDeleteIdentitiesVerifierLookupTable, (deletionVerifiers) + ); + bytes memory expectedError = + abi.encodeWithSelector(CheckInitialized.ImplementationNotInitialized.selector); + + // Test + assertCallFailsOn(identityManagerAddress, callData, expectedError); + } + /// @notice Checks that it is impossible to call `getIdentityUpdateVerifierLookupTableAddress` /// while the contract is not initialized. function testShouldNotCallGetIdentityUpdateVerifierLookupTableAddressWhileUninit() public {