@aztec/aztec 3.0.0-devnet.6 → 3.0.0-devnet.6-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 (92) hide show
  1. package/README.md +1 -1
  2. package/dest/bin/index.d.ts +1 -1
  3. package/dest/bin/index.js +4 -2
  4. package/dest/cli/aztec_start_action.d.ts +1 -1
  5. package/dest/cli/aztec_start_action.js +9 -9
  6. package/dest/cli/aztec_start_options.d.ts +1 -1
  7. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  8. package/dest/cli/aztec_start_options.js +12 -8
  9. package/dest/cli/cli.d.ts +1 -1
  10. package/dest/cli/cli.d.ts.map +1 -1
  11. package/dest/cli/cli.js +46 -1
  12. package/dest/cli/cmds/start_archiver.d.ts +1 -1
  13. package/dest/cli/cmds/start_archiver.js +1 -1
  14. package/dest/cli/cmds/start_blob_sink.d.ts +1 -1
  15. package/dest/cli/cmds/start_blob_sink.js +1 -1
  16. package/dest/cli/cmds/start_bot.d.ts +1 -1
  17. package/dest/cli/cmds/start_bot.js +1 -1
  18. package/dest/cli/cmds/start_node.d.ts +1 -1
  19. package/dest/cli/cmds/start_node.js +4 -4
  20. package/dest/cli/cmds/start_p2p_bootstrap.d.ts +1 -1
  21. package/dest/cli/cmds/start_p2p_bootstrap.js +1 -1
  22. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  23. package/dest/cli/cmds/start_prover_agent.js +1 -1
  24. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  25. package/dest/cli/cmds/start_prover_broker.js +2 -2
  26. package/dest/cli/cmds/start_prover_node.d.ts +1 -1
  27. package/dest/cli/cmds/start_prover_node.js +3 -3
  28. package/dest/cli/cmds/start_txe.d.ts +1 -1
  29. package/dest/cli/index.d.ts +1 -1
  30. package/dest/cli/preload_crs.d.ts +1 -1
  31. package/dest/cli/release_version.d.ts +1 -1
  32. package/dest/cli/util.d.ts +6 -6
  33. package/dest/cli/util.d.ts.map +1 -1
  34. package/dest/cli/util.js +3 -3
  35. package/dest/cli/versioning.d.ts +1 -1
  36. package/dest/examples/token.d.ts +1 -1
  37. package/dest/examples/token.js +1 -1
  38. package/dest/examples/util.d.ts +2 -2
  39. package/dest/examples/util.d.ts.map +1 -1
  40. package/dest/index.d.ts +2 -2
  41. package/dest/index.d.ts.map +1 -1
  42. package/dest/index.js +1 -1
  43. package/dest/local-network/banana_fpc.d.ts +10 -0
  44. package/dest/local-network/banana_fpc.d.ts.map +1 -0
  45. package/dest/{sandbox → local-network}/banana_fpc.js +1 -1
  46. package/dest/local-network/index.d.ts +4 -0
  47. package/dest/local-network/index.d.ts.map +1 -0
  48. package/dest/{sandbox → local-network}/index.js +1 -1
  49. package/dest/{sandbox/sandbox.d.ts → local-network/local-network.d.ts} +15 -15
  50. package/dest/local-network/local-network.d.ts.map +1 -0
  51. package/dest/{sandbox/sandbox.js → local-network/local-network.js} +16 -11
  52. package/dest/local-network/sponsored_fpc.d.ts +5 -0
  53. package/dest/local-network/sponsored_fpc.d.ts.map +1 -0
  54. package/dest/mnemonic.d.ts +1 -1
  55. package/dest/splash.d.ts +1 -1
  56. package/dest/testing/anvil_test_watcher.d.ts +4 -4
  57. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  58. package/dest/testing/anvil_test_watcher.js +16 -14
  59. package/dest/testing/cheat_codes.d.ts +1 -3
  60. package/dest/testing/cheat_codes.d.ts.map +1 -1
  61. package/dest/testing/index.d.ts +1 -1
  62. package/package.json +37 -36
  63. package/src/bin/index.ts +4 -2
  64. package/src/cli/aztec_start_action.ts +9 -9
  65. package/src/cli/aztec_start_options.ts +12 -7
  66. package/src/cli/cli.ts +46 -1
  67. package/src/cli/cmds/start_archiver.ts +1 -1
  68. package/src/cli/cmds/start_blob_sink.ts +1 -1
  69. package/src/cli/cmds/start_bot.ts +1 -1
  70. package/src/cli/cmds/start_node.ts +4 -4
  71. package/src/cli/cmds/start_p2p_bootstrap.ts +1 -1
  72. package/src/cli/cmds/start_prover_agent.ts +1 -1
  73. package/src/cli/cmds/start_prover_broker.ts +2 -2
  74. package/src/cli/cmds/start_prover_node.ts +3 -3
  75. package/src/cli/util.ts +4 -4
  76. package/src/examples/token.ts +1 -1
  77. package/src/examples/util.ts +1 -1
  78. package/src/index.ts +2 -2
  79. package/src/{sandbox → local-network}/banana_fpc.ts +1 -1
  80. package/src/{sandbox → local-network}/index.ts +1 -1
  81. package/src/{sandbox/sandbox.ts → local-network/local-network.ts} +21 -23
  82. package/src/{sandbox → local-network}/sponsored_fpc.ts +3 -2
  83. package/src/testing/anvil_test_watcher.ts +16 -14
  84. package/src/testing/cheat_codes.ts +3 -2
  85. package/dest/sandbox/banana_fpc.d.ts +0 -10
  86. package/dest/sandbox/banana_fpc.d.ts.map +0 -1
  87. package/dest/sandbox/index.d.ts +0 -4
  88. package/dest/sandbox/index.d.ts.map +0 -1
  89. package/dest/sandbox/sandbox.d.ts.map +0 -1
  90. package/dest/sandbox/sponsored_fpc.d.ts +0 -4
  91. package/dest/sandbox/sponsored_fpc.d.ts.map +0 -1
  92. /package/dest/{sandbox → local-network}/sponsored_fpc.js +0 -0
package/src/cli/cli.ts CHANGED
@@ -37,10 +37,55 @@ export function injectAztecCommands(program: Command, userLog: LogFn, debugLogge
37
37
 
38
38
  Additional commands:
39
39
 
40
+ init [folder] [options]: creates a new Noir project
41
+ Options:
42
+ --name <name> Name of the package
43
+ --contract Use a contract template (default)
44
+ --lib Use a library template
45
+ --bin Use a binary template
46
+ Examples:
47
+ $ aztec init # creates a contract project in current directory
48
+ $ aztec init --lib # creates a library project
49
+
50
+ new <path> [options]: creates a new Noir project in a new directory
51
+ Options:
52
+ --name <name> Name of the package
53
+ --contract Use a contract template (default)
54
+ --lib Use a library template
55
+ --bin Use a binary template
56
+ Examples:
57
+ $ aztec new my-project # creates a contract project in ./my-project
58
+ $ aztec new my-lib --lib # creates a library project in ./my-lib
59
+
60
+ compile [options]: compiles Aztec Noir contracts
61
+ Compiles contracts with nargo compile and then postprocesses them to generate Aztec-specific artifacts including:
62
+ - Transpiled contract artifacts
63
+ - Verification keys
64
+ The compiled contracts will be placed in the target/ directory by default.
65
+ Supports standard nargo compile options.
66
+
67
+ fmt [options]: formats Noir code using nargo fmt
68
+ Example:
69
+ $ aztec fmt # formats all Noir files in the project
70
+
71
+ check [options]: type-checks Noir code without compiling using nargo check
72
+ Example:
73
+ $ aztec check # checks all Noir files in the project
74
+
40
75
  test [options]: starts a dockerized TXE node via
41
76
  $ aztec start --txe
42
77
  then runs
43
- $ aztec-nargo test --silence-warnings --oracle-resolver=<TXE_ADDRESS> [options]
78
+ $ aztec test --silence-warnings --oracle-resolver=<TXE_ADDRESS> [options]
79
+
80
+ lsp: starts the Nargo Language Server Protocol server
81
+ Runs nargo lsp in a Docker container for IDE integration with Noir.
82
+ This command is typically used by IDE extensions and not called directly by users.
83
+ Example:
84
+ $ aztec lsp # starts the LSP server
85
+
86
+ preload-crs: Downloads and caches the Common Reference String (CRS) data required for zero-knowledge proofs.
87
+ Example:
88
+ $ aztec preload-crs # preloads CRS data
44
89
  `,
45
90
  );
46
91
 
@@ -51,7 +51,7 @@ export async function startArchiver(
51
51
  const store = await createStore('archiver', KVArchiverDataStore.SCHEMA_VERSION, archiverConfig, storeLog);
52
52
  const archiverStore = new KVArchiverDataStore(store, archiverConfig.maxLogs);
53
53
 
54
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
54
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
55
55
  const blobSinkClient = createBlobSinkClient(archiverConfig, { logger: createLogger('archiver:blob-sink:client') });
56
56
  const archiver = await Archiver.createAndSync(archiverConfig, archiverStore, { telemetry, blobSinkClient }, true);
57
57
  services.archiver = [archiver, ArchiverApiSchema];
@@ -35,7 +35,7 @@ export async function startBlobSink(options: any, signalHandlers: (() => Promise
35
35
  throw new Error('L1_CHAIN_ID');
36
36
  }
37
37
 
38
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
38
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
39
39
 
40
40
  const { config: chainConfig, addresses } = await getL1Config(
41
41
  blobSinkConfig.l1Contracts.registryAddress,
@@ -40,7 +40,7 @@ export async function startBot(
40
40
  const pxeConfig = extractRelevantOptions<PXEConfig & CliPXEOptions>(options, allPxeConfigMappings, 'pxe');
41
41
  const wallet = await TestWallet.create(aztecNode, pxeConfig);
42
42
 
43
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
43
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
44
44
  await addBot(options, signalHandlers, services, wallet, aztecNode, telemetry, undefined);
45
45
  }
46
46
 
@@ -3,7 +3,7 @@ import { type AztecNodeConfig, aztecNodeConfigMappings, getConfigEnvVars } from
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
5
5
  import { getL1Config } from '@aztec/cli/config';
6
- import { getPublicClient } from '@aztec/ethereum';
6
+ import { getPublicClient } from '@aztec/ethereum/client';
7
7
  import { SecretValue } from '@aztec/foundation/config';
8
8
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
9
9
  import type { LogFn } from '@aztec/foundation/log';
@@ -18,7 +18,7 @@ import {
18
18
  import { TestWallet } from '@aztec/test-wallet/server';
19
19
  import { getGenesisValues } from '@aztec/world-state/testing';
20
20
 
21
- import { createAztecNode } from '../../sandbox/index.js';
21
+ import { createAztecNode } from '../../local-network/index.js';
22
22
  import {
23
23
  extractNamespacedOptions,
24
24
  extractRelevantOptions,
@@ -93,7 +93,7 @@ export async function startNode(
93
93
  ...config,
94
94
  };
95
95
 
96
- if (!options.sequencer) {
96
+ if (!options.sequencer && !nodeConfig.fishermanMode) {
97
97
  nodeConfig.disableValidator = true;
98
98
  } else {
99
99
  const sequencerConfig = {
@@ -117,7 +117,7 @@ export async function startNode(
117
117
  }
118
118
 
119
119
  const telemetryConfig = extractRelevantOptions<TelemetryClientConfig>(options, telemetryClientConfigMappings, 'tel');
120
- const telemetry = initTelemetryClient(telemetryConfig);
120
+ const telemetry = await initTelemetryClient(telemetryConfig);
121
121
 
122
122
  // Create and start Aztec Node
123
123
  const node = await createAztecNode(nodeConfig, { telemetry }, { prefilledPublicData });
@@ -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);
@@ -53,7 +53,7 @@ export async function startProverAgent(
53
53
  );
54
54
  const broker = createProvingJobBrokerClient(config.proverBrokerUrl, getVersions(), fetch);
55
55
 
56
- const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
56
+ const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
57
57
  const prover = await buildServerCircuitProver(config, telemetry);
58
58
  const proofStore = new InlineProofStore();
59
59
  const agents = times(
@@ -1,5 +1,5 @@
1
1
  import { getL1Config } from '@aztec/cli/config';
2
- import { getPublicClient } from '@aztec/ethereum';
2
+ import { getPublicClient } from '@aztec/ethereum/client';
3
3
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
4
4
  import type { LogFn } from '@aztec/foundation/log';
5
5
  import {
@@ -45,7 +45,7 @@ export async function startProverBroker(
45
45
  config.l1Contracts = addresses;
46
46
  config.rollupVersion = rollupConfig.rollupVersion;
47
47
 
48
- const client = initTelemetryClient(getTelemetryClientConfig());
48
+ const client = await initTelemetryClient(getTelemetryClientConfig());
49
49
  const broker = await createAndStartProvingBroker(config, client);
50
50
 
51
51
  if (options.autoUpdate !== 'disabled' && options.autoUpdateUrl) {
@@ -2,7 +2,7 @@ import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import { Fr } from '@aztec/aztec.js/fields';
3
3
  import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
4
  import { getL1Config } from '@aztec/cli/config';
5
- import { getPublicClient } from '@aztec/ethereum';
5
+ import { getPublicClient } from '@aztec/ethereum/client';
6
6
  import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
7
7
  import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
8
8
  import type { LogFn } from '@aztec/foundation/log';
@@ -67,11 +67,11 @@ export async function startProverNode(
67
67
  );
68
68
  }
69
69
 
70
- const telemetry = initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
70
+ const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
71
71
 
72
72
  let broker: ProvingJobBroker;
73
73
  if (proverConfig.proverBrokerUrl) {
74
- // 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
75
75
  // set a lower connection limit such that we don't overload the server
76
76
  // Keep retrying up to 30s
77
77
  const fetch = makeTracedFetch(
package/src/cli/util.ts CHANGED
@@ -2,13 +2,12 @@ import type { AztecNodeConfig } from '@aztec/aztec-node';
2
2
  import { EthAddress } from '@aztec/aztec.js/addresses';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { AccountManager } from '@aztec/aztec.js/wallet';
5
- import type { ViemClient } from '@aztec/ethereum';
5
+ import type { ViemClient } from '@aztec/ethereum/types';
6
6
  import type { ConfigMappingsType } from '@aztec/foundation/config';
7
7
  import { type LogFn, createLogger } from '@aztec/foundation/log';
8
8
  import type { SharedNodeConfig } from '@aztec/node-lib/config';
9
9
  import type { ProverConfig } from '@aztec/stdlib/interfaces/server';
10
- import { UpdateChecker } from '@aztec/stdlib/update-checker';
11
- import { getTelemetryClient } from '@aztec/telemetry-client';
10
+ import { getTelemetryClient } from '@aztec/telemetry-client/start';
12
11
  import type { TestWallet } from '@aztec/test-wallet/server';
13
12
 
14
13
  import chalk from 'chalk';
@@ -273,7 +272,7 @@ export const extractRelevantOptions = <T>(
273
272
  };
274
273
 
275
274
  /**
276
- * Downloads just enough points to be able to verify ClientIVC proofs.
275
+ * Downloads just enough points to be able to verify Chonk proofs.
277
276
  * @param opts - Whether proof are to be verifier
278
277
  * @param log - Logging function
279
278
  */
@@ -312,6 +311,7 @@ export async function setupUpdateMonitor(
312
311
  updateNodeConfig?: (config: object) => Promise<void>,
313
312
  ) {
314
313
  const logger = createLogger('update-check');
314
+ const { UpdateChecker } = await import('@aztec/stdlib/update-checker');
315
315
  const checker = await UpdateChecker.new({
316
316
  baseURL: updatesLocation,
317
317
  publicClient,
@@ -21,7 +21,7 @@ async function main() {
21
21
 
22
22
  const wallet = await TestWallet.create(node);
23
23
 
24
- // During sandbox setup we deploy a few accounts. Below we add them to our wallet.
24
+ // During local network setup we deploy a few accounts. Below we add them to our wallet.
25
25
  const [aliceInitialAccountData, bobInitialAccountData] = await getInitialTestAccountsData();
26
26
  await wallet.createSchnorrAccount(aliceInitialAccountData.secret, aliceInitialAccountData.salt);
27
27
  await wallet.createSchnorrAccount(bobInitialAccountData.secret, bobInitialAccountData.salt);
@@ -1,5 +1,5 @@
1
1
  import { EthAddress } from '@aztec/aztec.js/addresses';
2
- import type { ExtendedViemWalletClient } from '@aztec/ethereum';
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,
2
+ createLocalNetwork,
3
3
  registerDeployedBananaCoinInWalletAndGetAddress,
4
4
  registerDeployedBananaFPCInWalletAndGetAddress,
5
5
  registerDeployedSponsoredFPCInWalletAndGetAddress,
6
- } from './sandbox/index.js';
6
+ } from './local-network/index.js';
@@ -1,6 +1,6 @@
1
1
  import { type InitialAccountData, getInitialTestAccountsData } from '@aztec/accounts/testing';
2
2
  import type { Wallet } from '@aztec/aztec.js/wallet';
3
- import { Fr } from '@aztec/foundation/fields';
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';
@@ -1,4 +1,4 @@
1
- export * from './sandbox.js';
1
+ export * from './local-network.js';
2
2
 
3
3
  export {
4
4
  registerDeployedBananaCoinInWalletAndGetAddress,
@@ -4,17 +4,15 @@ import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec
4
4
  import { EthAddress } from '@aztec/aztec.js/addresses';
5
5
  import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
6
6
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
7
- import {
8
- NULL_KEY,
9
- createEthereumChain,
10
- deployL1Contracts,
11
- deployMulticall3,
12
- getL1ContractsConfigEnvVars,
13
- waitForPublicClient,
14
- } from '@aztec/ethereum';
7
+ import { createEthereumChain } from '@aztec/ethereum/chain';
8
+ import { waitForPublicClient } from '@aztec/ethereum/client';
9
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
10
+ import { NULL_KEY } from '@aztec/ethereum/constants';
11
+ import { deployMulticall3 } from '@aztec/ethereum/contracts';
12
+ import { deployL1Contracts } from '@aztec/ethereum/deploy-l1-contracts';
15
13
  import { EthCheatCodes } from '@aztec/ethereum/test';
16
14
  import { SecretValue } from '@aztec/foundation/config';
17
- import { Fr } from '@aztec/foundation/fields';
15
+ import { Fr } from '@aztec/foundation/curves/bn254';
18
16
  import { type LogFn, createLogger } from '@aztec/foundation/log';
19
17
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
20
18
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
@@ -38,12 +36,12 @@ import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
38
36
  import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
39
37
  import { getSponsoredFPCAddress } from './sponsored_fpc.js';
40
38
 
41
- const logger = createLogger('sandbox');
39
+ const logger = createLogger('local-network');
42
40
 
43
41
  const localAnvil = foundry;
44
42
 
45
43
  /**
46
- * Function to deploy our L1 contracts to the sandbox L1
44
+ * Function to deploy our L1 contracts to the local network L1
47
45
  * @param aztecNodeConfig - The Aztec Node Config
48
46
  * @param hdAccount - Account for publishing L1 contracts
49
47
  */
@@ -78,8 +76,8 @@ export async function deployContractsToL1(
78
76
  genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
79
77
  salt: opts.salt,
80
78
  feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
81
- aztecTargetCommitteeSize: 0, // no committee in sandbox
82
- slasherFlavor: 'none', // no slashing in sandbox
79
+ aztecTargetCommitteeSize: 0, // no committee in local network
80
+ slasherFlavor: 'none', // no slashing in local network
83
81
  realVerifier: false,
84
82
  },
85
83
  );
@@ -92,29 +90,29 @@ export async function deployContractsToL1(
92
90
  return aztecNodeConfig.l1Contracts;
93
91
  }
94
92
 
95
- /** Sandbox settings. */
96
- export type SandboxConfig = AztecNodeConfig & {
93
+ /** Local network settings. */
94
+ export type LocalNetworkConfig = AztecNodeConfig & {
97
95
  /** Mnemonic used to derive the L1 deployer private key.*/
98
96
  l1Mnemonic: string;
99
97
  /** Salt used to deploy L1 contracts.*/
100
98
  deployAztecContractsSalt: string;
101
- /** Whether to deploy test accounts on sandbox start.*/
99
+ /** Whether to deploy test accounts on local network start.*/
102
100
  testAccounts: boolean;
103
101
  };
104
102
 
105
103
  /**
106
104
  * Create and start a new Aztec Node and PXE. Deploys L1 contracts.
107
105
  * Does not start any HTTP services nor populate any initial accounts.
108
- * @param config - Optional Sandbox settings.
106
+ * @param config - Optional local network settings.
109
107
  */
110
- export async function createSandbox(config: Partial<SandboxConfig> = {}, userLog: LogFn) {
111
- // sandbox is meant for test envs. We should only need one l1RpcUrl
108
+ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {}, userLog: LogFn) {
109
+ // local network is meant for test envs. We should only need one l1RpcUrl
112
110
  const l1RpcUrl = config.l1RpcUrls?.[0];
113
111
  if (!l1RpcUrl) {
114
112
  throw new Error('An L1 RPC URL is required');
115
113
  }
116
114
  if ((config.l1RpcUrls?.length || 0) > 1) {
117
- logger.warn(`Multiple L1 RPC URLs provided. Sandbox will only use the first one: ${l1RpcUrl}`);
115
+ logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
118
116
  }
119
117
  const aztecNodeConfig: AztecNodeConfig = { ...getConfigEnvVars(), ...config };
120
118
  const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
@@ -179,12 +177,12 @@ export async function createSandbox(config: Partial<SandboxConfig> = {}, userLog
179
177
  publicClient,
180
178
  dateProvider,
181
179
  );
182
- watcher.setIsSandbox(true);
180
+ watcher.setisLocalNetwork(true);
183
181
  await watcher.start();
184
182
  }
185
183
 
186
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
187
- // Create a local blob sink client inside the sandbox, no http connectivity
184
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
185
+ // Create a local blob sink client inside the local network, no http connectivity
188
186
  const blobSinkClient = createBlobSinkClient();
189
187
  const node = await createAztecNode(
190
188
  aztecNodeConfig,
@@ -1,3 +1,4 @@
1
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
1
2
  import {
2
3
  type ContractInstanceWithAddress,
3
4
  getContractInstanceFromInstantiationParams,
@@ -13,11 +14,11 @@ async function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress> {
13
14
  });
14
15
  }
15
16
 
16
- export async function getSponsoredFPCAddress() {
17
+ export async function getSponsoredFPCAddress(): Promise<AztecAddress> {
17
18
  return (await getSponsoredFPCInstance()).address;
18
19
  }
19
20
 
20
- export async function registerDeployedSponsoredFPCInWalletAndGetAddress(wallet: Wallet) {
21
+ export async function registerDeployedSponsoredFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress> {
21
22
  const fpc = await getSponsoredFPCInstance();
22
23
  // The following is no-op if the contract is already registered
23
24
  await wallet.registerContract(fpc, SponsoredFPCContract.artifact);
@@ -1,5 +1,6 @@
1
- import type { ViemClient } from '@aztec/ethereum';
2
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
+ import type { ViemClient } from '@aztec/ethereum/types';
3
+ import { SlotNumber } from '@aztec/foundation/branded-types';
3
4
  import type { EthAddress } from '@aztec/foundation/eth-address';
4
5
  import { type Logger, createLogger } from '@aztec/foundation/log';
5
6
  import { RunningPromise } from '@aztec/foundation/running-promise';
@@ -16,11 +17,11 @@ import { type GetContractReturnType, getAddress, getContract } from 'viem';
16
17
  * block within the slot. And if so, it will time travel into the next slot.
17
18
  */
18
19
  export class AnvilTestWatcher {
19
- private isSandbox: boolean = false;
20
+ private isLocalNetwork: boolean = false;
20
21
 
21
22
  private rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
22
23
  private rollupCheatCodes: RollupCheatCodes;
23
- private l2SlotDuration!: bigint;
24
+ private l2SlotDuration!: number;
24
25
 
25
26
  private filledRunningPromise?: RunningPromise;
26
27
  private syncDateProviderPromise?: RunningPromise;
@@ -54,8 +55,8 @@ export class AnvilTestWatcher {
54
55
  this.isMarkingAsProven = isMarkingAsProven;
55
56
  }
56
57
 
57
- setIsSandbox(isSandbox: boolean) {
58
- this.isSandbox = isSandbox;
58
+ setisLocalNetwork(isLocalNetwork: boolean) {
59
+ this.isLocalNetwork = isLocalNetwork;
59
60
  }
60
61
 
61
62
  async start() {
@@ -68,7 +69,7 @@ export class AnvilTestWatcher {
68
69
 
69
70
  // If auto mining is not supported (e.g., we are on a real network), then we
70
71
  // will simple do nothing. But if on an anvil or the like, this make sure that
71
- // the sandbox and tests don't break because time is frozen and we never get to
72
+ // the local network and tests don't break because time is frozen and we never get to
72
73
  // the next slot.
73
74
  const isAutoMining = await this.cheatcodes.isAutoMining();
74
75
 
@@ -105,7 +106,7 @@ export class AnvilTestWatcher {
105
106
  }
106
107
 
107
108
  async syncDateProviderToL1IfBehind() {
108
- // this doesn't apply to the sandbox, because we don't have a date provider in the sandbox
109
+ // this doesn't apply to the local network, because we don't have a date provider in the local network
109
110
  if (!this.dateProvider) {
110
111
  return;
111
112
  }
@@ -123,12 +124,13 @@ export class AnvilTestWatcher {
123
124
 
124
125
  async warpTimeIfNeeded() {
125
126
  try {
126
- const currentSlot = await this.rollup.read.getCurrentSlot();
127
- const pendingBlockNumber = BigInt(await this.rollup.read.getPendingBlockNumber());
128
- const blockLog = await this.rollup.read.getBlock([pendingBlockNumber]);
129
- const nextSlotTimestamp = Number(await this.rollup.read.getTimestampForSlot([currentSlot + 1n]));
127
+ const currentSlot = SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
128
+ const pendingCheckpointNumber = await this.rollup.read.getPendingCheckpointNumber();
129
+ const checkpointLog = await this.rollup.read.getCheckpoint([pendingCheckpointNumber]);
130
+ const nextSlot = SlotNumber(currentSlot + 1);
131
+ const nextSlotTimestamp = Number(await this.rollup.read.getTimestampForSlot([BigInt(nextSlot)]));
130
132
 
131
- if (currentSlot === blockLog.slotNumber) {
133
+ if (BigInt(currentSlot) === checkpointLog.slotNumber) {
132
134
  // We should jump to the next slot
133
135
  try {
134
136
  await this.cheatcodes.warp(nextSlotTimestamp, {
@@ -142,8 +144,8 @@ export class AnvilTestWatcher {
142
144
  return;
143
145
  }
144
146
 
145
- // If we are not in sandbox, we don't need to warp time
146
- if (!this.isSandbox) {
147
+ // If we are not in local network, we don't need to warp time
148
+ if (!this.isLocalNetwork) {
147
149
  return;
148
150
  }
149
151
 
@@ -1,4 +1,5 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
+ import { BlockNumber } from '@aztec/foundation/branded-types';
2
3
  import { retryUntil } from '@aztec/foundation/retry';
3
4
  import type { DateProvider } from '@aztec/foundation/timer';
4
5
  import type { SequencerClient } from '@aztec/sequencer-client';
@@ -37,7 +38,7 @@ export class CheatCodes {
37
38
  * @param targetTimestamp - The target timestamp to warp to (in seconds)
38
39
  */
39
40
  async warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number) {
40
- const currentL2BlockNumber = await node.getBlockNumber();
41
+ const currentL2BlockNumber: BlockNumber = await node.getBlockNumber();
41
42
 
42
43
  // We warp the L1 timestamp
43
44
  await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
@@ -49,7 +50,7 @@ export class CheatCodes {
49
50
 
50
51
  await retryUntil(
51
52
  async () => {
52
- const newL2BlockNumber = await node.getBlockNumber();
53
+ const newL2BlockNumber: BlockNumber = await node.getBlockNumber();
53
54
  return newL2BlockNumber > currentL2BlockNumber;
54
55
  },
55
56
  'new block after warping L2 time',
@@ -1,10 +0,0 @@
1
- import { type InitialAccountData } from '@aztec/accounts/testing';
2
- import type { Wallet } from '@aztec/aztec.js/wallet';
3
- import type { LogFn } from '@aztec/foundation/log';
4
- import { AztecAddress } from '@aztec/stdlib/aztec-address';
5
- export declare function getBananaCoinAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
6
- export declare function getBananaFPCAddress(initialAccounts: InitialAccountData[]): Promise<AztecAddress>;
7
- export declare function setupBananaFPC(initialAccounts: InitialAccountData[], wallet: Wallet, log: LogFn): Promise<void>;
8
- export declare function registerDeployedBananaCoinInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
9
- export declare function registerDeployedBananaFPCInWalletAndGetAddress(wallet: Wallet): Promise<AztecAddress>;
10
- //# sourceMappingURL=banana_fpc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"banana_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/banana_fpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAA8B,MAAM,yBAAyB,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAwB3D,wBAAsB,oBAAoB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE/E;AAWD,wBAAsB,mBAAmB,CAAC,eAAe,EAAE,kBAAkB,EAAE,yBAE9E;AAED,wBAAsB,cAAc,CAAC,eAAe,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,iBAcrG;AAED,wBAAsB,+CAA+C,CAAC,MAAM,EAAE,MAAM,yBAMnF;AAED,wBAAsB,8CAA8C,CAAC,MAAM,EAAE,MAAM,yBAMlF"}
@@ -1,4 +0,0 @@
1
- export * from './sandbox.js';
2
- export { registerDeployedBananaCoinInWalletAndGetAddress, registerDeployedBananaFPCInWalletAndGetAddress, } from './banana_fpc.js';
3
- export { registerDeployedSponsoredFPCInWalletAndGetAddress } from './sponsored_fpc.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,+CAA+C,EAC/C,8CAA8C,GAC/C,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iDAAiD,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../../src/sandbox/sandbox.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,eAAe,EAAE,gBAAgB,EAAoB,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAY7F,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,KAAK,EAAgB,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAoB,MAAM,yBAAyB,CAAC;AAGzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAA2D,MAAM,MAAM,CAAC;AAcvH;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,SAAS,GAAG,iBAAiB,EACxC,oBAAoB,yCAAS,EAC7B,IAAI,GAAE;IACJ,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB,CAAC,EAAE,EAAE,CAAC;IACxB,4BAA4B,CAAC,EAAE,MAAM,CAAC;CAClC;;;;;;;;;;;;;;;;;;;;;;;GAkCP;AAED,wBAAwB;AACxB,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG;IAC5C,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,wBAAwB,EAAE,MAAM,CAAC;IACjC,uDAAuD;IACvD,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,YAAK,EAAE,OAAO,EAAE,KAAK;;;GAgHtF;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,MAAM,GAAE,OAAO,CAAC,eAAe,CAAM,EACrC,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,eAAe,CAAC;IAAC,cAAc,CAAC,EAAE,uBAAuB,CAAC;IAAC,YAAY,CAAC,EAAE,YAAY,CAAA;CAAO,EACjH,OAAO,GAAE;IAAE,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAA;CAAO,6BAW7D"}
@@ -1,4 +0,0 @@
1
- import type { Wallet } from '@aztec/aztec.js/wallet';
2
- export declare function getSponsoredFPCAddress(): Promise<import("@aztec/aztec.js/addresses").AztecAddress>;
3
- export declare function registerDeployedSponsoredFPCInWalletAndGetAddress(wallet: Wallet): Promise<import("@aztec/aztec.js/addresses").AztecAddress>;
4
- //# sourceMappingURL=sponsored_fpc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sponsored_fpc.d.ts","sourceRoot":"","sources":["../../src/sandbox/sponsored_fpc.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAUrD,wBAAsB,sBAAsB,8DAE3C;AAED,wBAAsB,iDAAiD,CAAC,MAAM,EAAE,MAAM,6DAKrF"}