From d83d463904fe35f6d369a44529e132d8e8640796 Mon Sep 17 00:00:00 2001 From: Jay Paik Date: Mon, 25 Nov 2024 14:03:10 -0500 Subject: [PATCH] fix: [ALC-2] check paymaster address in hook as well (#309) --- src/modules/permissions/PaymasterGuardModule.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/permissions/PaymasterGuardModule.sol b/src/modules/permissions/PaymasterGuardModule.sol index c7d905ed..493a0c9b 100644 --- a/src/modules/permissions/PaymasterGuardModule.sol +++ b/src/modules/permissions/PaymasterGuardModule.sol @@ -65,11 +65,13 @@ contract PaymasterGuardModule is ModuleBase, IValidationHookModule { returns (uint256) { address payingPaymaster = address(bytes20(userOp.paymasterAndData[:20])); - if (payingPaymaster == paymasters[entityId][msg.sender]) { - return 0; - } else { + if (payingPaymaster == address(0)) { + revert InvalidPaymaster(); + } + if (payingPaymaster != paymasters[entityId][msg.sender]) { revert BadPaymasterSpecified(); } + return 0; } /// @inheritdoc IValidationHookModule