Skip to content

Commit 1063ce0

Browse files
mvanhornIGI-111
andauthored
docs: warn about keeping compiler versions consistent across upgrades (#29547)
* docs: warn about keeping compiler versions consistent across upgrades * docs: note constructor and feature stability, not just checksums Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> --------- Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: IGI-111 <igi-111@protonmail.com>
1 parent 278a36a commit 1063ce0

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

documentation/guides/program_upgradability.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,27 @@ constructor:
134134
position end;
135135
```
136136

137+
### Warning: Keep Compiler Versions Consistent
138+
139+
Checksum-governed upgrades are bytecode-sensitive. Do not assume bytecode is stable across Leo compiler versions: different compiler versions can produce different bytecode for identical source, which can cause a checksum-governed upgrade to fail.
140+
141+
Version consistency matters beyond checksums, though. A program's constructor cannot change between upgrades, and compiler behavior or supported features can change (or even break) across versions. Building every edition with the same pinned toolchain avoids both bytecode drift and subtle semantic differences a different compiler version could introduce.
142+
143+
Pin the Leo compiler version used for the initial deployment and all subsequent upgrades. Before deploying or approving an upgrade, check the local toolchain:
144+
145+
```bash
146+
leo --version
147+
```
148+
149+
To inspect the source currently deployed on the network, query the program. Use `--edition <N>` when you need to inspect a specific edition:
150+
151+
```bash
152+
leo query program <NAME>
153+
leo query program <NAME> --edition <N>
154+
```
155+
156+
The query returns deployed source; it does not print the compiler version. Use it with your pinned toolchain record and rebuild with the same Leo version to avoid bytecode drift.
157+
137158
### Pattern 4: Custom Logic (Time-lock Example)
138159

139160
**Goal:** Enforce a time delay before an upgrade is allowed. No pre-defined mode is available for this so we'll have to write our own upgrade policy

0 commit comments

Comments
 (0)