You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs-developers/docs/aztec-nr/framework-description/contract_upgrades.md
+11-8Lines changed: 11 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,17 @@ tags: [contracts]
5
5
description: Understand contract upgrade patterns in Aztec and how to implement upgradeable contracts.
6
6
---
7
7
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
+
8
19
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.
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