@aztec/aztec 0.0.1-commit.5914bae → 0.0.1-commit.59a0419c6

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 (58) hide show
  1. package/dest/cli/aztec_start_action.d.ts +1 -1
  2. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  3. package/dest/cli/aztec_start_action.js +2 -3
  4. package/dest/cli/aztec_start_options.d.ts +2 -2
  5. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  6. package/dest/cli/aztec_start_options.js +7 -1
  7. package/dest/cli/cmds/compile.d.ts +1 -1
  8. package/dest/cli/cmds/compile.d.ts.map +1 -1
  9. package/dest/cli/cmds/compile.js +1 -14
  10. package/dest/cli/cmds/standby.d.ts +1 -1
  11. package/dest/cli/cmds/standby.js +2 -2
  12. package/dest/cli/cmds/start_archiver.d.ts +2 -2
  13. package/dest/cli/cmds/start_archiver.d.ts.map +1 -1
  14. package/dest/cli/cmds/start_archiver.js +4 -2
  15. package/dest/cli/cmds/start_node.d.ts +1 -1
  16. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  17. package/dest/cli/cmds/start_node.js +3 -5
  18. package/dest/cli/cmds/start_txe.d.ts +2 -2
  19. package/dest/cli/cmds/start_txe.d.ts.map +1 -1
  20. package/dest/cli/cmds/start_txe.js +4 -3
  21. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +2 -2
  22. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -1
  23. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +33 -12
  24. package/dest/cli/util.js +3 -3
  25. package/dest/local-network/local-network.d.ts +3 -4
  26. package/dest/local-network/local-network.d.ts.map +1 -1
  27. package/dest/local-network/local-network.js +3 -3
  28. package/dest/testing/anvil_test_watcher.d.ts +7 -3
  29. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  30. package/dest/testing/anvil_test_watcher.js +4 -4
  31. package/dest/testing/index.d.ts +2 -2
  32. package/dest/testing/index.d.ts.map +1 -1
  33. package/package.json +33 -34
  34. package/scripts/add_crate.sh +8 -58
  35. package/scripts/aztec.sh +6 -3
  36. package/scripts/init.sh +5 -5
  37. package/scripts/new.sh +2 -2
  38. package/scripts/setup_workspace.sh +3 -2
  39. package/scripts/templates/blank/contract/Nargo.toml +6 -0
  40. package/scripts/templates/blank/contract/src/main.nr +10 -0
  41. package/scripts/templates/blank/test/Nargo.toml +7 -0
  42. package/scripts/templates/blank/test/src/lib.nr +11 -0
  43. package/scripts/templates/counter/contract/Nargo.toml +7 -0
  44. package/scripts/templates/counter/contract/src/main.nr +48 -0
  45. package/scripts/templates/counter/test/Nargo.toml +7 -0
  46. package/scripts/templates/counter/test/src/lib.nr +32 -0
  47. package/src/cli/aztec_start_action.ts +2 -3
  48. package/src/cli/aztec_start_options.ts +13 -3
  49. package/src/cli/cmds/compile.ts +1 -17
  50. package/src/cli/cmds/standby.ts +2 -2
  51. package/src/cli/cmds/start_archiver.ts +8 -2
  52. package/src/cli/cmds/start_node.ts +2 -4
  53. package/src/cli/cmds/start_txe.ts +5 -3
  54. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +35 -12
  55. package/src/cli/util.ts +2 -2
  56. package/src/local-network/local-network.ts +5 -5
  57. package/src/testing/anvil_test_watcher.ts +11 -3
  58. package/src/testing/index.ts +1 -1
@@ -7,7 +7,25 @@ import { join } from 'path';
7
7
 
8
8
  import { collectCrateDirs } from './collect_crate_dirs.js';
9
9
 
10
- /** Warns if the `aztec` dependency tag in any crate's Nargo.toml doesn't match the CLI version. */
10
+ /** Returns true if the given git URL points to the AztecProtocol/aztec-nr repository. */
11
+ function isAztecNrGitUrl(gitUrl: string): boolean {
12
+ let url: URL;
13
+ try {
14
+ url = new URL(gitUrl);
15
+ } catch {
16
+ return false;
17
+ }
18
+ if (url.hostname !== 'github.com') {
19
+ return false;
20
+ }
21
+ const repoPath = url.pathname
22
+ .replace(/^\//, '')
23
+ .replace(/\.git$/, '')
24
+ .replace(/\/$/, '');
25
+ return repoPath === 'AztecProtocol/aztec-nr';
26
+ }
27
+
28
+ /** Warns if any aztec-nr git dependency in a crate's Nargo.toml has a tag that doesn't match the CLI version. */
11
29
  export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string): Promise<void> {
12
30
  const version = cliVersion ?? getPackageVersion();
13
31
  if (!version) {
@@ -16,7 +34,7 @@ export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string
16
34
  }
17
35
 
18
36
  const expectedTag = `v${version}`;
19
- const mismatches: { file: string; tag: string }[] = [];
37
+ const mismatches: { file: string; depName: string; tag: string }[] = [];
20
38
 
21
39
  const crateDirs = await collectCrateDirs('.', { skipGitDeps: true });
22
40
 
@@ -30,23 +48,28 @@ export async function warnIfAztecVersionMismatch(log: LogFn, cliVersion?: string
30
48
  }
31
49
 
32
50
  const parsed = TOML.parse(content) as Record<string, any>;
33
- const aztecDep = (parsed.dependencies as Record<string, any>)?.aztec;
34
- if (!aztecDep || typeof aztecDep !== 'object' || typeof aztecDep.tag !== 'string') {
35
- // If a dep called "aztec" doesn't exist or it does not get parsed to an object or it doesn't have a tag defined
36
- // we skip the check.
37
- continue;
38
- }
51
+ const deps = (parsed.dependencies as Record<string, any>) ?? {};
39
52
 
40
- if (aztecDep.tag !== expectedTag) {
41
- mismatches.push({ file: tomlPath, tag: aztecDep.tag });
53
+ for (const [depName, dep] of Object.entries(deps)) {
54
+ // Skip non-object deps (e.g. malformed entries) and anything that isn't a tagged git dep.
55
+ if (!dep || typeof dep !== 'object' || typeof dep.git !== 'string' || typeof dep.tag !== 'string') {
56
+ continue;
57
+ }
58
+ // Only flag deps that are sourced from the aztec-nr repo.
59
+ if (!isAztecNrGitUrl(dep.git)) {
60
+ continue;
61
+ }
62
+ if (dep.tag !== expectedTag) {
63
+ mismatches.push({ file: tomlPath, depName, tag: dep.tag });
64
+ }
42
65
  }
43
66
  }
44
67
 
45
68
  if (mismatches.length > 0) {
46
- const details = mismatches.map(m => ` ${m.file} (${m.tag})`).join('\n');
69
+ const details = mismatches.map(m => ` ${m.file} — ${m.depName} (${m.tag})`).join('\n');
47
70
  log(
48
71
  `WARNING: Aztec dependency version mismatch detected.\n` +
49
- `The following crates have an aztec dependency that does not match the CLI version (${expectedTag}):\n` +
72
+ `The following aztec-nr dependencies do not match the CLI version (${expectedTag}):\n` +
50
73
  `${details}\n\n` +
51
74
  `See https://docs.aztec.network/errors/9 for how to update your dependencies.`,
52
75
  );
package/src/cli/util.ts CHANGED
@@ -272,7 +272,7 @@ export async function preloadCrsDataForVerifying(
272
272
  ): Promise<void> {
273
273
  if (realProofs) {
274
274
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
275
- await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16 + 1, undefined, log)]);
275
+ await Promise.all([Crs.new(2 ** 1, undefined, log), GrumpkinCrs.new(2 ** 16, undefined, log)]);
276
276
  }
277
277
  }
278
278
 
@@ -287,7 +287,7 @@ export async function preloadCrsDataForServerSideProving(
287
287
  ): Promise<void> {
288
288
  if (realProofs) {
289
289
  const { Crs, GrumpkinCrs } = await import('@aztec/bb.js');
290
- await Promise.all([Crs.new(2 ** 25 + 1, undefined, log), GrumpkinCrs.new(2 ** 18 + 1, undefined, log)]);
290
+ await Promise.all([Crs.new(2 ** 25, undefined, log), GrumpkinCrs.new(2 ** 18, undefined, log)]);
291
291
  }
292
292
  }
293
293
 
@@ -21,7 +21,7 @@ import { protocolContractsHash } from '@aztec/protocol-contracts';
21
21
  import { SequencerState } from '@aztec/sequencer-client';
22
22
  import { AztecAddress } from '@aztec/stdlib/aztec-address';
23
23
  import type { ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
24
- import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
24
+ import type { GenesisData } from '@aztec/stdlib/world-state';
25
25
  import {
26
26
  type TelemetryClient,
27
27
  getConfigEnvVars as getTelemetryClientConfig,
@@ -70,7 +70,7 @@ export async function deployContractsToL1(
70
70
  genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
71
71
  feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
72
72
  aztecTargetCommitteeSize: 0, // no committee in local network
73
- slasherFlavor: 'none', // no slashing in local network
73
+ slasherEnabled: false, // no slashing in local network
74
74
  realVerifier: false,
75
75
  });
76
76
 
@@ -151,7 +151,7 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
151
151
  ...(initialAccounts.length ? [bananaFPC, sponsoredFPC] : []),
152
152
  ...prefundAddresses,
153
153
  ];
154
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
154
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses);
155
155
 
156
156
  const dateProvider = new TestDateProvider();
157
157
 
@@ -190,7 +190,7 @@ export async function createLocalNetwork(config: Partial<LocalNetworkConfig> = {
190
190
  const telemetry = await initTelemetryClient(getTelemetryClientConfig());
191
191
  // Create a local blob client client inside the local network, no http connectivity
192
192
  const blobClient = createBlobClient();
193
- const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, { prefilledPublicData });
193
+ const node = await createAztecNode(aztecNodeConfig, { telemetry, blobClient, dateProvider }, { genesis });
194
194
 
195
195
  // Now that the node is up, let the watcher check for pending txs so it can skip unfilled slots faster when
196
196
  // transactions are waiting in the mempool. Also let it check if the sequencer is actively building, to avoid
@@ -259,7 +259,7 @@ export async function createAztecNode(
259
259
  dateProvider?: DateProvider;
260
260
  proverBroker?: ProvingJobBroker;
261
261
  } = {},
262
- options: { prefilledPublicData?: PublicDataTreeLeaf[] } = {},
262
+ options: { genesis?: GenesisData } = {},
263
263
  ) {
264
264
  // TODO(#12272): will clean this up. This is criminal.
265
265
  const { l1Contracts, ...rest } = getConfigEnvVars();
@@ -9,6 +9,11 @@ import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
9
9
 
10
10
  import { type GetContractReturnType, getAddress, getContract } from 'viem';
11
11
 
12
+ export type AnvilTestWatcherOpts = {
13
+ isLocalNetwork?: boolean;
14
+ isMarkingAsProven?: boolean;
15
+ };
16
+
12
17
  /**
13
18
  * Represents a watcher for a rollup contract.
14
19
  *
@@ -17,7 +22,8 @@ import { type GetContractReturnType, getAddress, getContract } from 'viem';
17
22
  * block within the slot. And if so, it will time travel into the next slot.
18
23
  */
19
24
  export class AnvilTestWatcher {
20
- private isLocalNetwork: boolean = false;
25
+ private isLocalNetwork;
26
+ private isMarkingAsProven;
21
27
 
22
28
  private rollup: GetContractReturnType<typeof RollupAbi, ViemClient>;
23
29
  private rollupCheatCodes: RollupCheatCodes;
@@ -29,8 +35,6 @@ export class AnvilTestWatcher {
29
35
 
30
36
  private logger: Logger = createLogger(`aztecjs:utils:watcher`);
31
37
 
32
- private isMarkingAsProven = true;
33
-
34
38
  // Optional callback to check if there are pending txs in the mempool.
35
39
  private getPendingTxCount?: () => Promise<number>;
36
40
 
@@ -45,6 +49,7 @@ export class AnvilTestWatcher {
45
49
  rollupAddress: EthAddress,
46
50
  l1Client: ViemClient,
47
51
  private dateProvider?: TestDateProvider,
52
+ opts: AnvilTestWatcherOpts = {},
48
53
  ) {
49
54
  this.rollup = getContract({
50
55
  address: getAddress(rollupAddress.toString()),
@@ -56,6 +61,9 @@ export class AnvilTestWatcher {
56
61
  rollupAddress,
57
62
  });
58
63
 
64
+ this.isLocalNetwork = opts.isLocalNetwork ?? false;
65
+ this.isMarkingAsProven = opts.isMarkingAsProven ?? true;
66
+
59
67
  this.logger.debug(`Watcher created for rollup at ${rollupAddress}`);
60
68
  }
61
69
 
@@ -1,4 +1,4 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
1
+ export { AnvilTestWatcher, type AnvilTestWatcherOpts } from './anvil_test_watcher.js';
2
2
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
3
  export { CheatCodes } from './cheat_codes.js';
4
4
  export { EpochTestSettler } from './epoch_test_settler.js';