@aztec/aztec 0.0.1-commit.733c4a3 → 0.0.1-commit.7689c7f

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 (124) hide show
  1. package/dest/bin/index.js +2 -2
  2. package/dest/cli/aztec_start_action.d.ts +1 -1
  3. package/dest/cli/aztec_start_action.d.ts.map +1 -1
  4. package/dest/cli/aztec_start_action.js +31 -14
  5. package/dest/cli/aztec_start_options.d.ts +2 -2
  6. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  7. package/dest/cli/aztec_start_options.js +16 -17
  8. package/dest/cli/cli.js +3 -3
  9. package/dest/cli/cmds/compile.d.ts +1 -1
  10. package/dest/cli/cmds/compile.d.ts.map +1 -1
  11. package/dest/cli/cmds/compile.js +15 -9
  12. package/dest/cli/cmds/profile.d.ts +1 -1
  13. package/dest/cli/cmds/profile.d.ts.map +1 -1
  14. package/dest/cli/cmds/profile.js +1 -1
  15. package/dest/cli/cmds/profile_flamegraph.d.ts +1 -1
  16. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -1
  17. package/dest/cli/cmds/profile_flamegraph.js +2 -1
  18. package/dest/cli/cmds/profile_gates.d.ts +2 -2
  19. package/dest/cli/cmds/profile_gates.d.ts.map +1 -1
  20. package/dest/cli/cmds/profile_gates.js +23 -4
  21. package/dest/cli/cmds/standby.d.ts +30 -0
  22. package/dest/cli/cmds/standby.d.ts.map +1 -0
  23. package/dest/cli/cmds/standby.js +97 -0
  24. package/dest/cli/cmds/start_bot.d.ts +1 -1
  25. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  26. package/dest/cli/cmds/start_bot.js +3 -3
  27. package/dest/cli/cmds/start_node.d.ts +3 -2
  28. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  29. package/dest/cli/cmds/start_node.js +28 -40
  30. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  31. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  32. package/dest/cli/cmds/start_prover_agent.js +5 -17
  33. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  34. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  35. package/dest/cli/cmds/start_prover_broker.js +22 -13
  36. package/dest/cli/cmds/start_txe.d.ts +2 -2
  37. package/dest/cli/cmds/start_txe.d.ts.map +1 -1
  38. package/dest/cli/cmds/start_txe.js +6 -5
  39. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  40. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  41. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  42. package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
  43. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
  44. package/dest/cli/cmds/utils/needs_recompile.js +90 -0
  45. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  46. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  47. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
  48. package/dest/cli/util.d.ts +3 -5
  49. package/dest/cli/util.d.ts.map +1 -1
  50. package/dest/cli/util.js +46 -85
  51. package/dest/examples/token.js +4 -4
  52. package/dest/local-network/auth_registry.d.ts +4 -0
  53. package/dest/local-network/auth_registry.d.ts.map +1 -0
  54. package/dest/local-network/auth_registry.js +15 -0
  55. package/dest/local-network/banana_fpc.d.ts +1 -1
  56. package/dest/local-network/banana_fpc.d.ts.map +1 -1
  57. package/dest/local-network/banana_fpc.js +9 -7
  58. package/dest/local-network/local-network.d.ts +5 -28
  59. package/dest/local-network/local-network.d.ts.map +1 -1
  60. package/dest/local-network/local-network.js +44 -17
  61. package/dest/testing/anvil_test_watcher.d.ts +15 -3
  62. package/dest/testing/anvil_test_watcher.d.ts.map +1 -1
  63. package/dest/testing/anvil_test_watcher.js +68 -14
  64. package/dest/testing/cheat_codes.d.ts +18 -17
  65. package/dest/testing/cheat_codes.d.ts.map +1 -1
  66. package/dest/testing/cheat_codes.js +72 -36
  67. package/dest/testing/epoch_test_settler.d.ts +1 -1
  68. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  69. package/dest/testing/epoch_test_settler.js +9 -8
  70. package/dest/testing/index.d.ts +3 -2
  71. package/dest/testing/index.d.ts.map +1 -1
  72. package/dest/testing/index.js +1 -0
  73. package/dest/testing/token_allowed_setup.d.ts +7 -0
  74. package/dest/testing/token_allowed_setup.d.ts.map +1 -0
  75. package/dest/testing/token_allowed_setup.js +20 -0
  76. package/package.json +35 -34
  77. package/scripts/add_crate.sh +53 -0
  78. package/scripts/aztec.sh +10 -3
  79. package/scripts/init.sh +18 -24
  80. package/scripts/new.sh +45 -22
  81. package/scripts/setup_workspace.sh +12 -67
  82. package/scripts/templates/blank/contract/Nargo.toml +6 -0
  83. package/scripts/templates/blank/contract/src/main.nr +10 -0
  84. package/scripts/templates/blank/test/Nargo.toml +7 -0
  85. package/scripts/templates/blank/test/src/lib.nr +11 -0
  86. package/scripts/templates/counter/contract/Nargo.toml +7 -0
  87. package/scripts/templates/counter/contract/src/main.nr +48 -0
  88. package/scripts/templates/counter/test/Nargo.toml +7 -0
  89. package/scripts/templates/counter/test/src/lib.nr +32 -0
  90. package/src/bin/index.ts +2 -2
  91. package/src/cli/aztec_start_action.ts +20 -14
  92. package/src/cli/aztec_start_options.ts +23 -25
  93. package/src/cli/cli.ts +3 -3
  94. package/src/cli/cmds/compile.ts +18 -10
  95. package/src/cli/cmds/profile.ts +2 -1
  96. package/src/cli/cmds/profile_flamegraph.ts +2 -1
  97. package/src/cli/cmds/profile_gates.ts +22 -5
  98. package/src/cli/cmds/standby.ts +132 -0
  99. package/src/cli/cmds/start_bot.ts +3 -5
  100. package/src/cli/cmds/start_node.ts +43 -39
  101. package/src/cli/cmds/start_prover_agent.ts +5 -8
  102. package/src/cli/cmds/start_prover_broker.ts +23 -24
  103. package/src/cli/cmds/start_txe.ts +7 -5
  104. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  105. package/src/cli/cmds/utils/needs_recompile.ts +98 -0
  106. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
  107. package/src/cli/util.ts +49 -82
  108. package/src/examples/token.ts +6 -4
  109. package/src/local-network/auth_registry.ts +14 -0
  110. package/src/local-network/banana_fpc.ts +5 -8
  111. package/src/local-network/local-network.ts +43 -14
  112. package/src/testing/anvil_test_watcher.ts +76 -13
  113. package/src/testing/cheat_codes.ts +92 -39
  114. package/src/testing/epoch_test_settler.ts +6 -8
  115. package/src/testing/index.ts +2 -1
  116. package/src/testing/token_allowed_setup.ts +19 -0
  117. package/dest/cli/cmds/start_archiver.d.ts +0 -9
  118. package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
  119. package/dest/cli/cmds/start_archiver.js +0 -48
  120. package/dest/cli/release_version.d.ts +0 -2
  121. package/dest/cli/release_version.d.ts.map +0 -1
  122. package/dest/cli/release_version.js +0 -14
  123. package/src/cli/cmds/start_archiver.ts +0 -50
  124. package/src/cli/release_version.ts +0 -21
@@ -1,9 +1,9 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { BlockNumber } from '@aztec/foundation/branded-types';
3
- import { retryUntil } from '@aztec/foundation/retry';
2
+ import { SlotNumber } from '@aztec/foundation/branded-types';
3
+ import { createLogger } from '@aztec/foundation/log';
4
4
  import type { DateProvider } from '@aztec/foundation/timer';
5
- import type { SequencerClient } from '@aztec/sequencer-client';
6
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
5
+ import type { AutomineSequencer } from '@aztec/sequencer-client';
6
+ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
7
7
 
8
8
  /**
9
9
  * A class that provides utility functions for interacting with the chain.
@@ -12,68 +12,121 @@ import type { AztecNode } from '@aztec/stdlib/interfaces/client';
12
12
  * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
13
13
  */
14
14
  export class CheatCodes {
15
+ private logger = createLogger('aztecjs:cheat_codes');
16
+
15
17
  constructor(
16
18
  /** Cheat codes for L1.*/
17
19
  public eth: EthCheatCodes,
18
20
  /** Cheat codes for the Aztec Rollup contract on L1. */
19
21
  public rollup: RollupCheatCodes,
22
+ /** When wired, redirects time-warps through the AutomineSequencer queue (test-only). */
23
+ private automine?: AutomineSequencer,
20
24
  ) {}
21
25
 
22
- static async create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes> {
26
+ static async create(
27
+ rpcUrls: string[],
28
+ node: AztecNode,
29
+ dateProvider: DateProvider,
30
+ automine?: AutomineSequencer,
31
+ ): Promise<CheatCodes> {
23
32
  const ethCheatCodes = new EthCheatCodes(rpcUrls, dateProvider);
24
33
  const rollupCheatCodes = new RollupCheatCodes(
25
34
  ethCheatCodes,
26
35
  await node.getNodeInfo().then(n => n.l1ContractAddresses),
27
36
  );
28
- return new CheatCodes(ethCheatCodes, rollupCheatCodes);
37
+ return new CheatCodes(ethCheatCodes, rollupCheatCodes, automine);
29
38
  }
30
39
 
31
40
  /**
32
41
  * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
33
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
34
- * by the slot number, which advances in fixed intervals.
35
- * This is useful for testing time-dependent contract behavior.
36
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
37
- * @param node - The Aztec node used to query if a new block has been mined.
42
+ * the target timestamp. If the target timestamp falls within the current L2 slot (which already has a block),
43
+ * the timestamp is automatically adjusted forward to the start of the next slot so that `mineBlock()` succeeds.
44
+ * @param node - The Aztec node used to force an empty block to be mined.
38
45
  * @param targetTimestamp - The target timestamp to warp to (in seconds)
39
46
  */
40
- async warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number) {
41
- const currentL2BlockNumber: BlockNumber = await node.getBlockNumber();
47
+ async warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number) {
48
+ const targetBigInt = BigInt(targetTimestamp);
49
+ const currentTimestamp = BigInt(await this.eth.lastBlockTimestamp());
42
50
 
43
- // We warp the L1 timestamp
44
- await this.eth.warp(targetTimestamp, { resetBlockInterval: true });
51
+ if (targetBigInt <= currentTimestamp) {
52
+ throw new Error(
53
+ `warpL2TimeAtLeastTo: target timestamp ${targetBigInt} is not in the future (current L1 timestamp is ${currentTimestamp}).`,
54
+ );
55
+ }
45
56
 
46
- // Wait until an L2 block is mined
47
- const sequencer = sequencerClient.getSequencer();
48
- const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
49
- sequencer.updateConfig({ minTxsPerBlock: 0 });
57
+ // AutomineSequencer owns time control through its serial queue — delegate to keep warps atomic
58
+ // with respect to any in-flight build, and avoid the mineBlock-loop hack below.
59
+ // `warpTo` internally builds an empty L2 checkpoint, which auto-mines exactly one L1 block at
60
+ // the target slot boundary, so no separate `node.mineBlock()` is needed here.
61
+ if (this.automine) {
62
+ await this.automine.warpTo(Number(targetBigInt));
63
+ return;
64
+ }
50
65
 
51
- await retryUntil(
52
- async () => {
53
- const newL2BlockNumber: BlockNumber = await node.getBlockNumber();
54
- return newL2BlockNumber > currentL2BlockNumber;
55
- },
56
- 'new block after warping L2 time',
57
- 36,
58
- 1,
59
- );
66
+ const currentSlot = await this.rollup.getSlot();
67
+ const targetSlot = await this.rollup.getSlotAt(targetBigInt);
68
+
69
+ let effectiveTimestamp = targetBigInt;
70
+ let effectiveTargetSlot = targetSlot;
71
+
72
+ if (targetSlot <= currentSlot) {
73
+ // Target lands in the same (or earlier) slot — auto-adjust to the next slot's start.
74
+ const nextSlot = SlotNumber(currentSlot + 1);
75
+ const nextSlotTimestamp = await this.rollup.getTimestampForSlot(nextSlot);
76
+ this.logger.warn(
77
+ `warpL2TimeAtLeastTo: target timestamp ${targetBigInt} falls in current slot ${currentSlot}. ` +
78
+ `Auto-adjusting to start of slot ${nextSlot} at timestamp ${nextSlotTimestamp}.`,
79
+ );
80
+ effectiveTimestamp = nextSlotTimestamp;
81
+ effectiveTargetSlot = nextSlot;
82
+ }
60
83
 
61
- // Restore original minTxsPerBlock
62
- sequencer.updateConfig({ minTxsPerBlock });
84
+ await this.eth.warp(effectiveTimestamp, { resetBlockInterval: true });
85
+
86
+ // The sequencer's polling loop may have a `work()` cycle in flight that captured pre-warp slot/timestamp values
87
+ // just before our warp landed. That cycle would mine an L2 block at the stale slot — the L1 sync prunes such a
88
+ // block from the canonical chain, but it lingers in local world state and the PXE will use it as the anchor for
89
+ // subsequent txs, leading to `expiration_timestamp` values that are already in the past relative to L1. Mine
90
+ // until we observe an L2 block at (or past) the post-warp slot, ensuring the next tx anchors to a fresh block.
91
+ const maxAttempts = 5;
92
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
93
+ await node.mineBlock();
94
+ const blockData = await node.getBlockData('latest');
95
+ const blockSlot = blockData?.header.globalVariables.slotNumber;
96
+ if (blockSlot !== undefined && BigInt(blockSlot) >= BigInt(effectiveTargetSlot)) {
97
+ return;
98
+ }
99
+ this.logger.warn(
100
+ `warpL2TimeAtLeastTo: mined L2 block at slot ${blockSlot}, expected at least ${effectiveTargetSlot}. ` +
101
+ `Retrying mineBlock (attempt ${attempt}/${maxAttempts}).`,
102
+ );
103
+ }
104
+ throw new Error(
105
+ `warpL2TimeAtLeastTo: failed to mine an L2 block at or past slot ${effectiveTargetSlot} after ${maxAttempts} attempts.`,
106
+ );
63
107
  }
64
108
 
65
109
  /**
66
110
  * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
67
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
68
- * number, which advances in fixed intervals.
69
- * This is useful for testing time-dependent contract behavior.
70
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
71
- * @param node - The Aztec node used to query if a new block has been mined.
111
+ * least by the duration. If the duration is too short to cross an L2 slot boundary, the warp is automatically
112
+ * extended to the start of the next slot so that `mineBlock()` succeeds.
113
+ * @param node - The Aztec node used to force an empty block to be mined.
72
114
  * @param duration - The duration to advance time by (in seconds)
73
115
  */
74
- async warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number) {
75
- const currentTimestamp = await this.eth.timestamp();
76
- const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
77
- await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
116
+ async warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number) {
117
+ if (BigInt(duration) <= 0n) {
118
+ throw new Error(`warpL2TimeAtLeastBy: duration must be positive, got ${duration} seconds.`);
119
+ }
120
+
121
+ // Advance relative to whichever clock leads. A live sequencer mines L2 blocks at slot boundaries that can run
122
+ // ahead of anvil's L1 timestamp, so basing the target on L1 alone would advance the L2 timestamp by less than
123
+ // `duration`. Anchoring to the latest L2 block timestamp when it leads guarantees the post-warp L2 block is at
124
+ // least `duration` ahead of the current one.
125
+ const currentL1Timestamp = BigInt(await this.eth.lastBlockTimestamp());
126
+ const latestBlockData = await node.getBlockData('latest');
127
+ const latestL2Timestamp = latestBlockData ? BigInt(latestBlockData.header.globalVariables.timestamp) : 0n;
128
+ const baseTimestamp = latestL2Timestamp > currentL1Timestamp ? latestL2Timestamp : currentL1Timestamp;
129
+ const targetTimestamp = baseTimestamp + BigInt(duration);
130
+ await this.warpL2TimeAtLeastTo(node, targetTimestamp);
78
131
  }
79
132
  }
@@ -4,7 +4,7 @@ import { type EpochNumber, SlotNumber } from '@aztec/foundation/branded-types';
4
4
  import type { Logger } from '@aztec/foundation/log';
5
5
  import { EpochMonitor } from '@aztec/prover-node';
6
6
  import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
7
- import { computeL2ToL1MembershipWitnessFromMessagesInEpoch } from '@aztec/stdlib/messaging';
7
+ import { computeEpochOutHash } from '@aztec/stdlib/messaging';
8
8
 
9
9
  export class EpochTestSettler {
10
10
  private rollupCheatCodes: RollupCheatCodes;
@@ -31,8 +31,7 @@ export class EpochTestSettler {
31
31
  }
32
32
 
33
33
  async handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean> {
34
- const checkpointedBlocks = await this.l2BlockSource.getCheckpointedBlocksForEpoch(epoch);
35
- const blocks = checkpointedBlocks.map(b => b.block);
34
+ const blocks = await this.l2BlockSource.getBlocks({ epoch, onlyCheckpointed: true });
36
35
  this.log.info(
37
36
  `Settling epoch ${epoch} with blocks ${blocks[0]?.header.getBlockNumber()} to ${blocks.at(-1)?.header.getBlockNumber()}`,
38
37
  { blocks: blocks.map(b => b.toBlockInfo()) },
@@ -51,15 +50,14 @@ export class EpochTestSettler {
51
50
  messagesInEpoch[checkpointIndex].push(block.body.txEffects.map(txEffect => txEffect.l2ToL1Msgs));
52
51
  }
53
52
 
54
- const [firstMessage] = messagesInEpoch.flat(3);
55
- if (firstMessage) {
56
- const { root: outHash } = computeL2ToL1MembershipWitnessFromMessagesInEpoch(messagesInEpoch, firstMessage);
57
- await this.rollupCheatCodes.insertOutbox(epoch, outHash.toBigInt());
53
+ const outHash = computeEpochOutHash(messagesInEpoch);
54
+ if (!outHash.isZero()) {
55
+ await this.rollupCheatCodes.insertOutbox(epoch, messagesInEpoch.length, outHash.toBigInt());
58
56
  } else {
59
57
  this.log.info(`No L2 to L1 messages in epoch ${epoch}`);
60
58
  }
61
59
 
62
- const lastCheckpoint = checkpointedBlocks.at(-1)?.checkpointNumber;
60
+ const lastCheckpoint = blocks.at(-1)?.checkpointNumber;
63
61
  if (lastCheckpoint !== undefined) {
64
62
  await this.rollupCheatCodes.markAsProven(lastCheckpoint);
65
63
  } else {
@@ -1,4 +1,5 @@
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';
5
+ export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
@@ -0,0 +1,19 @@
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
+ import type { AllowedElement } from '@aztec/stdlib/interfaces/server';
5
+
6
+ /**
7
+ * Returns Token-specific allowlist entries needed for FPC-based fee payments.
8
+ * These are test-only: FPC-based fee payment with custom tokens won't work on mainnet alpha.
9
+ */
10
+ export async function getTokenAllowedSetupFunctions(): Promise<AllowedElement[]> {
11
+ const tokenClassId = (await getContractClassFromArtifact(TokenContractArtifact)).id;
12
+ const target = { classId: tokenClassId };
13
+ return Promise.all([
14
+ // Token: needed for private transfers via FPC (transfer_to_public enqueues this)
15
+ buildAllowedElement(TokenContractArtifact, target, '_increase_public_balance', { onlySelf: true }),
16
+ // Token: needed for public transfers via FPC (fee_entrypoint_public enqueues this)
17
+ buildAllowedElement(TokenContractArtifact, target, 'transfer_in_public'),
18
+ ]);
19
+ }
@@ -1,9 +0,0 @@
1
- import { type ArchiverConfig } from '@aztec/archiver';
2
- import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
3
- import { type DataStoreConfig } from '@aztec/kv-store/config';
4
- export type { ArchiverConfig, DataStoreConfig };
5
- /** Starts a standalone archiver. */
6
- export declare function startArchiver(options: any, signalHandlers: (() => Promise<void>)[], services: NamespacedApiHandlers): Promise<{
7
- config: ArchiverConfig & DataStoreConfig;
8
- }>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhcnRfYXJjaGl2ZXIuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9jbGkvY21kcy9zdGFydF9hcmNoaXZlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsS0FBSyxjQUFjLEVBQW9FLE1BQU0saUJBQWlCLENBQUM7QUFJeEgsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsTUFBTSxtQ0FBbUMsQ0FBQztBQUMvRSxPQUFPLEVBQUUsS0FBSyxlQUFlLEVBQXNCLE1BQU0sd0JBQXdCLENBQUM7QUFNbEYsWUFBWSxFQUFFLGNBQWMsRUFBRSxlQUFlLEVBQUUsQ0FBQztBQUVoRCxvQ0FBb0M7QUFDcEMsd0JBQXNCLGFBQWEsQ0FDakMsT0FBTyxFQUFFLEdBQUcsRUFDWixjQUFjLEVBQUUsQ0FBQyxNQUFNLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxFQUFFLEVBQ3ZDLFFBQVEsRUFBRSxxQkFBcUIsR0FDOUIsT0FBTyxDQUFDO0lBQUUsTUFBTSxFQUFFLGNBQWMsR0FBRyxlQUFlLENBQUE7Q0FBRSxDQUFDLENBK0J2RCJ9
@@ -1 +0,0 @@
1
- {"version":3,"file":"start_archiver.d.ts","sourceRoot":"","sources":["../../../src/cli/cmds/start_archiver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAoE,MAAM,iBAAiB,CAAC;AAIxH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAMlF,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC;AAEhD,oCAAoC;AACpC,wBAAsB,aAAa,CACjC,OAAO,EAAE,GAAG,EACZ,cAAc,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EACvC,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,cAAc,GAAG,eAAe,CAAA;CAAE,CAAC,CA+BvD"}
@@ -1,48 +0,0 @@
1
- import { archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from '@aztec/archiver';
2
- import { createLogger } from '@aztec/aztec.js/log';
3
- import { blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
4
- import { getL1Config } from '@aztec/cli/config';
5
- import { dataConfigMappings } from '@aztec/kv-store/config';
6
- import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
7
- import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
8
- import { extractRelevantOptions } from '../util.js';
9
- /** Starts a standalone archiver. */ export async function startArchiver(options, signalHandlers, services) {
10
- const envConfig = getArchiverConfigFromEnv();
11
- const cliOptions = extractRelevantOptions(options, {
12
- ...archiverConfigMappings,
13
- ...dataConfigMappings,
14
- ...blobClientConfigMapping
15
- }, 'archiver');
16
- let archiverConfig = {
17
- ...envConfig,
18
- ...cliOptions
19
- };
20
- archiverConfig.dataStoreMapSizeKb = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKb;
21
- if (!archiverConfig.l1Contracts.registryAddress || archiverConfig.l1Contracts.registryAddress.isZero()) {
22
- throw new Error('L1 registry address is required to start an Archiver');
23
- }
24
- const { addresses, config: l1Config } = await getL1Config(archiverConfig.l1Contracts.registryAddress, archiverConfig.l1RpcUrls, archiverConfig.l1ChainId);
25
- archiverConfig.l1Contracts = addresses;
26
- archiverConfig = {
27
- ...archiverConfig,
28
- ...l1Config
29
- };
30
- const telemetry = await initTelemetryClient(getTelemetryClientConfig());
31
- const blobClient = createBlobClient(archiverConfig, {
32
- logger: createLogger('archiver:blob-client:client')
33
- });
34
- const archiver = await createArchiver(archiverConfig, {
35
- telemetry,
36
- blobClient
37
- }, {
38
- blockUntilSync: true
39
- });
40
- services.archiver = [
41
- archiver,
42
- ArchiverApiSchema
43
- ];
44
- signalHandlers.push(archiver.stop);
45
- return {
46
- config: archiverConfig
47
- };
48
- }
@@ -1,2 +0,0 @@
1
- export declare const getCliVersion: () => any;
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVsZWFzZV92ZXJzaW9uLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvY2xpL3JlbGVhc2VfdmVyc2lvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFLQSxlQUFPLE1BQU0sYUFBYSxXQWV6QixDQUFDIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"release_version.d.ts","sourceRoot":"","sources":["../../src/cli/release_version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,WAezB,CAAC"}
@@ -1,14 +0,0 @@
1
- import { fileURLToPath } from '@aztec/foundation/url';
2
- import { readFileSync } from 'fs';
3
- import { dirname, resolve } from 'path';
4
- export const getCliVersion = ()=>{
5
- const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
6
- const cliVersion = JSON.parse(readFileSync(packageJsonPath).toString()).version;
7
- // If the version is 0.1.0, this is a placeholder version and we are in a docker container; query release please for the latest version
8
- if (cliVersion === '0.1.0') {
9
- const releasePleasePath = resolve(dirname(fileURLToPath(import.meta.url)), '../../../../.release-please-manifest.json');
10
- const releaseVersion = JSON.parse(readFileSync(releasePleasePath).toString())['.'];
11
- return releaseVersion;
12
- }
13
- return cliVersion;
14
- };
@@ -1,50 +0,0 @@
1
- import { type ArchiverConfig, archiverConfigMappings, createArchiver, getArchiverConfigFromEnv } from '@aztec/archiver';
2
- import { createLogger } from '@aztec/aztec.js/log';
3
- import { type BlobClientConfig, blobClientConfigMapping, createBlobClient } from '@aztec/blob-client/client';
4
- import { getL1Config } from '@aztec/cli/config';
5
- import type { NamespacedApiHandlers } from '@aztec/foundation/json-rpc/server';
6
- import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
7
- import { ArchiverApiSchema } from '@aztec/stdlib/interfaces/server';
8
- import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
9
-
10
- import { extractRelevantOptions } from '../util.js';
11
-
12
- export type { ArchiverConfig, DataStoreConfig };
13
-
14
- /** Starts a standalone archiver. */
15
- export async function startArchiver(
16
- options: any,
17
- signalHandlers: (() => Promise<void>)[],
18
- services: NamespacedApiHandlers,
19
- ): Promise<{ config: ArchiverConfig & DataStoreConfig }> {
20
- const envConfig = getArchiverConfigFromEnv();
21
- const cliOptions = extractRelevantOptions<ArchiverConfig & DataStoreConfig & BlobClientConfig>(
22
- options,
23
- { ...archiverConfigMappings, ...dataConfigMappings, ...blobClientConfigMapping },
24
- 'archiver',
25
- );
26
-
27
- let archiverConfig = { ...envConfig, ...cliOptions };
28
- archiverConfig.dataStoreMapSizeKb = archiverConfig.archiverStoreMapSizeKb ?? archiverConfig.dataStoreMapSizeKb;
29
-
30
- if (!archiverConfig.l1Contracts.registryAddress || archiverConfig.l1Contracts.registryAddress.isZero()) {
31
- throw new Error('L1 registry address is required to start an Archiver');
32
- }
33
-
34
- const { addresses, config: l1Config } = await getL1Config(
35
- archiverConfig.l1Contracts.registryAddress,
36
- archiverConfig.l1RpcUrls,
37
- archiverConfig.l1ChainId,
38
- );
39
-
40
- archiverConfig.l1Contracts = addresses;
41
- archiverConfig = { ...archiverConfig, ...l1Config };
42
-
43
- const telemetry = await initTelemetryClient(getTelemetryClientConfig());
44
- const blobClient = createBlobClient(archiverConfig, { logger: createLogger('archiver:blob-client:client') });
45
- const archiver = await createArchiver(archiverConfig, { telemetry, blobClient }, { blockUntilSync: true });
46
- services.archiver = [archiver, ArchiverApiSchema];
47
- signalHandlers.push(archiver.stop);
48
-
49
- return { config: archiverConfig };
50
- }
@@ -1,21 +0,0 @@
1
- import { fileURLToPath } from '@aztec/foundation/url';
2
-
3
- import { readFileSync } from 'fs';
4
- import { dirname, resolve } from 'path';
5
-
6
- export const getCliVersion = () => {
7
- const packageJsonPath = resolve(dirname(fileURLToPath(import.meta.url)), '../../package.json');
8
- const cliVersion: string = JSON.parse(readFileSync(packageJsonPath).toString()).version;
9
-
10
- // If the version is 0.1.0, this is a placeholder version and we are in a docker container; query release please for the latest version
11
- if (cliVersion === '0.1.0') {
12
- const releasePleasePath = resolve(
13
- dirname(fileURLToPath(import.meta.url)),
14
- '../../../../.release-please-manifest.json',
15
- );
16
- const releaseVersion = JSON.parse(readFileSync(releasePleasePath).toString())['.'];
17
- return releaseVersion;
18
- }
19
-
20
- return cliVersion;
21
- };