Design a Gradual Path Towards Immutability

Achieving perfect, bug-free smart contracts at launch is nearly impossible. Instead, treat immutability as a gradual process, building resilience through extensive testing, community review, and real-world use.

By starting with upgradeable contracts and gradually transitioning key components to immutability, you can ensure a balance between security and adaptability as your system matures.


Why Gradual Immutability?

  • Flexibility: Allows for fixes and improvements in the early stages.

  • Risk Mitigation: Reduces the impact of unforeseen vulnerabilities.

  • Progressive Security: Confidence in the code grows over time as it is battle-tested.


Staged Approach to Immutability

  1. Start with Upgradeable Contracts

    • Design most contracts to be upgradeable at launch, especially those with:

      • Complex or novel logic.

      • Dependencies on other upgradeable components.

      • Frequent interactions with external systems.

  2. Identify Candidates for Immutability

    • Mature contracts with:

      • Simple, self-contained logic.

      • Code derived from trusted libraries.

      • Extensive audits and real-world use.

  3. Transition Gradually

    • As confidence builds, evaluate contracts for immutability using these factors:

      • Code Maturity: Proven stability over time.

      • Usage: Widespread adoption and testing by the community.

      • Isolation: Minimal interaction with upgradeable components.


Examples

1. Good Candidate for Immutability

  • Token Contracts: Based on trusted libraries like OpenZeppelin and with self-contained logic.

2. Better Suited for Upgradeability

  • New AMM Models: Complex or experimental algorithms that may require adjustments post-deployment.


Best Practices

  • Leverage a Security Council: Regularly assess which components are ready to transition to immutability.

  • Audit Thoroughly: Ensure each contract has undergone rigorous testing and review before making it immutable.

  • Document the Process: Maintain a clear record of which components are upgradeable and which are immutable.

Last updated