Skip to content

Commit

Permalink
Automatically merged updates to draft EIP(s) 2535 (ethereum#2908)
Browse files Browse the repository at this point in the history
Hi, I'm a bot! This change was automatically merged because:

 - It only modifies existing Draft or Last Call EIP(s)
 - The PR was approved or written by at least one author of each modified EIP
 - The build is passing
  • Loading branch information
mudgen authored and Arachnid committed Mar 6, 2021
1 parent 714ff19 commit db379d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions EIPS/eip-2535.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ A diamond has four standard external functions that can be called to show what f

## Upgrades and Immutability

A diamond can be immutable by not adding an external function to it that can add/replace/remove functions or by removing such functions.
A diamond can be immutable from inception by not adding any external functions that can add/replace/remove functions. [There are number of reasons to do this.](#different-kinds-of-diamonds)

A diamond can be upgraded if has a `diamondCut` external function or other function(s) that can add/replace/remove functions.
A diamond that is mutable can be made immutable by removing such functions.

A diamond can be upgraded if it has a diamondCut external function or other function(s) that can add/replace/remove functions.

## Facets and State Variables

Expand Down Expand Up @@ -232,9 +234,7 @@ An upgradeable diamond has the `diamondCut` function and/or possibly other funct
A finished diamond was an upgradeable diamond and had a number of upgrades. Then its `diamondCut` function and/or other upgrade functions were removed and upgrades are no longer possible. It is no longer possible to add/replace/remove functions. It has become an immutable diamond.

**Single Cut Diamond**
The specification section of the standard is careful not to say that a diamond *has* a `diamondCut` function. Instead it says a diamond *uses* a `diamondCut` function. This careful wording makes single cut diamonds and other patterns possible. A single cut diamond uses the `diamondCut` function in the constructor function of the diamond to add all functions to the diamond, but it does not add the `diamondCut` function to the diamond. This means that a single cut diamond is fully created in its constructor and once created can never be upgraded. It has the same immutability and trustless guarantees as a regular vanilla contract. Why would someone do this? There may be a number of reasons. The two use cases below are really good reasons.

The two use cases below assume that you want an immutable diamond:
A single cut diamond adds all functions to itself in its constructor function, but it does not add the `diamondCut` function or any other function that can add/replace/remove functions. This means that a single cut diamond is fully created in its constructor and once created can never be upgraded. It has the same immutability and trustless guarantees as a regular vanilla contract. Why would someone do this? There may be a number of reasons. The two use cases below are good reasons.

1. Your contract hits the max contract size limit. Make it into a single cut diamond. You still break your big contract into smaller facets, modularizing your code.
2. You start with an upgradeable diamond in your development and testing and upgrade it to your heart's delight. Reap the advantages of easy upgrading and a stable address as you work out new features, bugs and kinks. Release the upgradeable diamond on a test network with your application for beta testing and upgrade it when needed. This is iterative development. When it is solid then deploy it as a single cut diamond on the main network.
Expand Down

0 comments on commit db379d9

Please sign in to comment.