@aztec/aztec 0.0.1-commit.b655e406 → 0.0.1-commit.c0b82b2

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 (149) hide show
  1. package/README.md +1 -1
  2. package/dest/bin/index.d.ts +1 -1
  3. package/dest/bin/index.js +11 -4
  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 +58 -21
  10. package/dest/cli/aztec_start_options.d.ts +1 -1
  11. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  12. package/dest/cli/aztec_start_options.js +46 -38
  13. package/dest/cli/cli.d.ts +1 -1
  14. package/dest/cli/cli.js +7 -7
  15. package/dest/cli/cmds/compile.d.ts +4 -0
  16. package/dest/cli/cmds/compile.d.ts.map +1 -0
  17. package/dest/cli/cmds/compile.js +160 -0
  18. package/dest/cli/cmds/migrate_ha_db.d.ts +3 -0
  19. package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
  20. package/dest/cli/cmds/migrate_ha_db.js +27 -0
  21. package/dest/cli/cmds/profile.d.ts +4 -0
  22. package/dest/cli/cmds/profile.d.ts.map +1 -0
  23. package/dest/cli/cmds/profile.js +8 -0
  24. package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
  25. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
  26. package/dest/cli/cmds/profile_flamegraph.js +51 -0
  27. package/dest/cli/cmds/profile_gates.d.ts +4 -0
  28. package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
  29. package/dest/cli/cmds/profile_gates.js +57 -0
  30. package/dest/cli/cmds/profile_utils.d.ts +18 -0
  31. package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
  32. package/dest/cli/cmds/profile_utils.js +50 -0
  33. package/dest/cli/cmds/start_archiver.d.ts +1 -1
  34. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  35. package/dest/cli/cmds/start_archiver.js +11 -13
  36. package/dest/cli/cmds/start_bot.d.ts +3 -3
  37. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  38. package/dest/cli/cmds/start_bot.js +10 -6
  39. package/dest/cli/cmds/start_node.d.ts +1 -1
  40. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  41. package/dest/cli/cmds/start_node.js +66 -14
  42. package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
  43. package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
  44. package/dest/cli/cmds/start_p2p_bootstrap.js +2 -3
  45. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  46. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  47. package/dest/cli/cmds/start_prover_agent.js +4 -4
  48. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  49. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  50. package/dest/cli/cmds/start_prover_broker.js +4 -4
  51. package/dest/cli/cmds/start_txe.d.ts +1 -1
  52. package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
  53. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
  54. package/dest/cli/cmds/utils/artifacts.js +24 -0
  55. package/dest/cli/cmds/utils/spawn.d.ts +3 -0
  56. package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
  57. package/dest/cli/cmds/utils/spawn.js +16 -0
  58. package/dest/cli/index.d.ts +1 -1
  59. package/dest/cli/preload_crs.d.ts +1 -1
  60. package/dest/cli/release_version.d.ts +1 -1
  61. package/dest/cli/util.d.ts +11 -20
  62. package/dest/cli/util.d.ts.map +1 -1
  63. package/dest/cli/util.js +16 -11
  64. package/dest/cli/versioning.d.ts +1 -1
  65. package/dest/examples/token.d.ts +1 -1
  66. package/dest/examples/token.js +6 -6
  67. package/dest/examples/util.d.ts +2 -2
  68. package/dest/examples/util.d.ts.map +1 -1
  69. package/dest/index.d.ts +2 -2
  70. package/dest/index.d.ts.map +1 -1
  71. package/dest/index.js +1 -1
  72. package/dest/local-network/banana_fpc.d.ts +10 -0
  73. package/dest/local-network/banana_fpc.d.ts.map +1 -0
  74. package/dest/{sandbox → local-network}/banana_fpc.js +3 -3
  75. package/dest/local-network/index.d.ts +4 -0
  76. package/dest/local-network/index.d.ts.map +1 -0
  77. package/dest/{sandbox → local-network}/index.js +1 -1
  78. package/dest/local-network/local-network.d.ts +73 -0
  79. package/dest/local-network/local-network.d.ts.map +1 -0
  80. package/dest/{sandbox/sandbox.js → local-network/local-network.js} +75 -45
  81. package/dest/local-network/sponsored_fpc.d.ts +5 -0
  82. package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
  83. package/dest/mnemonic.d.ts +1 -1
  84. package/dest/splash.d.ts +1 -1
  85. package/dest/testing/anvil_test_watcher.d.ts +12 -4
  86. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  87. package/dest/testing/anvil_test_watcher.js +68 -29
  88. package/dest/testing/cheat_codes.d.ts +1 -1
  89. package/dest/testing/cheat_codes.d.ts.map +1 -1
  90. package/dest/testing/epoch_test_settler.d.ts +19 -0
  91. package/dest/testing/epoch_test_settler.d.ts.map +1 -0
  92. package/dest/testing/epoch_test_settler.js +62 -0
  93. package/dest/testing/index.d.ts +2 -1
  94. package/dest/testing/index.d.ts.map +1 -1
  95. package/dest/testing/index.js +1 -0
  96. package/package.json +41 -37
  97. package/scripts/aztec.sh +66 -0
  98. package/scripts/init.sh +45 -0
  99. package/scripts/new.sh +60 -0
  100. package/scripts/setup_workspace.sh +124 -0
  101. package/src/bin/index.ts +12 -4
  102. package/src/cli/admin_api_key_store.ts +128 -0
  103. package/src/cli/aztec_start_action.ts +61 -16
  104. package/src/cli/aztec_start_options.ts +47 -36
  105. package/src/cli/cli.ts +11 -11
  106. package/src/cli/cmds/compile.ts +184 -0
  107. package/src/cli/cmds/migrate_ha_db.ts +43 -0
  108. package/src/cli/cmds/profile.ts +25 -0
  109. package/src/cli/cmds/profile_flamegraph.ts +63 -0
  110. package/src/cli/cmds/profile_gates.ts +67 -0
  111. package/src/cli/cmds/profile_utils.ts +58 -0
  112. package/src/cli/cmds/start_archiver.ts +7 -18
  113. package/src/cli/cmds/start_bot.ts +9 -6
  114. package/src/cli/cmds/start_node.ts +55 -13
  115. package/src/cli/cmds/start_p2p_bootstrap.ts +3 -3
  116. package/src/cli/cmds/start_prover_agent.ts +4 -12
  117. package/src/cli/cmds/start_prover_broker.ts +7 -3
  118. package/src/cli/cmds/utils/artifacts.ts +44 -0
  119. package/src/cli/cmds/utils/spawn.ts +16 -0
  120. package/src/cli/util.ts +22 -27
  121. package/src/examples/token.ts +6 -8
  122. package/src/examples/util.ts +1 -1
  123. package/src/index.ts +2 -2
  124. package/src/{sandbox → local-network}/banana_fpc.ts +11 -7
  125. package/src/{sandbox → local-network}/index.ts +1 -1
  126. package/src/local-network/local-network.ts +267 -0
  127. package/src/{sandbox → local-network}/sponsored_fpc.ts +3 -2
  128. package/src/testing/anvil_test_watcher.ts +76 -30
  129. package/src/testing/cheat_codes.ts +3 -2
  130. package/src/testing/epoch_test_settler.ts +71 -0
  131. package/src/testing/index.ts +1 -0
  132. package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
  133. package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
  134. package/dest/cli/cmds/start_blob_sink.js +0 -33
  135. package/dest/cli/cmds/start_prover_node.d.ts +0 -7
  136. package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
  137. package/dest/cli/cmds/start_prover_node.js +0 -108
  138. package/dest/sandbox/banana_fpc.d.ts +0 -10
  139. package/dest/sandbox/banana_fpc.d.ts.map +0 -1
  140. package/dest/sandbox/index.d.ts +0 -4
  141. package/dest/sandbox/index.d.ts.map +0 -1
  142. package/dest/sandbox/sandbox.d.ts +0 -74
  143. package/dest/sandbox/sandbox.d.ts.map +0 -1
  144. package/dest/sandbox/sponsored_fpc.d.ts +0 -4
  145. package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
  146. package/src/cli/cmds/start_blob_sink.ts +0 -57
  147. package/src/cli/cmds/start_prover_node.ts +0 -124
  148. package/src/sandbox/sandbox.ts +0 -242
  149. /package/dest/{sandbox → local-network}/sponsored_fpc.js +0 -0
@@ -0,0 +1,160 @@
1
+ import { execFileSync } from 'child_process';
2
+ import { readFile, writeFile } from 'fs/promises';
3
+ import { join } from 'path';
4
+ import { readArtifactFiles } from './utils/artifacts.js';
5
+ import { run } from './utils/spawn.js';
6
+ /** Returns paths to contract artifacts in the target directory. */ async function collectContractArtifacts() {
7
+ let files;
8
+ try {
9
+ files = await readArtifactFiles('target');
10
+ } catch (err) {
11
+ if (err?.message?.includes('does not exist')) {
12
+ return [];
13
+ }
14
+ throw err;
15
+ }
16
+ return files.filter((f)=>Array.isArray(f.content.functions)).map((f)=>f.filePath);
17
+ }
18
+ /** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */ async function stripInternalPrefixes(artifactPaths) {
19
+ for (const path of artifactPaths){
20
+ const artifact = JSON.parse(await readFile(path, 'utf-8'));
21
+ for (const fn of artifact.functions){
22
+ if (typeof fn.name === 'string') {
23
+ fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
24
+ }
25
+ }
26
+ await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
27
+ }
28
+ }
29
+ /** Returns the set of package names that are contract crates in the current workspace. */ async function getContractPackageNames() {
30
+ const contractNames = new Set();
31
+ let rootToml;
32
+ try {
33
+ rootToml = await readFile('Nargo.toml', 'utf-8');
34
+ } catch {
35
+ return contractNames;
36
+ }
37
+ const membersMatch = rootToml.match(/members\s*=\s*\[([^\]]*)\]/);
38
+ if (membersMatch) {
39
+ const members = membersMatch[1].split(',').map((m)=>m.trim().replace(/^"|"$/g, '')).filter((m)=>m.length > 0);
40
+ for (const member of members){
41
+ try {
42
+ const memberToml = await readFile(join(member, 'Nargo.toml'), 'utf-8');
43
+ if (/type\s*=\s*"contract"/.test(memberToml)) {
44
+ const nameMatch = memberToml.match(/name\s*=\s*"([^"]+)"/);
45
+ if (nameMatch) {
46
+ contractNames.add(nameMatch[1]);
47
+ }
48
+ }
49
+ } catch {
50
+ // Member directory might not exist or have no Nargo.toml; skip.
51
+ }
52
+ }
53
+ } else {
54
+ // Single-crate project (no workspace): check if the root Nargo.toml itself is a contract.
55
+ if (/type\s*=\s*"contract"/.test(rootToml)) {
56
+ const nameMatch = rootToml.match(/name\s*=\s*"([^"]+)"/);
57
+ if (nameMatch) {
58
+ contractNames.add(nameMatch[1]);
59
+ }
60
+ }
61
+ }
62
+ return contractNames;
63
+ }
64
+ /** Checks that no tests exist in contract crates and fails with a helpful message if they do. */ async function checkNoTestsInContracts(nargo, log) {
65
+ const contractPackages = await getContractPackageNames();
66
+ if (contractPackages.size === 0) {
67
+ return;
68
+ }
69
+ let output;
70
+ try {
71
+ // We list tests for all the crates in the workspace
72
+ output = execFileSync(nargo, [
73
+ 'test',
74
+ '--list-tests',
75
+ '--silence-warnings'
76
+ ], {
77
+ encoding: 'utf-8',
78
+ stdio: [
79
+ 'pipe',
80
+ 'pipe',
81
+ 'inherit'
82
+ ]
83
+ });
84
+ } catch {
85
+ // If listing tests fails (e.g. test crate has compile errors), skip the check.
86
+ return;
87
+ }
88
+ // The output of the `nargo test --list-tests` command is as follows:
89
+ // ```
90
+ // crate_name_1 test_name_1
91
+ // crate_name_2 test_name_2
92
+ // ...
93
+ // crate_name_n test_name_n
94
+ // ```
95
+ //
96
+ // We parse the individual lines and then we check if any contract crate appeared in the parsed output.
97
+ const lines = output.trim().split('\n').filter((line)=>line.length > 0);
98
+ const testsInContracts = [];
99
+ for (const line of lines){
100
+ const spaceIndex = line.indexOf(' ');
101
+ if (spaceIndex === -1) {
102
+ continue;
103
+ }
104
+ const packageName = line.substring(0, spaceIndex);
105
+ const testName = line.substring(spaceIndex + 1);
106
+ if (contractPackages.has(packageName)) {
107
+ testsInContracts.push({
108
+ packageName,
109
+ testName
110
+ });
111
+ }
112
+ }
113
+ if (testsInContracts.length > 0) {
114
+ const details = testsInContracts.map((t)=>` ${t.packageName}::${t.testName}`).join('\n');
115
+ log(`WARNING: Found tests in contract crate(s):\n${details}\n\n` + `Tests should be in a dedicated test crate, not in the contract crate.\n` + `Learn more: https://docs.aztec.network/errors/1`);
116
+ }
117
+ }
118
+ /** Compiles Aztec Noir contracts and postprocesses artifacts. */ async function compileAztecContract(nargoArgs, log) {
119
+ const nargo = process.env.NARGO ?? 'nargo';
120
+ const bb = process.env.BB ?? 'bb';
121
+ await run(nargo, [
122
+ 'compile',
123
+ ...nargoArgs
124
+ ]);
125
+ // Ensure contract crates contain no tests (tests belong in the test crate).
126
+ await checkNoTestsInContracts(nargo, log);
127
+ const artifacts = await collectContractArtifacts();
128
+ if (artifacts.length > 0) {
129
+ log('Postprocessing contracts...');
130
+ const bbArgs = artifacts.flatMap((a)=>[
131
+ '-i',
132
+ a
133
+ ]);
134
+ await run(bb, [
135
+ 'aztec_process',
136
+ ...bbArgs
137
+ ]);
138
+ // TODO: This should be part of bb aztec_process!
139
+ await stripInternalPrefixes(artifacts);
140
+ }
141
+ log('Compilation complete!');
142
+ }
143
+ export function injectCompileCommand(program, log) {
144
+ program.command('compile').argument('[nargo-args...]').passThroughOptions().allowUnknownOption().description('Compile Aztec Noir contracts using nargo and postprocess them to generate transpiled artifacts and verification keys. All options are forwarded to nargo compile.').addHelpText('after', ()=>{
145
+ // Show nargo's own compile options so users see all available flags in one place.
146
+ const nargo = process.env.NARGO ?? 'nargo';
147
+ try {
148
+ const output = execFileSync(nargo, [
149
+ 'compile',
150
+ '--help'
151
+ ], {
152
+ encoding: 'utf-8'
153
+ });
154
+ return `\nUnderlying nargo compile options:\n\n${output}`;
155
+ } catch {
156
+ return '\n(Run "nargo compile --help" to see available nargo options)';
157
+ }
158
+ }).action((nargoArgs)=>compileAztecContract(nargoArgs, log));
159
+ return program;
160
+ }
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function injectMigrateCommand(program: Command, log: (msg: string) => void): Command;
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlncmF0ZV9oYV9kYi5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL21pZ3JhdGVfaGFfZGIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRUEsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBRXpDLHdCQUFnQixvQkFBb0IsQ0FBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsRUFBRSxNQUFNLEtBQUssSUFBSSxHQUFHLE9BQU8sQ0FzQzFGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate_ha_db.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/migrate_ha_db.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAsC1F"}
@@ -0,0 +1,27 @@
1
+ import { runMigrations } from '@aztec/validator-ha-signer/migrations';
2
+ export function injectMigrateCommand(program, log) {
3
+ const migrateCommand = program.command('migrate-ha-db').description('Run validator-ha-signer database migrations');
4
+ migrateCommand.command('up').description('Apply pending migrations').requiredOption('--database-url <string>', 'PostgreSQL connection string', process.env.DATABASE_URL).option('--verbose', 'Enable verbose output', false).action(async (options)=>{
5
+ const migrations = await runMigrations(options.databaseUrl, {
6
+ direction: 'up',
7
+ verbose: options.verbose
8
+ });
9
+ if (migrations.length > 0) {
10
+ log(`Applied migrations: ${migrations.join(', ')}`);
11
+ } else {
12
+ log('No migrations to apply - schema is up to date');
13
+ }
14
+ });
15
+ migrateCommand.command('down').description('Rollback the last migration').requiredOption('--database-url <string>', 'PostgreSQL connection string', process.env.DATABASE_URL).option('--verbose', 'Enable verbose output', false).action(async (options)=>{
16
+ const migrations = await runMigrations(options.databaseUrl, {
17
+ direction: 'down',
18
+ verbose: options.verbose
19
+ });
20
+ if (migrations.length > 0) {
21
+ log(`Rolled back migrations: ${migrations.join(', ')}`);
22
+ } else {
23
+ log('No migrations to rollback');
24
+ }
25
+ });
26
+ return program;
27
+ }
@@ -0,0 +1,4 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ import type { Command } from 'commander';
3
+ export declare function injectProfileCommand(program: Command, log: LogFn): Command;
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFFbkQsT0FBTyxLQUFLLEVBQUUsT0FBTyxFQUFFLE1BQU0sV0FBVyxDQUFDO0FBS3pDLHdCQUFnQixvQkFBb0IsQ0FBQyxPQUFPLEVBQUUsT0FBTyxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQWlCMUUifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAiB1E"}
@@ -0,0 +1,8 @@
1
+ import { profileFlamegraph } from './profile_flamegraph.js';
2
+ import { profileGates } from './profile_gates.js';
3
+ export function injectProfileCommand(program, log) {
4
+ const profile = program.command('profile').description('Profile compiled Aztec artifacts.');
5
+ profile.command('gates').argument('[target-dir]', 'Path to the compiled artifacts directory', './target').description('Display gate counts for all compiled Aztec artifacts in a target directory.').action((targetDir)=>profileGates(targetDir, log));
6
+ profile.command('flamegraph').argument('<contract-artifact>', 'Path to the compiled contract artifact JSON').argument('<function>', 'Name of the contract function to profile').description('Generate a gate count flamegraph SVG for a contract function.').action((artifactPath, functionName)=>profileFlamegraph(artifactPath, functionName, log));
7
+ return program;
8
+ }
@@ -0,0 +1,4 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ /** Generates a gate count flamegraph SVG for a single contract function. */
3
+ export declare function profileFlamegraph(artifactPath: string, functionName: string, log: LogFn): Promise<void>;
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9mbGFtZWdyYXBoLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvcHJvZmlsZV9mbGFtZWdyYXBoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLEtBQUssRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBU25ELDRFQUE0RTtBQUM1RSx3QkFBc0IsaUJBQWlCLENBQUMsWUFBWSxFQUFFLE1BQU0sRUFBRSxZQUFZLEVBQUUsTUFBTSxFQUFFLEdBQUcsRUFBRSxLQUFLLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxDQW9EN0cifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile_flamegraph.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_flamegraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AASnD,4EAA4E;AAC5E,wBAAsB,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAoD7G"}
@@ -0,0 +1,51 @@
1
+ import { readFile, rename, rm, writeFile } from 'fs/promises';
2
+ import { basename, dirname, join } from 'path';
3
+ import { makeFunctionArtifact } from './profile_utils.js';
4
+ import { run } from './utils/spawn.js';
5
+ /** Generates a gate count flamegraph SVG for a single contract function. */ export async function profileFlamegraph(artifactPath, functionName, log) {
6
+ const raw = await readFile(artifactPath, 'utf-8');
7
+ const artifact = JSON.parse(raw);
8
+ if (!Array.isArray(artifact.functions)) {
9
+ throw new Error(`${artifactPath} does not appear to be a contract artifact (no functions array)`);
10
+ }
11
+ const func = artifact.functions.find((f)=>f.name === functionName);
12
+ if (!func) {
13
+ const available = artifact.functions.map((f)=>f.name).join(', ');
14
+ throw new Error(`Function "${functionName}" not found in artifact. Available: ${available}`);
15
+ }
16
+ if (func.is_unconstrained) {
17
+ throw new Error(`Function "${functionName}" is unconstrained and cannot be profiled`);
18
+ }
19
+ const outputDir = dirname(artifactPath);
20
+ const contractName = basename(artifactPath, '.json');
21
+ const functionArtifact = join(outputDir, `${contractName}-${functionName}.json`);
22
+ try {
23
+ await writeFile(functionArtifact, makeFunctionArtifact(artifact, func));
24
+ const profiler = process.env.PROFILER_PATH ?? 'noir-profiler';
25
+ const bb = process.env.BB ?? 'bb';
26
+ await run(profiler, [
27
+ 'gates',
28
+ '--artifact-path',
29
+ functionArtifact,
30
+ '--backend-path',
31
+ bb,
32
+ '--backend-gates-command',
33
+ 'gates',
34
+ '--output',
35
+ outputDir,
36
+ '--scheme',
37
+ 'chonk',
38
+ '--include_gates_per_opcode'
39
+ ]);
40
+ // noir-profiler names the SVG using the internal function name which
41
+ // retains the __aztec_nr_internals__ prefix in the bytecode metadata.
42
+ const srcSvg = join(outputDir, `__aztec_nr_internals__${functionName}_gates.svg`);
43
+ const destSvg = join(outputDir, `${contractName}-${functionName}-flamegraph.svg`);
44
+ await rename(srcSvg, destSvg);
45
+ log(`Flamegraph written to ${destSvg}`);
46
+ } finally{
47
+ await rm(functionArtifact, {
48
+ force: true
49
+ });
50
+ }
51
+ }
@@ -0,0 +1,4 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+ /** Profiles all compiled artifacts in a target directory and prints gate counts. */
3
+ export declare function profileGates(targetDir: string, log: LogFn): Promise<void>;
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV9nYXRlcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfZ2F0ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUErQm5ELG9GQUFvRjtBQUNwRix3QkFBc0IsWUFBWSxDQUFDLFNBQVMsRUFBRSxNQUFNLEVBQUUsR0FBRyxFQUFFLEtBQUssR0FBRyxPQUFPLENBQUMsSUFBSSxDQUFDLENBaUMvRSJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile_gates.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_gates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AA+BnD,oFAAoF;AACpF,wBAAsB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC/E"}
@@ -0,0 +1,57 @@
1
+ import { asyncPool } from '@aztec/foundation/async-pool';
2
+ import { execFile as execFileCb } from 'child_process';
3
+ import { rm } from 'fs/promises';
4
+ import { promisify } from 'util';
5
+ import { MAX_CONCURRENT, discoverArtifacts } from './profile_utils.js';
6
+ const execFile = promisify(execFileCb);
7
+ /** Parses circuit_size from bb gates JSON output: { "functions": [{ "circuit_size": N }] } */ function parseGateCount(stdout) {
8
+ const parsed = JSON.parse(stdout);
9
+ const size = parsed?.functions?.[0]?.circuit_size;
10
+ if (typeof size !== 'number') {
11
+ throw new Error('Failed to parse circuit_size from bb gates output');
12
+ }
13
+ return size;
14
+ }
15
+ /** Runs bb gates on a single artifact file and returns the gate count. */ async function getGateCount(bb, artifactPath) {
16
+ const { stdout } = await execFile(bb, [
17
+ 'gates',
18
+ '--scheme',
19
+ 'chonk',
20
+ '-b',
21
+ artifactPath
22
+ ]);
23
+ return parseGateCount(stdout);
24
+ }
25
+ /** Profiles all compiled artifacts in a target directory and prints gate counts. */ export async function profileGates(targetDir, log) {
26
+ const bb = process.env.BB ?? 'bb';
27
+ const { artifacts, tmpDir } = await discoverArtifacts(targetDir);
28
+ if (artifacts.length === 0) {
29
+ log('No artifacts found in target directory.');
30
+ return;
31
+ }
32
+ try {
33
+ const results = await asyncPool(MAX_CONCURRENT, artifacts, async (artifact)=>({
34
+ name: artifact.name,
35
+ gateCount: await getGateCount(bb, artifact.filePath)
36
+ }));
37
+ results.sort((a, b)=>a.name.localeCompare(b.name));
38
+ if (results.length === 0) {
39
+ log('No constrained circuits found.');
40
+ return;
41
+ }
42
+ const maxNameLen = Math.max(...results.map((r)=>r.name.length));
43
+ log('');
44
+ log('Gate counts:');
45
+ log('-'.repeat(maxNameLen + 16));
46
+ for (const { name, gateCount } of results){
47
+ log(`${name.padEnd(maxNameLen)} ${gateCount.toLocaleString().padStart(12)}`);
48
+ }
49
+ log('-'.repeat(maxNameLen + 16));
50
+ log(`Total: ${results.length} circuit(s)`);
51
+ } finally{
52
+ await rm(tmpDir, {
53
+ recursive: true,
54
+ force: true
55
+ });
56
+ }
57
+ }
@@ -0,0 +1,18 @@
1
+ import type { CompiledArtifact, ContractFunction } from './utils/artifacts.js';
2
+ export declare const MAX_CONCURRENT = 4;
3
+ export interface DiscoveredArtifact {
4
+ name: string;
5
+ filePath: string;
6
+ type: 'contract-function' | 'program';
7
+ }
8
+ /**
9
+ * Reads a target directory and returns a list of discovered artifacts with temp files
10
+ * created for contract functions. Caller must clean up tmpDir when done.
11
+ */
12
+ export declare function discoverArtifacts(targetDir: string): Promise<{
13
+ artifacts: DiscoveredArtifact[];
14
+ tmpDir: string;
15
+ }>;
16
+ /** Extracts a contract function as a standalone program artifact JSON string. */
17
+ export declare function makeFunctionArtifact(artifact: CompiledArtifact, func: ContractFunction): string;
18
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZmlsZV91dGlscy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3Byb2ZpbGVfdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsT0FBTyxLQUFLLEVBQUUsZ0JBQWdCLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUcvRSxlQUFPLE1BQU0sY0FBYyxJQUFJLENBQUM7QUFFaEMsTUFBTSxXQUFXLGtCQUFrQjtJQUNqQyxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IsUUFBUSxFQUFFLE1BQU0sQ0FBQztJQUNqQixJQUFJLEVBQUUsbUJBQW1CLEdBQUcsU0FBUyxDQUFDO0NBQ3ZDO0FBRUQ7OztHQUdHO0FBQ0gsd0JBQXNCLGlCQUFpQixDQUNyQyxTQUFTLEVBQUUsTUFBTSxHQUNoQixPQUFPLENBQUM7SUFBRSxTQUFTLEVBQUUsa0JBQWtCLEVBQUUsQ0FBQztJQUFDLE1BQU0sRUFBRSxNQUFNLENBQUE7Q0FBRSxDQUFDLENBc0I5RDtBQUVELGlGQUFpRjtBQUNqRix3QkFBZ0Isb0JBQW9CLENBQUMsUUFBUSxFQUFFLGdCQUFnQixFQUFFLElBQUksRUFBRSxnQkFBZ0IsVUFXdEYifQ==
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile_utils.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/profile_utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,mBAAmB,GAAG,SAAS,CAAC;CACvC;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB9D;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,gBAAgB,UAWtF"}
@@ -0,0 +1,50 @@
1
+ import { mkdtemp, writeFile } from 'fs/promises';
2
+ import { tmpdir } from 'os';
3
+ import { join } from 'path';
4
+ import { readArtifactFiles } from './utils/artifacts.js';
5
+ export const MAX_CONCURRENT = 4;
6
+ /**
7
+ * Reads a target directory and returns a list of discovered artifacts with temp files
8
+ * created for contract functions. Caller must clean up tmpDir when done.
9
+ */ export async function discoverArtifacts(targetDir) {
10
+ const files = await readArtifactFiles(targetDir);
11
+ const tmpDir = await mkdtemp(join(tmpdir(), 'aztec-profile-'));
12
+ const artifacts = [];
13
+ for (const file of files){
14
+ if (Array.isArray(file.content.functions)) {
15
+ for (const func of file.content.functions){
16
+ if (!func.bytecode || func.is_unconstrained) {
17
+ continue;
18
+ }
19
+ const name = `${file.name}::${func.name}`;
20
+ const tmpPath = join(tmpDir, `${file.name}-${func.name}.json`);
21
+ await writeFile(tmpPath, makeFunctionArtifact(file.content, func));
22
+ artifacts.push({
23
+ name,
24
+ filePath: tmpPath,
25
+ type: 'contract-function'
26
+ });
27
+ }
28
+ } else if (file.content.bytecode) {
29
+ artifacts.push({
30
+ name: file.name,
31
+ filePath: file.filePath,
32
+ type: 'program'
33
+ });
34
+ }
35
+ }
36
+ return {
37
+ artifacts,
38
+ tmpDir
39
+ };
40
+ }
41
+ /** Extracts a contract function as a standalone program artifact JSON string. */ export function makeFunctionArtifact(artifact, func) {
42
+ /* eslint-disable camelcase */ return JSON.stringify({
43
+ noir_version: artifact.noir_version,
44
+ hash: 0,
45
+ abi: func.abi,
46
+ bytecode: func.bytecode,
47
+ debug_symbols: func.debug_symbols,
48
+ file_map: artifact.file_map
49
+ });
50
+ /* eslint-enable camelcase */ }
@@ -6,4 +6,4 @@ export type { ArchiverConfig, DataStoreConfig };
6
6
  export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
7
7
  config: ArchiverConfig & DataStoreConfig;
8
8
  }>;
9
- //# sourceMappingURL=start_archiver.d.ts.map
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFNbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
@@ -1 +1 @@
1
- {"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,iBAAiB,CAAC;AAIzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAOlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CAmCvD"}
1
+ {"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAMlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
@@ -1,9 +1,8 @@
1
- import { Archiver, KVArchiverDataStore, archiverConfigMappings, getArchiverConfigFromEnv } from '@aztec/archiver';
1
+ import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from '@aztec/archiver';
2
2
  import { createLogger } from '@aztec/aztec.js/log';
3
- import { blobSinkConfigMapping, createBlobSinkClient } from '@aztec/blob-sink/client';
3
+ import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
5
  import { dataConfigMappings } from '@aztec/kv-store/config';
6
- import { createStore } from '@aztec/kv-store/lmdb-v2';
7
6
  import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
8
7
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
9
8
  import { extractRelevantOptions } from '../util.js';
@@ -12,7 +11,7 @@ import { extractRelevantOptions } from '../util.js';
12
11
  const cliOptions = extractRelevantOptions(options, {
13
12
  ...archiverConfigMappings,
14
13
  ...dataConfigMappings,
15
- ...blobSinkConfigMapping
14
+ ...blobClientConfigMapping
16
15
  }, 'archiver');
17
16
  let archiverConfig = {
18
17
  ...envConfig,
@@ -28,17 +27,16 @@ import { extractRelevantOptions } from '../util.js';
28
27
  ...archiverConfig,
29
28
  ...l1Config
30
29
  };
31
- const storeLog = createLogger('archiver:lmdb');
32
- const store = await createStore('archiver', KVArchiverDataStore.SCHEMA_VERSION, archiverConfig, storeLog);
33
- const archiverStore = new KVArchiverDataStore(store, archiverConfig.maxLogs);
34
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
35
- const blobSinkClient = createBlobSinkClient(archiverConfig, {
36
- logger: createLogger('archiver:blob-sink:client')
30
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
31
+ const blobClient = createBlobClient(archiverConfig, {
32
+ logger: createLogger('archiver:blob-client:client')
37
33
  });
38
- const archiver = await Archiver.createAndSync(archiverConfig, archiverStore, {
34
+ const archiver = await createArchiver(archiverConfig, {
39
35
  telemetry,
40
- blobSinkClient
41
- }, true);
36
+ blobClient
37
+ }, {
38
+ blockUntilSync: true
39
+ });
42
40
  services.archiver = [
43
41
  archiver,
44
42
  ArchiverApiSchema
@@ -2,7 +2,7 @@ import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
2
  import type { LogFn } from '@aztec/foundation/log';
3
3
  import { type AztecNode, type AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
4
4
  import type { TelemetryClient } from '@aztec/telemetry-client';
5
- import { TestWallet } from '@aztec/test-wallet/server';
5
+ import { EmbeddedWallet } from '@aztec/wallets/embedded';
6
6
  export declare function startBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, userLog: LogFn): Promise<void>;
7
- export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, wallet: TestWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin?: AztecNodeAdmin): Promise<void>;
8
- //# sourceMappingURL=start_bot.d.ts.map
7
+ export declare function addBot(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, wallet: EmbeddedWallet, aztecNode: AztecNode, telemetry: TelemetryClient, aztecNodeAdmin?: AztecNodeAdmin, userLog?: LogFn): Promise<void>;
8
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYm90LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY2xpL2NtZHMvc3RhcnRfYm90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFHbkQsT0FBTyxFQUFFLEtBQUssU0FBUyxFQUFFLEtBQUssY0FBYyxFQUF5QixNQUFNLGlDQUFpQyxDQUFDO0FBQzdHLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBTS9ELE9BQU8sRUFBRSxjQUFjLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUt6RCx3QkFBc0IsUUFBUSxDQUM1QixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixPQUFPLEVBQUUsS0FBSyxpQkF3QmY7QUFFRCx3QkFBc0IsTUFBTSxDQUMxQixPQUFPLEVBQUUsR0FBRyxFQUNaLGNBQWMsRUFBRSxDQUFDLE1BQU0sT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLEVBQUUsRUFDdkMsUUFBUSxFQUFFLHFCQUFxQixFQUMvQixNQUFNLEVBQUUsY0FBYyxFQUN0QixTQUFTLEVBQUUsU0FBUyxFQUNwQixTQUFTLEVBQUUsZUFBZSxFQUMxQixjQUFjLENBQUMsRUFBRSxjQUFjLEVBQy9CLE9BQU8sQ0FBQyxFQUFFLEtBQUssaUJBbUJoQiJ9
@@ -1 +1 @@
1
- {"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAKvD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAuBf;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,eAAe,EAC1B,cAAc,CAAC,EAAE,cAAc,iBAkBhC"}
1
+ {"version":3,"file":"start_bot.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_bot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAyB,MAAM,iCAAiC,CAAC;AAC7G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAM/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAKzD,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,OAAO,EAAE,KAAK,iBAwBf;AAED,wBAAsB,MAAM,CAC1B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,eAAe,EAC1B,cAAc,CAAC,EAAE,cAAc,EAC/B,OAAO,CAAC,EAAE,KAAK,iBAmBhB"}
@@ -3,8 +3,8 @@ import { createStore, openTmpStore } from '@aztec/kv-store/lmdb-v2';
3
3
  import { allPxeConfigMappings } from '@aztec/pxe/config';
4
4
  import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
5
5
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
6
- import { TestWallet } from '@aztec/test-wallet/server';
7
- import { extractRelevantOptions } from '../util.js';
6
+ import { EmbeddedWallet } from '@aztec/wallets/embedded';
7
+ import { extractRelevantOptions, stringifyConfig } from '../util.js';
8
8
  import { getVersions } from '../versioning.js';
9
9
  export async function startBot(options, signalHandlers, services, userLog) {
10
10
  const { proverNode, archiver, sequencer, p2pBootstrap, txe, prover } = options;
@@ -23,12 +23,16 @@ export async function startBot(options, signalHandlers, services, userLog) {
23
23
  }
24
24
  const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
25
25
  const pxeConfig = extractRelevantOptions(options, allPxeConfigMappings, 'pxe');
26
- const wallet = await TestWallet.create(aztecNode, pxeConfig);
27
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
28
- await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
26
+ userLog(`Creating bot wallet with config ${stringifyConfig(pxeConfig)}`);
27
+ const wallet = await EmbeddedWallet.create(aztecNode, {
28
+ pxeConfig
29
+ });
30
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
31
+ await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined, userLog);
29
32
  }
30
- export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin) {
33
+ export async function addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, aztecNodeAdmin, userLog) {
31
34
  const config = extractRelevantOptions(options, botConfigMappings, 'bot');
35
+ userLog?.(`Starting bot with config ${stringifyConfig(config)}`);
32
36
  const db = await (config.dataDirectory ? createStore('bot', BotStore.SCHEMA_VERSION, config) : openTmpStore('bot', true, config.dataStoreMapSizeKb));
33
37
  const store = new BotStore(db);
34
38
  await store.cleanupOldClaims();
@@ -4,4 +4,4 @@ import type { LogFn } from '@aztec/foundation/log';
4
4
  export declare function startNode(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers, adminServices: NamespacedApiHandlers, userLog: LogFn): Promise<{
5
5
  config: AztecNodeConfig;
6
6
  }>;
7
- //# sourceMappingURL=start_node.d.ts.map
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfbm9kZS5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NsaS9jbWRzL3N0YXJ0X25vZGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLEtBQUssZUFBZSxFQUE2QyxNQUFNLG1CQUFtQixDQUFDO0FBTXBHLE9BQU8sS0FBSyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFFL0UsT0FBTyxLQUFLLEVBQUUsS0FBSyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUF3Qm5ELHdCQUFzQixTQUFTLENBQzdCLE9BQU8sRUFBRSxHQUFHLEVBQ1osY0FBYyxFQUFFLENBQUMsTUFBTSxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsRUFBRSxFQUN2QyxRQUFRLEVBQUUscUJBQXFCLEVBQy9CLGFBQWEsRUFBRSxxQkFBcUIsRUFDcEMsT0FBTyxFQUFFLEtBQUssR0FDYixPQUFPLENBQUM7SUFBRSxNQUFNLEVBQUUsZUFBZSxDQUFBO0NBQUUsQ0FBQyxDQThKdEMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAMpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAoBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAyHtC"}
1
+ {"version":3,"file":"start_node.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,eAAe,EAA6C,MAAM,mBAAmB,CAAC;AAMpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAwBnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,EAC/B,aAAa,EAAE,qBAAqB,EACpC,OAAO,EAAE,KAAK,GACb,OAAO,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CA8JtC"}