Skip to content
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/enable mode module types (m06) #112

Merged

Conversation

filmakarov
Copy link
Collaborator

@filmakarov filmakarov commented Jul 19, 2024

Fix Issue #30) : Enable mode would not install any module types but validators or multitypes with validator included.

Also includes fixes to issues 37,38,42 from PR#111

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (remediations/cantina-spearbit@ad6af35). Learn more about missing BASE report.

Files Patch % Lines
contracts/base/ModuleManager.sol 50.00% 2 Missing ⚠️
Additional details and impacted files
@@                       Coverage Diff                        @@
##             remediations/cantina-spearbit     #112   +/-   ##
================================================================
  Coverage                                 ?   72.31%           
================================================================
  Files                                    ?       13           
  Lines                                    ?      679           
  Branches                                 ?      124           
================================================================
  Hits                                     ?      491           
  Misses                                   ?      188           
  Partials                                 ?        0           
Files Coverage Δ
contracts/Nexus.sol 63.06% <100.00%> (ø)
contracts/base/ModuleManager.sol 86.07% <50.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad6af35...5f82f00. Read the comment docs.

@livingrockrises livingrockrises changed the base branch from dev to remediations/cantina-spearbit July 29, 2024 14:11
Comment on lines +103 to +108
if (op.nonce.isModuleEnableMode()) {
PackedUserOperation memory userOp = op;
userOp.signature = _enableMode(userOpHash, op.signature);
if (!_isValidatorInstalled(validator)) return VALIDATION_FAILED;
validationData = IValidator(validator).validateUserOp(userOp, userOpHash);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason the order changed? I think it's less likely to happen when calling with EnableMode enabled compared to when calling without EnableMode

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -38,7 +38,7 @@ uint256 constant MODULE_TYPE_FALLBACK = 3;

// Module type identifier for hooks
uint256 constant MODULE_TYPE_HOOK = 4;
bytes32 constant MODULE_ENABLE_MODE_TYPE_HASH = keccak256("ModuleEnableMode(address module, bytes32 initDataHash)");
bytes32 constant MODULE_ENABLE_MODE_TYPE_HASH = keccak256("ModuleEnableMode(address module, uint256 moduleType, bytes32 userOpHash, bytes32 initDataHash)");
Copy link
Contributor

@Aboudjem Aboudjem Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the [EIP-712 standard](https://eips.ethereum.org/EIPS/eip-712), members are joined by a "," without any blank space.

The type of a struct is encoded as name ‖ "(" ‖ member₁ ‖ "," ‖ member₂ ‖ "," ‖ … ‖ memberₙ ")" where each member is written as type ‖ " " ‖ name. For example, the above Mail struct is encoded as Mail(address from,address to,string contents).

Check M-06 for more info if it applies here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!

Copy link

openzeppelin-code bot commented Aug 6, 2024

Fix/enable mode module types

Generated at commit: 5f82f005ad5f0f522d6367770daed76f0eb89f6d

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
0
1
0
6
24
31

For more details view the full report in OpenZeppelin Code Inspector

Copy link

github-actions bot commented Aug 7, 2024

🤖 Slither Analysis Report 🔎

Slither report

# Slither report

THIS CHECKLIST IS NOT COMPLETE. Use --show-ignored-findings to show all the results.
Summary

constable-states

Impact: Optimization
🔴 Confidence: High

base/RegistryAdapter.sol#L12

factory/RegistryFactory.sol#L39

_This comment was automatically generated by the GitHub Actions workflow._

@Aboudjem Aboudjem changed the title Fix/enable mode module types Fix/enable mode module types (m06) Aug 8, 2024
@livingrockrises livingrockrises merged commit 2375a58 into remediations/cantina-spearbit Aug 8, 2024
8 of 10 checks passed
@livingrockrises livingrockrises deleted the fix/EnableMode-module-types branch August 8, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants