-
Notifications
You must be signed in to change notification settings - Fork 111
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 Zero Address Checks in Constructors of IPAccountRegistry and IPAccountStorage Contracts #158
Add Zero Address Checks in Constructors of IPAccountRegistry and IPAccountStorage Contracts #158
Conversation
WalkthroughThe recent changes enhance the robustness of the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant Deployer
participant IPAccountStorage
participant Errors
Deployer->>IPAccountStorage: Deploy with addresses
IPAccountStorage->>IPAccountStorage: Check zero addresses
alt Any address is zero
IPAccountStorage->>Errors: Revert with specific error
else All addresses valid
IPAccountStorage->>IPAccountStorage: Set storage variables
end
sequenceDiagram
participant Deployer
participant IPAccountRegistry
participant Errors
Deployer->>IPAccountRegistry: Deploy with erc6551Registry and ipAccountImpl
IPAccountRegistry->>IPAccountRegistry: Check erc6551Registry address
alt Address is zero
IPAccountRegistry->>Errors: Revert with specific error
else Address valid
IPAccountRegistry->>IPAccountRegistry: Set storage variables
end
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- contracts/IPAccountStorage.sol (1 hunks)
- contracts/lib/Errors.sol (2 hunks)
- contracts/registries/IPAccountRegistry.sol (1 hunks)
- test/foundry/IPAccountStorage.t.sol (2 hunks)
- test/foundry/registries/IPAccountRegistry.t.sol (2 hunks)
Additional comments not posted (6)
test/foundry/registries/IPAccountRegistry.t.sol (2)
7-7
: Import statement andMockIPAccountRegistry
contract definition look good.Also applies to: 11-13
42-47
: The constructor revert tests intest_IPAccountRegistry_constructor_revert
are correctly implemented.contracts/registries/IPAccountRegistry.sol (1)
28-28
: The constructor now correctly handles zero addresses, enhancing contract robustness.contracts/IPAccountStorage.sol (1)
37-39
: The constructor now correctly handles zero addresses, enhancing contract robustness.test/foundry/IPAccountStorage.t.sol (1)
239-246
: The constructor revert tests intest_IPAccountStorage_constructor_revert
are correctly implemented.contracts/lib/Errors.sol (1)
Line range hint
41-62
: New error definitions for zero addresses inErrors
library are correctly defined and used.
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.
LGTM + Approved by auditors
Description
This PR includes changes that add zero address checks in the constructors of the
IPAccountRegistry
andIPAccountStorage
contracts. These checks ensure that the contracts are initialized with valid addresses, preventing potential issues down the line.Changes:
Modified the constructor of the
IPAccountRegistry
contract to include a check for theerc6551Registry
contract address. If theerc6551Registry
contract address is zero, the constructor will revert and prevent the initialization of the contract.Modified the constructor of the
IPAccountStorage
contract to include checks for theipAssetRegistry
,licenseRegistry
, andmoduleRegistry
addresses. If any of these addresses are zero, the constructor will revert and prevent the initialization of the contract.Test Plan
Updated the unit tests to reflect these changes. The tests now cover scenarios where an attempt is made to initialize the
IPAccountRegistry
andIPAccountStorage
contracts with zero addresses.Summary by CodeRabbit
New Features
Tests