-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add ownerCount method #60
Conversation
@@ -137,8 +136,7 @@ contract MultiOwnable { | |||
/// @param index The index of the owner to be removed. | |||
/// @param owner The ABI encoded bytes of the owner to be removed. | |||
function removeLastOwner(uint256 index, bytes calldata owner) external virtual onlyOwner { | |||
MultiOwnableStorage storage $ = _getMultiOwnableStorage(); | |||
uint256 ownersRemaining = $.nextOwnerIndex - $.removedOwnersCount; | |||
uint256 ownersRemaining = ownerCount(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get rid of this stack variable and do the same thing as in `removeOwnerAtIndex():
if (ownerCount() > 1) {
revert NotLastOwner(ownersRemaining);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but then I would need to call ownerCount
again here revert NotLastOwner(ownersRemaining);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be revert NotLastOwner(ownerCount());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes right, I missed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yeah could debate: do we penalize gas on the non revert path in order to save on revert?
Review Error for xenoliss @ 2024-04-19 17:06:50 UTC |
af8384c
to
5e90754
Compare
Convenience method https://github.com/cantinasec/review-coinbase-smartwallet/issues/5