@aztec/aztec 0.0.1-commit.f2ce05ee → 0.0.1-commit.f81dbcf

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 (103) hide show
  1. package/dest/bin/index.js +7 -3
  2. package/dest/cli/admin_api_key_store.d.ts +45 -0
  3. package/dest/cli/admin_api_key_store.d.ts.map +1 -0
  4. package/dest/cli/admin_api_key_store.js +98 -0
  5. package/dest/cli/aztec_start_action.d.ts +1 -1
  6. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  7. package/dest/cli/aztec_start_action.js +56 -15
  8. package/dest/cli/aztec_start_options.d.ts +1 -1
  9. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  10. package/dest/cli/aztec_start_options.js +24 -8
  11. package/dest/cli/cli.d.ts +1 -1
  12. package/dest/cli/cli.d.ts.map +1 -1
  13. package/dest/cli/cli.js +0 -1
  14. package/dest/cli/cmds/compile.d.ts +4 -0
  15. package/dest/cli/cmds/compile.d.ts.map +1 -0
  16. package/dest/cli/cmds/compile.js +68 -0
  17. package/dest/cli/cmds/profile.d.ts +4 -0
  18. package/dest/cli/cmds/profile.d.ts.map +1 -0
  19. package/dest/cli/cmds/profile.js +8 -0
  20. package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
  21. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
  22. package/dest/cli/cmds/profile_flamegraph.js +51 -0
  23. package/dest/cli/cmds/profile_gates.d.ts +4 -0
  24. package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
  25. package/dest/cli/cmds/profile_gates.js +57 -0
  26. package/dest/cli/cmds/profile_utils.d.ts +18 -0
  27. package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
  28. package/dest/cli/cmds/profile_utils.js +50 -0
  29. package/dest/cli/cmds/standby.d.ts +32 -0
  30. package/dest/cli/cmds/standby.d.ts.map +1 -0
  31. package/dest/cli/cmds/standby.js +97 -0
  32. package/dest/cli/cmds/start_bot.d.ts +3 -3
  33. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  34. package/dest/cli/cmds/start_bot.js +9 -5
  35. package/dest/cli/cmds/start_node.d.ts +3 -2
  36. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  37. package/dest/cli/cmds/start_node.js +83 -27
  38. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  39. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  40. package/dest/cli/cmds/start_prover_broker.js +12 -6
  41. package/dest/cli/cmds/utils/artifacts.d.ts +21 -0
  42. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
  43. package/dest/cli/cmds/utils/artifacts.js +24 -0
  44. package/dest/cli/cmds/utils/spawn.d.ts +3 -0
  45. package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
  46. package/dest/cli/cmds/utils/spawn.js +16 -0
  47. package/dest/cli/util.d.ts +7 -18
  48. package/dest/cli/util.d.ts.map +1 -1
  49. package/dest/cli/util.js +47 -83
  50. package/dest/examples/token.js +6 -6
  51. package/dest/local-network/banana_fpc.js +1 -1
  52. package/dest/local-network/local-network.d.ts +3 -1
  53. package/dest/local-network/local-network.d.ts.map +1 -1
  54. package/dest/local-network/local-network.js +50 -18
  55. package/dest/testing/anvil_test_watcher.d.ts +9 -1
  56. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  57. package/dest/testing/anvil_test_watcher.js +52 -15
  58. package/dest/testing/epoch_test_settler.d.ts +1 -1
  59. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  60. package/dest/testing/epoch_test_settler.js +3 -4
  61. package/dest/testing/index.d.ts +2 -1
  62. package/dest/testing/index.d.ts.map +1 -1
  63. package/dest/testing/index.js +1 -0
  64. package/dest/testing/token_allowed_setup.d.ts +7 -0
  65. package/dest/testing/token_allowed_setup.d.ts.map +1 -0
  66. package/dest/testing/token_allowed_setup.js +20 -0
  67. package/package.json +34 -34
  68. package/scripts/aztec.sh +7 -3
  69. package/src/bin/index.ts +7 -3
  70. package/src/cli/admin_api_key_store.ts +128 -0
  71. package/src/cli/aztec_start_action.ts +58 -11
  72. package/src/cli/aztec_start_options.ts +26 -7
  73. package/src/cli/cli.ts +0 -1
  74. package/src/cli/cmds/compile.ts +80 -0
  75. package/src/cli/cmds/profile.ts +25 -0
  76. package/src/cli/cmds/profile_flamegraph.ts +63 -0
  77. package/src/cli/cmds/profile_gates.ts +67 -0
  78. package/src/cli/cmds/profile_utils.ts +58 -0
  79. package/src/cli/cmds/standby.ts +132 -0
  80. package/src/cli/cmds/start_bot.ts +8 -5
  81. package/src/cli/cmds/start_node.ts +83 -33
  82. package/src/cli/cmds/start_prover_broker.ts +14 -14
  83. package/src/cli/cmds/utils/artifacts.ts +44 -0
  84. package/src/cli/cmds/utils/spawn.ts +16 -0
  85. package/src/cli/util.ts +55 -93
  86. package/src/examples/token.ts +8 -6
  87. package/src/local-network/banana_fpc.ts +1 -1
  88. package/src/local-network/local-network.ts +54 -17
  89. package/src/testing/anvil_test_watcher.ts +59 -15
  90. package/src/testing/epoch_test_settler.ts +3 -4
  91. package/src/testing/index.ts +1 -0
  92. package/src/testing/token_allowed_setup.ts +19 -0
  93. package/dest/cli/cmds/start_prover_node.d.ts +0 -7
  94. package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
  95. package/dest/cli/cmds/start_prover_node.js +0 -108
  96. package/dest/cli/release_version.d.ts +0 -2
  97. package/dest/cli/release_version.d.ts.map +0 -1
  98. package/dest/cli/release_version.js +0 -14
  99. package/scripts/compile.sh +0 -44
  100. package/scripts/extract_function.js +0 -47
  101. package/scripts/flamegraph.sh +0 -59
  102. package/src/cli/cmds/start_prover_node.ts +0 -124
  103. package/src/cli/release_version.ts +0 -21
@@ -1,7 +1,7 @@
1
1
  import { RollupCheatCodes } from '@aztec/ethereum/test';
2
2
  import { SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { EpochMonitor } from '@aztec/prover-node';
4
- import { computeL2ToL1MembershipWitnessFromMessagesInEpoch } from '@aztec/stdlib/messaging';
4
+ import { computeEpochOutHash } from '@aztec/stdlib/messaging';
5
5
  export class EpochTestSettler {
6
6
  l2BlockSource;
7
7
  log;
@@ -44,9 +44,8 @@ export class EpochTestSettler {
44
44
  }
45
45
  messagesInEpoch[checkpointIndex].push(block.body.txEffects.map((txEffect)=>txEffect.l2ToL1Msgs));
46
46
  }
47
- const [firstMessage] = messagesInEpoch.flat(3);
48
- if (firstMessage) {
49
- const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
47
+ const outHash = computeEpochOutHash(messagesInEpoch);
48
+ if (!outHash.isZero()) {
50
49
  await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
51
50
  } else {
52
51
  this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
@@ -2,4 +2,5 @@ export { AnvilTestWatcher } 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';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUMifQ==
5
+ export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sMEJBQTBCLENBQUMifQ==
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
@@ -2,3 +2,4 @@ export { AnvilTestWatcher } 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';
5
+ export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
@@ -0,0 +1,7 @@
1
+ import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
2
+ /**
3
+ * Returns Token-specific allowlist entries needed for FPC-based fee payments.
4
+ * These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
5
+ */
6
+ export declare function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]>;
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9rZW5fYWxsb3dlZF9zZXR1cC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvdG9rZW5fYWxsb3dlZF9zZXR1cC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHQSxPQUFPLEtBQUssRUFBRSxjQUFjLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUV0RTs7O0dBR0c7QUFDSCx3QkFBc0IsNkJBQTZCLElBQUksT0FBTyxDQUFDLGNBQWMsRUFBRSxDQUFDLENBUy9FIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token_allowed_setup.d.ts","sourceRoot":"","sources":["../../src/testing/token_allowed_setup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;GAGG;AACH,wBAAsB,6BAA6B,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAS/E"}
@@ -0,0 +1,20 @@
1
+ import { TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
2
+ import { buildAllowedElement } from '@aztec/p2p/msg_validators';
3
+ import { getContractClassFromArtifact } from '@aztec/stdlib/contract';
4
+ /**
5
+ * Returns Token-specific allowlist entries needed for FPC-based fee payments.
6
+ * These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
7
+ */ export async function getTokenAllowedSetupFunctions() {
8
+ const tokenClassId = (await getContractClassFromArtifact(TokenContractArtifact)).id;
9
+ const target = {
10
+ classId: tokenClassId
11
+ };
12
+ return Promise.all([
13
+ // Token: needed for private transfers via FPC (transfer_to_public enqueues this)
14
+ buildAllowedElement(TokenContractArtifact, target, '_increase_public_balance', {
15
+ onlySelf: true
16
+ }),
17
+ // Token: needed for public transfers via FPC (fee_entrypoint_public enqueues this)
18
+ buildAllowedElement(TokenContractArtifact, target, 'transfer_in_public')
19
+ ]);
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/aztec",
3
- "version": "0.0.1-commit.f2ce05ee",
3
+ "version": "0.0.1-commit.f81dbcf",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -28,39 +28,39 @@
28
28
  "../package.common.json"
29
29
  ],
30
30
  "dependencies": {
31
- "@aztec/accounts": "0.0.1-commit.f2ce05ee",
32
- "@aztec/archiver": "0.0.1-commit.f2ce05ee",
33
- "@aztec/aztec-faucet": "0.0.1-commit.f2ce05ee",
34
- "@aztec/aztec-node": "0.0.1-commit.f2ce05ee",
35
- "@aztec/aztec.js": "0.0.1-commit.f2ce05ee",
36
- "@aztec/bb-prover": "0.0.1-commit.f2ce05ee",
37
- "@aztec/bb.js": "0.0.1-commit.f2ce05ee",
38
- "@aztec/blob-client": "0.0.1-commit.f2ce05ee",
39
- "@aztec/bot": "0.0.1-commit.f2ce05ee",
40
- "@aztec/builder": "0.0.1-commit.f2ce05ee",
41
- "@aztec/cli": "0.0.1-commit.f2ce05ee",
42
- "@aztec/constants": "0.0.1-commit.f2ce05ee",
43
- "@aztec/entrypoints": "0.0.1-commit.f2ce05ee",
44
- "@aztec/ethereum": "0.0.1-commit.f2ce05ee",
45
- "@aztec/foundation": "0.0.1-commit.f2ce05ee",
46
- "@aztec/kv-store": "0.0.1-commit.f2ce05ee",
47
- "@aztec/l1-artifacts": "0.0.1-commit.f2ce05ee",
48
- "@aztec/node-lib": "0.0.1-commit.f2ce05ee",
49
- "@aztec/noir-contracts.js": "0.0.1-commit.f2ce05ee",
50
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f2ce05ee",
51
- "@aztec/p2p": "0.0.1-commit.f2ce05ee",
52
- "@aztec/p2p-bootstrap": "0.0.1-commit.f2ce05ee",
53
- "@aztec/protocol-contracts": "0.0.1-commit.f2ce05ee",
54
- "@aztec/prover-client": "0.0.1-commit.f2ce05ee",
55
- "@aztec/prover-node": "0.0.1-commit.f2ce05ee",
56
- "@aztec/pxe": "0.0.1-commit.f2ce05ee",
57
- "@aztec/sequencer-client": "0.0.1-commit.f2ce05ee",
58
- "@aztec/stdlib": "0.0.1-commit.f2ce05ee",
59
- "@aztec/telemetry-client": "0.0.1-commit.f2ce05ee",
60
- "@aztec/test-wallet": "0.0.1-commit.f2ce05ee",
61
- "@aztec/txe": "0.0.1-commit.f2ce05ee",
62
- "@aztec/validator-ha-signer": "0.0.1-commit.f2ce05ee",
63
- "@aztec/world-state": "0.0.1-commit.f2ce05ee",
31
+ "@aztec/accounts": "0.0.1-commit.f81dbcf",
32
+ "@aztec/archiver": "0.0.1-commit.f81dbcf",
33
+ "@aztec/aztec-faucet": "0.0.1-commit.f81dbcf",
34
+ "@aztec/aztec-node": "0.0.1-commit.f81dbcf",
35
+ "@aztec/aztec.js": "0.0.1-commit.f81dbcf",
36
+ "@aztec/bb-prover": "0.0.1-commit.f81dbcf",
37
+ "@aztec/bb.js": "0.0.1-commit.f81dbcf",
38
+ "@aztec/blob-client": "0.0.1-commit.f81dbcf",
39
+ "@aztec/bot": "0.0.1-commit.f81dbcf",
40
+ "@aztec/builder": "0.0.1-commit.f81dbcf",
41
+ "@aztec/cli": "0.0.1-commit.f81dbcf",
42
+ "@aztec/constants": "0.0.1-commit.f81dbcf",
43
+ "@aztec/entrypoints": "0.0.1-commit.f81dbcf",
44
+ "@aztec/ethereum": "0.0.1-commit.f81dbcf",
45
+ "@aztec/foundation": "0.0.1-commit.f81dbcf",
46
+ "@aztec/kv-store": "0.0.1-commit.f81dbcf",
47
+ "@aztec/l1-artifacts": "0.0.1-commit.f81dbcf",
48
+ "@aztec/node-lib": "0.0.1-commit.f81dbcf",
49
+ "@aztec/noir-contracts.js": "0.0.1-commit.f81dbcf",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.f81dbcf",
51
+ "@aztec/p2p": "0.0.1-commit.f81dbcf",
52
+ "@aztec/p2p-bootstrap": "0.0.1-commit.f81dbcf",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.f81dbcf",
54
+ "@aztec/prover-client": "0.0.1-commit.f81dbcf",
55
+ "@aztec/prover-node": "0.0.1-commit.f81dbcf",
56
+ "@aztec/pxe": "0.0.1-commit.f81dbcf",
57
+ "@aztec/sequencer-client": "0.0.1-commit.f81dbcf",
58
+ "@aztec/stdlib": "0.0.1-commit.f81dbcf",
59
+ "@aztec/telemetry-client": "0.0.1-commit.f81dbcf",
60
+ "@aztec/txe": "0.0.1-commit.f81dbcf",
61
+ "@aztec/validator-ha-signer": "0.0.1-commit.f81dbcf",
62
+ "@aztec/wallets": "0.0.1-commit.f81dbcf",
63
+ "@aztec/world-state": "0.0.1-commit.f81dbcf",
64
64
  "@types/chalk": "^2.2.0",
65
65
  "abitype": "^0.8.11",
66
66
  "chalk": "^5.3.0",
package/scripts/aztec.sh CHANGED
@@ -21,13 +21,13 @@ function aztec {
21
21
 
22
22
  case $cmd in
23
23
  test)
24
- export LOG_LEVEL="${LOG_LEVEL:-error}"
24
+ export LOG_LEVEL="${LOG_LEVEL:-"error;trace:contract_log"}"
25
25
  aztec start --txe --port 8081 &
26
26
  server_pid=$!
27
27
  trap 'kill $server_pid &>/dev/null || true' EXIT
28
28
  while ! nc -z 127.0.0.1 8081 &>/dev/null; do sleep 0.2; done
29
29
  export NARGO_FOREIGN_CALL_TIMEOUT=300000
30
- nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081 "$@"
30
+ nargo test --silence-warnings --oracle-resolver http://127.0.0.1:8081 --test-threads 16 "$@"
31
31
  ;;
32
32
  start)
33
33
  if [ "${1:-}" == "--local-network" ]; then
@@ -54,9 +54,13 @@ case $cmd in
54
54
 
55
55
  aztec start "$@"
56
56
  ;;
57
- compile|new|init|flamegraph)
57
+ new|init)
58
58
  $script_dir/${cmd}.sh "$@"
59
59
  ;;
60
+ flamegraph)
61
+ echo "Warning: 'aztec flamegraph' is deprecated. Use 'aztec profile flamegraph' instead." >&2
62
+ aztec profile flamegraph "$@"
63
+ ;;
60
64
  *)
61
65
  aztec $cmd "$@"
62
66
  ;;
package/src/bin/index.ts CHANGED
@@ -11,12 +11,14 @@ import { injectCommands as injectMiscCommands } from '@aztec/cli/misc';
11
11
  import { injectCommands as injectValidatorKeysCommands } from '@aztec/cli/validator_keys';
12
12
  import { getActiveNetworkName } from '@aztec/foundation/config';
13
13
  import { createConsoleLogger, createLogger } from '@aztec/foundation/log';
14
+ import { getPackageVersion } from '@aztec/stdlib/update-checker';
14
15
 
15
16
  import { Command } from 'commander';
16
17
 
18
+ import { injectCompileCommand } from '../cli/cmds/compile.js';
17
19
  import { injectMigrateCommand } from '../cli/cmds/migrate_ha_db.js';
20
+ import { injectProfileCommand } from '../cli/cmds/profile.js';
18
21
  import { injectAztecCommands } from '../cli/index.js';
19
- import { getCliVersion } from '../cli/release_version.js';
20
22
 
21
23
  const NETWORK_FLAG = 'network';
22
24
 
@@ -45,9 +47,9 @@ async function main() {
45
47
  await enrichEnvironmentWithNetworkConfig(networkName);
46
48
  enrichEnvironmentWithChainName(networkName);
47
49
 
48
- const cliVersion = getCliVersion();
50
+ const cliVersion = getPackageVersion() ?? 'unknown';
49
51
  let program = new Command('aztec');
50
- program.description('Aztec command line interface').version(cliVersion);
52
+ program.description('Aztec command line interface').version(cliVersion).enablePositionalOptions();
51
53
  program = injectAztecCommands(program, userLog, debugLogger);
52
54
  program = injectBuilderCommands(program);
53
55
  program = injectContractCommands(program, userLog, debugLogger);
@@ -56,6 +58,8 @@ async function main() {
56
58
  program = injectAztecNodeCommands(program, userLog, debugLogger);
57
59
  program = injectMiscCommands(program, userLog);
58
60
  program = injectValidatorKeysCommands(program, userLog);
61
+ program = injectCompileCommand(program, userLog);
62
+ program = injectProfileCommand(program, userLog);
59
63
  program = injectMigrateCommand(program, userLog);
60
64
 
61
65
  await program.parseAsync(process.argv);
@@ -0,0 +1,128 @@
1
+ import { randomBytes } from '@aztec/foundation/crypto/random';
2
+ import { sha256Hash } from '@aztec/foundation/json-rpc/server';
3
+ import type { Logger } from '@aztec/foundation/log';
4
+
5
+ import { promises as fs } from 'fs';
6
+ import { join } from 'path';
7
+
8
+ /** Subdirectory under dataDirectory for admin API key storage. */
9
+ const ADMIN_STORE_DIR = 'admin';
10
+ const HASH_FILE_NAME = 'api_key_hash';
11
+
12
+ /**
13
+ * Result of resolving the admin API key.
14
+ * Contains the SHA-256 hex hash of the API key to be used by the auth middleware,
15
+ * and optionally the raw key when newly generated (so the caller can display it).
16
+ */
17
+ export interface AdminApiKeyResolution {
18
+ /** The SHA-256 hash of the API key. */
19
+ apiKeyHash: Buffer;
20
+ /**
21
+ * The raw API key, only present when a new key was generated during this call.
22
+ * The caller MUST display this to the operator — it will not be stored or returned again.
23
+ */
24
+ rawKey?: string;
25
+ }
26
+
27
+ export interface ResolveAdminApiKeyOptions {
28
+ /** SHA-256 hex hash of a pre-generated API key. When set, the node uses this hash directly. */
29
+ adminApiKeyHash?: string;
30
+ /** If true, disable admin API key auth entirely. */
31
+ disableAdminApiKey?: boolean;
32
+ /** If true, force-generate a new key even if one is already persisted. */
33
+ resetAdminApiKey?: boolean;
34
+ /** Root data directory for persistent storage. */
35
+ dataDirectory?: string;
36
+ }
37
+
38
+ /**
39
+ * Resolves the admin API key for the admin RPC endpoint.
40
+ *
41
+ * Strategy:
42
+ * 1. If opt-out flag is set (`disableAdminApiKey`), return undefined (no auth).
43
+ * 2. If a pre-generated hash is provided (`adminApiKeyHash`), use it directly.
44
+ * 3. If a data directory exists, look for a persisted hash file
45
+ * at `<dataDirectory>/admin/api_key_hash`:
46
+ * - If `resetAdminApiKey` is set, skip loading and force-generate a new key.
47
+ * - Found: use the stored hash (operator already saved the key from first run).
48
+ * - Not found: auto-generate a random key, display it once, persist the hash.
49
+ * 3. If no data directory: generate a random key
50
+ * each run and display it (cannot persist).
51
+ *
52
+ * @param options - The options for resolving the admin API key.
53
+ * @param log - Logger for outputting the key and status messages.
54
+ * @returns The resolved API key hash, or undefined if auth is disabled.
55
+ */
56
+ export async function resolveAdminApiKey(
57
+ options: ResolveAdminApiKeyOptions,
58
+ log: Logger,
59
+ ): Promise<AdminApiKeyResolution | undefined> {
60
+ // Operator explicitly opted out of admin auth
61
+ if (options.disableAdminApiKey) {
62
+ log.warn('Admin API key authentication is DISABLED (--disable-admin-api-key / AZTEC_DISABLE_ADMIN_API_KEY)');
63
+ return undefined;
64
+ }
65
+
66
+ // Operator provided a pre-generated hash (e.g. via AZTEC_ADMIN_API_KEY_HASH env var)
67
+ if (options.adminApiKeyHash) {
68
+ const hex = options.adminApiKeyHash.trim();
69
+ if (hex.length !== 64 || !/^[0-9a-f]{64}$/.test(hex)) {
70
+ throw new Error(`Invalid admin API key hash: expected 64-char hex string, got "${hex}"`);
71
+ }
72
+ log.info('Admin API key authentication enabled (using pre-configured key hash)');
73
+ return { apiKeyHash: Buffer.from(hex, 'hex') };
74
+ }
75
+
76
+ // Persistent storage available, load or generate key
77
+ if (options.dataDirectory) {
78
+ const adminDir = join(options.dataDirectory, ADMIN_STORE_DIR);
79
+ const hashFilePath = join(adminDir, HASH_FILE_NAME);
80
+
81
+ // Unless a reset is forced, try to load the existing hash from disk
82
+ if (!options.resetAdminApiKey) {
83
+ try {
84
+ const storedHash = (await fs.readFile(hashFilePath, 'utf-8')).trim();
85
+ if (storedHash.length === 64) {
86
+ log.info('Admin API key authentication enabled (loaded stored key hash from disk)');
87
+ return { apiKeyHash: Buffer.from(storedHash, 'hex') };
88
+ }
89
+ log.warn(`Invalid stored admin API key hash at ${hashFilePath}, regenerating...`);
90
+ } catch (err: any) {
91
+ if (err.code !== 'ENOENT') {
92
+ log.warn(`Failed to read admin API key hash from ${hashFilePath}: ${err.message}`);
93
+ }
94
+ // File doesn't exist — fall through to generate
95
+ }
96
+ } else {
97
+ log.warn('Admin API key reset requested — generating a new key');
98
+ }
99
+
100
+ // Generate a new key, persist the hash, and return the raw key for the caller to display
101
+ const { rawKey, hash } = generateApiKey();
102
+ await fs.mkdir(adminDir, { recursive: true });
103
+ await fs.writeFile(hashFilePath, hash.toString('hex'), 'utf-8');
104
+ // Set restrictive permissions (owner read/write only)
105
+ await fs.chmod(hashFilePath, 0o600);
106
+
107
+ log.info('Admin API key authentication enabled (new key generated and hash persisted to disk)');
108
+ return { apiKeyHash: hash, rawKey };
109
+ }
110
+
111
+ // No data directory, generate a temporary key per session
112
+ const { rawKey, hash } = generateApiKey();
113
+
114
+ log.warn('No data directory configured — admin API key cannot be persisted.');
115
+ log.warn('A temporary key has been generated for this session only.');
116
+
117
+ return { apiKeyHash: hash, rawKey };
118
+ }
119
+
120
+ /**
121
+ * Generates a cryptographically random API key and its SHA-256 hash.
122
+ * @returns The raw key (hex string) and its SHA-256 hash as a Buffer.
123
+ */
124
+ function generateApiKey(): { rawKey: string; hash: Buffer } {
125
+ const rawKey = randomBytes(32).toString('hex');
126
+ const hash = sha256Hash(rawKey);
127
+ return { rawKey, hash };
128
+ }
@@ -1,17 +1,20 @@
1
+ import { getActiveNetworkName } from '@aztec/foundation/config';
1
2
  import {
2
3
  type NamespacedApiHandlers,
3
4
  createNamespacedSafeJsonRpcServer,
5
+ getApiKeyAuthMiddleware,
4
6
  startHttpRpcServer,
5
7
  } from '@aztec/foundation/json-rpc/server';
6
8
  import type { LogFn, Logger } from '@aztec/foundation/log';
7
9
  import type { ChainConfig } from '@aztec/stdlib/config';
8
10
  import { AztecNodeApiSchema } from '@aztec/stdlib/interfaces/client';
11
+ import { getPackageVersion } from '@aztec/stdlib/update-checker';
9
12
  import { getVersioningMiddleware } from '@aztec/stdlib/versioning';
10
13
  import { getOtelJsonRpcPropagationMiddleware } from '@aztec/telemetry-client';
11
14
 
12
15
  import { createLocalNetwork } from '../local-network/index.js';
13
16
  import { github, splash } from '../splash.js';
14
- import { getCliVersion } from './release_version.js';
17
+ import { resolveAdminApiKey } from './admin_api_key_store.js';
15
18
  import { extractNamespacedOptions, installSignalHandlers } from './util.js';
16
19
  import { getVersions } from './versioning.js';
17
20
 
@@ -20,14 +23,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
20
23
  const signalHandlers: Array<() => Promise<void>> = [];
21
24
  const services: NamespacedApiHandlers = {};
22
25
  const adminServices: NamespacedApiHandlers = {};
26
+ const packageVersion = getPackageVersion();
23
27
  let config: ChainConfig | undefined = undefined;
24
28
 
25
29
  if (options.localNetwork) {
26
- const cliVersion = getCliVersion();
27
30
  const localNetwork = extractNamespacedOptions(options, 'local-network');
28
31
  localNetwork.testAccounts = true;
29
32
  userLog(`${splash}\n${github}\n\n`);
30
- userLog(`Setting up Aztec local network ${cliVersion}, please stand by...`);
33
+ userLog(`Setting up Aztec local network ${packageVersion ?? 'unknown'}, please stand by...`);
31
34
 
32
35
  const { node, stop } = await createLocalNetwork(
33
36
  {
@@ -35,11 +38,11 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
35
38
  l1RpcUrls: options.l1RpcUrls,
36
39
  testAccounts: localNetwork.testAccounts,
37
40
  realProofs: false,
38
- // Setting the epoch duration to 4 by default for local network. This allows the epoch to be "proven" faster, so
41
+ // Setting the epoch duration to 2 by default for local network. This allows the epoch to be "proven" faster, so
39
42
  // the users can consume out hash without having to wait for a long time.
40
43
  // Note: We are not proving anything in the local network (realProofs == false). But in `createLocalNetwork`,
41
44
  // the EpochTestSettler will set the out hash to the outbox when an epoch is complete.
42
- aztecEpochDuration: 4,
45
+ aztecEpochDuration: 2,
43
46
  },
44
47
  userLog,
45
48
  );
@@ -48,15 +51,18 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
48
51
  signalHandlers.push(stop);
49
52
  services.node = [node, AztecNodeApiSchema];
50
53
  } else {
54
+ // Route --prover-node through startNode
55
+ if (options.proverNode && !options.node) {
56
+ options.node = true;
57
+ }
58
+
51
59
  if (options.node) {
52
60
  const { startNode } = await import('./cmds/start_node.js');
53
- ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog));
61
+ const networkName = getActiveNetworkName(options.network);
62
+ ({ config } = await startNode(options, signalHandlers, services, adminServices, userLog, networkName));
54
63
  } else if (options.bot) {
55
64
  const { startBot } = await import('./cmds/start_bot.js');
56
65
  await startBot(options, signalHandlers, services, userLog);
57
- } else if (options.proverNode) {
58
- const { startProverNode } = await import('./cmds/start_prover_node.js');
59
- ({ config } = await startProverNode(options, signalHandlers, services, userLog));
60
66
  } else if (options.archiver) {
61
67
  const { startArchiver } = await import('./cmds/start_archiver.js');
62
68
  ({ config } = await startArchiver(options, signalHandlers, services));
@@ -83,13 +89,14 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
83
89
 
84
90
  installSignalHandlers(debugLogger.info, signalHandlers);
85
91
  const versions = getVersions(config);
92
+ const versioningOpts = { packageVersion };
86
93
 
87
94
  // Start the main JSON-RPC server
88
95
  if (Object.entries(services).length > 0) {
89
96
  const rpcServer = createNamespacedSafeJsonRpcServer(services, {
90
97
  http200OnError: false,
91
98
  log: debugLogger,
92
- middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
99
+ middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)],
93
100
  maxBatchSize: options.rpcMaxBatchSize,
94
101
  maxBodySizeBytes: options.rpcMaxBodySize,
95
102
  });
@@ -99,14 +106,54 @@ export async function aztecStart(options: any, userLog: LogFn, debugLogger: Logg
99
106
 
100
107
  // If there are any admin services, start a separate JSON-RPC server for them
101
108
  if (Object.entries(adminServices).length > 0) {
109
+ const adminMiddlewares = [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions, versioningOpts)];
110
+
111
+ // Resolve the admin API key (auto-generated and persisted, or opt-out)
112
+ const apiKeyResolution = await resolveAdminApiKey(
113
+ {
114
+ adminApiKeyHash: options.adminApiKeyHash,
115
+ disableAdminApiKey: options.disableAdminApiKey,
116
+ resetAdminApiKey: options.resetAdminApiKey,
117
+ dataDirectory: options.dataDirectory,
118
+ },
119
+ debugLogger,
120
+ );
121
+ if (apiKeyResolution) {
122
+ adminMiddlewares.unshift(getApiKeyAuthMiddleware(apiKeyResolution.apiKeyHash));
123
+ } else {
124
+ debugLogger.warn('No admin API key set — admin endpoint is unauthenticated');
125
+ }
126
+
102
127
  const rpcServer = createNamespacedSafeJsonRpcServer(adminServices, {
103
128
  http200OnError: false,
104
129
  log: debugLogger,
105
- middlewares: [getOtelJsonRpcPropagationMiddleware(), getVersioningMiddleware(versions)],
130
+ middlewares: adminMiddlewares,
106
131
  maxBatchSize: options.rpcMaxBatchSize,
107
132
  maxBodySizeBytes: options.rpcMaxBodySize,
108
133
  });
109
134
  const { port } = await startHttpRpcServer(rpcServer, { port: options.adminPort });
110
135
  debugLogger.info(`Aztec Server admin API listening on port ${port}`, versions);
136
+
137
+ // Display the API key after the server has started
138
+ // Uses userLog which is never filtered by LOG_LEVEL.
139
+ if (apiKeyResolution?.rawKey) {
140
+ const separator = '='.repeat(70);
141
+ userLog('');
142
+ userLog(separator);
143
+ userLog(' ADMIN API KEY (save this — it will NOT be shown again)');
144
+ userLog('');
145
+ userLog(` ${apiKeyResolution.rawKey}`);
146
+ userLog('');
147
+ userLog(` Use via header: x-api-key: <key>`);
148
+ userLog(` Or via header: Authorization: Bearer <key>`);
149
+ if (options.dataDirectory) {
150
+ userLog('');
151
+ userLog(' The key hash has been persisted — on next restart, the same key will be used.');
152
+ }
153
+ userLog('');
154
+ userLog(' To disable admin auth: --disable-admin-api-key or AZTEC_DISABLE_ADMIN_API_KEY=true');
155
+ userLog(separator);
156
+ userLog('');
157
+ }
111
158
  }
112
159
  }
@@ -105,8 +105,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
105
105
  env: 'NETWORK',
106
106
  },
107
107
 
108
- configToFlag('--auto-update', sharedNodeConfigMappings.autoUpdate),
109
- configToFlag('--auto-update-url', sharedNodeConfigMappings.autoUpdateUrl),
108
+ configToFlag('--enable-version-check', sharedNodeConfigMappings.enableVersionCheck),
110
109
 
111
110
  configToFlag('--sync-mode', sharedNodeConfigMappings.syncMode),
112
111
  configToFlag('--snapshots-urls', sharedNodeConfigMappings.snapshotsUrls),
@@ -142,6 +141,30 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
142
141
  env: 'AZTEC_ADMIN_PORT',
143
142
  parseVal: val => parseInt(val, 10),
144
143
  },
144
+ {
145
+ flag: '--admin-api-key-hash <value>',
146
+ description:
147
+ 'SHA-256 hex hash of a pre-generated admin API key. When set, the node uses this hash for authentication instead of auto-generating a key.',
148
+ defaultValue: undefined,
149
+ env: 'AZTEC_ADMIN_API_KEY_HASH',
150
+ },
151
+ {
152
+ flag: '--disable-admin-api-key',
153
+ description:
154
+ 'Disable API key authentication on the admin RPC endpoint. By default, a key is auto-generated, displayed once, and its hash is persisted.',
155
+ defaultValue: false,
156
+ env: 'AZTEC_DISABLE_ADMIN_API_KEY',
157
+ // undefined means the flag was passed without a value (boolean toggle), treat as true.
158
+ parseVal: val => val === undefined || val === 'true' || val === '1',
159
+ },
160
+ {
161
+ flag: '--reset-admin-api-key',
162
+ description:
163
+ 'Force-generate a new admin API key, replacing any previously persisted key hash. The new key is displayed once at startup.',
164
+ defaultValue: false,
165
+ env: 'AZTEC_RESET_ADMIN_API_KEY',
166
+ parseVal: val => val === 'true' || val === '1',
167
+ },
145
168
  {
146
169
  flag: '--api-prefix <value>',
147
170
  description: 'Prefix for API routes on any service that is started',
@@ -170,7 +193,7 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
170
193
  'WORLD STATE': [
171
194
  configToFlag('--world-state-data-directory', worldStateConfigMappings.worldStateDataDirectory),
172
195
  configToFlag('--world-state-db-map-size-kb', worldStateConfigMappings.worldStateDbMapSizeKb),
173
- configToFlag('--world-state-block-history', worldStateConfigMappings.worldStateBlockHistory),
196
+ configToFlag('--world-state-checkpoint-history', worldStateConfigMappings.worldStateCheckpointHistory),
174
197
  ],
175
198
  // We can't easily auto-generate node options as they're parts of modules defined below
176
199
  'AZTEC NODE': [
@@ -222,12 +245,8 @@ export const aztecStartOptions: { [key: string]: AztecStartOption[] } = {
222
245
  'proverNode',
223
246
  omitConfigMappings(proverNodeConfigMappings, [
224
247
  // filter out options passed separately
225
- ...getKeys(archiverConfigMappings),
226
248
  ...getKeys(proverBrokerConfigMappings),
227
249
  ...getKeys(proverAgentConfigMappings),
228
- ...getKeys(p2pConfigMappings),
229
- ...getKeys(worldStateConfigMappings),
230
- ...getKeys(sharedNodeConfigMappings),
231
250
  ]),
232
251
  ),
233
252
  ],
package/src/cli/cli.ts CHANGED
@@ -39,7 +39,6 @@ Additional commands:
39
39
 
40
40
  init [folder] [options] creates a new Aztec Noir project.
41
41
  new <path> [options] creates a new Aztec Noir project in a new directory.
42
- compile [options] compiles Aztec Noir contracts.
43
42
  test [options] starts a TXE and runs "nargo test" using it as the oracle resolver.
44
43
  `,
45
44
  );
@@ -0,0 +1,80 @@
1
+ import type { LogFn } from '@aztec/foundation/log';
2
+
3
+ import { execFileSync } from 'child_process';
4
+ import type { Command } from 'commander';
5
+ import { readFile, writeFile } from 'fs/promises';
6
+
7
+ import { readArtifactFiles } from './utils/artifacts.js';
8
+ import { run } from './utils/spawn.js';
9
+
10
+ /** Returns paths to contract artifacts in the target directory. */
11
+ async function collectContractArtifacts(): Promise<string[]> {
12
+ let files;
13
+ try {
14
+ files = await readArtifactFiles('target');
15
+ } catch (err: any) {
16
+ if (err?.message?.includes('does not exist')) {
17
+ return [];
18
+ }
19
+ throw err;
20
+ }
21
+ return files.filter(f => Array.isArray(f.content.functions)).map(f => f.filePath);
22
+ }
23
+
24
+ /** Strips the `__aztec_nr_internals__` prefix from function names in contract artifacts. */
25
+ async function stripInternalPrefixes(artifactPaths: string[]): Promise<void> {
26
+ for (const path of artifactPaths) {
27
+ const artifact = JSON.parse(await readFile(path, 'utf-8'));
28
+ for (const fn of artifact.functions) {
29
+ if (typeof fn.name === 'string') {
30
+ fn.name = fn.name.replace(/^__aztec_nr_internals__/, '');
31
+ }
32
+ }
33
+ await writeFile(path, JSON.stringify(artifact, null, 2) + '\n');
34
+ }
35
+ }
36
+
37
+ /** Compiles Aztec Noir contracts and postprocesses artifacts. */
38
+ async function compileAztecContract(nargoArgs: string[], log: LogFn): Promise<void> {
39
+ const nargo = process.env.NARGO ?? 'nargo';
40
+ const bb = process.env.BB ?? 'bb';
41
+
42
+ await run(nargo, ['compile', ...nargoArgs]);
43
+
44
+ const artifacts = await collectContractArtifacts();
45
+
46
+ if (artifacts.length > 0) {
47
+ log('Postprocessing contracts...');
48
+ const bbArgs = artifacts.flatMap(a => ['-i', a]);
49
+ await run(bb, ['aztec_process', ...bbArgs]);
50
+
51
+ // TODO: This should be part of bb aztec_process!
52
+ await stripInternalPrefixes(artifacts);
53
+ }
54
+
55
+ log('Compilation complete!');
56
+ }
57
+
58
+ export function injectCompileCommand(program: Command, log: LogFn): Command {
59
+ program
60
+ .command('compile')
61
+ .argument('[nargo-args...]')
62
+ .passThroughOptions()
63
+ .allowUnknownOption()
64
+ .description(
65
+ 'Compile Aztec Noir contracts using nargo and postprocess them to generate transpiled artifacts and verification keys. All options are forwarded to nargo compile.',
66
+ )
67
+ .addHelpText('after', () => {
68
+ // Show nargo's own compile options so users see all available flags in one place.
69
+ const nargo = process.env.NARGO ?? 'nargo';
70
+ try {
71
+ const output = execFileSync(nargo, ['compile', '--help'], { encoding: 'utf-8' });
72
+ return `\nUnderlying nargo compile options:\n\n${output}`;
73
+ } catch {
74
+ return '\n(Run "nargo compile --help" to see available nargo options)';
75
+ }
76
+ })
77
+ .action((nargoArgs: string[]) => compileAztecContract(nargoArgs, log));
78
+
79
+ return program;
80
+ }