From 27fe9de783242c1b14de2f792d501858dfdb91c6 Mon Sep 17 00:00:00 2001 From: Jay Paik Date: Mon, 8 Jan 2024 17:28:29 -0500 Subject: [PATCH] fix: [spearbit-72] cache dependencies.length earlier (#40) --- src/account/PluginManagerInternals.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/account/PluginManagerInternals.sol b/src/account/PluginManagerInternals.sol index 66f42b40..7a0c0751 100644 --- a/src/account/PluginManagerInternals.sol +++ b/src/account/PluginManagerInternals.sol @@ -350,11 +350,11 @@ abstract contract PluginManagerInternals is IPluginManager, AccountStorageV1 { } // Check that the dependencies match the manifest. - if (dependencies.length != manifest.dependencyInterfaceIds.length) { + uint256 length = dependencies.length; + if (length != manifest.dependencyInterfaceIds.length) { revert InvalidDependenciesProvided(); } - uint256 length = dependencies.length; for (uint256 i = 0; i < length;) { // Check the dependency interface id over the address of the dependency. (address dependencyAddr,) = dependencies[i].unpack();