The Draft “ERC-8109 Diamonds, Simplified,” is here: ERC-8109: Diamonds, Simplified
All feedback for this standard should be given in the comments below.
Please give your feedback about what you think needs improvement. And also please give feedback on what parts of the design you think are correct and should not be changed. Any kind of real world experience or useful data to consider for the standard is also very helpful.
Preface
Over the years ERC-2535 Diamonds has been adopted enthusiastically by numerous projects, including a number of high-profile teams:
- ZKsync
- Li.Fi
- Aavegotchi
- Trust Wallet
- Towns Protocol
- Boson Protocol
- Stobox
- Venus Protocol
- hardhat-deploy
- Etherscan
Despite its use, ERC-2535 has sometimes been described as complex or “hard to understand,” even though its actual requirements are small, simple and straightforward.
The diamond pattern is not complex. Over time, I’ve noticed that most of the confusion comes from a few specific sources:
- Unnecessary diamond industry jargon.
- Relatively complex loupe (introspection) implementations.
- Diamond storage / namespaced storage, now a more common technique that was unfamiliar to many.
- Unfamiliarity with diamond contracts.
- Misinformation about diamonds.
- Articles that framed diamonds as inherently complex or suitable only for complex systems.
Important Clarification
Complexity in software can be understood as anything that makes a system harder to understand or work with.
ERC-2535 was never designed to create complex (hard to understand) systems.
Its purpose has always been the opposite — to reduce complexity in large smart contract systems by giving developers a structured way to isolate, organize, test, and manage distinct areas of functionality.
When diamonds are used this way, they’re being used as intended.
What is a Diamond Contract?
A less technical description of diamond contracts can be found here.
A diamond is a proxy contract that delegatecalls to multiple implementation contracts called facets. It has been standardized by ERC-2535 Diamonds.
New Proposal
I am proposing a new, simplified standard for diamond contracts. It is meant to make diamonds easier to understand and implement and to improve event functionality.
The new standard addresses these things:
-
Simplified terminology:
- Keeps the terms “diamond” and “facet”.
- Replaces “loupe” with “inspect” or “introspection”.
- Replaces “diamondCut” with “upgradeDiamond”.
-
A simpler introspection functions.
-
More capable events.
-
Optional upgrade path for existing ERC-2535 Diamond implementations.
Events
The problem with the DiamondCut event is that nothing is indexed and the data is in arrays. This makes it difficult for tools to filter, index, or analyze function and facet changes.
I propose new diamond events which can be see in the standard.
These events cost more gas than using the DiamondCut event, but they enable more functionality.
The new events:
- solve searchability
- improve GUI interoperability
- allow fine-grained history queries
- help explorers reconstruct upgrade history
- enable blockchain-wide analytics on functions and facets
Gas cost benchmark tests show that the new events increase the overall gas costs of adding functions to diamonds by about 3.5%. See the gas benchmark tests here.
Request for Feedback
Please read the standard here: ERC-8109: Diamonds, Simplified
I am actively seeking feedback on this proposal. Please share your thoughts on any aspects that could be improved, simplified, or clarified.
Additionally, if you agree with specific design choices, please let me know why. Validating the current design is just as important as finding edge cases. Broad community review is essential to ensuring this standard is robust and ready for adoption.
This new standard is going to need a new name, what should it be called? Here are some ideas:
- Diamonds, Simplified
- Diamond Pattern
- Diamond Standard (trademark dispute)
- What else?