Skip to content

Release v0.1.0#24

Merged
dadadave80 merged 37 commits intomainfrom
dev
Apr 14, 2026
Merged

Release v0.1.0#24
dadadave80 merged 37 commits intomainfrom
dev

Conversation

@dadadave80
Copy link
Copy Markdown
Owner

@dadadave80 dadadave80 commented Apr 14, 2026

Summary

  • Add initializable Diamond pattern with OwnableInit and ERC165Init
  • Replace OwnableRoles with simpler Ownable lib and facet
  • Extract supportsInterface into dedicated ERC165Facet
  • Hardcode ERC-165 interface support in assembly
  • Optimize storage access and extract _removeSelectorFromOldFacet
  • Add immutable function guard to addFacet
  • Make Diamond contract non-abstract for direct deployment
  • Add extensive diamond test coverage
  • Remove memory-variant diamond cut functions
  • Consolidate imports and update naming conventions

Test plan

  • All existing tests pass (forge test)
  • Diamond cut operations work correctly
  • ERC-165 interface detection works
  • Ownable access control works
  • Initializable pattern prevents re-initialization

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.
Replace vm.readFile artifact parsing with forge inspect FFI call
to fetch only methodIdentifiers, eliminating full artifact JSON
dumps in test and script traces.
Add 81 new tests across 3 test files covering diamond cut operations
(add/replace/remove), all error conditions, ownership transfer and
handover ceremonies, role management, MultiInit error paths, ETH
handling, and ERC-165 compliance edge cases.
Remove duplicate addFunctions, replaceFunctions, removeFunctions,
diamondCut, and initializeDiamondCut memory variants. Rename
calldata variants to be the canonical functions.
…th-ownable

Refactor and enhance Diamond library with initializable pattern
- Inline storage access to eliminate redundant view helper calls
- Optimize addFunction to use single struct assignment
- Optimize replaceSelectors to avoid costly delete + recreate
- Extract _removeSelectorFromOldFacet for reuse in replace and remove
- Reorganize internal sections for clarity
Replace storage-based interface checks with an assembly switch-case in
ERC165Lib that returns true for ERC-165, ERC-173, IDiamondCut, and
IDiamondLoupe without touching storage. This eliminates the need for
ERC165Init and its storage writes during initialization.
Move supportsInterface from DiamondLoupeFacet into a new ERC165Facet for
cleaner separation of concerns. Update deploy script, test state, and
all test files to register and reference the new facet.
@dadadave80 dadadave80 merged commit d9c4ea7 into main Apr 14, 2026
2 checks passed
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