@aztec/aztec 0.0.1-commit.4d79d1f2d → 0.0.1-commit.4d9804df

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 (158) hide show
  1. package/dest/bin/index.js +9 -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 +69 -32
  8. package/dest/cli/aztec_start_options.d.ts +2 -2
  9. package/dest/cli/aztec_start_options.d.ts.map +1 -1
  10. package/dest/cli/aztec_start_options.js +39 -23
  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 +3 -4
  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 +174 -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 +52 -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 +76 -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/prover.d.ts +4 -0
  30. package/dest/cli/cmds/prover.d.ts.map +1 -0
  31. package/dest/cli/cmds/prover.js +24 -0
  32. package/dest/cli/cmds/standby.d.ts +56 -0
  33. package/dest/cli/cmds/standby.d.ts.map +1 -0
  34. package/dest/cli/cmds/standby.js +140 -0
  35. package/dest/cli/cmds/start_bot.d.ts +2 -2
  36. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  37. package/dest/cli/cmds/start_bot.js +13 -7
  38. package/dest/cli/cmds/start_node.d.ts +3 -2
  39. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  40. package/dest/cli/cmds/start_node.js +78 -49
  41. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  42. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  43. package/dest/cli/cmds/start_prover_agent.js +5 -17
  44. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  45. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  46. package/dest/cli/cmds/start_prover_broker.js +22 -13
  47. package/dest/cli/cmds/start_txe.d.ts +2 -2
  48. package/dest/cli/cmds/start_txe.d.ts.map +1 -1
  49. package/dest/cli/cmds/start_txe.js +6 -5
  50. package/dest/cli/cmds/utils/artifacts.d.ts +26 -0
  51. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
  52. package/dest/cli/cmds/utils/artifacts.js +24 -0
  53. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  54. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  55. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  56. package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
  57. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
  58. package/dest/cli/cmds/utils/needs_recompile.js +90 -0
  59. package/dest/cli/cmds/utils/spawn.d.ts +3 -0
  60. package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
  61. package/dest/cli/cmds/utils/spawn.js +16 -0
  62. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  63. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  64. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
  65. package/dest/cli/util.d.ts +10 -6
  66. package/dest/cli/util.d.ts.map +1 -1
  67. package/dest/cli/util.js +32 -96
  68. package/dest/examples/token.js +7 -7
  69. package/dest/local-network/auth_registry.d.ts +5 -0
  70. package/dest/local-network/auth_registry.d.ts.map +1 -0
  71. package/dest/local-network/auth_registry.js +17 -0
  72. package/dest/local-network/banana_fpc.d.ts +3 -2
  73. package/dest/local-network/banana_fpc.d.ts.map +1 -1
  74. package/dest/local-network/banana_fpc.js +12 -8
  75. package/dest/local-network/local-network.d.ts +12 -32
  76. package/dest/local-network/local-network.d.ts.map +1 -1
  77. package/dest/local-network/local-network.js +77 -64
  78. package/dest/testing/cheat_codes.d.ts +17 -23
  79. package/dest/testing/cheat_codes.d.ts.map +1 -1
  80. package/dest/testing/cheat_codes.js +17 -43
  81. package/dest/testing/epoch_test_settler.d.ts +2 -2
  82. package/dest/testing/epoch_test_settler.d.ts.map +1 -1
  83. package/dest/testing/epoch_test_settler.js +6 -26
  84. package/dest/testing/index.d.ts +3 -2
  85. package/dest/testing/index.d.ts.map +1 -1
  86. package/dest/testing/index.js +2 -1
  87. package/dest/testing/local-network.d.ts +51 -0
  88. package/dest/testing/local-network.d.ts.map +1 -0
  89. package/dest/testing/local-network.js +60 -0
  90. package/dest/testing/token_allowed_setup.d.ts +12 -0
  91. package/dest/testing/token_allowed_setup.d.ts.map +1 -0
  92. package/dest/testing/token_allowed_setup.js +24 -0
  93. package/package.json +35 -34
  94. package/scripts/add_crate.sh +53 -0
  95. package/scripts/aztec.sh +15 -5
  96. package/scripts/init.sh +23 -19
  97. package/scripts/new.sh +48 -24
  98. package/scripts/setup_workspace.sh +69 -0
  99. package/scripts/templates/blank/contract/Nargo.toml +6 -0
  100. package/scripts/templates/blank/contract/src/main.nr +10 -0
  101. package/scripts/templates/blank/test/Nargo.toml +7 -0
  102. package/scripts/templates/blank/test/src/lib.nr +11 -0
  103. package/scripts/templates/counter/contract/Nargo.toml +7 -0
  104. package/scripts/templates/counter/contract/src/main.nr +48 -0
  105. package/scripts/templates/counter/test/Nargo.toml +7 -0
  106. package/scripts/templates/counter/test/src/lib.nr +32 -0
  107. package/src/bin/index.ts +9 -3
  108. package/src/cli/admin_api_key_store.ts +128 -0
  109. package/src/cli/aztec_start_action.ts +69 -24
  110. package/src/cli/aztec_start_options.ts +48 -30
  111. package/src/cli/cli.ts +3 -4
  112. package/src/cli/cmds/compile.ts +205 -0
  113. package/src/cli/cmds/profile.ts +26 -0
  114. package/src/cli/cmds/profile_flamegraph.ts +64 -0
  115. package/src/cli/cmds/profile_gates.ts +84 -0
  116. package/src/cli/cmds/profile_utils.ts +58 -0
  117. package/src/cli/cmds/prover.ts +42 -0
  118. package/src/cli/cmds/standby.ts +184 -0
  119. package/src/cli/cmds/start_bot.ts +14 -8
  120. package/src/cli/cmds/start_node.ts +90 -50
  121. package/src/cli/cmds/start_prover_agent.ts +5 -8
  122. package/src/cli/cmds/start_prover_broker.ts +23 -24
  123. package/src/cli/cmds/start_txe.ts +7 -5
  124. package/src/cli/cmds/utils/artifacts.ts +49 -0
  125. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  126. package/src/cli/cmds/utils/needs_recompile.ts +98 -0
  127. package/src/cli/cmds/utils/spawn.ts +16 -0
  128. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
  129. package/src/cli/util.ts +33 -100
  130. package/src/examples/token.ts +17 -7
  131. package/src/local-network/auth_registry.ts +19 -0
  132. package/src/local-network/banana_fpc.ts +13 -9
  133. package/src/local-network/local-network.ts +94 -75
  134. package/src/testing/cheat_codes.ts +18 -49
  135. package/src/testing/epoch_test_settler.ts +8 -32
  136. package/src/testing/index.ts +2 -1
  137. package/src/testing/local-network.ts +97 -0
  138. package/src/testing/token_allowed_setup.ts +26 -0
  139. package/dest/cli/cmds/start_archiver.d.ts +0 -9
  140. package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
  141. package/dest/cli/cmds/start_archiver.js +0 -48
  142. package/dest/cli/cmds/start_prover_node.d.ts +0 -7
  143. package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
  144. package/dest/cli/cmds/start_prover_node.js +0 -108
  145. package/dest/cli/release_version.d.ts +0 -2
  146. package/dest/cli/release_version.d.ts.map +0 -1
  147. package/dest/cli/release_version.js +0 -14
  148. package/dest/testing/anvil_test_watcher.d.ts +0 -34
  149. package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
  150. package/dest/testing/anvil_test_watcher.js +0 -144
  151. package/scripts/compile.sh +0 -44
  152. package/scripts/extract_function.js +0 -47
  153. package/scripts/flamegraph.sh +0 -59
  154. package/scripts/setup_project.sh +0 -31
  155. package/src/cli/cmds/start_archiver.ts +0 -50
  156. package/src/cli/cmds/start_prover_node.ts +0 -124
  157. package/src/cli/release_version.ts +0 -21
  158. package/src/testing/anvil_test_watcher.ts +0 -166
@@ -1,108 +0,0 @@
1
- import { getInitialTestAccountsData } from '@aztec/accounts/testing';
2
- import { Fr } from '@aztec/aztec.js/fields';
3
- import { getSponsoredFPCAddress } from '@aztec/cli/cli-utils';
4
- import { getL1Config } from '@aztec/cli/config';
5
- import { getPublicClient } from '@aztec/ethereum/client';
6
- import { Agent, makeUndiciFetch } from '@aztec/foundation/json-rpc/undici';
7
- import { ProvingJobConsumerSchema, createProvingJobBrokerClient } from '@aztec/prover-client/broker';
8
- import { createProverNode, getProverNodeConfigFromEnv, proverNodeConfigMappings } from '@aztec/prover-node';
9
- import { P2PApiSchema, ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
10
- import { initTelemetryClient, makeTracedFetch, telemetryClientConfigMappings } from '@aztec/telemetry-client';
11
- import { getGenesisValues } from '@aztec/world-state/testing';
12
- import { extractRelevantOptions, preloadCrsDataForVerifying, setupUpdateMonitor } from '../util.js';
13
- import { getVersions } from '../versioning.js';
14
- import { startProverBroker } from './start_prover_broker.js';
15
- export async function startProverNode(options, signalHandlers, services, userLog) {
16
- if (options.node || options.sequencer || options.pxe || options.p2pBootstrap || options.txe) {
17
- userLog(`Starting a prover-node with --node, --sequencer, --pxe, --p2p-bootstrap, or --txe is not supported.`);
18
- process.exit(1);
19
- }
20
- let proverConfig = {
21
- ...getProverNodeConfigFromEnv(),
22
- ...extractRelevantOptions(options, proverNodeConfigMappings, 'proverNode')
23
- };
24
- if (!proverConfig.l1Contracts.registryAddress || proverConfig.l1Contracts.registryAddress.isZero()) {
25
- throw new Error('L1 registry address is required to start a Prover Node');
26
- }
27
- const followsCanonicalRollup = typeof proverConfig.rollupVersion !== 'number';
28
- const { addresses, config } = await getL1Config(proverConfig.l1Contracts.registryAddress, proverConfig.l1RpcUrls, proverConfig.l1ChainId, proverConfig.rollupVersion);
29
- process.env.ROLLUP_CONTRACT_ADDRESS ??= addresses.rollupAddress.toString();
30
- proverConfig.l1Contracts = addresses;
31
- proverConfig = {
32
- ...proverConfig,
33
- ...config
34
- };
35
- const testAccounts = proverConfig.testAccounts ? (await getInitialTestAccountsData()).map((a)=>a.address) : [];
36
- const sponsoredFPCAccounts = proverConfig.sponsoredFPC ? [
37
- await getSponsoredFPCAddress()
38
- ] : [];
39
- const initialFundedAccounts = testAccounts.concat(sponsoredFPCAccounts);
40
- userLog(`Initial funded accounts: ${initialFundedAccounts.map((a)=>a.toString()).join(', ')}`);
41
- const { genesisArchiveRoot, prefilledPublicData } = await getGenesisValues(initialFundedAccounts);
42
- userLog(`Genesis archive root: ${genesisArchiveRoot.toString()}`);
43
- if (!Fr.fromHexString(config.genesisArchiveTreeRoot).equals(genesisArchiveRoot)) {
44
- throw new Error(`The computed genesis archive tree root ${genesisArchiveRoot} does not match the expected genesis archive tree root ${config.genesisArchiveTreeRoot} for the rollup deployed at ${addresses.rollupAddress}`);
45
- }
46
- const telemetry = await initTelemetryClient(extractRelevantOptions(options, telemetryClientConfigMappings, 'tel'));
47
- let broker;
48
- if (proverConfig.proverBrokerUrl) {
49
- // at 1TPS we'd enqueue ~1k chonk verifier proofs and ~1k AVM proofs immediately
50
- // set a lower connection limit such that we don't overload the server
51
- // Keep retrying up to 30s
52
- const fetch = makeTracedFetch([
53
- 1,
54
- 2,
55
- 3,
56
- 3,
57
- 3,
58
- 3,
59
- 3,
60
- 3,
61
- 3,
62
- 3,
63
- 3
64
- ], false, makeUndiciFetch(new Agent({
65
- connections: 100
66
- })));
67
- broker = createProvingJobBrokerClient(proverConfig.proverBrokerUrl, getVersions(proverConfig), fetch);
68
- } else if (options.proverBroker) {
69
- ({ broker } = await startProverBroker(options, signalHandlers, services, userLog));
70
- } else {
71
- userLog(`--prover-broker-url or --prover-broker is required to start a Prover Node`);
72
- process.exit(1);
73
- }
74
- if (proverConfig.proverAgentCount === 0) {
75
- userLog(`Running prover node without local prover agent. Connect one or more prover agents to this node or pass --proverAgent.proverAgentCount`);
76
- }
77
- await preloadCrsDataForVerifying(proverConfig, userLog);
78
- const proverNode = await createProverNode(proverConfig, {
79
- telemetry,
80
- broker
81
- }, {
82
- prefilledPublicData
83
- });
84
- services.proverNode = [
85
- proverNode,
86
- ProverNodeApiSchema
87
- ];
88
- if (proverNode.getP2P()) {
89
- services.p2p = [
90
- proverNode.getP2P(),
91
- P2PApiSchema
92
- ];
93
- }
94
- if (!proverConfig.proverBrokerUrl) {
95
- services.provingJobSource = [
96
- proverNode.getProver().getProvingJobSource(),
97
- ProvingJobConsumerSchema
98
- ];
99
- }
100
- signalHandlers.push(proverNode.stop.bind(proverNode));
101
- await proverNode.start();
102
- if (proverConfig.autoUpdate !== 'disabled' && proverConfig.autoUpdateUrl) {
103
- await setupUpdateMonitor(proverConfig.autoUpdate, new URL(proverConfig.autoUpdateUrl), followsCanonicalRollup, getPublicClient(proverConfig), proverConfig.l1Contracts.registryAddress, signalHandlers);
104
- }
105
- return {
106
- config: proverConfig
107
- };
108
- }
@@ -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,34 +0,0 @@
1
- import { EthCheatCodes } from '@aztec/ethereum/test';
2
- import type { ViemClient } from '@aztec/ethereum/types';
3
- import type { EthAddress } from '@aztec/foundation/eth-address';
4
- import type { TestDateProvider } from '@aztec/foundation/timer';
5
- /**
6
- * Represents a watcher for a rollup contract.
7
- *
8
- * It started on a network like anvil where time traveling is allowed, and auto-mine is turned on
9
- * it will periodically check if the current slot have already been filled, e.g., there was an L2
10
- * block within the slot. And if so, it will time travel into the next slot.
11
- */
12
- export declare class AnvilTestWatcher {
13
- private cheatcodes;
14
- private dateProvider?;
15
- private isLocalNetwork;
16
- private rollup;
17
- private rollupCheatCodes;
18
- private l2SlotDuration;
19
- private filledRunningPromise?;
20
- private syncDateProviderPromise?;
21
- private markingAsProvenRunningPromise?;
22
- private logger;
23
- private isMarkingAsProven;
24
- constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l1Client: ViemClient, dateProvider?: TestDateProvider | undefined);
25
- setIsMarkingAsProven(isMarkingAsProven: boolean): void;
26
- setisLocalNetwork(isLocalNetwork: boolean): void;
27
- start(): Promise<void>;
28
- stop(): Promise<void>;
29
- trigger(): Promise<void>;
30
- markAsProven(): Promise<void>;
31
- syncDateProviderToL1IfBehind(): Promise<void>;
32
- warpTimeIfNeeded(): Promise<void>;
33
- }
34
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYW52aWxfdGVzdF93YXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9hbnZpbF90ZXN0X3dhdGNoZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLGFBQWEsRUFBb0IsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUV4RCxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUdoRSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBS2hFOzs7Ozs7R0FNRztBQUNILHFCQUFhLGdCQUFnQjtJQWdCekIsT0FBTyxDQUFDLFVBQVU7SUFHbEIsT0FBTyxDQUFDLFlBQVksQ0FBQztJQWxCdkIsT0FBTyxDQUFDLGNBQWMsQ0FBa0I7SUFFeEMsT0FBTyxDQUFDLE1BQU0sQ0FBc0Q7SUFDcEUsT0FBTyxDQUFDLGdCQUFnQixDQUFtQjtJQUMzQyxPQUFPLENBQUMsY0FBYyxDQUFVO0lBRWhDLE9BQU8sQ0FBQyxvQkFBb0IsQ0FBQyxDQUFpQjtJQUM5QyxPQUFPLENBQUMsdUJBQXVCLENBQUMsQ0FBaUI7SUFDakQsT0FBTyxDQUFDLDZCQUE2QixDQUFDLENBQWlCO0lBRXZELE9BQU8sQ0FBQyxNQUFNLENBQWlEO0lBRS9ELE9BQU8sQ0FBQyxpQkFBaUIsQ0FBUTtJQUVqQyxZQUNVLFVBQVUsRUFBRSxhQUFhLEVBQ2pDLGFBQWEsRUFBRSxVQUFVLEVBQ3pCLFFBQVEsRUFBRSxVQUFVLEVBQ1osWUFBWSxDQUFDLDhCQUFrQixFQWF4QztJQUVELG9CQUFvQixDQUFDLGlCQUFpQixFQUFFLE9BQU8sUUFHOUM7SUFFRCxpQkFBaUIsQ0FBQyxjQUFjLEVBQUUsT0FBTyxRQUV4QztJQUVLLEtBQUssa0JBeUJWO0lBRUssSUFBSSxrQkFJVDtJQUVLLE9BQU8sa0JBSVo7SUFFSyxZQUFZLGtCQUtqQjtJQUVLLDRCQUE0QixrQkFlakM7SUFFSyxnQkFBZ0Isa0JBd0NyQjtDQUNGIn0=
@@ -1 +0,0 @@
1
- {"version":3,"file":"anvil_test_watcher.d.ts","sourceRoot":"","sources":["../../src/testing/anvil_test_watcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAKhE;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAgBzB,OAAO,CAAC,UAAU;IAGlB,OAAO,CAAC,YAAY,CAAC;IAlBvB,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO,CAAC,MAAM,CAAsD;IACpE,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAU;IAEhC,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAC9C,OAAO,CAAC,uBAAuB,CAAC,CAAiB;IACjD,OAAO,CAAC,6BAA6B,CAAC,CAAiB;IAEvD,OAAO,CAAC,MAAM,CAAiD;IAE/D,OAAO,CAAC,iBAAiB,CAAQ;IAEjC,YACU,UAAU,EAAE,aAAa,EACjC,aAAa,EAAE,UAAU,EACzB,QAAQ,EAAE,UAAU,EACZ,YAAY,CAAC,8BAAkB,EAaxC;IAED,oBAAoB,CAAC,iBAAiB,EAAE,OAAO,QAG9C;IAED,iBAAiB,CAAC,cAAc,EAAE,OAAO,QAExC;IAEK,KAAK,kBAyBV;IAEK,IAAI,kBAIT;IAEK,OAAO,kBAIZ;IAEK,YAAY,kBAKjB;IAEK,4BAA4B,kBAejC;IAEK,gBAAgB,kBAwCrB;CACF"}
@@ -1,144 +0,0 @@
1
- import { RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { SlotNumber } from '@aztec/foundation/branded-types';
3
- import { createLogger } from '@aztec/foundation/log';
4
- import { RunningPromise } from '@aztec/foundation/running-promise';
5
- import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
6
- import { getAddress, getContract } from 'viem';
7
- /**
8
- * Represents a watcher for a rollup contract.
9
- *
10
- * It started on a network like anvil where time traveling is allowed, and auto-mine is turned on
11
- * it will periodically check if the current slot have already been filled, e.g., there was an L2
12
- * block within the slot. And if so, it will time travel into the next slot.
13
- */ export class AnvilTestWatcher {
14
- cheatcodes;
15
- dateProvider;
16
- isLocalNetwork;
17
- rollup;
18
- rollupCheatCodes;
19
- l2SlotDuration;
20
- filledRunningPromise;
21
- syncDateProviderPromise;
22
- markingAsProvenRunningPromise;
23
- logger;
24
- isMarkingAsProven;
25
- constructor(cheatcodes, rollupAddress, l1Client, dateProvider){
26
- this.cheatcodes = cheatcodes;
27
- this.dateProvider = dateProvider;
28
- this.isLocalNetwork = false;
29
- this.logger = createLogger(`aztecjs:utils:watcher`);
30
- this.isMarkingAsProven = true;
31
- this.rollup = getContract({
32
- address: getAddress(rollupAddress.toString()),
33
- abi: RollupAbi,
34
- client: l1Client
35
- });
36
- this.rollupCheatCodes = new RollupCheatCodes(this.cheatcodes, {
37
- rollupAddress
38
- });
39
- this.logger.debug(`Watcher created for rollup at ${rollupAddress}`);
40
- }
41
- setIsMarkingAsProven(isMarkingAsProven) {
42
- this.logger.warn(`Watcher is now ${isMarkingAsProven ? 'marking' : 'not marking'} blocks as proven`);
43
- this.isMarkingAsProven = isMarkingAsProven;
44
- }
45
- setisLocalNetwork(isLocalNetwork) {
46
- this.isLocalNetwork = isLocalNetwork;
47
- }
48
- async start() {
49
- if (this.filledRunningPromise) {
50
- throw new Error('Watcher already watching for filled slot');
51
- }
52
- const config = await this.rollupCheatCodes.getConfig();
53
- this.l2SlotDuration = config.slotDuration;
54
- // If auto mining is not supported (e.g., we are on a real network), then we
55
- // will simple do nothing. But if on an anvil or the like, this make sure that
56
- // the local network and tests don't break because time is frozen and we never get to
57
- // the next slot.
58
- const isAutoMining = await this.cheatcodes.isAutoMining();
59
- if (isAutoMining) {
60
- this.filledRunningPromise = new RunningPromise(()=>this.warpTimeIfNeeded(), this.logger, 200);
61
- this.filledRunningPromise.start();
62
- this.syncDateProviderPromise = new RunningPromise(()=>this.syncDateProviderToL1IfBehind(), this.logger, 200);
63
- this.syncDateProviderPromise.start();
64
- this.markingAsProvenRunningPromise = new RunningPromise(()=>this.markAsProven(), this.logger, 200);
65
- this.markingAsProvenRunningPromise.start();
66
- this.logger.info(`Watcher started for rollup at ${this.rollup.address}`);
67
- } else {
68
- this.logger.info(`Watcher not started because not auto mining`);
69
- }
70
- }
71
- async stop() {
72
- await this.filledRunningPromise?.stop();
73
- await this.syncDateProviderPromise?.stop();
74
- await this.markingAsProvenRunningPromise?.stop();
75
- }
76
- async trigger() {
77
- await this.filledRunningPromise?.trigger();
78
- await this.syncDateProviderPromise?.trigger();
79
- await this.markingAsProvenRunningPromise?.trigger();
80
- }
81
- async markAsProven() {
82
- if (!this.isMarkingAsProven) {
83
- return;
84
- }
85
- await this.rollupCheatCodes.markAsProven();
86
- }
87
- async syncDateProviderToL1IfBehind() {
88
- // this doesn't apply to the local network, because we don't have a date provider in the local network
89
- if (!this.dateProvider) {
90
- return;
91
- }
92
- const l1Time = await this.cheatcodes.timestamp() * 1000;
93
- const wallTime = this.dateProvider.now();
94
- if (l1Time > wallTime) {
95
- this.logger.warn(`L1 is ahead of wall time. Syncing wall time to L1 time`);
96
- this.dateProvider.setTime(l1Time);
97
- } else if (l1Time + Number(this.l2SlotDuration) * 1000 < wallTime) {
98
- this.logger.warn(`L1 is more than 1 L2 slot behind wall time. Warping to wall time`);
99
- await this.cheatcodes.warp(Math.ceil(wallTime / 1000));
100
- }
101
- }
102
- async warpTimeIfNeeded() {
103
- try {
104
- const currentSlot = SlotNumber.fromBigInt(await this.rollup.read.getCurrentSlot());
105
- const pendingCheckpointNumber = await this.rollup.read.getPendingCheckpointNumber();
106
- const checkpointLog = await this.rollup.read.getCheckpoint([
107
- pendingCheckpointNumber
108
- ]);
109
- const nextSlot = SlotNumber(currentSlot + 1);
110
- const nextSlotTimestamp = Number(await this.rollup.read.getTimestampForSlot([
111
- BigInt(nextSlot)
112
- ]));
113
- if (BigInt(currentSlot) === checkpointLog.slotNumber) {
114
- // We should jump to the next slot
115
- try {
116
- await this.cheatcodes.warp(nextSlotTimestamp, {
117
- resetBlockInterval: true
118
- });
119
- } catch (e) {
120
- this.logger.error(`Failed to warp to timestamp ${nextSlotTimestamp}: ${e}`);
121
- }
122
- this.logger.info(`Slot ${currentSlot} was filled, jumped to next slot`);
123
- return;
124
- }
125
- // If we are not in local network, we don't need to warp time
126
- if (!this.isLocalNetwork) {
127
- return;
128
- }
129
- const currentTimestamp = this.dateProvider?.now() ?? Date.now();
130
- if (currentTimestamp > nextSlotTimestamp * 1000) {
131
- try {
132
- await this.cheatcodes.warp(nextSlotTimestamp, {
133
- resetBlockInterval: true
134
- });
135
- } catch (e) {
136
- this.logger.error(`Failed to warp to timestamp ${nextSlotTimestamp}: ${e}`);
137
- }
138
- this.logger.info(`Slot ${currentSlot} was missed, jumped to next slot`);
139
- }
140
- } catch {
141
- this.logger.error('mineIfSlotFilled failed');
142
- }
143
- }
144
- }
@@ -1,44 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- NARGO=${NARGO:-nargo}
5
- BB=${BB:-bb}
6
-
7
- # If help is requested, show Aztec-specific info then run nargo compile help and then exit in order to not trigger
8
- # transpilation
9
- for arg in "$@"; do
10
- if [ "$arg" == "--help" ] || [ "$arg" == "-h" ]; then
11
- cat << 'EOF'
12
- Aztec Compile - Compile Aztec Noir contracts
13
-
14
- This command compiles Aztec Noir contracts using nargo and then automatically
15
- postprocesses them to generate Aztec specific artifacts including:
16
- - Transpiled contract artifacts
17
- - Verification keys
18
-
19
- The compiled contracts will be placed in the target/ directory by default.
20
-
21
- ---
22
- Underlying nargo compile options:
23
-
24
- EOF
25
- nargo compile --help
26
- exit 0
27
- fi
28
- done
29
-
30
- # Run nargo compile.
31
- $NARGO compile "$@"
32
-
33
- echo "Postprocessing contract..."
34
- $BB aztec_process
35
-
36
- # Strip internal prefixes from all compiled contract JSONs in target directory
37
- # TODO: This should be part of bb aztec_process!
38
- for json in target/*.json; do
39
- temp_file="${json}.tmp"
40
- jq '.functions |= map(.name |= sub("^__aztec_nr_internals__"; ""))' "$json" > "$temp_file"
41
- mv "$temp_file" "$json"
42
- done
43
-
44
- echo "Compilation complete!"
@@ -1,47 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from 'fs/promises';
3
- import path from 'path';
4
-
5
- // Simple script to extract a contract function as a separate Noir artifact.
6
- // We need to use this since the transpiling that we do on public functions make the contract artifacts
7
- // unreadable by noir tooling, since they are no longer following the noir artifact format.
8
- async function main() {
9
- let [contractArtifactPath, functionName] = process.argv.slice(2);
10
- if (!contractArtifactPath || !functionName) {
11
- console.log('Usage: node extractFunctionAsNoirArtifact.js <contractArtifactPath> <functionName>');
12
- return;
13
- }
14
-
15
- const contractArtifact = JSON.parse(await fs.readFile(contractArtifactPath, 'utf8'));
16
- const func = contractArtifact.functions.find(f => f.name === functionName);
17
- if (!func) {
18
- console.error(`Function ${functionName} not found in ${contractArtifactPath}`);
19
- return;
20
- }
21
-
22
- const artifact = {
23
- noir_version: contractArtifact.noir_version,
24
- hash: 0,
25
- abi: func.abi,
26
- bytecode: func.bytecode,
27
- debug_symbols: func.debug_symbols,
28
- file_map: contractArtifact.file_map,
29
- expression_width: {
30
- Bounded: {
31
- width: 4,
32
- },
33
- },
34
- };
35
-
36
- const outputDir = path.dirname(contractArtifactPath);
37
- const outputName = path.basename(contractArtifactPath, '.json') + `-${functionName}.json`;
38
-
39
- const outPath = path.join(outputDir, outputName);
40
-
41
- await fs.writeFile(outPath, JSON.stringify(artifact, null, 2));
42
- }
43
-
44
- main().catch(err => {
45
- console.error(err);
46
- process.exit(1);
47
- });
@@ -1,59 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -eu
3
-
4
- # If first arg is -h or --help, print usage.
5
- if [ $# -lt 2 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
6
- cat << 'EOF'
7
- Aztec Flamegraph - Generate a gate count flamegraph for an aztec contract function.
8
-
9
- Usage: aztec flamegraph <contract_artifact> <function>
10
-
11
- Options:
12
- -h, --help Print help
13
-
14
- Will output an svg at <artifact_path>/<contract>-<function>-flamegraph.svg.
15
- You can open it in your browser to view it.
16
-
17
- EOF
18
- exit 0
19
- fi
20
-
21
- cleanup() {
22
- set +e
23
- if [ -f "$function_artifact" ]; then
24
- rm -f "$function_artifact"
25
- fi
26
- }
27
-
28
- trap cleanup EXIT
29
-
30
- # Get the directory of the script
31
- script_dir=$(realpath $(dirname $0))
32
-
33
- PROFILER=${PROFILER_PATH:-noir-profiler}
34
- BB=${BB:-bb}
35
-
36
- # first console arg is contract name in camel case or path to contract artifact
37
- contract=$1
38
-
39
- # second console arg is the contract function
40
- function=$2
41
-
42
- if [ ! -f "$contract" ]; then
43
- echo "Error: Contract artifact not found at: $contract"
44
- exit 1
45
- fi
46
- artifact_path=$contract
47
- function_artifact="${artifact_path%%.json}-${function}.json"
48
- output_dir=$(dirname "$artifact_path")
49
-
50
- # Extract artifact for the specific function.
51
- node $script_dir/extract_function.js "$artifact_path" $function
52
-
53
- # Generate the flamegraph
54
- $PROFILER gates --artifact-path "$function_artifact" --backend-path "$BB" --backend-gates-command "gates" --output "$output_dir" --scheme chonk --include_gates_per_opcode
55
-
56
- # Save as $artifact_name-$function-flamegraph.svg
57
- output_file="${function_artifact%%.json}-flamegraph.svg"
58
- mv "$output_dir/__aztec_nr_internals__${function}_gates.svg" "$output_file"
59
- echo "Flamegraph generated at: $output_file"
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- # Get the actual aztec version for the git tag.
5
- AZTEC_VERSION=$(jq -r '.version' $(dirname $0)/../package.json)
6
- NARGO_TOML_PATH="Nargo.toml"
7
- MAIN_NR_PATH="src/main.nr"
8
-
9
- if [ ! -f "$NARGO_TOML_PATH" ]; then
10
- >&2 echo "Warning: Could not find Nargo.toml at $NARGO_TOML_PATH to add aztec dependency"
11
- exit 1
12
- fi
13
-
14
- if [ ! -f "$MAIN_NR_PATH" ]; then
15
- >&2 echo "Warning: Could not find main.nr at $MAIN_NR_PATH"
16
- exit 1
17
- fi
18
-
19
- # Add aztec dependency to Nargo.toml
20
- echo "" >> "$NARGO_TOML_PATH"
21
- echo "aztec = { git=\"https://github.com/AztecProtocol/aztec-nr\", tag=\"v${AZTEC_VERSION}\", directory=\"aztec\" }" >> "$NARGO_TOML_PATH"
22
- echo "Added aztec dependency (v${AZTEC_VERSION}) to Nargo.toml"
23
-
24
- # Replace the contents of main.nr with the Aztec contract template
25
- cat > "$MAIN_NR_PATH" << 'EOF'
26
- use aztec::macros::aztec;
27
-
28
- #[aztec]
29
- contract Main {}
30
- EOF
31
- echo "Created main.nr with Aztec contract template"
@@ -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
- }