@@ -84,7 +84,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
8484 if (validator.isModuleType (4 )) {
8585 bytes memory ret = IHook (address (validator)).preCheck (msg .sender , msg .value , msg .data );
8686 _;
87- IHook (address (validator)).postCheck (ret);
87+ IHook (address (validator)).postCheck (ret, true , hex "" ); // TODO don't support try catch hook here
8888 } else {
8989 revert InvalidCaller ();
9090 }
@@ -121,28 +121,6 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
121121 }
122122 }
123123
124- function changeRootValidator (
125- ValidationId _rootValidator ,
126- IHook hook ,
127- bytes calldata validatorData ,
128- bytes calldata hookData
129- ) external payable onlyEntryPointOrSelfOrRoot {
130- ValidationStorage storage vs = _validationStorage ();
131- if (ValidationId.unwrap (_rootValidator) == bytes21 (0 )) {
132- revert InvalidValidator ();
133- }
134- ValidationType vType = ValidatorLib.getType (_rootValidator);
135- if (vType != VALIDATION_TYPE_VALIDATOR && vType != VALIDATION_TYPE_PERMISSION) {
136- revert InvalidValidationType ();
137- }
138- _setRootValidator (_rootValidator);
139- if (_validationStorage ().validationConfig[_rootValidator].hook == IHook (address (0 ))) {
140- // when new rootValidator is not installed yet
141- ValidationConfig memory config = ValidationConfig ({nonce: uint32 (vs.currentNonce), hook: hook});
142- _installValidation (_rootValidator, config, validatorData, hookData);
143- }
144- }
145-
146124 function upgradeTo (address _newImplementation ) external payable onlyEntryPointOrSelfOrRoot {
147125 assembly {
148126 sstore (ERC1967_IMPLEMENTATION_SLOT , _newImplementation)
@@ -184,16 +162,8 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
184162 } else {
185163 // action installed
186164 bytes memory context;
187- if (
188- address (config.hook) != address (1 ) && address (config.hook) != 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
189- ) {
165+ if (address (config.hook) != address (1 )) {
190166 context = _doPreHook (config.hook, msg .value , msg .data );
191- } else if (address (config.hook) == 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF ) {
192- // for selector manager, address(0) for the hook will default to type(address).max,
193- // and this will only allow entrypoints to interact
194- if (msg .sender != address (entrypoint)) {
195- revert InvalidCaller ();
196- }
197167 }
198168 // execute action
199169 if (config.callType == CALLTYPE_SINGLE) {
@@ -203,10 +173,8 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
203173 } else {
204174 revert NotSupportedCallType ();
205175 }
206- if (
207- address (config.hook) != address (1 ) && address (config.hook) != 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF
208- ) {
209- _doPostHook (config.hook, context);
176+ if (address (config.hook) != address (1 )) {
177+ _doPostHook (config.hook, context, success, result);
210178 }
211179 }
212180 if (! success) {
@@ -290,7 +258,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
290258 }
291259 (bool success , bytes memory ret ) = ExecLib.executeDelegatecall (address (this ), userOp.callData[4 :]);
292260 if (address (hook) != address (1 )) {
293- _doPostHook (hook, context);
261+ _doPostHook (hook, context, success, ret );
294262 } else if (! success) {
295263 revert ExecutionReverted ();
296264 }
@@ -312,7 +280,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
312280 }
313281 returnData = ExecLib.execute (execMode, executionCalldata);
314282 if (address (hook) != address (1 )) {
315- _doPostHook (hook, context);
283+ _doPostHook (hook, context, true , abi.encode (returnData) );
316284 }
317285 }
318286
@@ -361,14 +329,11 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
361329 ValidationConfig ({nonce: vs.currentNonce, hook: IHook (address (bytes20 (initData[0 :20 ])))});
362330 bytes calldata validatorData;
363331 bytes calldata hookData;
364- bytes calldata selectorData;
365332 assembly {
366333 validatorData.offset := add (add (initData.offset, 52 ), calldataload (add (initData.offset, 20 )))
367334 validatorData.length := calldataload (sub (validatorData.offset, 32 ))
368335 hookData.offset := add (add (initData.offset, 52 ), calldataload (add (initData.offset, 52 )))
369336 hookData.length := calldataload (sub (hookData.offset, 32 ))
370- selectorData.offset := add (add (initData.offset, 52 ), calldataload (add (initData.offset, 84 )))
371- selectorData.length := calldataload (sub (selectorData.offset, 32 ))
372337 }
373338 _installValidation (vId, config, validatorData, hookData);
374339 if (selectorData.length == 4 ) {
@@ -525,7 +490,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
525490 }
526491
527492 function accountId () external pure override returns (string memory accountImplementationId ) {
528- return "kernel.advanced.v0.3.1 " ;
493+ return "kernel.advanced.v0.3.0-beta " ;
529494 }
530495
531496 function supportsExecutionMode (ExecMode mode ) external pure override returns (bool ) {
0 commit comments