Common
Diamond Upgrade Reversion Plan
If a diamond upgrade reversion is required, the next steps must be followed:
- Determine if the upgraded facet has changed at all (logic, function signatures, etc.). If not, skip next step and continue to step 3.
- If the contract has changed, then use the version control system to go back to the desired state of the contract and build the entire repo to make sure that the
out
directory has the desired abi. - Checkout the
deployments/$CHAIN_ID/$TIMESTAMP/diamonds.json
file and find the facet to revert to its previous state. Make sure that the address of the facet recorded there is not the latest one. You can do this by looking at the historical version of this file through the version control system. - Configure the environment variables to carry out the reversion. Specifically set the following variables in the root
.env
file:
- Finally, run the following script:
Notice that the environment variables are automatically cleaned by the script. This is to prevent accidental faulty upgrades. Also, the script makes sure that the reversion was successful by checking that the old selectors are first removed, the new ones are in the diamond, and that they are configured to point to the correct facet address as well as updating the address within the deployment directory.