@aztec/aztec 0.0.0-test.1 → 0.0.1-commit.001888fc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +1 -1
  2. package/dest/bin/index.d.ts +1 -1
  3. package/dest/bin/index.js +28 -13
  4. package/dest/cli/admin_api_key_store.d.ts +45 -0
  5. package/dest/cli/admin_api_key_store.d.ts.map +1 -0
  6. package/dest/cli/admin_api_key_store.js +98 -0
  7. package/dest/cli/aztec_start_action.d.ts +1 -1
  8. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  9. package/dest/cli/aztec_start_action.js +89 -44
  10. package/dest/cli/aztec_start_options.d.ts +5 -3
  11. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  12. package/dest/cli/aztec_start_options.js +157 -220
  13. package/dest/cli/cli.d.ts +1 -1
  14. package/dest/cli/cli.d.ts.map +1 -1
  15. package/dest/cli/cli.js +11 -7
  16. package/dest/cli/cmds/compile.d.ts +4 -0
  17. package/dest/cli/cmds/compile.d.ts.map +1 -0
  18. package/dest/cli/cmds/compile.js +166 -0
  19. package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
  20. package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
  21. package/dest/cli/cmds/migrate_ha_db.js +27 -0
  22. package/dest/cli/cmds/profile.d.ts +4 -0
  23. package/dest/cli/cmds/profile.d.ts.map +1 -0
  24. package/dest/cli/cmds/profile.js +8 -0
  25. package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
  26. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
  27. package/dest/cli/cmds/profile_flamegraph.js +52 -0
  28. package/dest/cli/cmds/profile_gates.d.ts +4 -0
  29. package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
  30. package/dest/cli/cmds/profile_gates.js +58 -0
  31. package/dest/cli/cmds/profile_utils.d.ts +18 -0
  32. package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
  33. package/dest/cli/cmds/profile_utils.js +50 -0
  34. package/dest/cli/cmds/standby.d.ts +32 -0
  35. package/dest/cli/cmds/standby.d.ts.map +1 -0
  36. package/dest/cli/cmds/standby.js +97 -0
  37. package/dest/cli/cmds/start_archiver.d.ts +2 -2
  38. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  39. package/dest/cli/cmds/start_archiver.js +25 -19
  40. package/dest/cli/cmds/start_bot.d.ts +4 -7
  41. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  42. package/dest/cli/cmds/start_bot.js +29 -14
  43. package/dest/cli/cmds/start_node.d.ts +3 -2
  44. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  45. package/dest/cli/cmds/start_node.js +128 -85
  46. package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
  47. package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
  48. package/dest/cli/cmds/start_p2p_bootstrap.js +10 -6
  49. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  50. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  51. package/dest/cli/cmds/start_prover_agent.js +35 -6
  52. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  53. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  54. package/dest/cli/cmds/start_prover_broker.js +17 -5
  55. package/dest/cli/cmds/start_txe.d.ts +1 -1
  56. package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
  57. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
  58. package/dest/cli/cmds/utils/artifacts.js +24 -0
  59. package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
  60. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
  61. package/dest/cli/cmds/utils/needs_recompile.js +134 -0
  62. package/dest/cli/cmds/utils/spawn.d.ts +3 -0
  63. package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
  64. package/dest/cli/cmds/utils/spawn.js +16 -0
  65. package/dest/cli/index.d.ts +1 -1
  66. package/dest/cli/preload_crs.d.ts +3 -0
  67. package/dest/cli/preload_crs.d.ts.map +1 -0
  68. package/dest/cli/preload_crs.js +6 -0
  69. package/dest/cli/util.d.ts +37 -17
  70. package/dest/cli/util.d.ts.map +1 -1
  71. package/dest/cli/util.js +165 -31
  72. package/dest/cli/versioning.d.ts +1 -1
  73. package/dest/cli/versioning.js +3 -3
  74. package/dest/examples/token.d.ts +1 -1
  75. package/dest/examples/token.js +31 -18
  76. package/dest/examples/util.d.ts +5 -6
  77. package/dest/examples/util.d.ts.map +1 -1
  78. package/dest/examples/util.js +5 -6
  79. package/dest/index.d.ts +2 -2
  80. package/dest/index.d.ts.map +1 -1
  81. package/dest/index.js +1 -1
  82. package/dest/local-network/banana_fpc.d.ts +10 -0
  83. package/dest/local-network/banana_fpc.d.ts.map +1 -0
  84. package/dest/{sandbox → local-network}/banana_fpc.js +23 -25
  85. package/dest/local-network/index.d.ts +4 -0
  86. package/dest/local-network/index.d.ts.map +1 -0
  87. package/dest/local-network/index.js +3 -0
  88. package/dest/local-network/local-network.d.ts +73 -0
  89. package/dest/local-network/local-network.d.ts.map +1 -0
  90. package/dest/local-network/local-network.js +226 -0
  91. package/dest/local-network/sponsored_fpc.d.ts +5 -0
  92. package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
  93. package/dest/local-network/sponsored_fpc.js +18 -0
  94. package/dest/mnemonic.d.ts +1 -1
  95. package/dest/splash.d.ts +1 -1
  96. package/dest/testing/anvil_test_watcher.d.ts +42 -0
  97. package/dest/testing/anvil_test_watcher.d.ts.map +1 -0
  98. package/dest/testing/anvil_test_watcher.js +181 -0
  99. package/dest/testing/cheat_codes.d.ts +43 -0
  100. package/dest/testing/cheat_codes.d.ts.map +1 -0
  101. package/dest/testing/cheat_codes.js +62 -0
  102. package/dest/testing/epoch_test_settler.d.ts +19 -0
  103. package/dest/testing/epoch_test_settler.d.ts.map +1 -0
  104. package/dest/testing/epoch_test_settler.js +61 -0
  105. package/dest/testing/index.d.ts +6 -0
  106. package/dest/testing/index.d.ts.map +1 -0
  107. package/dest/testing/index.js +5 -0
  108. package/dest/testing/token_allowed_setup.d.ts +7 -0
  109. package/dest/testing/token_allowed_setup.d.ts.map +1 -0
  110. package/dest/testing/token_allowed_setup.js +20 -0
  111. package/package.json +55 -45
  112. package/scripts/add_crate.sh +102 -0
  113. package/scripts/aztec.sh +69 -0
  114. package/scripts/init.sh +39 -0
  115. package/scripts/new.sh +83 -0
  116. package/scripts/setup_workspace.sh +68 -0
  117. package/src/bin/index.ts +33 -13
  118. package/src/cli/admin_api_key_store.ts +128 -0
  119. package/src/cli/aztec_start_action.ts +87 -41
  120. package/src/cli/aztec_start_options.ts +176 -218
  121. package/src/cli/cli.ts +19 -11
  122. package/src/cli/cmds/compile.ts +191 -0
  123. package/src/cli/cmds/migrate_ha_db.ts +43 -0
  124. package/src/cli/cmds/profile.ts +25 -0
  125. package/src/cli/cmds/profile_flamegraph.ts +64 -0
  126. package/src/cli/cmds/profile_gates.ts +68 -0
  127. package/src/cli/cmds/profile_utils.ts +58 -0
  128. package/src/cli/cmds/standby.ts +132 -0
  129. package/src/cli/cmds/start_archiver.ts +16 -21
  130. package/src/cli/cmds/start_bot.ts +40 -14
  131. package/src/cli/cmds/start_node.ts +146 -91
  132. package/src/cli/cmds/start_p2p_bootstrap.ts +14 -6
  133. package/src/cli/cmds/start_prover_agent.ts +26 -14
  134. package/src/cli/cmds/start_prover_broker.ts +28 -4
  135. package/src/cli/cmds/utils/artifacts.ts +44 -0
  136. package/src/cli/cmds/utils/needs_recompile.ts +151 -0
  137. package/src/cli/cmds/utils/spawn.ts +16 -0
  138. package/src/cli/preload_crs.ts +7 -0
  139. package/src/cli/util.ts +186 -50
  140. package/src/cli/versioning.ts +3 -3
  141. package/src/examples/token.ts +23 -19
  142. package/src/examples/util.ts +6 -8
  143. package/src/index.ts +5 -6
  144. package/src/{sandbox → local-network}/banana_fpc.ts +28 -29
  145. package/src/local-network/index.ts +7 -0
  146. package/src/local-network/local-network.ts +277 -0
  147. package/src/local-network/sponsored_fpc.ts +26 -0
  148. package/src/testing/anvil_test_watcher.ts +210 -0
  149. package/src/testing/cheat_codes.ts +79 -0
  150. package/src/testing/epoch_test_settler.ts +70 -0
  151. package/src/testing/index.ts +5 -0
  152. package/src/testing/token_allowed_setup.ts +19 -0
  153. package/dest/cli/chain_l2_config.d.ts +0 -19
  154. package/dest/cli/chain_l2_config.d.ts.map +0 -1
  155. package/dest/cli/chain_l2_config.js +0 -56
  156. package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
  157. package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
  158. package/dest/cli/cmds/start_blob_sink.js +0 -17
  159. package/dest/cli/cmds/start_faucet.d.ts +0 -4
  160. package/dest/cli/cmds/start_faucet.d.ts.map +0 -1
  161. package/dest/cli/cmds/start_faucet.js +0 -20
  162. package/dest/cli/cmds/start_prover_node.d.ts +0 -7
  163. package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
  164. package/dest/cli/cmds/start_prover_node.js +0 -110
  165. package/dest/cli/cmds/start_pxe.d.ts +0 -16
  166. package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
  167. package/dest/cli/cmds/start_pxe.js +0 -95
  168. package/dest/cli/get_l1_config.d.ts +0 -7
  169. package/dest/cli/get_l1_config.d.ts.map +0 -1
  170. package/dest/cli/get_l1_config.js +0 -13
  171. package/dest/sandbox/banana_fpc.d.ts +0 -11
  172. package/dest/sandbox/banana_fpc.d.ts.map +0 -1
  173. package/dest/sandbox/index.d.ts +0 -5
  174. package/dest/sandbox/index.d.ts.map +0 -1
  175. package/dest/sandbox/index.js +0 -4
  176. package/dest/sandbox/sandbox.d.ts +0 -76
  177. package/dest/sandbox/sandbox.d.ts.map +0 -1
  178. package/dest/sandbox/sandbox.js +0 -181
  179. package/dest/sandbox/sponsored_fee_payment_method.d.ts +0 -23
  180. package/dest/sandbox/sponsored_fee_payment_method.d.ts.map +0 -1
  181. package/dest/sandbox/sponsored_fee_payment_method.js +0 -36
  182. package/dest/sandbox/sponsored_fpc.d.ts +0 -6
  183. package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
  184. package/dest/sandbox/sponsored_fpc.js +0 -26
  185. package/src/cli/chain_l2_config.ts +0 -74
  186. package/src/cli/cmds/start_blob_sink.ts +0 -31
  187. package/src/cli/cmds/start_faucet.ts +0 -34
  188. package/src/cli/cmds/start_prover_node.ts +0 -121
  189. package/src/cli/cmds/start_pxe.ts +0 -129
  190. package/src/cli/get_l1_config.ts +0 -18
  191. package/src/sandbox/index.ts +0 -5
  192. package/src/sandbox/sandbox.ts +0 -229
  193. package/src/sandbox/sponsored_fee_payment_method.ts +0 -46
  194. package/src/sandbox/sponsored_fpc.ts +0 -38
@@ -0,0 +1,21 @@
1
+ export interface CompiledArtifact {
2
+ noir_version: string;
3
+ file_map: unknown;
4
+ functions: ContractFunction[];
5
+ bytecode?: string;
6
+ }
7
+ export interface ContractFunction {
8
+ name: string;
9
+ abi: unknown;
10
+ bytecode: string;
11
+ debug_symbols: unknown;
12
+ is_unconstrained?: boolean;
13
+ }
14
+ export interface ArtifactFile {
15
+ name: string;
16
+ filePath: string;
17
+ content: CompiledArtifact;
18
+ }
19
+ /** Reads all JSON artifact files from a target directory and returns their parsed contents. */
20
+ export declare function readArtifactFiles(targetDir: string): Promise<ArtifactFile[]>;
21
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXJ0aWZhY3RzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvYXJ0aWZhY3RzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBLE1BQU0sV0FBVyxnQkFBZ0I7SUFDL0IsWUFBWSxFQUFFLE1BQU0sQ0FBQztJQUNyQixRQUFRLEVBQUUsT0FBTyxDQUFDO0lBQ2xCLFNBQ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OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,+FAA+F;AAC/F,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAkBlF"}
@@ -0,0 +1,24 @@
1
+ import { readFile, readdir } from 'fs/promises';
2
+ import { join } from 'path';
3
+ /** Reads all JSON artifact files from a target directory and returns their parsed contents. */ export async function readArtifactFiles(targetDir) {
4
+ let entries;
5
+ try {
6
+ entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
7
+ } catch (err) {
8
+ if (err?.code === 'ENOENT') {
9
+ throw new Error(`Target directory '${targetDir}' does not exist. Compile first with 'aztec compile'.`);
10
+ }
11
+ throw err;
12
+ }
13
+ const artifacts = [];
14
+ for (const file of entries){
15
+ const filePath = join(targetDir, file);
16
+ const content = JSON.parse(await readFile(filePath, 'utf-8'));
17
+ artifacts.push({
18
+ name: file.replace('.json', ''),
19
+ filePath,
20
+ content
21
+ });
22
+ }
23
+ return artifacts;
24
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
3
+ * (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
4
+ * that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
5
+ * a recompile.
6
+ *
7
+ * Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
8
+ */
9
+ export declare function needsRecompile(): Promise<boolean>;
10
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmVlZHNfcmVjb21waWxlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY2xpL2NtZHMvdXRpbHMvbmVlZHNfcmVjb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUlBOzs7Ozs7O0dBT0c7QUFDSCx3QkFBc0IsY0FBYyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsQ0FRdkQifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"needs_recompile.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/needs_recompile.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAQvD"}
@@ -0,0 +1,134 @@
1
+ import TOML from '@iarna/toml';
2
+ import { readFile, readdir, stat } from 'fs/promises';
3
+ import { join, resolve } from 'path';
4
+ /**
5
+ * Returns true if recompilation is needed: either no artifacts exist in target/ or any .nr or Nargo.toml source file
6
+ * (including path-based dependencies) is newer than the oldest artifact. We compare against the oldest artifact so
7
+ * that a source change between the oldest and newest compilation (e.g. in a multi-contract workspace) still triggers
8
+ * a recompile.
9
+ *
10
+ * Note: The above implies that if there is a random json file in the target dir we would be always recompiling.
11
+ */ export async function needsRecompile() {
12
+ const oldestArtifactMs = await getOldestArtifactModificationTime('target');
13
+ if (oldestArtifactMs === undefined) {
14
+ return true;
15
+ }
16
+ const crateDirs = await collectCrateDirs('.');
17
+ return hasNewerSourceFile(crateDirs, oldestArtifactMs);
18
+ }
19
+ /**
20
+ * Returns the last modification time (timestamp in ms) of the oldest .json artifact in targetDir, or undefined if
21
+ * none exist.
22
+ */ async function getOldestArtifactModificationTime(targetDir) {
23
+ let entries;
24
+ try {
25
+ entries = (await readdir(targetDir)).filter((f)=>f.endsWith('.json'));
26
+ } catch (err) {
27
+ if (err?.code === 'ENOENT') {
28
+ return undefined;
29
+ }
30
+ throw err;
31
+ }
32
+ if (entries.length === 0) {
33
+ return undefined;
34
+ }
35
+ let oldest = Infinity;
36
+ for (const entry of entries){
37
+ const s = await stat(join(targetDir, entry));
38
+ if (s.mtimeMs < oldest) {
39
+ oldest = s.mtimeMs;
40
+ }
41
+ }
42
+ return oldest;
43
+ }
44
+ /**
45
+ * Recursively collects crate directories starting from startCrateDir by following path-based dependencies declared in
46
+ * Nargo.toml files. Git-based deps are ignored (they only change when Nargo.toml itself is modified since the deps are
47
+ * tagged).
48
+ */ async function collectCrateDirs(startCrateDir) {
49
+ // We have a set of visited dirs we check against when entering a new dir because we could stumble upon a directory
50
+ // multiple times in case multiple deps shared a dep (e.g. dep A and dep B both sharing dep C).
51
+ const visited = new Set();
52
+ async function visit(crateDir) {
53
+ const absDir = resolve(crateDir);
54
+ if (visited.has(absDir)) {
55
+ return;
56
+ }
57
+ visited.add(absDir);
58
+ // Every dep is its own crate and every crate needs to have Nargo.toml defined in the root so we try to load it and
59
+ // error out if it's not the case.
60
+ const tomlPath = join(absDir, 'Nargo.toml');
61
+ const content = await readFile(tomlPath, 'utf-8').catch(()=>{
62
+ throw new Error(`Incorrectly defined dependency. Nargo.toml not found in ${absDir}`);
63
+ });
64
+ const parsed = TOML.parse(content);
65
+ const members = parsed.workspace?.members;
66
+ // A Nargo.toml is either a workspace root (has workspace.members) or a single crate (has dependencies).
67
+ if (Array.isArray(members)) {
68
+ // The crate is a workspace root and has members defined so we visit the members
69
+ for (const member of members){
70
+ const memberPath = resolve(absDir, member);
71
+ await visit(memberPath);
72
+ }
73
+ } else {
74
+ // The crate is not a workspace root so we check for dependencies
75
+ const deps = parsed.dependencies ?? {};
76
+ for (const dep of Object.values(deps)){
77
+ if (dep && typeof dep === 'object' && typeof dep.path === 'string') {
78
+ const depPath = resolve(absDir, dep.path);
79
+ const s = await stat(depPath);
80
+ if (!s.isDirectory()) {
81
+ throw new Error(`Dependency path "${dep.path}" in ${tomlPath} resolves to ${depPath} which is not a directory`);
82
+ }
83
+ await visit(depPath);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ await visit(startCrateDir);
89
+ return [
90
+ ...visited
91
+ ];
92
+ }
93
+ /**
94
+ * Walks crate dirs looking for .nr and Nargo.toml files newer than thresholdMs. Short-circuits on the first match.
95
+ */ async function hasNewerSourceFile(crateDirs, thresholdMs) {
96
+ // Returns true if it find a new file than thresholdMs, false otherwise
97
+ async function walkForNewer(dir) {
98
+ let entries;
99
+ try {
100
+ entries = await readdir(dir, {
101
+ withFileTypes: true
102
+ });
103
+ } catch {
104
+ return false;
105
+ }
106
+ // We iterate over the entries in the dir
107
+ for (const entry of entries){
108
+ const fullPath = join(dir, entry.name);
109
+ if (entry.isDirectory()) {
110
+ // If the entry is a dir and it's not called `target` we recursively enter it
111
+ if (entry.name === 'target') {
112
+ continue;
113
+ }
114
+ if (await walkForNewer(fullPath)) {
115
+ return true;
116
+ }
117
+ } else if (entry.name === 'Nargo.toml' || entry.name.endsWith('.nr')) {
118
+ // The entry is a Nargo.toml file or *.nr file so we check the timestamp
119
+ const s = await stat(fullPath);
120
+ if (s.mtimeMs > thresholdMs) {
121
+ return true;
122
+ }
123
+ }
124
+ }
125
+ return false;
126
+ }
127
+ // We search through the crate dirs
128
+ for (const dir of crateDirs){
129
+ if (await walkForNewer(dir)) {
130
+ return true;
131
+ }
132
+ }
133
+ return false;
134
+ }
@@ -0,0 +1,3 @@
1
+ /** Spawns a command with inherited stdio and rejects on non-zero exit. */
2
+ export declare function run(cmd: string, args: string[]): Promise<void>;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhd24uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jbGkvY21kcy91dGlscy9zcGF3bi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSwwRUFBMEU7QUFDMUUsd0JBQWdCLEdBQUcsQ0FBQyxHQUFHLEVBQUUsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLEVBQUUsR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBWTlEIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../../src/cli/cmds/utils/spawn.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY9D"}
@@ -0,0 +1,16 @@
1
+ import { spawn } from 'child_process';
2
+ /** Spawns a command with inherited stdio and rejects on non-zero exit. */ export function run(cmd, args) {
3
+ return new Promise((resolve, reject)=>{
4
+ const child = spawn(cmd, args, {
5
+ stdio: 'inherit'
6
+ });
7
+ child.on('error', reject);
8
+ child.on('close', (code)=>{
9
+ if (code !== 0) {
10
+ reject(new Error(`${cmd} exited with code ${code}`));
11
+ } else {
12
+ resolve();
13
+ }
14
+ });
15
+ });
16
+ }
@@ -1,2 +1,2 @@
1
1
  export * from './cli.js';
2
- //# sourceMappingURL=index.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGkvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxVQUFVLENBQUMifQ==
@@ -0,0 +1,3 @@
1
+ import type { LogFn, Logger } from '@aztec/foundation/log';
2
+ export declare function preloadCrs(_options: any, userLog: LogFn, _debugLogger: Logger): Promise<void>;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJlbG9hZF9jcnMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jbGkvcHJlbG9hZF9jcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBSTNELHdCQUFzQixVQUFVLENBQUMsUUFBUSxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLGlCQUVuRiJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preload_crs.d.ts","sourceRoot":"","sources":["../../src/cli/preload_crs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAI3D,wBAAsB,UAAU,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,iBAEnF"}
@@ -0,0 +1,6 @@
1
+ import { preloadCrsDataForServerSideProving } from './util.js';
2
+ export async function preloadCrs(_options, userLog, _debugLogger) {
3
+ await preloadCrsDataForServerSideProving({
4
+ realProofs: true
5
+ }, userLog);
6
+ }
@@ -1,26 +1,32 @@
1
- import type { AccountManager, Fr } from '@aztec/aztec.js';
2
- import type { ConfigMappingsType } from '@aztec/foundation/config';
3
- import type { LogFn } from '@aztec/foundation/log';
4
- import type { PXEService } from '@aztec/pxe/server';
1
+ import type { AztecNodeConfig } from '@aztec/aztec-node';
2
+ import type { AccountManager } from '@aztec/aztec.js/wallet';
3
+ import type { ViemClient } from '@aztec/ethereum/types';
4
+ import type { ConfigMappingsType, NetworkNames } from '@aztec/foundation/config';
5
+ import { type LogFn } from '@aztec/foundation/log';
6
+ import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
7
+ import type { EmbeddedWallet } from '@aztec/wallets/embedded';
5
8
  import type { Command } from 'commander';
6
9
  import { type AztecStartOption } from './aztec_start_options.js';
7
- export declare const installSignalHandlers: (logFn: LogFn, cb?: Array<() => Promise<void>>) => void;
10
+ export declare const enum ExitCode {
11
+ SUCCESS = 0,
12
+ ERROR = 1,
13
+ ROLLUP_UPGRADE = 78,
14
+ VERSION_UPGRADE = 79,
15
+ SIGHUP = 129,
16
+ SIGINT = 130,
17
+ SIGQUIT = 131,
18
+ SIGTERM = 143
19
+ }
20
+ export declare function shutdown(logFn: LogFn, exitCode: ExitCode, cb?: Array<() => Promise<void>>): Promise<never>;
21
+ export declare function isShuttingDown(): boolean;
22
+ export declare const installSignalHandlers: (logFn: LogFn, cb?: (() => Promise<void>)[] | undefined) => void;
8
23
  /**
9
24
  * Creates logs for the initial accounts
10
25
  * @param accounts - The initial accounts
11
- * @param pxe - A PXE instance to get the registered accounts
26
+ * @param wallet - A EmbeddedWallet instance to get the registered accounts
12
27
  * @returns A string array containing the initial accounts details
13
28
  */
14
- export declare function createAccountLogs(accountsWithSecretKeys: {
15
- /**
16
- * The account object
17
- */
18
- account: AccountManager;
19
- /**
20
- * The secret key of the account
21
- */
22
- secretKey: Fr;
23
- }[], pxe: PXEService): Promise<string[]>;
29
+ export declare function createAccountLogs(accountManagers: AccountManager[], wallet: EmbeddedWallet): Promise<string[]>;
24
30
  export declare function getMaxLengths(sections: {
25
31
  [key: string]: AztecStartOption[];
26
32
  }): [number, number];
@@ -43,4 +49,18 @@ export declare const extractNamespacedOptions: (options: Record<string, any>, na
43
49
  * @returns Key-value map of relevant options.
44
50
  */
45
51
  export declare const extractRelevantOptions: <T>(options: Record<string, any>, mappings: ConfigMappingsType<T>, namespace: string) => T;
46
- //# sourceMappingURL=util.d.ts.map
52
+ /**
53
+ * Downloads just enough points to be able to verify Chonk proofs.
54
+ * @param opts - Whether proof are to be verifier
55
+ * @param log - Logging function
56
+ */
57
+ export declare function preloadCrsDataForVerifying({ realProofs }: Pick<AztecNodeConfig, 'realProofs'>, log: LogFn): Promise<void>;
58
+ /**
59
+ * Downloads enough points to be able to prove every server-side circuit
60
+ * @param opts - Whether real proof are to be generated
61
+ * @param log - Logging function
62
+ */
63
+ export declare function preloadCrsDataForServerSideProving({ realProofs }: Pick<ProverConfig, 'realProofs'>, log: LogFn): Promise<void>;
64
+ export declare function setupVersionChecker(network: NetworkNames, followsCanonicalRollup: boolean, publicClient: ViemClient, signalHandlers: Array<() => Promise<void>>, cacheDir?: string): Promise<void>;
65
+ export declare function stringifyConfig(config: object): string;
66
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpb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AU,EAAE,EAAE,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EACnD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;GAIG;AACH,wBAAsB,kCAAkC,CACtD,EAAE,UAAU,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAChD,GAAG,EAAE,KAAK,GACT,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,YAAY,EACrB,sBAAsB,EAAE,OAAO,EAC/B,YAAY,EAAE,UAAU,EACxB,cAAc,EAAE,KAAK,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAC1C,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAItD"}
package/dest/cli/util.js CHANGED
@@ -1,36 +1,85 @@
1
+ import { getNetworkConfig } from '@aztec/cli/config';
2
+ import { RegistryContract } from '@aztec/ethereum/contracts';
3
+ import { jsonStringify } from '@aztec/foundation/json-rpc';
4
+ import { createLogger } from '@aztec/foundation/log';
5
+ import { getPackageVersion } from '@aztec/stdlib/update-checker';
1
6
  import chalk from 'chalk';
2
7
  import { aztecStartOptions } from './aztec_start_options.js';
8
+ export var ExitCode = /*#__PURE__*/ function(ExitCode) {
9
+ ExitCode[ExitCode["SUCCESS"] = 0] = "SUCCESS";
10
+ ExitCode[ExitCode["ERROR"] = 1] = "ERROR";
11
+ ExitCode[ExitCode["ROLLUP_UPGRADE"] = 78] = "ROLLUP_UPGRADE";
12
+ ExitCode[ExitCode["VERSION_UPGRADE"] = 79] = "VERSION_UPGRADE";
13
+ // 128 + int(SIGNAL)
14
+ ExitCode[ExitCode["SIGHUP"] = 129] = "SIGHUP";
15
+ ExitCode[ExitCode["SIGINT"] = 130] = "SIGINT";
16
+ ExitCode[ExitCode["SIGQUIT"] = 131] = "SIGQUIT";
17
+ ExitCode[ExitCode["SIGTERM"] = 143] = "SIGTERM";
18
+ return ExitCode;
19
+ }({});
20
+ let shutdownPromise;
21
+ export function shutdown(logFn, exitCode, cb) {
22
+ if (shutdownPromise) {
23
+ logFn('Already shutting down.');
24
+ return shutdownPromise;
25
+ }
26
+ logFn('Shutting down...', {
27
+ exitCode
28
+ });
29
+ if (cb) {
30
+ shutdownPromise = Promise.allSettled(cb.map((fn)=>fn())).then(()=>process.exit(exitCode));
31
+ } else {
32
+ // synchronously shuts down the process
33
+ // no need to set shutdownPromise on this branch of the if statement because no more code will be executed
34
+ process.exit(exitCode);
35
+ }
36
+ return shutdownPromise;
37
+ }
38
+ export function isShuttingDown() {
39
+ return shutdownPromise !== undefined;
40
+ }
3
41
  export const installSignalHandlers = (logFn, cb)=>{
4
- const shutdown = async ()=>{
5
- logFn('Shutting down...');
6
- if (cb) {
7
- await Promise.all(cb);
8
- }
9
- process.exit(0);
10
- };
11
- process.removeAllListeners('SIGINT');
12
- process.removeAllListeners('SIGTERM');
13
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
14
- process.once('SIGINT', shutdown);
15
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
16
- process.once('SIGTERM', shutdown);
42
+ const signals = [
43
+ [
44
+ 'SIGINT',
45
+ 130
46
+ ],
47
+ [
48
+ 'SIGTERM',
49
+ 143
50
+ ],
51
+ [
52
+ 'SIGHUP',
53
+ 129
54
+ ],
55
+ [
56
+ 'SIQUIT',
57
+ 131
58
+ ]
59
+ ];
60
+ for (const [signal, exitCode] of signals){
61
+ process.removeAllListeners(signal);
62
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
63
+ process.once(signal, ()=>shutdown(logFn, exitCode, cb));
64
+ }
17
65
  };
18
66
  /**
19
67
  * Creates logs for the initial accounts
20
68
  * @param accounts - The initial accounts
21
- * @param pxe - A PXE instance to get the registered accounts
69
+ * @param wallet - A EmbeddedWallet instance to get the registered accounts
22
70
  * @returns A string array containing the initial accounts details
23
- */ export async function createAccountLogs(accountsWithSecretKeys, pxe) {
24
- const registeredAccounts = await pxe.getRegisteredAccounts();
71
+ */ export async function createAccountLogs(accountManagers, wallet) {
72
+ const registeredAccounts = await wallet.getAccounts();
25
73
  const accountLogStrings = [
26
74
  `Initial Accounts:\n\n`
27
75
  ];
28
- for (const accountWithSecretKey of accountsWithSecretKeys){
29
- const completeAddress = await accountWithSecretKey.account.getCompleteAddress();
30
- if (registeredAccounts.find((a)=>a.equals(completeAddress))) {
76
+ for (const accountManager of accountManagers){
77
+ const account = await accountManager.getAccount();
78
+ const completeAddress = account.getCompleteAddress();
79
+ if (registeredAccounts.find((a)=>a.item.equals(completeAddress.address))) {
31
80
  accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
32
81
  accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
33
- accountLogStrings.push(` Secret Key: ${accountWithSecretKey.secretKey.toString()}\n`);
82
+ accountLogStrings.push(` Secret Key: ${account.getSecretKey().toString()}\n`);
34
83
  accountLogStrings.push(` Master nullifier public key: ${completeAddress.publicKeys.masterNullifierPublicKey.toString()}\n`);
35
84
  accountLogStrings.push(` Master incoming viewing public key: ${completeAddress.publicKeys.masterIncomingViewingPublicKey.toString()}\n\n`);
36
85
  accountLogStrings.push(` Master outgoing viewing public key: ${completeAddress.publicKeys.masterOutgoingViewingPublicKey.toString()}\n\n`);
@@ -65,22 +114,34 @@ export function formatHelpLine(option, defaultValue, envVar, maxOptionLength, ma
65
114
  }
66
115
  const getDefaultOrEnvValue = (opt)=>{
67
116
  let val;
68
- // if the option is set in the environment, use that & parse it
69
- if (opt.envVar && process.env[opt.envVar]) {
70
- val = process.env[opt.envVar];
71
- if (val && opt.parseVal) {
117
+ // if the option is set in the environment, use that
118
+ if (opt.env) {
119
+ val = process.env[opt.env];
120
+ }
121
+ // if we have fallback env vars, check those
122
+ if (!val && opt.fallback && opt.fallback.length > 0) {
123
+ for (const fallback of opt.fallback){
124
+ val = process.env[fallback];
125
+ if (val) {
126
+ break;
127
+ }
128
+ }
129
+ }
130
+ // if we have a value, optionally parse it and return
131
+ if (val) {
132
+ if (opt.parseVal) {
72
133
  return opt.parseVal(val);
73
134
  }
74
- // if no env variable, use the default value
75
- } else if (opt.defaultValue) {
76
- val = opt.defaultValue;
135
+ return val;
136
+ } else if (opt.defaultValue !== undefined) {
137
+ return opt.defaultValue;
77
138
  }
78
- return val;
139
+ return undefined;
79
140
  };
80
141
  // Function to add options dynamically
81
142
  export const addOptions = (cmd, options)=>{
82
143
  options.forEach((opt)=>{
83
- cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.envVar})`, opt.parseVal ? opt.parseVal : (val)=>val, getDefaultOrEnvValue(opt));
144
+ cmd.option(opt.flag, `${opt.description} (default: ${opt.defaultValue}) ($${opt.env})`, opt.parseVal ? opt.parseVal : (val)=>val, getDefaultOrEnvValue(opt));
84
145
  });
85
146
  };
86
147
  export const printAztecStartHelpText = ()=>{
@@ -92,8 +153,8 @@ export const printAztecStartHelpText = ()=>{
92
153
  helpTextLines.push(chalk.bold.blue(` ${category}`));
93
154
  helpTextLines.push('');
94
155
  aztecStartOptions[category].forEach((opt)=>{
95
- const defaultValueText = opt.defaultValue ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
96
- const envVarText = opt.envVar ? `($${opt.envVar})` : '';
156
+ const defaultValueText = opt.defaultValue || Array.isArray(opt.defaultValue) && opt.defaultValue.length > 0 ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})` : '';
157
+ const envVarText = opt.env ? `($${opt.env})` : '';
97
158
  const flagText = `${opt.flag}`;
98
159
  const paddedText = formatHelpLine(flagText, defaultValueText, envVarText, maxFlagLength, maxDefaultLength);
99
160
  helpTextLines.push(` ${paddedText}`);
@@ -152,3 +213,76 @@ export const printAztecStartHelpText = ()=>{
152
213
  });
153
214
  return relevantOptions;
154
215
  };
216
+ /**
217
+ * Downloads just enough points to be able to verify Chonk proofs.
218
+ * @param opts - Whether proof are to be verifier
219
+ * @param log - Logging function
220
+ */ export async function preloadCrsDataForVerifying({ realProofs }, log) {
221
+ if (realProofs) {
222
+ const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
223
+ await Promise.all([
224
+ Crs.new(2 ** 1, undefined, log),
225
+ GrumpkinCrs.new(2 ** 16, undefined, log)
226
+ ]);
227
+ }
228
+ }
229
+ /**
230
+ * Downloads enough points to be able to prove every server-side circuit
231
+ * @param opts - Whether real proof are to be generated
232
+ * @param log - Logging function
233
+ */ export async function preloadCrsDataForServerSideProving({ realProofs }, log) {
234
+ if (realProofs) {
235
+ const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
236
+ await Promise.all([
237
+ Crs.new(2 ** 25, undefined, log),
238
+ GrumpkinCrs.new(2 ** 18, undefined, log)
239
+ ]);
240
+ }
241
+ }
242
+ export async function setupVersionChecker(network, followsCanonicalRollup, publicClient, signalHandlers, cacheDir) {
243
+ const networkConfig = await getNetworkConfig(network, cacheDir);
244
+ if (!networkConfig) {
245
+ return;
246
+ }
247
+ const { VersionChecker } = await import('@aztec/stdlib/update-checker');
248
+ const logger = createLogger('version_check');
249
+ const registry = new RegistryContract(publicClient, networkConfig.registryAddress);
250
+ const checks = [];
251
+ checks.push({
252
+ name: 'node',
253
+ currentVersion: getPackageVersion() ?? 'unknown',
254
+ getLatestVersion: async ()=>{
255
+ const cfg = await getNetworkConfig(network, cacheDir);
256
+ return cfg?.nodeVersion;
257
+ }
258
+ });
259
+ if (followsCanonicalRollup) {
260
+ const getLatestVersion = async ()=>{
261
+ const version = (await registry.getRollupVersions()).at(-1);
262
+ return version !== undefined ? String(version) : undefined;
263
+ };
264
+ const currentVersion = await getLatestVersion();
265
+ if (currentVersion !== undefined) {
266
+ checks.push({
267
+ name: 'rollup',
268
+ currentVersion,
269
+ getLatestVersion
270
+ });
271
+ }
272
+ }
273
+ const checker = new VersionChecker(checks, 600_000, logger);
274
+ checker.on('newVersion', ({ name, latestVersion, currentVersion })=>{
275
+ if (isShuttingDown()) {
276
+ return;
277
+ }
278
+ logger.warn(`New ${name} version available`, {
279
+ latestVersion,
280
+ currentVersion
281
+ });
282
+ });
283
+ checker.start();
284
+ signalHandlers.push(()=>checker.stop());
285
+ }
286
+ export function stringifyConfig(config) {
287
+ return Object.entries(config).map(([key, value])=>`${key}=${jsonStringify(value)}`).join(' ');
288
+ }
@@ -1,4 +1,4 @@
1
1
  import type { ChainConfig } from '@aztec/stdlib/config';
2
2
  import { type ComponentsVersions } from '@aztec/stdlib/versioning';
3
3
  export declare function getVersions(config?: ChainConfig): Partial<ComponentsVersions>;
4
- //# sourceMappingURL=versioning.d.ts.map
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbmluZy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NsaS92ZXJzaW9uaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLHNCQUFzQixDQUFDO0FBQ3hELE9BQU8sRUFBRSxLQUFLLGtCQUFrQixFQUFtQyxNQUFNLDBCQUEwQixDQUFDO0FBRXBHLHdCQUFnQixXQUFXLENBQUMsTUFBTSxDQUFDLEVBQUUsV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQU83RSJ9
@@ -1,9 +1,9 @@
1
1
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
2
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
2
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
3
3
  import { getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
4
4
  export function getVersions(config) {
5
- return config ? getComponentsVersionsFromConfig(config, protocolContractTreeRoot, getVKTreeRoot()) : {
5
+ return config ? getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot()) : {
6
6
  l2CircuitsVkTreeRoot: getVKTreeRoot().toString(),
7
- l2ProtocolContractsTreeRoot: protocolContractTreeRoot.toString()
7
+ l2ProtocolContractsHash: protocolContractsHash.toString()
8
8
  };
9
9
  }
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=token.d.ts.map
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW4uZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9leGFtcGxlcy90b2tlbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=