Skip to content

Commit

Permalink
Fix/posthook 0xff (#113)
Browse files Browse the repository at this point in the history
* v3.1 rc1

* fix : do propor posthook routing if hook is 0xff and check testcase works properly
  • Loading branch information
leekt authored May 7, 2024
1 parent e18c700 commit 6681a2b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Kernel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/sdk/KernelTestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
}

Expand Down
1 change: 0 additions & 1 deletion src/validator/ECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/validator/MultiSignatureECDSAValidator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6681a2b

Please sign in to comment.