From 198d00ca556516c8b435d24fcc8b19c071ce824f Mon Sep 17 00:00:00 2001 From: Wojciech Zmuda Date: Fri, 23 Aug 2024 01:02:55 +0200 Subject: [PATCH] 4844 tests to dedicated contract: testCannotRegisterIdentitiesIfNotViaProxy --- ...ntityManagerIdentityRegistration4844.t.sol | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol index 596a1f8..9a1e0bc 100644 --- a/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol +++ b/src/test/identity-manager/WorldIDIdentityManagerIdentityRegistration4844.t.sol @@ -621,4 +621,30 @@ contract WorldIDIdentityManagerIdentityRegistration4844 is WorldIDIdentityManage // Test assertCallSucceedsOn(identityManagerAddress, callData, new bytes(0)); } + + /// @notice Tests that identities can only be registered through the proxy. + function testCannotRegisterIdentitiesIfNotViaProxy() public { + // Setup + address expectedOwner = managerImplV3.owner(); + vm.expectRevert("Function must be called through delegatecall"); + vm.prank(expectedOwner); + + // Test + ManagerImplV3.RegisterIdentities4844Params memory params = ManagerImplV3.RegisterIdentities4844Params({ + insertionProof: insertionProof, + commitments: commitments, + commitmentPok: commitmentsPok, + kzgCommitment: kzgCommitment, + kzgProof: kzgProof, + expectedEvaluation: insertionExpectedEvaluation, + preRoot: initialRoot, + postRoot: insertionPostRoot, + kzgChallenge: kzgChallenge, + inputHash: insertionInputHash4844, + batchSize: uint32(identityCommitments.length), + startIndex: startIndex + }); + + managerImplV3.registerIdentities(params); + } }