From f0f63f8b256f36bc3efa8802a156ac854b656a3f Mon Sep 17 00:00:00 2001 From: Jay Paik Date: Fri, 22 Nov 2024 15:58:00 -0500 Subject: [PATCH] fix: [ALCHEMY-010] easy fixes (002, 015, 016) --- gas-snapshots/ModularAccount.json | 2 +- src/account/AccountStorage.sol | 2 +- src/helpers/ExecutionInstallDelegate.sol | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gas-snapshots/ModularAccount.json b/gas-snapshots/ModularAccount.json index 050f0170..c47329c6 100644 --- a/gas-snapshots/ModularAccount.json +++ b/gas-snapshots/ModularAccount.json @@ -1,5 +1,5 @@ { - "Runtime_AccountCreation": "176147", + "Runtime_AccountCreation": "176129", "Runtime_BatchTransfers": "93045", "Runtime_Erc20Transfer": "78454", "Runtime_InstallSessionKey_Case1": "423148", diff --git a/src/account/AccountStorage.sol b/src/account/AccountStorage.sol index 471ed7de..86b886c2 100644 --- a/src/account/AccountStorage.sol +++ b/src/account/AccountStorage.sol @@ -50,7 +50,7 @@ struct ValidationStorage { /// @custom:storage-location erc7201:Alchemy.ModularAccount.Storage_V2 struct AccountStorage { // AccountStorageInitializable variables. - uint8 initialized; + uint64 initialized; bool initializing; // Execution functions and their associated functions. mapping(bytes4 selector => ExecutionStorage) executionStorage; diff --git a/src/helpers/ExecutionInstallDelegate.sol b/src/helpers/ExecutionInstallDelegate.sol index da4a648f..a9e52f05 100644 --- a/src/helpers/ExecutionInstallDelegate.sol +++ b/src/helpers/ExecutionInstallDelegate.sol @@ -94,6 +94,10 @@ contract ExecutionInstallDelegate { { AccountStorage storage _storage = getAccountStorage(); + if (module == address(0)) { + revert NullModule(); + } + uint256 length = manifest.executionHooks.length; for (uint256 i = 0; i < length; ++i) { ManifestExecutionHook memory mh = manifest.executionHooks[i]; @@ -132,7 +136,7 @@ contract ExecutionInstallDelegate { bool allowGlobalValidation, address module ) internal { - ExecutionStorage storage _executionStorage = getAccountStorage().executionStorage[bytes4(selector)]; + ExecutionStorage storage _executionStorage = getAccountStorage().executionStorage[selector]; if (_executionStorage.module != address(0)) { revert ExecutionFunctionAlreadySet();