-
Notifications
You must be signed in to change notification settings - Fork 16
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: linting warnings and initializer logic #46
Conversation
@@ -43,7 +43,23 @@ abstract contract WalletStorageInitializable { | |||
* Emits an {WalletStorageInitialized} event. | |||
*/ | |||
modifier walletStorageInitializer() { | |||
bool isTopLevelCall = _setWalletStorageInitializing(); | |||
bool isTopLevelCall = !WalletStorageV1Lib.getLayout().initializing; |
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.
The original logic expression !initialSetup || deploying
was incorrect due to missing parentheses. The intended logic should have been !(initialSetup || deploying)
. This corrected expression is logically equivalent to !initialSetup && !deploying
.
To break it down:
- The original (incorrect):
!initialSetup || deploying
- The corrected version:
!(initialSetup || deploying)
- The equivalent expression:
!initialSetup && !deploying
} | ||
|
||
/// @inheritdoc IERC1271 | ||
function isValidSignature(bytes32 hash, bytes memory signature) external view override returns (bytes4) { | ||
address owner = WalletStorageV1Lib.getLayout().owner; | ||
if (owner == address(0)) { | ||
ExecutionDetail storage executionDetail = | ||
WalletStorageV1Lib.getLayout().executionDetails[IERC1271.isValidSignature.selector]; | ||
// this is a sanity check only, as using address(0) as a plugin is not permitted during installation |
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.
Minor fix to check plugin != address(0)
even if it should not happen
@@ -99,10 +96,7 @@ contract SingleOwnerMSCA is BaseMSCA, DefaultCallbackHandler, UUPSUpgradeable, I | |||
|
|||
constructor(IEntryPoint _newEntryPoint, PluginManager _newPluginManager) | |||
BaseMSCA(_newEntryPoint, _newPluginManager) | |||
{ |
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.
Remove the redundant check as it's done in BaseMSCA
1356bf3
to
616b1c1
Compare
## Summary Parallel PR of #46. This PR addresses the linting warnings and corrects the logic in `WalletStorageInitializable` for 6900 v0.7 and 6900 v0.8 accounts (both on entry point v0.7). ## Detail ### Changeset * Resolve all warnings (thanks to Ashutosh!) * Correct the logic in the unused code within `WalletStorageInitializable` * Eliminate redundant calls in `SingleOwnerMSCA` constructor * Add a sanity check `!= address(0)` in `SingleOwnerMSCA` ### Checklist - [x] Did you add new tests and confirm all tests pass? (`yarn test`) - [ ] Did you update relevant docs? (docs are found in the `docs` folder) - [x] Do your commits follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [x] Does your PR title also follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) standard? - [ ] If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples)? (e.g. `feat!: breaking change`) - [x] Did you run lint (`yarn lint`) and fix any issues? - [x] Did you run formatter (`yarn format:check`) and fix any issues (`yarn format:write`)? ## Testing * No new tests have been added for style changes. * New tests have been included for the fixes: * For the `walletStorageInitializer` fix, I have forked the OZ JavaScript tests and rewritten them using Foundry. * The remaining two changes are already covered by existing tests (we don't allow installing `address(0)` and `testInitializeSingleOwnerMSCAWithRuntimeValidation`). ## Documentation n/a
Summary
This PR addresses the linting warnings and corrects the logic in
WalletStorageInitializable
.Detail
Changeset
WalletStorageInitializable
SingleOwnerMSCA
constructor!= address(0)
inSingleOwnerMSCA
Checklist
yarn test
)docs
folder)feat!: breaking change
)yarn lint
) and fix any issues?yarn format:check
) and fix any issues (yarn format:write
)?Testing
walletStorageInitializer
fix, I have forked the OZ JavaScript tests and rewritten them using Foundry.address(0)
andtestInitializeSingleOwnerMSCAWithRuntimeValidation
).Documentation
n/a