Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/v3.2 #127

Merged
merged 9 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@ forge test
MIT

## Addresses

<details>
<summary>v3.2</summary>

| Name | Address |
| -------------------- | ------------------------------------------ |
| Meta Factory | [0xd703aaE79538628d27099B8c4f621bE4CCd142d5](https://contractscan.xyz/contract/0xd703aae79538628d27099b8c4f621be4ccd142d5) |
| Factory | [0x4600A1e70fB9e4C9A3feC6d9105f6807aDEACbe2](https://contractscan.xyz/contract/0x4600A1e70fB9e4C9A3feC6d9105f6807aDEACbe2) |
| Kernel | [0x97EBdCa9c606d493daD1bE10188Dd78cadB2a139](https://contractscan.xyz/contract/0x97EBdCa9c606d493daD1bE10188Dd78cadB2a139) |
| Factory | [0x7a1dBAB750f12a90EB1B60D2Ae3aD17D4D81EfFe](https://contractscan.xyz/contract/0x7a1dBAB750f12a90EB1B60D2Ae3aD17D4D81EfFe) |
| Kernel | [0xD830D15D3dc0C269F3dBAa0F3e8626d33CFdaBe1](https://contractscan.xyz/contract/0xD830D15D3dc0C269F3dBAa0F3e8626d33CFdaBe1) |

</details>

Expand Down
124 changes: 124 additions & 0 deletions broadcast/DeployKernel.s.sol/11155111/run-1733880637.json

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions broadcast/DeployKernel.s.sol/11155111/run-1733885191.json

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions broadcast/DeployKernel.s.sol/11155111/run-1733885257.json

Large diffs are not rendered by default.

124 changes: 124 additions & 0 deletions broadcast/DeployKernel.s.sol/11155111/run-1733940034.json

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions broadcast/DeployKernel.s.sol/11155111/run-latest.json

Large diffs are not rendered by default.

142 changes: 142 additions & 0 deletions broadcast/DeployKernel.s.sol/84532/run-latest.json

Large diffs are not rendered by default.

43 changes: 15 additions & 28 deletions src/Kernel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
MAGIC_VALUE_SIG_REPLAYABLE
} from "./types/Constants.sol";

import {InstallExecutorDataFormat, InstallFallbackDataFormat, InstallValidatorDataFormat} from "./types/Structs.sol";

contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager {
error ExecutionReverted();
error InvalidExecutor();
Expand Down Expand Up @@ -357,45 +359,30 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
}
ValidationConfig memory config =
ValidationConfig({nonce: vs.currentNonce, hook: IHook(address(bytes20(initData[0:20])))});
bytes calldata validatorData;
bytes calldata hookData;
bytes calldata selectorData;
InstallValidatorDataFormat calldata data;
assembly {
validatorData.offset := add(add(initData.offset, 52), calldataload(add(initData.offset, 20)))
validatorData.length := calldataload(sub(validatorData.offset, 32))
hookData.offset := add(add(initData.offset, 52), calldataload(add(initData.offset, 52)))
hookData.length := calldataload(sub(hookData.offset, 32))
selectorData.offset := add(add(initData.offset, 52), calldataload(add(initData.offset, 84)))
selectorData.length := calldataload(sub(selectorData.offset, 32))
data := add(initData.offset, 20)
}
_installValidation(vId, config, validatorData, hookData);
if (selectorData.length == 4) {
_installValidation(vId, config, data.validatorData, data.hookData);
if (data.selectorData.length == 4) {
// NOTE: we don't allow configure on selector data on v3.1+, but using bytes instead of bytes4 for selector data to make sure we are future proof
_setSelector(vId, bytes4(selectorData[0:4]), true);
_setSelector(vId, bytes4(data.selectorData[0:4]), true);
}
} else if (moduleType == MODULE_TYPE_EXECUTOR) {
bytes calldata executorData;
bytes calldata hookData;
InstallExecutorDataFormat calldata data;
assembly {
executorData.offset := add(add(initData.offset, 52), calldataload(add(initData.offset, 20)))
executorData.length := calldataload(sub(executorData.offset, 32))
hookData.offset := add(add(initData.offset, 52), calldataload(add(initData.offset, 52)))
hookData.length := calldataload(sub(hookData.offset, 32))
data := add(initData.offset, 20)
}
IHook hook = IHook(address(bytes20(initData[0:20])));
_installExecutor(IExecutor(module), executorData, hook);
_installHook(hook, hookData);
_installExecutor(IExecutor(module), data.executorData, hook);
_installHook(hook, data.hookData);
} else if (moduleType == MODULE_TYPE_FALLBACK) {
bytes calldata selectorData;
bytes calldata hookData;
InstallFallbackDataFormat calldata data;
assembly {
selectorData.offset := add(add(initData.offset, 56), calldataload(add(initData.offset, 24)))
selectorData.length := calldataload(sub(selectorData.offset, 32))
hookData.offset := add(add(initData.offset, 56), calldataload(add(initData.offset, 56)))
hookData.length := calldataload(sub(hookData.offset, 32))
data := add(initData.offset, 24)
}
_installSelector(bytes4(initData[0:4]), module, IHook(address(bytes20(initData[4:24]))), selectorData);
_installHook(IHook(address(bytes20(initData[4:24]))), hookData);
_installSelector(bytes4(initData[0:4]), module, IHook(address(bytes20(initData[4:24]))), data.selectorData);
_installHook(IHook(address(bytes20(initData[4:24]))), data.hookData);
} else if (moduleType == MODULE_TYPE_HOOK) {
// force call onInstall for hook
// NOTE: for hook, kernel does not support independent hook install,
Expand Down
2 changes: 1 addition & 1 deletion src/core/ExecutorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract contract ExecutorManager {
function _installExecutor(IExecutor executor, bytes calldata executorData, IHook hook) internal {
_installExecutorWithoutInit(executor, hook);
if (executorData.length == 0) {
(bool success,) = address(executor).call(abi.encodeWithSelector(IModule.onInstall.selector, hex""));
(bool success,) = address(executor).call(abi.encodeWithSelector(IModule.onInstall.selector, hex"")); // ignore return value
} else {
executor.onInstall(executorData);
}
Expand Down
Loading
Loading