Merged
Conversation
Remove underscore prefix from all internal library functions,
_guardInitializeOwner indirection, and use inline
`assembly("memory-safe")` annotations. Update DiamondCutFacet and
OwnableRolesFacet call sites.
Replace constructor-based initialization with an external `initialize()` function guarded by InitializableLib. Simplify MultiInit to use inline delegatecall with explicit error handling. Remove _beforeDelegate hook and _diamondCut wrapper from Diamond base contract.
Split DiamondInit into standalone OwnableInit and ERC165Init initializers for granular use via MultiInit. Update deploy script to use MultiInit with the separate initializers.
postReinitializer was storing the raw version without shifting left by 1, breaking the packed slot layout (bit 0 = initializing, bits 1..64 = version). This caused getInitializedVersion() to return incorrect values and the Initialized event to emit wrong versions after reinitialization.
Test initialization, re-initialization prevention, version tracking, sequential reinitializations, disableInitializers, and MultiInit composition through the Diamond.initialize() entrypoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InitializableLibwith versioned initialization guards (initializer,reinitializer,disableInitializers) adapted from Solady/OpenZeppelinDiamond.solfrom constructor-based to externalinitialize()function, enabling proxy-friendly deploymentOwnableInitandERC165InitfromDiamondInitfor granular, composable initialization viaMultiInitpostReinitializerbug where version was stored without left-shifting, breaking the packed slot layout and causing incorrect version trackingdisableInitializers, andMultiInitcompositionOwnableRolesLib: rename functions and simplify assembly