Skip to content

Commit

Permalink
Merge pull request #182 from bcnmy/feat/SMA-346-fixes-upon-audit
Browse files Browse the repository at this point in the history
SMA 346 Multi owner ECDSA fixes upon audit
  • Loading branch information
livingrockrises authored Dec 13, 2023
2 parents 44fdb23 + dee4956 commit 0f7b799
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface IMultiOwnedECDSAModule {
);

error AlreadyInitedForSmartAccount(address smartAccount);
error NoOwnersToAdd();
error WrongSignatureLength();
error NotEOA(address account);
error ZeroAddressNotAllowedAsOwner();
Expand Down
5 changes: 3 additions & 2 deletions contracts/smart-account/modules/MultiOwnedECDSAModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ contract MultiOwnedECDSAModule is
revert AlreadyInitedForSmartAccount(msg.sender);
}
uint256 ownersToAdd = eoaOwners.length;
if (ownersToAdd == 0) revert NoOwnersToAdd();
for (uint256 i; i < ownersToAdd; ) {
if (eoaOwners[i] == address(0))
revert ZeroAddressNotAllowedAsOwner();
Expand All @@ -67,7 +68,7 @@ contract MultiOwnedECDSAModule is
address owner,
address newOwner
) external override {
if (_isSmartContract(newOwner)) revert NotEOA(owner);
if (_isSmartContract(newOwner)) revert NotEOA(newOwner);
if (newOwner == address(0)) revert ZeroAddressNotAllowedAsOwner();
if (owner == address(0)) revert ZeroAddressNotAllowedAsOwner();
if (owner == newOwner)
Expand Down Expand Up @@ -96,7 +97,7 @@ contract MultiOwnedECDSAModule is
function removeOwner(address owner) external override {
if (!_smartAccountOwners[owner][msg.sender])
revert NotAnOwner(owner, msg.sender);
_transferOwnership(msg.sender, owner, address(0));
_smartAccountOwners[owner][msg.sender] = false;
unchecked {
--numberOfOwners[msg.sender];
}
Expand Down

0 comments on commit 0f7b799

Please sign in to comment.