Skip to content

Commit

Permalink
fix: [spearbit-62] cache owners_.length
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypaik committed Jan 7, 2024
1 parent 5034db5 commit 31e6986
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/plugins/owner/MultiOwnerPlugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,14 @@ contract MultiOwnerPlugin is BasePlugin, IMultiOwnerPlugin, IERC1271 {
address associated,
address[] memory ownersToRemove
) private {
uint256 ownersToRemoveLength = ownersToRemove.length;
for (uint256 j; j < ownersToRemoveLength;) {
if (!ownerSet.tryRemove(associated, CastLib.toSetValue(ownersToRemove[j]))) {
revert OwnerDoesNotExist(ownersToRemove[j]);
uint256 length = ownersToRemove.length;
for (uint256 i; i < length;) {
if (!ownerSet.tryRemove(associated, CastLib.toSetValue(ownersToRemove[i]))) {
revert OwnerDoesNotExist(ownersToRemove[i]);
}

unchecked {
++j;
++i;
}
}
}
Expand All @@ -421,7 +421,8 @@ contract MultiOwnerPlugin is BasePlugin, IMultiOwnerPlugin, IERC1271 {
returns (bool)
{
address[] memory owners_ = ownersOf(associated);
for (uint256 i; i < owners_.length;) {
uint256 length = owners_.length;
for (uint256 i; i < length;) {
if (SignatureChecker.isValidERC1271SignatureNow(owners_[i], digest, signature)) {
return true;
}
Expand Down

0 comments on commit 31e6986

Please sign in to comment.