Skip to content

fix: remove initializer modifier from child contracts#64

Merged
keyleu merged 1 commit into
contractsfrom
keyne/update-initialization-contracts
Dec 9, 2025
Merged

fix: remove initializer modifier from child contracts#64
keyleu merged 1 commit into
contractsfrom
keyne/update-initialization-contracts

Conversation

@keyleu
Copy link
Copy Markdown

@keyleu keyleu commented Dec 5, 2025

The initializer modifier is already being used during

    function initialize(
        string memory _name,
        string memory _symbol,
        address _hook,
        address _interchainSecurityModule,
        address _owner
    ) public virtual initializer {

when calling super.initialize. So it's not needed in the child contracts.

This was currently preventing me from deploying using Create3 because it wouldn't allow me to do a 2 step deployment (first deploying the proxy and then initializing it). Since we are setting the owner as msg.sender during initialization:

super.initialize("Noble Dollar", "USDN", hook_, ism_, msg.sender);

when passing the initData to Create3 it would set the owner as the temporary proxy that is created and destroying during the deployment using Create3 (which is some random address, making us lose ownership of the contract), therefore I first deploy without initializing and then initialize it immediately after deployed with the deployer's key. Unfortunately having multiple "initializer" modifiers invalidates initializing in 2 steps because with multiple initializer modifiers in the inheritance chain, 2-step initialization only works during constructor context (address(this).code.length == 0) and we can't do it during constructor context because we want the owner to be msg.sender.

@keyleu keyleu requested a review from johnletey December 5, 2025 20:22
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 5, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch keyne/update-initialization-contracts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keyleu keyleu merged commit b2d5c7d into contracts Dec 9, 2025
7 checks passed
@keyleu keyleu deleted the keyne/update-initialization-contracts branch December 9, 2025 14:16
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.

1 participant