refactor!: make Diamond an abstract fallback-only base#33
Merged
Conversation
Diamond no longer ships initialize/receive or the Initializable machinery; concrete diamonds now apply cuts in their constructor, or compose Diamond with an initializer guard for factory/CREATE2 deploys. - strip Initializable/InitializableLib and ContextLib from src/ (initializables move to lattice); vendor the pair in test/utils - preInitializer now returns the possibly-zeroed slot so nested constructor initializers finalize exactly once (regression test added); drop deprecated virtual modifiers and unusable lib modifiers - make MockDiamond the reference initializable preset (Diamond + Initializable + receive) consumed by tests and the deploy script; ReinitializableDiamond now extends it - update README, SPECIFICATION, GLOSSARY, and DEVELOPER_GUIDE for the constructor-based initialization pattern BREAKING CHANGE: Diamond is abstract with no initialize or receive; InitializableLib and ContextLib are removed from src/.
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
Restructures the library around a minimal, unopinionated core:
Diamondis now an abstract, fallback-only proxy base (mirroring SolidState'sDiamondBasearchitecture). Concrete diamonds decide their own deployment strategy:test/mocks/MockDiamond.solfor the reference preset)Changes
Diamondlosesinitializeandreceive(), becomesabstract; plain ETH sends now revert withFunctionDoesNotExistunless the concrete diamond opts inInitializableLib+Initializablestripped fromsrc/(destined for lattice) and vendored undertest/utils/;ContextLibdeleted (trivialmsg.senderwrapper)preInitializernow returns the possibly-zeroed slot so nested constructor initializers finalize exactly once — the previous by-value split lost the skip signal, double-emittingInitializedand clearing the initializing flag mid-init. Pinned bytestNestedConstructorInitializerFinalizesOnceMockDiamondis the initializable preset consumed by the deploy script and all suites;ReinitializableDiamondextends itvirtualmodifiers (solc 0.8.35) and dead library modifiersBreaking changes
Diamond.initialize,Diamond.receive,InitializableLib, andContextLibare removed from the library surface.Testing
Vm.solvs solc 0.8.35)