-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix/cantina fixes #139
Fix/cantina fixes #139
Conversation
…signature validation
…attesters length
…st attesters length
…to be more generic in IModuleManagerEventsAndErrors.sol
…ainst attesters length
…ingValidator for more generic handling
…ingValidator for more generic handling
…ingValidator for more generic handling
…ingValidator for more generic handling
Fix/cantina fixes
🚨 Report Summary
For more details view the full report in OpenZeppelin Code Inspector |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## remediations/cantina-spearbit #139 +/- ##
=================================================================
+ Coverage 75.60% 75.67% +0.07%
=================================================================
Files 13 13
Lines 664 666 +2
Branches 153 154 +1
=================================================================
+ Hits 502 504 +2
Misses 162 162
Continue to review full report in Codecov by Sentry.
|
…ing for vmode calculation
…h an inner Bootstrap.initNexus
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.
review i
contracts/base/ModuleManager.sol
Outdated
/// @dev Checks if there is at least one validator installed. | ||
/// @return True if there is at least one validator, otherwise false. | ||
function _hasValidators() internal view returns (bool) { | ||
return _getAccountStorage().validators.getNext(address(0x01)) != address(0x01); |
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 just checked the SentinelListLib
again. There's a bug in this lib when you call popAll()
it leaves the list in an uninitialized state instead of an initialized but empty state.
You're not using popAll()
but it's better to fix it and change this check to also ensure the next
is not the zero
address (uninitialized):
return _getAccountStorage().validators.getNext(address(0x01)) != address(0x01) && _getAccountStorage().validators.getNext(address(0x01)) != address(0x00);
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 this comment be appropriate then? @MrToph
// Sentinel pointing to itself means the list is empty, so check this after removal
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.
just double check above comment. actual fix is done @MrToph
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.
You can write this instead
// Sentinel pointing to itself / zero means the list is empty / uninitialized, so check this after removal
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.
ok changing this
🤖 Slither Analysis Report 🔎Slither report
# Slither report
_This comment was automatically generated by the GitHub Actions workflow._
THIS CHECKLIST IS NOT COMPLETE. Use
locked-ether🟡 Impact: Medium
utils/RegistryBootstrap.sol#L33-L165 constable-statesImpact: Optimization
|
5bd4851
into
remediations/cantina-spearbit
# 25: Gas Optimization in
K1Validator.validateUserOp
Swapped
isValidSignatureNow
withisValidSignatureNowCalldata
to reduce gas costs.Link
# 26: Unnecessary Module Type Check on Uninstall
Removed redundant type checks during module uninstall to streamline the process.
Link
# 24: Registry Threshold Validation
Added checks to ensure the threshold doesn’t exceed the number of attesters.
Link
# 15: Validator Installation Check in
initializeAccount
Ensured at least one validator is installed during account initialization to avoid issues.
Link
# 14: Optimized
_uninstallValidator
FlowModified the logic to check for an empty validator list after removal, improving efficiency.
Link
# 10: Documentation and Typo Fixes
Cleared up various typos and improved doc clarity across the codebase.
Link
# 7: ModuleType Range Validation
Added a range check for
ModuleType
to ensure it stays within valid bounds.Link
# 50: Risk of Account Becoming Unrecoverable
Discussed scenarios where an account could become unrecoverable if all validators are removed. Explored potential solutions like fallback validators or social recovery mechanisms.
Link
# 40: Missing Memory-Safe Assembly Annotation
Added missing
memory-safe
annotations to assembly blocks where applicable.Link
# 11: Custom
userOp.signature
Encoding DocumentationDocumented the custom encoding used for
userOp.signature
in enableMode.Link
# 5: Missing Owner Address Validation in
K1ValidatorFactory
Added a check to ensure the factory owner address is non-zero for consistency with other factories.
Link
# 4: Missing Return Parameters in NatSpec
Added descriptions for missing return parameters in NatSpec comments to improve code documentation.
Link
# 3: RegistryFactory
createAccount
AssumesBootstrap.initNexus
Will Be UsedDocumented that
RegistryFactory.createAccount
is only compatible with an innerBootstrap.initNexus
call as its initialization method.Link