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 #124

Merged
merged 11 commits into from
Dec 7, 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
73 changes: 42 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,26 @@ 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) |

</details>

<details>
<summary>v3.1</summary>

| Name | Address |
| -------------------- | ------------------------------------------ |
| Meta Factory | 0xd703aaE79538628d27099B8c4f621bE4CCd142d5 |
| Factory | 0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419 |
| Kernel | 0xBAC849bB641841b44E965fB01A4Bf5F074f84b4D |
| ECDSA Validator | 0x845ADb2C711129d4f3966735eD98a9F09fC4cE57 |
| Meta Factory | [0xd703aaE79538628d27099B8c4f621bE4CCd142d5](https://contractscan.xyz/contract/0xd703aae79538628d27099b8c4f621be4ccd142d5) |
| Factory | [0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419](https://contractscan.xyz/contract/0xaac5d4240af87249b3f71bc8e4a2cae074a3e419) |
| Kernel | [0xBAC849bB641841b44E965fB01A4Bf5F074f84b4D](https://contractscan.xyz/contract/0xbac849bb641841b44e965fb01a4bf5f074f84b4d) |
| ECDSA Validator | [0x845ADb2C711129d4f3966735eD98a9F09fC4cE57](https://contractscan.xyz/contract/0x845adb2c711129d4f3966735ed98a9f09fc4ce57) |

</details>

Expand All @@ -54,10 +65,10 @@ MIT

| Name | Address |
| -------------------- | ------------------------------------------ |
| Meta Factory | 0xd703aaE79538628d27099B8c4f621bE4CCd142d5 |
| Factory | 0x6723b44Abeec4E71eBE3232BD5B455805baDD22f |
| Kernel | 0x94F097E1ebEB4ecA3AAE54cabb08905B239A7D27 |
| ECDSA Validator | 0x8104e3Ad430EA6d354d013A6789fDFc71E671c43 |
| Meta Factory | [0xd703aaE79538628d27099B8c4f621bE4CCd142d5](https://contractscan.xyz/contract/0xd703aae79538628d27099b8c4f621be4ccd142d5) |
| Factory | [0x6723b44Abeec4E71eBE3232BD5B455805baDD22f](https://contractscan.xyz/contract/0x6723b44abeec4e71ebe3232bd5b455805badd22f) |
| Kernel | [0x94F097E1ebEB4ecA3AAE54cabb08905B239A7D27](https://contractscan.xyz/contract/0x94f097e1ebeb4eca3aae54cabb08905b239a7d27) |
| ECDSA Validator | [0x8104e3Ad430EA6d354d013A6789fDFc71E671c43](https://contractscan.xyz/contract/0x8104e3ad430ea6d354d013a6789fdfc71e671c43) |

</details>

Expand All @@ -66,34 +77,34 @@ MIT

| Name | Address |
| -------------------- | ------------------------------------------ |
| Kernel | 0xd3082872F8B06073A021b4602e022d5A070d7cfC |
| KernelFactory | 0x5de4839a76cf55d0c90e2061ef4386d962E15ae3 |
| SessionKeyValidator | 0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5 |
| ECDSA Validator | 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390 |
| Kernel | [0xd3082872F8B06073A021b4602e022d5A070d7cfC](https://contractscan.xyz/contract/0xd3082872f8b06073a021b4602e022d5a070d7cfc) |
| KernelFactory | [0x5de4839a76cf55d0c90e2061ef4386d962E15ae3](https://contractscan.xyz/contract/0x5de4839a76cf55d0c90e2061ef4386d962e15ae3) |
| SessionKeyValidator | [0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5](https://contractscan.xyz/contract/0x5c06ce2b673fd5e6e56076e40dd46ab67f5a72a5) |
| ECDSA Validator | [0xd9AB5096a832b9ce79914329DAEE236f8Eea0390](https://contractscan.xyz/contract/0xd9ab5096a832b9ce79914329daee236f8eea0390) |
</details>

<details>
<summary>v2.3</summary>

| Name | Address |
| -------------------- | ------------------------------------------ |
| Kernel | 0xD3F582F6B4814E989Ee8E96bc3175320B5A540ab |
| KernelFactory | 0x5de4839a76cf55d0c90e2061ef4386d962E15ae3 |
| KernelLite | 0x482EC42E88a781485E1B6A4f07a0C5479d183291 |
| SessionKeyValidator | 0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5 |
| ECDSA Validator | 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390 |
| Kernel | [0xD3F582F6B4814E989Ee8E96bc3175320B5A540ab](https://contractscan.xyz/contract/0xd3f582f6b4814e989ee8e96bc3175320b5a540ab) |
| KernelFactory | [0x5de4839a76cf55d0c90e2061ef4386d962E15ae3](https://contractscan.xyz/contract/0x5de4839a76cf55d0c90e2061ef4386d962e15ae3) |
| KernelLite | [0x482EC42E88a781485E1B6A4f07a0C5479d183291](https://contractscan.xyz/contract/0x482ec42e88a781485e1b6a4f07a0c5479d183291) |
| SessionKeyValidator | [0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5](https://contractscan.xyz/contract/0x5c06ce2b673fd5e6e56076e40dd46ab67f5a72a5) |
| ECDSA Validator | [0xd9AB5096a832b9ce79914329DAEE236f8Eea0390](https://contractscan.xyz/contract/0xd9ab5096a832b9ce79914329daee236f8eea0390) |
</details>

<details>
<summary>v2.2</summary>

| Name | Address |
| -------------------- | ------------------------------------------ |
| Kernel | 0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5 |
| KernelFactory | 0x5de4839a76cf55d0c90e2061ef4386d962E15ae3 |
| KernelLite | 0xbEdb61Be086F3f15eE911Cc9AB3EEa945DEbFa96 |
| SessionKeyValidator | 0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5 |
| ECDSA Validator | 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390 |
| Kernel | [0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5](https://contractscan.xyz/contract/0x0da6a956b9488ed4dd761e59f52fdc6c8068e6b5) |
| KernelFactory | [0x5de4839a76cf55d0c90e2061ef4386d962E15ae3](https://contractscan.xyz/contract/0x5de4839a76cf55d0c90e2061ef4386d962e15ae3) |
| KernelLite | [0xbEdb61Be086F3f15eE911Cc9AB3EEa945DEbFa96](https://contractscan.xyz/contract/0xbedb61be086f3f15ee911cc9ab3eea945debfa96) |
| SessionKeyValidator | [0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5](https://contractscan.xyz/contract/0x5c06ce2b673fd5e6e56076e40dd46ab67f5a72a5) |
| ECDSA Validator | [0xd9AB5096a832b9ce79914329DAEE236f8Eea0390](https://contractscan.xyz/contract/0xd9ab5096a832b9ce79914329daee236f8eea0390) |

</details>

Expand All @@ -102,20 +113,20 @@ MIT

| Name | Address |
| -------------------- | ------------------------------------------ |
| Kernel | 0xf048AD83CB2dfd6037A43902a2A5Be04e53cd2Eb |
| KernelFactory | 0x5de4839a76cf55d0c90e2061ef4386d962E15ae3 |
| SessionKeyValidator | 0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5 |
| ECDSA Validator | 0xd9AB5096a832b9ce79914329DAEE236f8Eea0390 |
| Kernel | [0xf048AD83CB2dfd6037A43902a2A5Be04e53cd2Eb](https://contractscan.xyz/contract/0xf048ad83cb2dfd6037a43902a2a5be04e53cd2eb) |
| KernelFactory | [0x5de4839a76cf55d0c90e2061ef4386d962E15ae3](https://contractscan.xyz/contract/0x5de4839a76cf55d0c90e2061ef4386d962e15ae3) |
| SessionKeyValidator | [0x5C06CE2b673fD5E6e56076e40DD46aB67f5a72A5](https://contractscan.xyz/contract/0x5c06ce2b673fd5e6e56076e40dd46ab67f5a72a5) |
| ECDSA Validator | [0xd9AB5096a832b9ce79914329DAEE236f8Eea0390](https://contractscan.xyz/contract/0xd9ab5096a832b9ce79914329daee236f8eea0390) |
</details>

<details>
<summary>v2.0</summary>

| Name | Address |
| --------------- | ------------------------------------------ |
| Kernel | 0xeB8206E02f6AB1884cfEa58CC7BabdA7d55aC957 |
| TempKernel | 0x727A10897e70cd3Ab1a6e43d59A12ab0895A4995 |
| KernelFactory | 0x12358cA00141D09cB90253F05a1DD16bE93A8EE6 |
| ECDSA Validator | 0x180D6465F921C7E0DEA0040107D342c87455fFF5 |
| ECDSA Factory | 0xAf299A1f51560F51A1F3ADC0a5991Ac74b61b0BE |
| Kernel | [0xeB8206E02f6AB1884cfEa58CC7BabdA7d55aC957](https://contractscan.xyz/contract/0xeb8206e02f6ab1884cfea58cc7babda7d55ac957) |
| TempKernel | [0x727A10897e70cd3Ab1a6e43d59A12ab0895A4995](https://contractscan.xyz/contract/0x727a10897e70cd3ab1a6e43d59a12ab0895a4995) |
| KernelFactory | [0x12358cA00141D09cB90253F05a1DD16bE93A8EE6](https://contractscan.xyz/contract/0x12358ca00141d09cb90253f05a1dd16be93a8ee6) |
| ECDSA Validator | [0x180D6465F921C7E0DEA0040107D342c87455fFF5](https://contractscan.xyz/contract/0x180d6465f921c7e0dea0040107d342c87455fff5) |
| ECDSA Factory | [0xAf299A1f51560F51A1F3ADC0a5991Ac74b61b0BE](https://contractscan.xyz/contract/0xaf299a1f51560f51a1f3adc0a5991ac74b61b0be) |
</details>
124 changes: 124 additions & 0 deletions broadcast/DeployKernel.s.sol/11155111/run-1733513810.json

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/solady
Submodule solady updated 175 files
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ExcessivelySafeCall/=lib/ExcessivelySafeCall/src/
forge-std/=lib/forge-std/src/
solady/=lib/solady/src/
solady_test/=lib/solady/test/
23 changes: 13 additions & 10 deletions src/Kernel.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import {
PassFlag,
SKIP_SIGNATURE
} from "./core/ValidationManager.sol";
import {HookManager} from "./core/HookManager.sol";
import {ExecutorManager} from "./core/ExecutorManager.sol";
import {SelectorManager} from "./core/SelectorManager.sol";
import {IModule, IValidator, IHook, IExecutor, IFallback, IPolicy, ISigner} from "./interfaces/IERC7579Modules.sol";
import {EIP712} from "solady/utils/EIP712.sol";
import {ExecLib, ExecMode, CallType, ExecType, ExecModeSelector, ExecModePayload} from "./utils/ExecLib.sol";
import {ExecLib} from "./utils/ExecLib.sol";
import {ExecMode, CallType, ExecType, ExecModeSelector, ExecModePayload} from "./types/Types.sol";
import {
CALLTYPE_SINGLE,
CALLTYPE_DELEGATECALL,
Expand All @@ -42,7 +40,8 @@ import {
CALLTYPE_DELEGATECALL,
CALLTYPE_SINGLE,
CALLTYPE_BATCH,
CALLTYPE_STATIC
CALLTYPE_STATIC,
MAGIC_VALUE_SIG_REPLAYABLE
} from "./types/Constants.sol";

contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager {
Expand Down Expand Up @@ -152,7 +151,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager

function _domainNameAndVersion() internal pure override returns (string memory name, string memory version) {
name = "Kernel";
version = "0.3.1";
version = "0.3.2";
}

receive() external payable {
Expand Down Expand Up @@ -321,19 +320,23 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
if (ValidatorLib.getType(vId) == VALIDATION_TYPE_ROOT) {
vId = vs.rootValidator;
}
bool isReplayable = sig.length >= 32 && bytes32(sig[0:32]) == MAGIC_VALUE_SIG_REPLAYABLE;
if (isReplayable) {
sig = sig[32:];
}
if (address(vs.validationConfig[vId].hook) == address(0)) {
revert InvalidValidator();
}
if (ValidatorLib.getType(vId) == VALIDATION_TYPE_VALIDATOR) {
IValidator validator = ValidatorLib.getValidator(vId);
return validator.isValidSignatureWithSender(msg.sender, _toWrappedHash(hash), sig);
return validator.isValidSignatureWithSender(msg.sender, _toWrappedHash(hash, isReplayable), sig);
} else {
PermissionId pId = ValidatorLib.getPermissionId(vId);
PassFlag permissionFlag = vs.permissionConfig[pId].permissionFlag;
if (PassFlag.unwrap(permissionFlag) & PassFlag.unwrap(SKIP_SIGNATURE) != 0) {
revert PermissionNotAlllowedForSignature();
}
return _checkPermissionSignature(pId, msg.sender, hash, sig);
return _checkPermissionSignature(pId, msg.sender, hash, sig, isReplayable);
}
}

Expand Down Expand Up @@ -367,7 +370,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
}
_installValidation(vId, config, validatorData, hookData);
if (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
// 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);
}
} else if (moduleType == MODULE_TYPE_EXECUTOR) {
Expand Down Expand Up @@ -526,7 +529,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager
}

function accountId() external pure override returns (string memory accountImplementationId) {
return "kernel.advanced.v0.3.1";
return "kernel.advanced.v0.3.2";
}

function supportsExecutionMode(ExecMode mode) external pure override returns (bool) {
Expand Down
8 changes: 6 additions & 2 deletions src/core/ExecutorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

pragma solidity ^0.8.0;

import {IHook, IExecutor} from "../interfaces/IERC7579Modules.sol";
import {IHook, IExecutor, IModule} from "../interfaces/IERC7579Modules.sol";
import {IERC7579Account} from "../interfaces/IERC7579Account.sol";
import {ModuleLib} from "../utils/ModuleLib.sol";
import {EXECUTOR_MANAGER_STORAGE_SLOT, MODULE_TYPE_EXECUTOR} from "../types/Constants.sol";
Expand Down Expand Up @@ -31,7 +31,11 @@ abstract contract ExecutorManager {

function _installExecutor(IExecutor executor, bytes calldata executorData, IHook hook) internal {
_installExecutorWithoutInit(executor, hook);
executor.onInstall(executorData);
if (executorData.length == 0) {
(bool success,) = address(executor).call(abi.encodeWithSelector(IModule.onInstall.selector, hex""));
} else {
executor.onInstall(executorData);
}
}

function _installExecutorWithoutInit(IExecutor executor, IHook hook) internal {
Expand Down
2 changes: 1 addition & 1 deletion src/core/HookManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract contract HookManager {
if (!hook.isInitialized(address(this))) {
// if hook is not installed, it should call onInstall
hook.onInstall(hookData[1:]);
} else if (bytes1(hookData[0]) == bytes1(0xff)) {
} else if (hookData.length > 0 && bytes1(hookData[0]) == bytes1(0xff)) {
// 0xff means you want to explicitly call install hook
hook.onInstall(hookData[1:]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/SelectorManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.0;

import {IHook, IFallback, IModule} from "../interfaces/IERC7579Modules.sol";
import {IERC7579Account} from "../interfaces/IERC7579Account.sol";
import {CallType} from "../utils/ExecLib.sol";
import {CallType} from "../types/Types.sol";
import {
SELECTOR_MANAGER_STORAGE_SLOT,
CALLTYPE_DELEGATECALL,
Expand Down
Loading
Loading