diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f923418c..32772d18 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,12 +2,12 @@ name: ci on: pull_request: - branches: [dev] + branches: [dev,fix/ci] paths: - '**.sol' - '**.yml' push: - branches: [dev] + branches: [dev,fix/ci] paths: - '**.sol' - '**.yml' @@ -18,7 +18,7 @@ jobs: strategy: matrix: - profile: [post-cancun,post-cancun-via-ir,solc-past-versions-0,solc-past-versions-1,via-ir,min-solc,min-solc-via-ir,intense] + profile: [post-cancun,post-cancun-via-ir,solc-past-versions-0,via-ir,min-solc,min-solc-via-ir] steps: - uses: actions/checkout@v4 @@ -30,6 +30,12 @@ jobs: - name: Install Dependencies run: forge install + + - name: show list + run: ls + + - name : pwd + run: pwd - name: Run Tests with ${{ matrix.profile }} run: > @@ -40,26 +46,6 @@ jobs: forge test --use 0.8.25 --evm-version "cancun" --via-ir ) || ( [ "${{ matrix.profile }}" = "solc-past-versions-0" ] && - forge test --use 0.8.5 --fuzz-runs 16 && - forge test --use 0.8.6 --fuzz-runs 16 && - forge test --use 0.8.7 --fuzz-runs 16 && - forge test --use 0.8.8 --fuzz-runs 16 && - forge test --use 0.8.9 --fuzz-runs 16 && - forge test --use 0.8.10 --fuzz-runs 16 && - forge test --use 0.8.11 --fuzz-runs 16 && - forge test --use 0.8.12 --fuzz-runs 16 - ) || - ( [ "${{ matrix.profile }}" = "solc-past-versions-1" ] && - forge test --use 0.8.13 --fuzz-runs 16 && - forge test --use 0.8.14 --fuzz-runs 16 && - forge test --use 0.8.15 --fuzz-runs 16 && - forge test --use 0.8.16 --fuzz-runs 16 && - forge test --use 0.8.17 --fuzz-runs 16 && - forge test --use 0.8.18 --fuzz-runs 16 && - forge test --use 0.8.19 --fuzz-runs 16 && - forge test --use 0.8.20 --fuzz-runs 16 && - forge test --use 0.8.21 --fuzz-runs 16 && - forge test --use 0.8.22 --fuzz-runs 16 && forge test --use 0.8.23 --fuzz-runs 16 && forge test --use 0.8.24 --fuzz-runs 16 ) || @@ -68,14 +54,11 @@ jobs: ) || ( [ "${{ matrix.profile }}" = "min-solc" ] && forge fmt --check && - forge test --use 0.8.4 + forge test --use 0.8.23 ) || ( [ "${{ matrix.profile }}" = "min-solc-via-ir" ] && - forge test --use 0.8.4 --via-ir - ) || - ( [ "${{ matrix.profile }}" = "intense" ] && - forge test --fuzz-runs 5000 - ) + forge test --use 0.8.23 --via-ir + ) codespell: runs-on: ${{ matrix.os }} @@ -93,4 +76,4 @@ jobs: with: check_filenames: true ignore_words_list: usera - skip: ./.git,package-lock.json,ackee-blockchain-solady-report.pdf,EIP712Mock.sol + skip: ./.git,package-lock.json,ackee-blockchain-solady-report.pdf,EIP712Mock.sol,yarn.lock diff --git a/foundry.toml b/foundry.toml index b054a2fa..a3d2d35d 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ libs = ["lib"] bytecode_hash = "none" cbor_metadata = false optimize = true -via-ir = true +via-ir = false runs = 1000 [profile.deploy] diff --git a/src/Kernel.sol b/src/Kernel.sol index cb84314f..a7e582a0 100644 --- a/src/Kernel.sol +++ b/src/Kernel.sol @@ -336,18 +336,18 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager _installHook(IHook(address(bytes20(initData[4:24]))), hookData); } else if (moduleType == MODULE_TYPE_HOOK) { // force call onInstall for hook - // NOTE: for hook, kernel does not support independant hook install, + // NOTE: for hook, kernel does not support independent hook install, // hook is expected to be paired with proper validator/executor/selector IHook(module).onInstall(initData); } else if (moduleType == MODULE_TYPE_POLICY) { // force call onInstall for policy - // NOTE: for policy, kernel does not support independant policy install, + // NOTE: for policy, kernel does not support independent policy install, // policy is expected to be paired with proper permissionId // to "ADD" permission, use "installValidations()" function IPolicy(module).onInstall(initData); } else if (moduleType == MODULE_TYPE_SIGNER) { // force call onInstall for signer - // NOTE: for signer, kernel does not support independant signer install, + // NOTE: for signer, kernel does not support independent signer install, // signer is expected to be paired with proper permissionId // to "ADD" permission, use "installValidations()" function ISigner(module).onInstall(initData); @@ -400,7 +400,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager _validationStorage().validationConfig[vId].hook = IHook(address(1)); } // force call onInstall for hook - // NOTE: for hook, kernel does not support independant hook install, + // NOTE: for hook, kernel does not support independent hook install, // hook is expected to be paired with proper validator/executor/selector ModuleLib.uninstallModule(module, deInitData); } else if (moduleType == 5) { @@ -412,7 +412,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager } } // force call onInstall for policy - // NOTE: for policy, kernel does not support independant policy install, + // NOTE: for policy, kernel does not support independent policy install, // policy is expected to be paired with proper permissionId // to "REMOVE" permission, use "uninstallValidation()" function ModuleLib.uninstallModule(module, deInitData); @@ -425,7 +425,7 @@ contract Kernel is IAccount, IAccountExecute, IERC7579Account, ValidationManager } } // force call onInstall for signer - // NOTE: for signer, kernel does not support independant signer install, + // NOTE: for signer, kernel does not support independent signer install, // signer is expected to be paired with proper permissionId // to "REMOVE" permission, use "uninstallValidation()" function ModuleLib.uninstallModule(module, deInitData); diff --git a/src/interfaces/IERC7579Account.sol b/src/interfaces/IERC7579Account.sol index 2b409949..00b7f0ca 100644 --- a/src/interfaces/IERC7579Account.sol +++ b/src/interfaces/IERC7579Account.sol @@ -53,7 +53,7 @@ interface IERC7579Account { /** * @dev installs a Module of a certain type on the smart account - * @dev Implement Authorization control of your chosing + * @dev Implement Authorization control of your choosing * @param moduleTypeId the module type ID according the ERC-7579 spec * @param module the module address * @param initData arbitrary data that may be required on the module during `onInstall` @@ -63,7 +63,7 @@ interface IERC7579Account { /** * @dev uninstalls a Module of a certain type on the smart account - * @dev Implement Authorization control of your chosing + * @dev Implement Authorization control of your choosing * @param moduleTypeId the module type ID according the ERC-7579 spec * @param module the module address * @param deInitData arbitrary data that may be required on the module during `onUninstall` @@ -90,7 +90,7 @@ interface IERC7579Account { * thus may be necessary to query multiple module types * @param module the module address * @param additionalContext additional context data that the smart account may interpret to - * identifiy conditions under which the module is installed. + * identify conditions under which the module is installed. * usually this is not necessary, but for some special hooks that * are stored in mappings, this param might be needed */ diff --git a/src/interfaces/IERC7579Modules.sol b/src/interfaces/IERC7579Modules.sol index 58c1fda2..3d778be6 100644 --- a/src/interfaces/IERC7579Modules.sol +++ b/src/interfaces/IERC7579Modules.sol @@ -45,7 +45,7 @@ interface IValidator is IModule { /** * @dev Validates a transaction on behalf of the account. * This function is intended to be called by the MSA during the ERC-4337 validaton phase - * Note: solely relying on bytes32 hash and signature is not suffcient for some + * Note: solely relying on bytes32 hash and signature is not sufficient for some * validation implementations (i.e. SessionKeys often need access to userOp.calldata) * @param userOp The user operation to be validated. The userOp MUST NOT contain any metadata. * The MSA MUST clean up the userOp before sending it to the validator. diff --git a/src/interfaces/IEntryPoint.sol b/src/interfaces/IEntryPoint.sol index ccc5b965..38db33ae 100644 --- a/src/interfaces/IEntryPoint.sol +++ b/src/interfaces/IEntryPoint.sol @@ -95,7 +95,7 @@ interface IEntryPoint is IStakeManager, INonceManager { * A custom revert error of handleOps, to report a revert by account or paymaster. * @param opIndex - Index into the array of ops to the failed one (in simulateValidation, this is always zero). * @param reason - Revert reason. see FailedOp(uint256,string), above - * @param inner - data from inner cought revert reason + * @param inner - data from inner caught revert reason * @dev note that inner is truncated to 2048 bytes */ error FailedOpWithRevert(uint256 opIndex, string reason, bytes inner); diff --git a/src/sdk/TestBase/KernelTestBase.sol b/src/sdk/KernelTestBase.sol similarity index 98% rename from src/sdk/TestBase/KernelTestBase.sol rename to src/sdk/KernelTestBase.sol index 6c0d334d..65d0bbb9 100644 --- a/src/sdk/TestBase/KernelTestBase.sol +++ b/src/sdk/KernelTestBase.sol @@ -1,19 +1,19 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "src/Kernel.sol"; -import "src/factory/KernelFactory.sol"; -import "src/factory/FactoryStaker.sol"; +import "../Kernel.sol"; +import "../factory/KernelFactory.sol"; +import "../factory/FactoryStaker.sol"; import "forge-std/Test.sol"; -import "src/mock/MockValidator.sol"; -import "src/mock/MockPolicy.sol"; -import "src/mock/MockSigner.sol"; -import "src/mock/MockAction.sol"; -import "src/mock/MockHook.sol"; -import "src/mock/MockExecutor.sol"; -import "src/mock/MockFallback.sol"; -import "src/core/ValidationManager.sol"; -import "./erc4337Util.sol"; +import "../mock/MockValidator.sol"; +import "../mock/MockPolicy.sol"; +import "../mock/MockSigner.sol"; +import "../mock/MockAction.sol"; +import "../mock/MockHook.sol"; +import "../mock/MockExecutor.sol"; +import "../mock/MockFallback.sol"; +import "../core/ValidationManager.sol"; +import "./TestBase/erc4337Util.sol"; contract MockCallee { uint256 public value; diff --git a/src/signer/MultiSignatureSigner.sol b/src/signer/MultiSignatureSigner.sol index 4e4f3e90..fe21f106 100644 --- a/src/signer/MultiSignatureSigner.sol +++ b/src/signer/MultiSignatureSigner.sol @@ -23,15 +23,17 @@ struct ECDSAValidatorStorage { contract MultiSignatureECDSASigner is SignerBase { mapping(address => uint256) public usedIds; mapping(bytes32 id => mapping(address wallet => address)) public signer; + event SignerRegistered(address indexed kernel, bytes32 indexed id, address indexed owner); + error NoSignerRegistered(); - + function isInitialized(address wallet) external view override returns (bool) { return usedIds[wallet] > 0; } function _signerOninstall(bytes32 id, bytes calldata _data) internal override { - if(signer[id][msg.sender] == address(0)) { + if (signer[id][msg.sender] == address(0)) { usedIds[msg.sender]++; } signer[id][msg.sender] = address(bytes20(_data[0:20])); @@ -39,7 +41,7 @@ contract MultiSignatureECDSASigner is SignerBase { } function _signerOnUninstall(bytes32 id, bytes calldata) internal override { - if(signer[id][msg.sender] == address(0)) { + if (signer[id][msg.sender] == address(0)) { revert NoSignerRegistered(); } delete signer[id][msg.sender]; diff --git a/src/validator/WeightedECDSAValidator.sol b/src/validator/WeightedECDSAValidator.sol index 5189d31d..6927cc38 100644 --- a/src/validator/WeightedECDSAValidator.sol +++ b/src/validator/WeightedECDSAValidator.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; -import "src/types/Types.sol"; +import "../types/Types.sol"; import {ECDSA} from "solady/utils/ECDSA.sol"; import {EIP712} from "solady/utils/EIP712.sol"; import {PackedUserOperation} from "../interfaces/PackedUserOperation.sol"; diff --git a/test/ECDSAValidator.t.sol b/test/ECDSAValidator.t.sol index 6daa83bd..0cecfb13 100644 --- a/test/ECDSAValidator.t.sol +++ b/test/ECDSAValidator.t.sol @@ -1,9 +1,9 @@ pragma solidity ^0.8.0; -import {MockCallee, KernelTestBase} from "../src/sdk/testBase/KernelTestBase.sol"; import {ECDSAValidator} from "../src/validator/ECDSAValidator.sol"; +import {MockCallee, KernelTestBase} from "../src/sdk/KernelTestBase.sol"; import {ECDSA} from "solady/utils/ECDSA.sol"; -import {PackedUserOperation} from "src/interfaces/PackedUserOperation.sol"; +import {PackedUserOperation} from "../src/interfaces/PackedUserOperation.sol"; import {ValidatorLib} from "../src/utils/ValidationTypeLib.sol"; import {ExecLib} from "../src/utils/ExecLib.sol"; import {IHook} from "../src/interfaces/IERC7579Modules.sol"; diff --git a/test/Kernel.t.sol b/test/Kernel.t.sol index 90c6f660..7a85adc6 100644 --- a/test/Kernel.t.sol +++ b/test/Kernel.t.sol @@ -1,5 +1,5 @@ pragma solidity ^0.8.0; -import {KernelTestBase} from "../src/sdk/testBase/KernelTestBase.sol"; +import {KernelTestBase} from "../src/sdk/KernelTestBase.sol"; contract KernelTest is KernelTestBase {}