From 30d32f68bd953f7355e00d36600c27ee97872e21 Mon Sep 17 00:00:00 2001 From: leekt Date: Wed, 8 May 2024 01:50:33 +0900 Subject: [PATCH] fix : do propor posthook routing if hook is 0xff and check testcase works properly --- src/Kernel.sol | 4 +++- src/sdk/KernelTestBase.sol | 2 ++ src/validator/ECDSAValidator.sol | 1 - src/validator/MultiSignatureECDSAValidator.sol | 1 - 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Kernel.sol b/src/Kernel.sol index f516dc6..ded5d5c 100644 --- a/src/Kernel.sol +++ b/src/Kernel.sol @@ -170,7 +170,9 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager } else { revert NotSupportedCallType(); } - if (address(config.hook) != address(1)) { + if ( + address(config.hook) != address(1) && address(config.hook) != 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF + ) { _doPostHook(config.hook, context); } } diff --git a/src/sdk/KernelTestBase.sol b/src/sdk/KernelTestBase.sol index 32fc2ad..2edca6e 100644 --- a/src/sdk/KernelTestBase.sol +++ b/src/sdk/KernelTestBase.sol @@ -705,6 +705,8 @@ abstract contract KernelTestBase is Test { ); PackedUserOperation[] memory ops = new PackedUserOperation[](1); ops[0] = op; + vm.expectEmit(address(kernel)); + emit MockAction.MockActionEvent(address(kernel)); entrypoint.handleOps(ops, payable(address(0xdeadbeef))); } diff --git a/src/validator/ECDSAValidator.sol b/src/validator/ECDSAValidator.sol index 4d9e98c..d5a4a65 100644 --- a/src/validator/ECDSAValidator.sol +++ b/src/validator/ECDSAValidator.sol @@ -24,7 +24,6 @@ contract ECDSAValidator is IValidator, IHook { mapping(address => ECDSAValidatorStorage) public ecdsaValidatorStorage; function onInstall(bytes calldata _data) external payable override { - if (_isInitialized(msg.sender)) revert AlreadyInitialized(msg.sender); address owner = address(bytes20(_data[0:20])); ecdsaValidatorStorage[msg.sender].owner = owner; emit OwnerRegistered(msg.sender, owner); diff --git a/src/validator/MultiSignatureECDSAValidator.sol b/src/validator/MultiSignatureECDSAValidator.sol index 98121e4..7c8ae6a 100644 --- a/src/validator/MultiSignatureECDSAValidator.sol +++ b/src/validator/MultiSignatureECDSAValidator.sol @@ -25,7 +25,6 @@ contract MultiSignatureECDSAValidator is IValidator, IHook { mapping(address => ECDSAValidatorStorage) public ecdsaValidatorStorage; function onInstall(bytes calldata _data) external payable override { - if (_isInitialized(msg.sender)) revert AlreadyInitialized(msg.sender); address owner = address(bytes20(_data[0:20])); ecdsaValidatorStorage[msg.sender].owner = owner; emit OwnerRegistered(msg.sender, owner);