From 1e04673fa79da5cf4c4a5dbda952b2d7b0639024 Mon Sep 17 00:00:00 2001 From: 0xOsiris Date: Mon, 30 Dec 2024 13:06:43 -0700 Subject: [PATCH] chore: restrict verify proof interface to view --- src/interfaces/IWorldID.sol | 2 +- src/test/mock/SimpleStateBridge.sol | 9 +++------ src/test/router/WorldIDRouterStateBridge.t.sol | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/interfaces/IWorldID.sol b/src/interfaces/IWorldID.sol index 9266d15..4008725 100644 --- a/src/interfaces/IWorldID.sol +++ b/src/interfaces/IWorldID.sol @@ -25,5 +25,5 @@ interface IWorldID is IBaseWorldID { uint256 nullifierHash, uint256 externalNullifierHash, uint256[8] calldata proof - ) external; + ) external view; } diff --git a/src/test/mock/SimpleStateBridge.sol b/src/test/mock/SimpleStateBridge.sol index f1485bc..aff6f4e 100644 --- a/src/test/mock/SimpleStateBridge.sol +++ b/src/test/mock/SimpleStateBridge.sol @@ -20,16 +20,13 @@ contract SimpleStateBridge is IBridge, IWorldID { emit SetRootHistoryExpiry(expiryTime); } - event ProofVerified(uint256 indexed root); - error ProofNotVerified(); - function verifyProof(uint256 root, uint256, uint256, uint256, uint256[8] calldata proof) + function verifyProof(uint256, uint256, uint256, uint256, uint256[8] calldata proof) external + pure { - if (proof[0] % 2 == 0) { - emit ProofVerified(root); - } else { + if (proof[0] % 2 != 0) { revert ProofNotVerified(); } } diff --git a/src/test/router/WorldIDRouterStateBridge.t.sol b/src/test/router/WorldIDRouterStateBridge.t.sol index 1c7621f..1a6a1fc 100644 --- a/src/test/router/WorldIDRouterStateBridge.t.sol +++ b/src/test/router/WorldIDRouterStateBridge.t.sol @@ -90,10 +90,7 @@ contract WorldIDRouterStateBridge is WorldIDRouterTest { bool shouldSucceed = proof[0] % 2 == 0; bytes memory errorData = new bytes(0); - if (shouldSucceed) { - vm.expectEmit(true, true, true, true); - emit ProofVerified(root); - } else { + if (!shouldSucceed) { errorData = abi.encodeWithSelector(SimpleStateBridge.ProofNotVerified.selector); }