Skip to content

Commit af64acc

Browse files
authored
docs: improve upgrades warning (#24462)
The docs don't currently do a good job of explaining to users just how scared they should be of trying to do an upgrade as of today.
1 parent 48be1a8 commit af64acc

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

docs/docs-developers/docs/aztec-nr/framework-description/contract_upgrades.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ tags: [contracts]
55
description: Understand contract upgrade patterns in Aztec and how to implement upgradeable contracts.
66
---
77

8+
:::warning[Upgrades are not yet well supported by the framework]
9+
Contract upgrades are currently a low-level protocol feature with minimal framework support. Before relying on them, be aware that:
10+
11+
- Upgrades are hard to execute correctly, and need lots of careful testing.
12+
- State migrations are non-trivial and also require extensive testing. The new implementation must be compatible with all existing state, including public storage, private notes, and initialization status.
13+
- The `#[aztec]` macros are not at the moment built with upgrades in mind. Macro-generated code makes assumptions that upgrades can violate (for example, initialization checks in the new implementation can make all functions of already-deployed instances permanently uncallable), so users may need to drop the macros until support is added.
14+
- There is no additional tooling at the moment to help with upgrades, such as detection of storage layout compatibility between the old and new implementations.
15+
16+
All in all, this feature is not well supported by the framework as of now, and should only be used with extreme care.
17+
:::
18+
819
Each contract instance refers to a contract class ID for its code. Upgrading a contract's implementation involves updating its current class ID to a new class ID, while retaining the original class ID for address verification.
920

1021
## Original class ID
@@ -134,11 +145,3 @@ const updatedContract = UpdatedContract.at(contract.address, wallet);
134145
```
135146

136147
If you try to register a contract artifact that doesn't match the current contract class, the registration will fail.
137-
138-
### Security considerations
139-
140-
1. **Access control**: Implement proper access controls for upgrade functions. Consider using `set_update_delay` to customize the delay for your security requirements.
141-
142-
2. **State compatibility**: Ensure the new implementation is compatible with existing state. Maintain the same storage layout to prevent data corruption.
143-
144-
3. **Testing**: Test upgrades thoroughly in a development environment. Verify all existing functionality works with the new implementation.

0 commit comments

Comments
 (0)