Commit 403191e
committed
feat(cli): add
Adds a `--rename <name>` flag to `leo deploy` that recompiles the primary
program under a different on-chain identity, producing a genuinely distinct
deployment. The parsed program scope is rewritten to the new name so every
downstream pass emits the renamed program, and the primary compilation unit
is renamed so build artifacts, the deploy read path, and the bytecode all
share the renamed identity. Programs that import the original name are
intentionally not redirected to the renamed copy.
The rename is applied wherever the primary's source is (re)parsed: both the
bytecode compile and the parse that builds the primary's stub. Otherwise the
stub parse, re-reading a source that still declares the original name under
the renamed unit, would fail the program-name check.
Validation rejects, before any network interaction:
- an invalid Aleo program name;
- a rename onto a name already used by another unit or dependency (compared
on the bare name, since artifacts are keyed that way);
- a no-op rename to the program's current name (compared on the bare name,
since a local primary's name is bare while the target is `.aleo`-suffixed);
- `--rename` combined with `--build-tests` (tests keep their original names
and would dangle against the renamed primary);
- `--rename` when deploying multiple workspace members.
The rename directive lives on the `LeoBuild` command struct rather than the
shared `BuildOptions`, keeping the deploy-only concept out of the compiler
options reused by build/run/test. A `canonicalize_program_name` helper in
`leo-package` centralizes `.aleo`-suffix handling.
Tests cover the rejections and an end-to-end deploy: `--rename` deploys to a
devnode and a follow-up `leo query` confirms the program is on-chain under its
new name.leo deploy --rename to deploy a program under a new name1 parent d199034 commit 403191e
61 files changed
Lines changed: 746 additions & 16 deletions
File tree
- crates
- compiler/src
- leo/src/cli
- commands
- package/src
- tests
- expectations/cli
- test_deploy_rename_conflict
- contents
- child
- src
- grandchild
- src
- parent
- src
- test_deploy_rename_rejected
- contents/solo
- src
- test_deploy_rename
- contents
- build/renamed_prog
- src
- tests/cli
- test_deploy_rename_conflict
- contents
- child
- src
- grandchild
- src
- parent
- src
- test_deploy_rename_rejected
- contents/solo
- src
- test_deploy_rename
- contents
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
95 | 96 | | |
96 | 97 | | |
97 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| |||
133 | 139 | | |
134 | 140 | | |
135 | 141 | | |
136 | | - | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
144 | | - | |
| 150 | + | |
| 151 | + | |
145 | 152 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
149 | 171 | | |
150 | | - | |
| 172 | + | |
151 | 173 | | |
152 | 174 | | |
153 | 175 | | |
| |||
157 | 179 | | |
158 | 180 | | |
159 | 181 | | |
160 | | - | |
| 182 | + | |
161 | 183 | | |
162 | 184 | | |
163 | 185 | | |
164 | 186 | | |
165 | | - | |
| 187 | + | |
166 | 188 | | |
167 | 189 | | |
168 | 190 | | |
| |||
328 | 350 | | |
329 | 351 | | |
330 | 352 | | |
| 353 | + | |
331 | 354 | | |
332 | 355 | | |
333 | 356 | | |
| |||
1174 | 1197 | | |
1175 | 1198 | | |
1176 | 1199 | | |
1177 | | - | |
| 1200 | + | |
1178 | 1201 | | |
1179 | 1202 | | |
1180 | 1203 | | |
| |||
1306 | 1329 | | |
1307 | 1330 | | |
1308 | 1331 | | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1309 | 1377 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
587 | 587 | | |
588 | 588 | | |
589 | 589 | | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
590 | 608 | | |
591 | 609 | | |
592 | 610 | | |
| |||
686 | 704 | | |
687 | 705 | | |
688 | 706 | | |
| 707 | + | |
689 | 708 | | |
690 | 709 | | |
691 | 710 | | |
| |||
721 | 740 | | |
722 | 741 | | |
723 | 742 | | |
| 743 | + | |
724 | 744 | | |
725 | 745 | | |
726 | 746 | | |
| |||
756 | 776 | | |
757 | 777 | | |
758 | 778 | | |
| 779 | + | |
759 | 780 | | |
760 | 781 | | |
761 | 782 | | |
| |||
791 | 812 | | |
792 | 813 | | |
793 | 814 | | |
| 815 | + | |
794 | 816 | | |
795 | 817 | | |
796 | 818 | | |
| |||
822 | 844 | | |
823 | 845 | | |
824 | 846 | | |
| 847 | + | |
825 | 848 | | |
826 | 849 | | |
827 | 850 | | |
| |||
875 | 898 | | |
876 | 899 | | |
877 | 900 | | |
| 901 | + | |
878 | 902 | | |
879 | 903 | | |
880 | 904 | | |
| |||
911 | 935 | | |
912 | 936 | | |
913 | 937 | | |
| 938 | + | |
914 | 939 | | |
915 | 940 | | |
916 | 941 | | |
| |||
946 | 971 | | |
947 | 972 | | |
948 | 973 | | |
| 974 | + | |
949 | 975 | | |
950 | 976 | | |
951 | 977 | | |
| |||
993 | 1019 | | |
994 | 1020 | | |
995 | 1021 | | |
| 1022 | + | |
996 | 1023 | | |
997 | 1024 | | |
998 | 1025 | | |
| |||
1040 | 1067 | | |
1041 | 1068 | | |
1042 | 1069 | | |
| 1070 | + | |
1043 | 1071 | | |
1044 | 1072 | | |
1045 | 1073 | | |
| |||
1087 | 1115 | | |
1088 | 1116 | | |
1089 | 1117 | | |
| 1118 | + | |
1090 | 1119 | | |
1091 | 1120 | | |
1092 | 1121 | | |
| |||
1135 | 1164 | | |
1136 | 1165 | | |
1137 | 1166 | | |
| 1167 | + | |
1138 | 1168 | | |
1139 | 1169 | | |
1140 | 1170 | | |
| |||
1193 | 1223 | | |
1194 | 1224 | | |
1195 | 1225 | | |
| 1226 | + | |
1196 | 1227 | | |
1197 | 1228 | | |
1198 | 1229 | | |
| |||
0 commit comments