@aztec/aztec 3.0.0-canary.a9708bd → 3.0.0-devnet.2-patch.1

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 (131) hide show
  1. package/README.md +1 -1
  2. package/dest/bin/index.d.ts +1 -1
  3. package/dest/bin/index.js +9 -9
  4. package/dest/cli/aztec_start_action.d.ts +1 -1
  5. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  6. package/dest/cli/aztec_start_action.js +10 -25
  7. package/dest/cli/aztec_start_options.d.ts +2 -2
  8. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  9. package/dest/cli/aztec_start_options.js +115 -231
  10. package/dest/cli/cli.d.ts +1 -1
  11. package/dest/cli/cli.d.ts.map +1 -1
  12. package/dest/cli/cli.js +46 -1
  13. package/dest/cli/cmds/start_archiver.d.ts +1 -1
  14. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  15. package/dest/cli/cmds/start_archiver.js +4 -4
  16. package/dest/cli/cmds/start_blob_sink.d.ts +1 -1
  17. package/dest/cli/cmds/start_blob_sink.d.ts.map +1 -1
  18. package/dest/cli/cmds/start_blob_sink.js +2 -2
  19. package/dest/cli/cmds/start_bot.d.ts +4 -7
  20. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  21. package/dest/cli/cmds/start_bot.js +25 -14
  22. package/dest/cli/cmds/start_node.d.ts +1 -1
  23. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  24. package/dest/cli/cmds/start_node.js +13 -30
  25. package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
  26. package/dest/cli/cmds/start_p2p_bootstrap.js +1 -1
  27. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  28. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  29. package/dest/cli/cmds/start_prover_agent.js +11 -2
  30. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  31. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  32. package/dest/cli/cmds/start_prover_broker.js +8 -3
  33. package/dest/cli/cmds/start_prover_node.d.ts +1 -1
  34. package/dest/cli/cmds/start_prover_node.d.ts.map +1 -1
  35. package/dest/cli/cmds/start_prover_node.js +17 -12
  36. package/dest/cli/cmds/start_txe.d.ts +1 -1
  37. package/dest/cli/index.d.ts +1 -1
  38. package/dest/cli/preload_crs.d.ts +1 -1
  39. package/dest/cli/release_version.d.ts +1 -1
  40. package/dest/cli/util.d.ts +12 -10
  41. package/dest/cli/util.d.ts.map +1 -1
  42. package/dest/cli/util.js +13 -13
  43. package/dest/cli/versioning.d.ts +1 -1
  44. package/dest/cli/versioning.js +3 -3
  45. package/dest/examples/token.d.ts +1 -1
  46. package/dest/examples/token.js +18 -16
  47. package/dest/examples/util.d.ts +3 -3
  48. package/dest/examples/util.d.ts.map +1 -1
  49. package/dest/examples/util.js +1 -1
  50. package/dest/index.d.ts +2 -2
  51. package/dest/index.d.ts.map +1 -1
  52. package/dest/index.js +1 -1
  53. package/dest/local-network/banana_fpc.d.ts +10 -0
  54. package/dest/local-network/banana_fpc.d.ts.map +1 -0
  55. package/dest/{sandbox → local-network}/banana_fpc.js +15 -19
  56. package/dest/local-network/index.d.ts +4 -0
  57. package/dest/local-network/index.d.ts.map +1 -0
  58. package/dest/local-network/index.js +3 -0
  59. package/dest/local-network/local-network.d.ts +74 -0
  60. package/dest/local-network/local-network.d.ts.map +1 -0
  61. package/dest/{sandbox/sandbox.js → local-network/local-network.js} +35 -43
  62. package/dest/local-network/sponsored_fpc.d.ts +5 -0
  63. package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
  64. package/dest/{sandbox → local-network}/sponsored_fpc.js +7 -8
  65. package/dest/mnemonic.d.ts +1 -1
  66. package/dest/splash.d.ts +1 -1
  67. package/dest/testing/anvil_test_watcher.d.ts +4 -4
  68. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  69. package/dest/testing/anvil_test_watcher.js +19 -18
  70. package/dest/testing/cheat_codes.d.ts +7 -10
  71. package/dest/testing/cheat_codes.d.ts.map +1 -1
  72. package/dest/testing/cheat_codes.js +9 -10
  73. package/dest/testing/index.d.ts +1 -2
  74. package/dest/testing/index.d.ts.map +1 -1
  75. package/dest/testing/index.js +0 -1
  76. package/package.json +38 -36
  77. package/src/bin/index.ts +9 -9
  78. package/src/cli/aztec_start_action.ts +10 -22
  79. package/src/cli/aztec_start_options.ts +124 -238
  80. package/src/cli/cli.ts +46 -1
  81. package/src/cli/cmds/start_archiver.ts +4 -4
  82. package/src/cli/cmds/start_blob_sink.ts +2 -2
  83. package/src/cli/cmds/start_bot.ts +36 -13
  84. package/src/cli/cmds/start_node.ts +16 -27
  85. package/src/cli/cmds/start_p2p_bootstrap.ts +1 -1
  86. package/src/cli/cmds/start_prover_agent.ts +7 -2
  87. package/src/cli/cmds/start_prover_broker.ts +17 -3
  88. package/src/cli/cmds/start_prover_node.ts +14 -14
  89. package/src/cli/util.ts +21 -18
  90. package/src/cli/versioning.ts +3 -3
  91. package/src/examples/token.ts +20 -17
  92. package/src/examples/util.ts +2 -2
  93. package/src/index.ts +5 -5
  94. package/src/{sandbox → local-network}/banana_fpc.ts +16 -21
  95. package/src/local-network/index.ts +7 -0
  96. package/src/{sandbox/sandbox.ts → local-network/local-network.ts} +42 -55
  97. package/src/local-network/sponsored_fpc.ts +26 -0
  98. package/src/testing/anvil_test_watcher.ts +18 -19
  99. package/src/testing/cheat_codes.ts +13 -13
  100. package/src/testing/index.ts +0 -1
  101. package/dest/cli/chain_l2_config.d.ts +0 -31
  102. package/dest/cli/chain_l2_config.d.ts.map +0 -1
  103. package/dest/cli/chain_l2_config.js +0 -261
  104. package/dest/cli/cmds/start_faucet.d.ts +0 -4
  105. package/dest/cli/cmds/start_faucet.d.ts.map +0 -1
  106. package/dest/cli/cmds/start_faucet.js +0 -20
  107. package/dest/cli/cmds/start_pxe.d.ts +0 -16
  108. package/dest/cli/cmds/start_pxe.d.ts.map +0 -1
  109. package/dest/cli/cmds/start_pxe.js +0 -31
  110. package/dest/cli/get_l1_config.d.ts +0 -7
  111. package/dest/cli/get_l1_config.d.ts.map +0 -1
  112. package/dest/cli/get_l1_config.js +0 -13
  113. package/dest/sandbox/banana_fpc.d.ts +0 -11
  114. package/dest/sandbox/banana_fpc.d.ts.map +0 -1
  115. package/dest/sandbox/index.d.ts +0 -4
  116. package/dest/sandbox/index.d.ts.map +0 -1
  117. package/dest/sandbox/index.js +0 -3
  118. package/dest/sandbox/sandbox.d.ts +0 -83
  119. package/dest/sandbox/sandbox.d.ts.map +0 -1
  120. package/dest/sandbox/sponsored_fpc.d.ts +0 -4
  121. package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
  122. package/dest/testing/aztec_cheat_codes.d.ts +0 -59
  123. package/dest/testing/aztec_cheat_codes.d.ts.map +0 -1
  124. package/dest/testing/aztec_cheat_codes.js +0 -62
  125. package/src/cli/chain_l2_config.ts +0 -341
  126. package/src/cli/cmds/start_faucet.ts +0 -34
  127. package/src/cli/cmds/start_pxe.ts +0 -49
  128. package/src/cli/get_l1_config.ts +0 -19
  129. package/src/sandbox/index.ts +0 -4
  130. package/src/sandbox/sponsored_fpc.ts +0 -27
  131. package/src/testing/aztec_cheat_codes.ts +0 -77
@@ -1,11 +1,19 @@
1
- import { type BotConfig, BotRunner, botConfigMappings, getBotRunnerApiHandler } from '@aztec/bot';
1
+ import { type BotConfig, BotRunner, BotStore, botConfigMappings, getBotRunnerApiHandler } from '@aztec/bot';
2
2
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
3
3
  import type { LogFn } from '@aztec/foundation/log';
4
- import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
4
+ import { createStore, openTmpStore } from '@aztec/kv-store/lmdb-v2';
5
+ import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
6
+ import { type AztecNode, type AztecNodeAdmin, createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
5
7
  import type { TelemetryClient } from '@aztec/telemetry-client';
6
- import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
8
+ import {
9
+ getConfigEnvVars as getTelemetryClientConfig,
10
+ initTelemetryClient,
11
+ makeTracedFetch,
12
+ } from '@aztec/telemetry-client';
13
+ import { TestWallet } from '@aztec/test-wallet/server';
7
14
 
8
15
  import { extractRelevantOptions } from '../util.js';
16
+ import { getVersions } from '../versioning.js';
9
17
 
10
18
  export async function startBot(
11
19
  options: any,
@@ -20,26 +28,41 @@ export async function startBot(
20
28
  );
21
29
  process.exit(1);
22
30
  }
23
- // Start a PXE client that is used by the bot if required
24
- let pxe: PXE | undefined;
25
- if (options.pxe) {
26
- const { addPXE } = await import('./start_pxe.js');
27
- ({ pxe } = await addPXE(options, signalHandlers, services, userLog));
31
+
32
+ const fetch = makeTracedFetch([1, 2, 3], true);
33
+ const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
34
+ if (!config.nodeUrl) {
35
+ throw new Error('The bot requires access to a Node');
28
36
  }
29
37
 
30
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
31
- await addBot(options, signalHandlers, services, { pxe, telemetry });
38
+ const aztecNode = createAztecNodeClient(config.nodeUrl, getVersions(), fetch);
39
+
40
+ const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
41
+ const wallet = await TestWallet.create(aztecNode, pxeConfig);
42
+
43
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
44
+ await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
32
45
  }
33
46
 
34
- export function addBot(
47
+ export async function addBot(
35
48
  options: any,
36
49
  signalHandlers: (() => Promise<void>)[],
37
50
  services: NamespacedApiHandlers,
38
- deps: { pxe?: PXE; node?: AztecNode; telemetry: TelemetryClient },
51
+ wallet: TestWallet,
52
+ aztecNode: AztecNode,
53
+ telemetry: TelemetryClient,
54
+ aztecNodeAdmin?: AztecNodeAdmin,
39
55
  ) {
40
56
  const config = extractRelevantOptions<BotConfig>(options, botConfigMappings, 'bot');
41
57
 
42
- const botRunner = new BotRunner(config, deps);
58
+ const db = await (config.dataDirectory
59
+ ? createStore('bot', BotStore.SCHEMA_VERSION, config)
60
+ : openTmpStore('bot', true, config.dataStoreMapSizeKb));
61
+
62
+ const store = new BotStore(db);
63
+ await store.cleanupOldClaims();
64
+
65
+ const botRunner = new BotRunner(config, wallet, aztecNode, telemetry, aztecNodeAdmin, store);
43
66
  if (!config.noStart) {
44
67
  void botRunner.start(); // Do not block since bot setup takes time
45
68
  }
@@ -1,22 +1,24 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from '@aztec/aztec-node';
3
- import { Fr } from '@aztec/aztec.js';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
5
- import { getPublicClient } from '@aztec/ethereum';
5
+ import { getL1Config } from '@aztec/cli/config';
6
+ import { getPublicClient } from '@aztec/ethereum/client';
6
7
  import { SecretValue } from '@aztec/foundation/config';
7
8
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
8
9
  import type { LogFn } from '@aztec/foundation/log';
9
- import { AztecNodeAdminApiSchema, AztecNodeApiSchema, type PXE } from '@aztec/stdlib/interfaces/client';
10
+ import { type CliPXEOptions, type PXEConfig, allPxeConfigMappings } from '@aztec/pxe/config';
11
+ import { AztecNodeAdminApiSchema, AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
10
12
  import { P2PApiSchema } from '@aztec/stdlib/interfaces/server';
11
13
  import {
12
14
  type TelemetryClientConfig,
13
15
  initTelemetryClient,
14
16
  telemetryClientConfigMappings,
15
17
  } from '@aztec/telemetry-client';
18
+ import { TestWallet } from '@aztec/test-wallet/server';
16
19
  import { getGenesisValues } from '@aztec/world-state/testing';
17
20
 
18
- import { createAztecNode } from '../../sandbox/index.js';
19
- import { getL1Config } from '../get_l1_config.js';
21
+ import { createAztecNode } from '../../local-network/index.js';
20
22
  import {
21
23
  extractNamespacedOptions,
22
24
  extractRelevantOptions,
@@ -50,7 +52,7 @@ export async function startNode(
50
52
 
51
53
  await preloadCrsDataForVerifying(nodeConfig, userLog);
52
54
 
53
- const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccounts()).map(a => a.address) : [];
55
+ const testAccounts = nodeConfig.testAccounts ? (await getInitialTestAccountsData()).map(a => a.address) : [];
54
56
  const sponsoredFPCAccounts = nodeConfig.sponsoredFPC ? [await getSponsoredFPCAddress()] : [];
55
57
  const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
56
58
 
@@ -91,17 +93,7 @@ export async function startNode(
91
93
  ...config,
92
94
  };
93
95
 
94
- if (!options.archiver) {
95
- // expect archiver url in node config
96
- const archiverUrl = nodeConfig.archiverUrl;
97
- if (!archiverUrl) {
98
- userLog('Archiver Service URL is required to start Aztec Node without --archiver option');
99
- throw new Error('Archiver Service URL is required to start Aztec Node without --archiver option');
100
- }
101
- nodeConfig.archiverUrl = archiverUrl;
102
- }
103
-
104
- if (!options.sequencer) {
96
+ if (!options.sequencer && !nodeConfig.fishermanMode) {
105
97
  nodeConfig.disableValidator = true;
106
98
  } else {
107
99
  const sequencerConfig = {
@@ -125,7 +117,7 @@ export async function startNode(
125
117
  }
126
118
 
127
119
  const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
128
- const telemetry = initTelemetryClient(telemetryConfig);
120
+ const telemetry = await initTelemetryClient(telemetryConfig);
129
121
 
130
122
  // Create and start Aztec Node
131
123
  const node = await createAztecNode(nodeConfig, { telemetry }, { prefilledPublicData });
@@ -138,17 +130,14 @@ export async function startNode(
138
130
  // Add node stop function to signal handlers
139
131
  signalHandlers.push(node.stop.bind(node));
140
132
 
141
- // Add a PXE client that connects to this node if requested
142
- let pxe: PXE | undefined;
143
- if (options.pxe) {
144
- const { addPXE } = await import('./start_pxe.js');
145
- ({ pxe } = await addPXE(options, signalHandlers, services, userLog, { node }));
146
- }
147
-
148
133
  // Add a txs bot if requested
149
134
  if (options.bot) {
150
135
  const { addBot } = await import('./start_bot.js');
151
- await addBot(options, signalHandlers, services, { pxe, node, telemetry });
136
+
137
+ const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
138
+ const wallet = await TestWallet.create(node, pxeConfig);
139
+
140
+ await addBot(options, signalHandlers, services, wallet, node, telemetry, undefined);
152
141
  }
153
142
 
154
143
  if (nodeConfig.autoUpdate !== 'disabled' && nodeConfig.autoUpdateUrl) {
@@ -25,7 +25,7 @@ export async function startP2PBootstrap(
25
25
  userLog(`Starting P2P bootstrap node with config: ${jsonStringify(safeConfig)}`);
26
26
 
27
27
  const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
28
- const telemetryClient = initTelemetryClient(telemetryConfig);
28
+ const telemetryClient = await initTelemetryClient(telemetryConfig);
29
29
 
30
30
  const store = await createStore('p2p-bootstrap', 1, config, createLogger('p2p:bootstrap:store'));
31
31
  const node = new BootstrapNode(store, telemetryClient);
@@ -45,10 +45,15 @@ export async function startProverAgent(
45
45
 
46
46
  await preloadCrsDataForServerSideProving(config, userLog);
47
47
 
48
- const fetch = makeTracedFetch([1, 2, 3], false, makeUndiciFetch(new Agent({ connections: 10 })));
48
+ const fetch = makeTracedFetch(
49
+ // retry connections every 3s, up to 30s before giving up
50
+ [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
51
+ false,
52
+ makeUndiciFetch(new Agent({ connections: 10 })),
53
+ );
49
54
  const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
50
55
 
51
- const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
56
+ const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
52
57
  const prover = await buildServerCircuitProver(config, telemetry);
53
58
  const proofStore = new InlineProofStore();
54
59
  const agents = times(
@@ -1,3 +1,5 @@
1
+ import { getL1Config } from '@aztec/cli/config';
2
+ import { getPublicClient } from '@aztec/ethereum/client';
1
3
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
2
4
  import type { LogFn } from '@aztec/foundation/log';
3
5
  import {
@@ -10,8 +12,7 @@ import { getProverNodeBrokerConfigFromEnv } from '@aztec/prover-node';
10
12
  import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
11
13
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
12
14
 
13
- import { getL1Config } from '../get_l1_config.js';
14
- import { extractRelevantOptions } from '../util.js';
15
+ import { extractRelevantOptions, setupUpdateMonitor } from '../util.js';
15
16
 
16
17
  export async function startProverBroker(
17
18
  options: any,
@@ -33,6 +34,7 @@ export async function startProverBroker(
33
34
  throw new Error('L1 registry address is required to start Aztec Node without --deploy-aztec-contracts option');
34
35
  }
35
36
 
37
+ const followsCanonicalRollup = typeof config.rollupVersion !== 'number';
36
38
  const { addresses, config: rollupConfig } = await getL1Config(
37
39
  config.l1Contracts.registryAddress,
38
40
  config.l1RpcUrls,
@@ -43,8 +45,20 @@ export async function startProverBroker(
43
45
  config.l1Contracts = addresses;
44
46
  config.rollupVersion = rollupConfig.rollupVersion;
45
47
 
46
- const client = initTelemetryClient(getTelemetryClientConfig());
48
+ const client = await initTelemetryClient(getTelemetryClientConfig());
47
49
  const broker = await createAndStartProvingBroker(config, client);
50
+
51
+ if (options.autoUpdate !== 'disabled' && options.autoUpdateUrl) {
52
+ await setupUpdateMonitor(
53
+ options.autoUpdate,
54
+ new URL(options.autoUpdateUrl),
55
+ followsCanonicalRollup,
56
+ getPublicClient(config),
57
+ config.l1Contracts.registryAddress,
58
+ signalHandlers,
59
+ );
60
+ }
61
+
48
62
  services.proverBroker = [broker, ProvingJobBrokerSchema];
49
63
  signalHandlers.push(() => broker.stop());
50
64
 
@@ -1,7 +1,8 @@
1
- import { getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import { Fr } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
3
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
- import { getPublicClient } from '@aztec/ethereum';
4
+ import { getL1Config } from '@aztec/cli/config';
5
+ import { getPublicClient } from '@aztec/ethereum/client';
5
6
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
6
7
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
7
8
  import type { LogFn } from '@aztec/foundation/log';
@@ -16,7 +17,6 @@ import { P2PApiSchema, ProverNodeApiSchema, type ProvingJobBroker } from '@aztec
16
17
  import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
17
18
  import { getGenesisValues } from '@aztec/world-state/testing';
18
19
 
19
- import { getL1Config } from '../get_l1_config.js';
20
20
  import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
21
21
  import { getVersions } from '../versioning.js';
22
22
  import { startProverBroker } from './start_prover_broker.js';
@@ -37,13 +37,8 @@ export async function startProverNode(
37
37
  ...extractRelevantOptions<ProverNodeConfig>(options, proverNodeConfigMappings, 'proverNode'), // override with command line options
38
38
  };
39
39
 
40
- if (!options.archiver && !proverConfig.archiverUrl) {
41
- userLog('--archiver.archiverUrl is required to start a Prover Node without --archiver option');
42
- process.exit(1);
43
- }
44
-
45
40
  if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
46
- throw new Error('L1 registry address is required to start a Prover Node with --archiver option');
41
+ throw new Error('L1 registry address is required to start a Prover Node');
47
42
  }
48
43
 
49
44
  const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
@@ -57,7 +52,7 @@ export async function startProverNode(
57
52
  proverConfig.l1Contracts = addresses;
58
53
  proverConfig = { ...proverConfig, ...config };
59
54
 
60
- const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccounts()).map(a => a.address) : [];
55
+ const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccountsData()).map(a => a.address) : [];
61
56
  const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [await getSponsoredFPCAddress()] : [];
62
57
  const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
63
58
 
@@ -72,13 +67,18 @@ export async function startProverNode(
72
67
  );
73
68
  }
74
69
 
75
- const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
70
+ const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
76
71
 
77
72
  let broker: ProvingJobBroker;
78
73
  if (proverConfig.proverBrokerUrl) {
79
- // at 1TPS we'd enqueue ~1k tube proofs and ~1k AVM proofs immediately
74
+ // at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
80
75
  // set a lower connection limit such that we don't overload the server
81
- const fetch = makeTracedFetch([1, 2, 3], false, makeUndiciFetch(new Agent({ connections: 100 })));
76
+ // Keep retrying up to 30s
77
+ const fetch = makeTracedFetch(
78
+ [1, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
79
+ false,
80
+ makeUndiciFetch(new Agent({ connections: 100 })),
81
+ );
82
82
  broker = createProvingJobBrokerClient(proverConfig.proverBrokerUrl, getVersions(proverConfig), fetch);
83
83
  } else if (options.proverBroker) {
84
84
  ({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
package/src/cli/util.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { AztecNodeConfig } from '@aztec/aztec-node';
2
- import type { AccountManager, EthAddress, Fr } from '@aztec/aztec.js';
3
- import type { ViemClient } from '@aztec/ethereum';
2
+ import { EthAddress } from '@aztec/aztec.js/addresses';
3
+ import { Fr } from '@aztec/aztec.js/fields';
4
+ import { AccountManager } from '@aztec/aztec.js/wallet';
5
+ import type { ViemClient } from '@aztec/ethereum/types';
4
6
  import type { ConfigMappingsType } from '@aztec/foundation/config';
5
7
  import { type LogFn, createLogger } from '@aztec/foundation/log';
6
8
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
7
- import type { PXEService } from '@aztec/pxe/server';
8
9
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
9
- import { UpdateChecker } from '@aztec/stdlib/update-checker';
10
- import { getTelemetryClient } from '@aztec/telemetry-client';
10
+ import { getTelemetryClient } from '@aztec/telemetry-client/start';
11
+ import type { TestWallet } from '@aztec/test-wallet/server';
11
12
 
12
13
  import chalk from 'chalk';
13
14
  import type { Command } from 'commander';
@@ -67,7 +68,7 @@ export const installSignalHandlers = (logFn: LogFn, cb?: Array<() => Promise<voi
67
68
  /**
68
69
  * Creates logs for the initial accounts
69
70
  * @param accounts - The initial accounts
70
- * @param pxe - A PXE instance to get the registered accounts
71
+ * @param wallet - A TestWallet instance to get the registered accounts
71
72
  * @returns A string array containing the initial accounts details
72
73
  */
73
74
  export async function createAccountLogs(
@@ -81,13 +82,13 @@ export async function createAccountLogs(
81
82
  */
82
83
  secretKey: Fr;
83
84
  }[],
84
- pxe: PXEService,
85
+ wallet: TestWallet,
85
86
  ) {
86
- const registeredAccounts = await pxe.getRegisteredAccounts();
87
+ const registeredAccounts = await wallet.getAccounts();
87
88
  const accountLogStrings = [`Initial Accounts:\n\n`];
88
89
  for (const accountWithSecretKey of accountsWithSecretKeys) {
89
90
  const completeAddress = await accountWithSecretKey.account.getCompleteAddress();
90
- if (registeredAccounts.find(a => a.equals(completeAddress))) {
91
+ if (registeredAccounts.find(a => a.item.equals(completeAddress.address))) {
91
92
  accountLogStrings.push(` Address: ${completeAddress.address.toString()}\n`);
92
93
  accountLogStrings.push(` Partial Address: ${completeAddress.partialAddress.toString()}\n`);
93
94
  accountLogStrings.push(` Secret Key: ${accountWithSecretKey.secretKey.toString()}\n`);
@@ -144,8 +145,8 @@ const getDefaultOrEnvValue = (opt: AztecStartOption) => {
144
145
  let val;
145
146
 
146
147
  // if the option is set in the environment, use that
147
- if (opt.envVar) {
148
- val = process.env[opt.envVar];
148
+ if (opt.env) {
149
+ val = process.env[opt.env];
149
150
  }
150
151
 
151
152
  // if we have fallback env vars, check those
@@ -164,7 +165,7 @@ const getDefaultOrEnvValue = (opt: AztecStartOption) => {
164
165
  return opt.parseVal(val);
165
166
  }
166
167
  return val;
167
- } else if (opt.defaultValue) {
168
+ } else if (opt.defaultValue !== undefined) {
168
169
  return opt.defaultValue;
169
170
  }
170
171
  return undefined;
@@ -175,7 +176,7 @@ export const addOptions = (cmd: Command, options: AztecStartOption[]) => {
175
176
  options.forEach(opt => {
176
177
  cmd.option(
177
178
  opt.flag,
178
- `${opt.description} (default: ${opt.defaultValue}) ($${opt.envVar})`,
179
+ `${opt.description} (default: ${opt.defaultValue}) ($${opt.env})`,
179
180
  opt.parseVal ? opt.parseVal : val => val,
180
181
  getDefaultOrEnvValue(opt),
181
182
  );
@@ -191,10 +192,11 @@ export const printAztecStartHelpText = () => {
191
192
  helpTextLines.push('');
192
193
 
193
194
  aztecStartOptions[category].forEach(opt => {
194
- const defaultValueText = opt.defaultValue
195
- ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})`
196
- : '';
197
- const envVarText = opt.envVar ? `($${opt.envVar})` : '';
195
+ const defaultValueText =
196
+ opt.defaultValue || (Array.isArray(opt.defaultValue) && opt.defaultValue.length > 0)
197
+ ? `(default: ${opt.printDefault ? opt.printDefault(opt.defaultValue) : opt.defaultValue})`
198
+ : '';
199
+ const envVarText = opt.env ? `($${opt.env})` : '';
198
200
  const flagText = `${opt.flag}`;
199
201
 
200
202
  const paddedText = formatHelpLine(flagText, defaultValueText, envVarText, maxFlagLength, maxDefaultLength);
@@ -270,7 +272,7 @@ export const extractRelevantOptions = <T>(
270
272
  };
271
273
 
272
274
  /**
273
- * Downloads just enough points to be able to verify ClientIVC proofs.
275
+ * Downloads just enough points to be able to verify Chonk proofs.
274
276
  * @param opts - Whether proof are to be verifier
275
277
  * @param log - Logging function
276
278
  */
@@ -309,6 +311,7 @@ export async function setupUpdateMonitor(
309
311
  updateNodeConfig?: (config: object) => Promise<void>,
310
312
  ) {
311
313
  const logger = createLogger('update-check');
314
+ const { UpdateChecker } = await import('@aztec/stdlib/update-checker');
312
315
  const checker = await UpdateChecker.new({
313
316
  baseURL: updatesLocation,
314
317
  publicClient,
@@ -1,13 +1,13 @@
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 type { ChainConfig } from '@aztec/stdlib/config';
4
4
  import { type ComponentsVersions, getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
5
5
 
6
6
  export function getVersions(config?: ChainConfig): Partial<ComponentsVersions> {
7
7
  return config
8
- ? getComponentsVersionsFromConfig(config, protocolContractTreeRoot, getVKTreeRoot())
8
+ ? getComponentsVersionsFromConfig(config, protocolContractsHash, getVKTreeRoot())
9
9
  : {
10
10
  l2CircuitsVkTreeRoot: getVKTreeRoot().toString(),
11
- l2ProtocolContractsTreeRoot: protocolContractTreeRoot.toString(),
11
+ l2ProtocolContractsHash: protocolContractsHash.toString(),
12
12
  };
13
13
  }
@@ -1,13 +1,14 @@
1
- import { getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
2
- import { createPXEClient } from '@aztec/aztec.js';
1
+ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import { createAztecNodeClient } from '@aztec/aztec.js/node';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
5
+ import { TestWallet } from '@aztec/test-wallet/server';
5
6
 
6
7
  const logger = createLogger('example:token');
7
8
 
8
- const url = 'http://localhost:8080';
9
+ const nodeUrl = 'http://localhost:8080';
9
10
 
10
- const pxe = createPXEClient(url);
11
+ const node = createAztecNodeClient(nodeUrl);
11
12
 
12
13
  const ALICE_MINT_BALANCE = 333n;
13
14
  const TRANSFER_AMOUNT = 33n;
@@ -18,40 +19,42 @@ const TRANSFER_AMOUNT = 33n;
18
19
  async function main() {
19
20
  logger.info('Running token contract test on HTTP interface.');
20
21
 
21
- const [aliceWallet, bobWallet] = await getDeployedTestAccountsWallets(pxe);
22
- const alice = aliceWallet.getAddress();
23
- const bob = bobWallet.getAddress();
22
+ const wallet = await TestWallet.create(node);
23
+
24
+ // During local network setup we deploy a few accounts. Below we add them to our wallet.
25
+ const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
26
+ await wallet.createSchnorrAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
27
+ await wallet.createSchnorrAccount(bobInitialAccountData.secret, bobInitialAccountData.salt);
28
+
29
+ const alice = aliceInitialAccountData.address;
30
+ const bob = bobInitialAccountData.address;
24
31
 
25
32
  logger.info(`Fetched Alice and Bob accounts: ${alice.toString()}, ${bob.toString()}`);
26
33
 
27
34
  logger.info('Deploying Token...');
28
- const token = await TokenContract.deploy(aliceWallet, alice, 'TokenName', 'TokenSymbol', 18)
35
+ const token = await TokenContract.deploy(wallet, alice, 'TokenName', 'TokenSymbol', 18)
29
36
  .send({ from: alice })
30
37
  .deployed();
31
38
  logger.info('Token deployed');
32
39
 
33
- // Create the contract abstraction and link it to Alice's and Bob's wallet for future signing
34
- const tokenAlice = await TokenContract.at(token.address, aliceWallet);
35
- const tokenBob = await TokenContract.at(token.address, bobWallet);
36
-
37
40
  // Mint tokens to Alice
38
41
  logger.info(`Minting ${ALICE_MINT_BALANCE} more coins to Alice...`);
39
- await tokenAlice.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({ from: alice }).wait();
42
+ await token.methods.mint_to_private(alice, ALICE_MINT_BALANCE).send({ from: alice }).wait();
40
43
 
41
44
  logger.info(`${ALICE_MINT_BALANCE} tokens were successfully minted by Alice and transferred to private`);
42
45
 
43
- const balanceAfterMint = await tokenAlice.methods.balance_of_private(alice).simulate({ from: alice });
46
+ const balanceAfterMint = await token.methods.balance_of_private(alice).simulate({ from: alice });
44
47
  logger.info(`Tokens successfully minted. New Alice's balance: ${balanceAfterMint}`);
45
48
 
46
49
  // We will now transfer tokens from Alice to Bob
47
50
  logger.info(`Transferring ${TRANSFER_AMOUNT} tokens from Alice to Bob...`);
48
- await tokenAlice.methods.transfer(bob, TRANSFER_AMOUNT).send({ from: alice }).wait();
51
+ await token.methods.transfer(bob, TRANSFER_AMOUNT).send({ from: alice }).wait();
49
52
 
50
53
  // Check the new balances
51
- const aliceBalance = await tokenAlice.methods.balance_of_private(alice).simulate({ from: alice });
54
+ const aliceBalance = await token.methods.balance_of_private(alice).simulate({ from: alice });
52
55
  logger.info(`Alice's balance ${aliceBalance}`);
53
56
 
54
- const bobBalance = await tokenBob.methods.balance_of_private(bob).simulate({ from: bob });
57
+ const bobBalance = await token.methods.balance_of_private(bob).simulate({ from: bob });
55
58
  logger.info(`Bob's balance ${bobBalance}`);
56
59
  }
57
60
 
@@ -1,5 +1,5 @@
1
- import { EthAddress } from '@aztec/aztec.js';
2
- import type { ExtendedViemWalletClient } from '@aztec/ethereum';
1
+ import { EthAddress } from '@aztec/aztec.js/addresses';
2
+ import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
3
3
  import { jsonStringify } from '@aztec/foundation/json-rpc';
4
4
 
5
5
  import type { Abi, Narrow } from 'abitype';
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export {
2
- createSandbox,
3
- getDeployedBananaCoinAddress,
4
- getDeployedBananaFPCAddress,
5
- getDeployedSponsoredFPCAddress,
6
- } from './sandbox/index.js';
2
+ createLocalNetwork,
3
+ registerDeployedBananaCoinInWalletAndGetAddress,
4
+ registerDeployedBananaFPCInWalletAndGetAddress,
5
+ registerDeployedSponsoredFPCInWalletAndGetAddress,
6
+ } from './local-network/index.js';
@@ -1,12 +1,11 @@
1
- import { type InitialAccountData, getInitialTestAccounts } from '@aztec/accounts/testing';
2
- import type { Wallet } from '@aztec/aztec.js';
3
- import { Fr } from '@aztec/foundation/fields';
1
+ import { type InitialAccountData, getInitialTestAccountsData } from '@aztec/accounts/testing';
2
+ import type { Wallet } from '@aztec/aztec.js/wallet';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
4
  import type { LogFn } from '@aztec/foundation/log';
5
5
  import { FPCContract } from '@aztec/noir-contracts.js/FPC';
6
6
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
7
7
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
8
8
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
9
- import type { PXE } from '@aztec/stdlib/interfaces/client';
10
9
 
11
10
  const BANANA_COIN_SALT = new Fr(0);
12
11
  const bananaCoinArgs = {
@@ -46,14 +45,14 @@ export async function getBananaFPCAddress(initialAccounts: InitialAccountData[])
46
45
  return (await getBananaFPCInstance(initialAccounts)).address;
47
46
  }
48
47
 
49
- export async function setupBananaFPC(initialAccounts: InitialAccountData[], deployer: Wallet, log: LogFn) {
48
+ export async function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn) {
50
49
  const bananaCoinAddress = await getBananaCoinAddress(initialAccounts);
51
50
  const admin = getBananaAdmin(initialAccounts);
52
51
  const [bananaCoin, fpc] = await Promise.all([
53
- TokenContract.deploy(deployer, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal)
52
+ TokenContract.deploy(wallet, admin, bananaCoinArgs.name, bananaCoinArgs.symbol, bananaCoinArgs.decimal)
54
53
  .send({ from: admin, contractAddressSalt: BANANA_COIN_SALT, universalDeploy: true })
55
54
  .deployed(),
56
- FPCContract.deploy(deployer, bananaCoinAddress, admin)
55
+ FPCContract.deploy(wallet, bananaCoinAddress, admin)
57
56
  .send({ from: admin, contractAddressSalt: BANANA_FPC_SALT, universalDeploy: true })
58
57
  .deployed(),
59
58
  ]);
@@ -62,22 +61,18 @@ export async function setupBananaFPC(initialAccounts: InitialAccountData[], depl
62
61
  log(`FPC: ${fpc.address}`);
63
62
  }
64
63
 
65
- export async function getDeployedBananaCoinAddress(pxe: PXE) {
66
- const initialAccounts = await getInitialTestAccounts();
67
- const bananaCoin = await getBananaCoinAddress(initialAccounts);
68
- const contracts = await pxe.getContracts();
69
- if (!contracts.find(c => c.equals(bananaCoin))) {
70
- throw new Error('BananaCoin not deployed.');
71
- }
72
- return bananaCoin;
64
+ export async function registerDeployedBananaCoinInWalletAndGetAddress(wallet: Wallet) {
65
+ const initialAccounts = await getInitialTestAccountsData();
66
+ const bananaCoin = await getBananaCoinInstance(initialAccounts);
67
+ // The following is no-op if the contract is already registered
68
+ await wallet.registerContract(bananaCoin, TokenContract.artifact);
69
+ return bananaCoin.address;
73
70
  }
74
71
 
75
- export async function getDeployedBananaFPCAddress(pxe: PXE) {
76
- const initialAccounts = await getInitialTestAccounts();
72
+ export async function registerDeployedBananaFPCInWalletAndGetAddress(wallet: Wallet) {
73
+ const initialAccounts = await getInitialTestAccountsData();
77
74
  const fpc = await getBananaFPCInstance(initialAccounts);
78
- const contracts = await pxe.getContracts();
79
- if (!contracts.find(c => c.equals(fpc.address))) {
80
- throw new Error('BananaFPC not deployed.');
81
- }
75
+ // The following is no-op if the contract is already registered
76
+ await wallet.registerContract(fpc, FPCContract.artifact);
82
77
  return fpc.address;
83
78
  }
@@ -0,0 +1,7 @@
1
+ export * from './local-network.js';
2
+
3
+ export {
4
+ registerDeployedBananaCoinInWalletAndGetAddress,
5
+ registerDeployedBananaFPCInWalletAndGetAddress,
6
+ } from './banana_fpc.js';
7
+ export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';