@aztec/aztec 0.0.1-commit.d3ec352c → 0.0.1-commit.d58ff9d0

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 (173) hide show
  1. package/dest/bin/index.js +14 -5
  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 -31
  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 +53 -48
  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 +4 -37
  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/migrate_ha_db.d.ts +3 -0
  18. package/dest/cli/cmds/migrate_ha_db.d.ts.map +1 -0
  19. package/dest/cli/cmds/migrate_ha_db.js +27 -0
  20. package/dest/cli/cmds/profile.d.ts +4 -0
  21. package/dest/cli/cmds/profile.d.ts.map +1 -0
  22. package/dest/cli/cmds/profile.js +8 -0
  23. package/dest/cli/cmds/profile_flamegraph.d.ts +4 -0
  24. package/dest/cli/cmds/profile_flamegraph.d.ts.map +1 -0
  25. package/dest/cli/cmds/profile_flamegraph.js +52 -0
  26. package/dest/cli/cmds/profile_gates.d.ts +4 -0
  27. package/dest/cli/cmds/profile_gates.d.ts.map +1 -0
  28. package/dest/cli/cmds/profile_gates.js +76 -0
  29. package/dest/cli/cmds/profile_utils.d.ts +18 -0
  30. package/dest/cli/cmds/profile_utils.d.ts.map +1 -0
  31. package/dest/cli/cmds/profile_utils.js +50 -0
  32. package/dest/cli/cmds/prover.d.ts +4 -0
  33. package/dest/cli/cmds/prover.d.ts.map +1 -0
  34. package/dest/cli/cmds/prover.js +24 -0
  35. package/dest/cli/cmds/standby.d.ts +56 -0
  36. package/dest/cli/cmds/standby.d.ts.map +1 -0
  37. package/dest/cli/cmds/standby.js +140 -0
  38. package/dest/cli/cmds/start_bot.d.ts +3 -3
  39. package/dest/cli/cmds/start_bot.d.ts.map +1 -1
  40. package/dest/cli/cmds/start_bot.js +18 -10
  41. package/dest/cli/cmds/start_node.d.ts +3 -2
  42. package/dest/cli/cmds/start_node.d.ts.map +1 -1
  43. package/dest/cli/cmds/start_node.js +83 -52
  44. package/dest/cli/cmds/start_p2p_bootstrap.d.ts +2 -2
  45. package/dest/cli/cmds/start_p2p_bootstrap.d.ts.map +1 -1
  46. package/dest/cli/cmds/start_p2p_bootstrap.js +2 -3
  47. package/dest/cli/cmds/start_prover_agent.d.ts +1 -1
  48. package/dest/cli/cmds/start_prover_agent.d.ts.map +1 -1
  49. package/dest/cli/cmds/start_prover_agent.js +8 -20
  50. package/dest/cli/cmds/start_prover_broker.d.ts +1 -1
  51. package/dest/cli/cmds/start_prover_broker.d.ts.map +1 -1
  52. package/dest/cli/cmds/start_prover_broker.js +25 -16
  53. package/dest/cli/cmds/start_txe.d.ts +2 -2
  54. package/dest/cli/cmds/start_txe.d.ts.map +1 -1
  55. package/dest/cli/cmds/start_txe.js +6 -5
  56. package/dest/cli/cmds/utils/artifacts.d.ts +26 -0
  57. package/dest/cli/cmds/utils/artifacts.d.ts.map +1 -0
  58. package/dest/cli/cmds/utils/artifacts.js +24 -0
  59. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts +21 -0
  60. package/dest/cli/cmds/utils/collect_crate_dirs.d.ts.map +1 -0
  61. package/dest/cli/cmds/utils/collect_crate_dirs.js +114 -0
  62. package/dest/cli/cmds/utils/needs_recompile.d.ts +10 -0
  63. package/dest/cli/cmds/utils/needs_recompile.d.ts.map +1 -0
  64. package/dest/cli/cmds/utils/needs_recompile.js +90 -0
  65. package/dest/cli/cmds/utils/spawn.d.ts +3 -0
  66. package/dest/cli/cmds/utils/spawn.d.ts.map +1 -0
  67. package/dest/cli/cmds/utils/spawn.js +16 -0
  68. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts +4 -0
  69. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.d.ts.map +1 -0
  70. package/dest/cli/cmds/utils/warn_if_aztec_version_mismatch.js +61 -0
  71. package/dest/cli/util.d.ts +14 -20
  72. package/dest/cli/util.d.ts.map +1 -1
  73. package/dest/cli/util.js +38 -101
  74. package/dest/examples/token.js +12 -12
  75. package/dest/examples/util.d.ts +2 -2
  76. package/dest/examples/util.d.ts.map +1 -1
  77. package/dest/local-network/auth_registry.d.ts +5 -0
  78. package/dest/local-network/auth_registry.d.ts.map +1 -0
  79. package/dest/local-network/auth_registry.js +17 -0
  80. package/dest/local-network/banana_fpc.d.ts +3 -2
  81. package/dest/local-network/banana_fpc.d.ts.map +1 -1
  82. package/dest/local-network/banana_fpc.js +14 -10
  83. package/dest/local-network/local-network.d.ts +18 -41
  84. package/dest/local-network/local-network.d.ts.map +1 -1
  85. package/dest/local-network/local-network.js +98 -76
  86. package/dest/testing/cheat_codes.d.ts +19 -23
  87. package/dest/testing/cheat_codes.d.ts.map +1 -1
  88. package/dest/testing/cheat_codes.js +17 -43
  89. package/dest/testing/epoch_test_settler.d.ts +19 -0
  90. package/dest/testing/epoch_test_settler.d.ts.map +1 -0
  91. package/dest/testing/epoch_test_settler.js +42 -0
  92. package/dest/testing/index.d.ts +4 -2
  93. package/dest/testing/index.d.ts.map +1 -1
  94. package/dest/testing/index.js +3 -1
  95. package/dest/testing/local-network.d.ts +51 -0
  96. package/dest/testing/local-network.d.ts.map +1 -0
  97. package/dest/testing/local-network.js +60 -0
  98. package/dest/testing/token_allowed_setup.d.ts +12 -0
  99. package/dest/testing/token_allowed_setup.d.ts.map +1 -0
  100. package/dest/testing/token_allowed_setup.js +24 -0
  101. package/package.json +36 -33
  102. package/scripts/add_crate.sh +53 -0
  103. package/scripts/aztec.sh +26 -9
  104. package/scripts/init.sh +23 -19
  105. package/scripts/new.sh +48 -24
  106. package/scripts/setup_workspace.sh +69 -0
  107. package/scripts/templates/blank/contract/Nargo.toml +6 -0
  108. package/scripts/templates/blank/contract/src/main.nr +10 -0
  109. package/scripts/templates/blank/test/Nargo.toml +7 -0
  110. package/scripts/templates/blank/test/src/lib.nr +11 -0
  111. package/scripts/templates/counter/contract/Nargo.toml +7 -0
  112. package/scripts/templates/counter/contract/src/main.nr +48 -0
  113. package/scripts/templates/counter/test/Nargo.toml +7 -0
  114. package/scripts/templates/counter/test/src/lib.nr +32 -0
  115. package/src/bin/index.ts +15 -5
  116. package/src/cli/admin_api_key_store.ts +128 -0
  117. package/src/cli/aztec_start_action.ts +69 -23
  118. package/src/cli/aztec_start_options.ts +61 -55
  119. package/src/cli/cli.ts +4 -37
  120. package/src/cli/cmds/compile.ts +205 -0
  121. package/src/cli/cmds/migrate_ha_db.ts +43 -0
  122. package/src/cli/cmds/profile.ts +26 -0
  123. package/src/cli/cmds/profile_flamegraph.ts +64 -0
  124. package/src/cli/cmds/profile_gates.ts +84 -0
  125. package/src/cli/cmds/profile_utils.ts +58 -0
  126. package/src/cli/cmds/prover.ts +42 -0
  127. package/src/cli/cmds/standby.ts +184 -0
  128. package/src/cli/cmds/start_bot.ts +18 -12
  129. package/src/cli/cmds/start_node.ts +93 -53
  130. package/src/cli/cmds/start_p2p_bootstrap.ts +3 -3
  131. package/src/cli/cmds/start_prover_agent.ts +9 -20
  132. package/src/cli/cmds/start_prover_broker.ts +29 -26
  133. package/src/cli/cmds/start_txe.ts +7 -5
  134. package/src/cli/cmds/utils/artifacts.ts +49 -0
  135. package/src/cli/cmds/utils/collect_crate_dirs.ts +118 -0
  136. package/src/cli/cmds/utils/needs_recompile.ts +98 -0
  137. package/src/cli/cmds/utils/spawn.ts +16 -0
  138. package/src/cli/cmds/utils/warn_if_aztec_version_mismatch.ts +76 -0
  139. package/src/cli/util.ts +41 -120
  140. package/src/examples/token.ts +21 -13
  141. package/src/examples/util.ts +1 -1
  142. package/src/local-network/auth_registry.ts +19 -0
  143. package/src/local-network/banana_fpc.ts +17 -9
  144. package/src/local-network/local-network.ts +124 -111
  145. package/src/testing/cheat_codes.ts +18 -49
  146. package/src/testing/epoch_test_settler.ts +47 -0
  147. package/src/testing/index.ts +3 -1
  148. package/src/testing/local-network.ts +97 -0
  149. package/src/testing/token_allowed_setup.ts +26 -0
  150. package/dest/cli/cmds/start_archiver.d.ts +0 -9
  151. package/dest/cli/cmds/start_archiver.d.ts.map +0 -1
  152. package/dest/cli/cmds/start_archiver.js +0 -50
  153. package/dest/cli/cmds/start_blob_sink.d.ts +0 -3
  154. package/dest/cli/cmds/start_blob_sink.d.ts.map +0 -1
  155. package/dest/cli/cmds/start_blob_sink.js +0 -33
  156. package/dest/cli/cmds/start_prover_node.d.ts +0 -7
  157. package/dest/cli/cmds/start_prover_node.d.ts.map +0 -1
  158. package/dest/cli/cmds/start_prover_node.js +0 -108
  159. package/dest/cli/release_version.d.ts +0 -2
  160. package/dest/cli/release_version.d.ts.map +0 -1
  161. package/dest/cli/release_version.js +0 -14
  162. package/dest/testing/anvil_test_watcher.d.ts +0 -34
  163. package/dest/testing/anvil_test_watcher.d.ts.map +0 -1
  164. package/dest/testing/anvil_test_watcher.js +0 -144
  165. package/scripts/compile.sh +0 -44
  166. package/scripts/extract_function.js +0 -47
  167. package/scripts/flamegraph.sh +0 -59
  168. package/scripts/setup_project.sh +0 -31
  169. package/src/cli/cmds/start_archiver.ts +0 -61
  170. package/src/cli/cmds/start_blob_sink.ts +0 -57
  171. package/src/cli/cmds/start_prover_node.ts +0 -124
  172. package/src/cli/release_version.ts +0 -21
  173. package/src/testing/anvil_test_watcher.ts +0 -166
@@ -1,55 +1,62 @@
1
1
  #!/usr/bin/env -S node --no-warnings
2
2
  import { getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
4
- import { EthAddress } from '@aztec/aztec.js/addresses';
5
- import { createBlobSinkClient } from '@aztec/blob-sink/client';
3
+ import { createAztecNodeService } from '@aztec/aztec-node';
4
+ import { getConfigEnvVars } from '@aztec/aztec-node/config';
5
+ import { Fr } from '@aztec/aztec.js/fields';
6
+ import { createLogger } from '@aztec/aztec.js/log';
7
+ import { createBlobClient } from '@aztec/blob-client/client';
6
8
  import { GENESIS_ARCHIVE_ROOT } from '@aztec/constants';
7
- import { NULL_KEY, createEthereumChain, deployL1Contracts, deployMulticall3, getL1ContractsConfigEnvVars, waitForPublicClient } from '@aztec/ethereum';
8
- import { EthCheatCodes } from '@aztec/ethereum/test';
9
+ import { waitForPublicClient } from '@aztec/ethereum/client';
10
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
11
+ import { NULL_KEY } from '@aztec/ethereum/constants';
12
+ import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
9
13
  import { SecretValue } from '@aztec/foundation/config';
10
- import { Fr } from '@aztec/foundation/fields';
11
- import { createLogger } from '@aztec/foundation/log';
14
+ import { EthAddress } from '@aztec/foundation/eth-address';
12
15
  import { TestDateProvider } from '@aztec/foundation/timer';
13
16
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
14
17
  import { protocolContractsHash } from '@aztec/protocol-contracts';
18
+ import { AztecAddress } from '@aztec/stdlib/aztec-address';
19
+ import { TxStatus } from '@aztec/stdlib/tx';
15
20
  import { getConfigEnvVars as getTelemetryClientConfig, initTelemetryClient } from '@aztec/telemetry-client';
16
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
21
+ import { EmbeddedWallet } from '@aztec/wallets/embedded';
22
+ import { createFundedInitializerlessAccounts } from '@aztec/wallets/testing';
17
23
  import { getGenesisValues } from '@aztec/world-state/testing';
18
- import { createPublicClient, fallback, http as httpViemTransport } from 'viem';
19
24
  import { mnemonicToAccount, privateKeyToAddress } from 'viem/accounts';
20
25
  import { foundry } from 'viem/chains';
21
26
  import { createAccountLogs } from '../cli/util.js';
22
27
  import { DefaultMnemonic } from '../mnemonic.js';
23
- import { AnvilTestWatcher } from '../testing/anvil_test_watcher.js';
28
+ import { getTokenAllowedSetupFunctions } from '../testing/token_allowed_setup.js';
29
+ import { publishStandardAuthRegistry } from './auth_registry.js';
24
30
  import { getBananaFPCAddress, setupBananaFPC } from './banana_fpc.js';
25
31
  import { getSponsoredFPCAddress } from './sponsored_fpc.js';
26
32
  const logger = createLogger('local-network');
27
- const localAnvil = foundry;
33
+ // The embedded wallet defaults to waiting for PROPOSED, which returns as soon as a tx lands in a
34
+ // proposed L2 block. That is flaky for the serial sandbox setup below: a proposed block can be
35
+ // pruned before its checkpoint is published, dropping a tx we already moved on from ("Tx dropped by
36
+ // P2P node"). Wait for the checkpoint so each setup tx is durably included before the next is sent.
37
+ const setupWaitOpts = {
38
+ waitForStatus: TxStatus.CHECKPOINTED
39
+ };
28
40
  /**
29
41
  * Function to deploy our L1 contracts to the local network L1
30
42
  * @param aztecNodeConfig - The Aztec Node Config
31
43
  * @param hdAccount - Account for publishing L1 contracts
32
- */ export async function deployContractsToL1(aztecNodeConfig, hdAccount, contractDeployLogger = logger, opts = {}) {
33
- const chain = aztecNodeConfig.l1RpcUrls.length > 0 ? createEthereumChain(aztecNodeConfig.l1RpcUrls, aztecNodeConfig.l1ChainId) : {
34
- chainInfo: localAnvil
35
- };
44
+ */ export async function deployContractsToL1(aztecNodeConfig, privateKey, opts = {}) {
36
45
  await waitForPublicClient(aztecNodeConfig);
37
- const l1Contracts = await deployL1Contracts(aztecNodeConfig.l1RpcUrls, hdAccount, chain.chainInfo, contractDeployLogger, {
46
+ const l1Contracts = await deployAztecL1Contracts(aztecNodeConfig.l1RpcUrls[0], privateKey, foundry.id, {
38
47
  ...getL1ContractsConfigEnvVars(),
39
48
  ...aztecNodeConfig,
40
49
  vkTreeRoot: getVKTreeRoot(),
41
50
  protocolContractsHash,
42
51
  genesisArchiveRoot: opts.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
43
- salt: opts.salt,
44
52
  feeJuicePortalInitialBalance: opts.feeJuicePortalInitialBalance,
45
53
  aztecTargetCommitteeSize: 0,
46
- slasherFlavor: 'none',
54
+ slasherEnabled: false,
47
55
  realVerifier: false
48
56
  });
49
- await deployMulticall3(l1Contracts.l1Client, logger);
50
- aztecNodeConfig.l1Contracts = l1Contracts.l1ContractAddresses;
57
+ Object.assign(aztecNodeConfig, l1Contracts.l1ContractAddresses);
51
58
  aztecNodeConfig.rollupVersion = l1Contracts.rollupVersion;
52
- return aztecNodeConfig.l1Contracts;
59
+ return l1Contracts.l1ContractAddresses;
53
60
  }
54
61
  /**
55
62
  * Create and start a new Aztec Node and PXE. Deploys L1 contracts.
@@ -64,14 +71,44 @@ const localAnvil = foundry;
64
71
  if ((config.l1RpcUrls?.length || 0) > 1) {
65
72
  logger.warn(`Multiple L1 RPC URLs provided. Local networks will only use the first one: ${l1RpcUrl}`);
66
73
  }
74
+ // The local network deploys a banana FPC with Token contracts, so include Token entries
75
+ // in the setup allowlist so FPC-based fee payments work out of the box.
76
+ const tokenAllowList = await getTokenAllowedSetupFunctions();
77
+ const envConfig = getConfigEnvVars();
67
78
  const aztecNodeConfig = {
68
- ...getConfigEnvVars(),
69
- ...config
79
+ ...envConfig,
80
+ ...config,
81
+ skipOrphanProposedBlockPruning: true,
82
+ // The local network builds node config from env without a DATA_DIRECTORY, so the validator's
83
+ // local signing protection runs against an ephemeral store. That is acceptable for this dev
84
+ // network; production validators must persist it and fail-fast when the data directory is unset.
85
+ allowEphemeralSigningProtection: config.allowEphemeralSigningProtection ?? true,
86
+ txPublicSetupAllowListExtend: [
87
+ ...tokenAllowList,
88
+ ...config.txPublicSetupAllowListExtend ?? []
89
+ ],
90
+ // The local network runs against anvil with no committee, so it defaults to the deterministic
91
+ // AutomineSequencer, which owns L1 time control (warps the dateProvider and L1 timestamps to slot
92
+ // boundaries as it builds), replacing the deleted AnvilTestWatcher. This remains true when p2p is
93
+ // enabled for local peer testing; local-network is not a mode for connecting to an existing network.
94
+ useAutomineSequencer: config.useAutomineSequencer ?? true,
95
+ // The AutomineSequencer owns epoch proving in the local network — it writes epoch out hashes to
96
+ // the L1 Outbox and advances the proven tip as checkpoints land, through the same serial queue as
97
+ // its builds — replacing the standalone EpochTestSettler that used to race the build loop.
98
+ automineEnableProveEpoch: config.automineEnableProveEpoch ?? true,
99
+ // Defaults for the local network / sandbox; callers (e.g. the CLI) may override. No real proving
100
+ // happens here — the AutomineSequencer synthetically settles epochs. Short epochs let it write out
101
+ // hashes quickly (so users can consume L2-to-L1 messages without a long wait), with a wider
102
+ // proof-submission window so the synthetic settler has headroom before the rollup would prune an
103
+ // unproven checkpoint.
104
+ realProofs: config.realProofs ?? false,
105
+ aztecEpochDuration: config.aztecEpochDuration ?? 4,
106
+ aztecProofSubmissionEpochs: config.aztecProofSubmissionEpochs ?? 2
70
107
  };
71
108
  const hdAccount = mnemonicToAccount(config.l1Mnemonic || DefaultMnemonic);
72
- if (aztecNodeConfig.publisherPrivateKeys == undefined || !aztecNodeConfig.publisherPrivateKeys.length || aztecNodeConfig.publisherPrivateKeys[0].getValue() === NULL_KEY) {
109
+ if (aztecNodeConfig.sequencerPublisherPrivateKeys == undefined || !aztecNodeConfig.sequencerPublisherPrivateKeys.length || aztecNodeConfig.sequencerPublisherPrivateKeys[0].getValue() === NULL_KEY) {
73
110
  const privKey = hdAccount.getHdKey().privateKey;
74
- aztecNodeConfig.publisherPrivateKeys = [
111
+ aztecNodeConfig.sequencerPublisherPrivateKeys = [
75
112
  new SecretValue(`0x${Buffer.from(privKey).toString('hex')}`)
76
113
  ];
77
114
  }
@@ -85,7 +122,7 @@ const localAnvil = foundry;
85
122
  const initialAccounts = await (async ()=>{
86
123
  if (config.testAccounts === true || config.testAccounts === undefined) {
87
124
  if (aztecNodeConfig.p2pEnabled) {
88
- userLog(`Not setting up test accounts as we are connecting to a network`);
125
+ userLog(`Not setting up test accounts when p2p is enabled`);
89
126
  } else {
90
127
  userLog(`Setting up test accounts`);
91
128
  return await getInitialTestAccountsData();
@@ -95,69 +132,53 @@ const localAnvil = foundry;
95
132
  })();
96
133
  const bananaFPC = await getBananaFPCAddress(initialAccounts);
97
134
  const sponsoredFPC = await getSponsoredFPCAddress();
98
- const fundedAddresses = initialAccounts.length ? [
135
+ const prefundAddresses = (aztecNodeConfig.prefundAddresses ?? []).map((a)=>AztecAddress.fromStringUnsafe(a));
136
+ const fundedAddresses = [
99
137
  ...initialAccounts.map((a)=>a.address),
100
- bananaFPC,
101
- sponsoredFPC
102
- ] : [];
103
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(fundedAddresses);
104
- let watcher = undefined;
138
+ ...initialAccounts.length ? [
139
+ bananaFPC,
140
+ sponsoredFPC
141
+ ] : [],
142
+ ...prefundAddresses
143
+ ];
144
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(fundedAddresses, config.initialAccountFeeJuice);
105
145
  const dateProvider = new TestDateProvider();
106
146
  if (!aztecNodeConfig.p2pEnabled) {
107
- const l1ContractAddresses = await deployContractsToL1(aztecNodeConfig, hdAccount, undefined, {
108
- assumeProvenThroughBlockNumber: Number.MAX_SAFE_INTEGER,
147
+ await deployContractsToL1(aztecNodeConfig, aztecNodeConfig.validatorPrivateKeys.getValue()[0], {
109
148
  genesisArchiveRoot,
110
- salt: config.deployAztecContractsSalt ? parseInt(config.deployAztecContractsSalt) : undefined,
111
149
  feeJuicePortalInitialBalance: fundingNeeded
112
150
  });
113
- const chain = aztecNodeConfig.l1RpcUrls.length > 0 ? createEthereumChain([
114
- l1RpcUrl
115
- ], aztecNodeConfig.l1ChainId) : {
116
- chainInfo: localAnvil
117
- };
118
- const publicClient = createPublicClient({
119
- chain: chain.chainInfo,
120
- transport: fallback([
121
- httpViemTransport(l1RpcUrl)
122
- ])
123
- });
124
- watcher = new AnvilTestWatcher(new EthCheatCodes([
125
- l1RpcUrl
126
- ], dateProvider), l1ContractAddresses.rollupAddress, publicClient, dateProvider);
127
- watcher.setisLocalNetwork(true);
128
- await watcher.start();
129
151
  }
130
- const telemetry = initTelemetryClient(getTelemetryClientConfig());
131
- // Create a local blob sink client inside the local network, no http connectivity
132
- const blobSinkClient = createBlobSinkClient();
152
+ const telemetry = await initTelemetryClient(getTelemetryClientConfig());
153
+ // Create a local blob client client inside the local network, no http connectivity
154
+ const blobClient = createBlobClient();
133
155
  const node = await createAztecNode(aztecNodeConfig, {
134
156
  telemetry,
135
- blobSinkClient,
157
+ blobClient,
136
158
  dateProvider
137
159
  }, {
138
- prefilledPublicData
160
+ genesis
139
161
  });
140
162
  if (initialAccounts.length) {
141
- const PXEConfig = {
142
- proverEnabled: aztecNodeConfig.realProofs
143
- };
144
- const wallet = await TestWallet.create(node, PXEConfig);
163
+ const wallet = await EmbeddedWallet.create(node, {
164
+ pxeConfig: {
165
+ proverEnabled: aztecNodeConfig.realProofs
166
+ },
167
+ ephemeral: true
168
+ });
145
169
  userLog('Setting up funded test accounts...');
146
- const accountManagers = await deployFundedSchnorrAccounts(wallet, node, initialAccounts);
147
- const accountsWithSecrets = accountManagers.map((manager, i)=>({
148
- account: manager,
149
- secretKey: initialAccounts[i].secret
150
- }));
151
- const accLogs = await createAccountLogs(accountsWithSecrets, wallet);
170
+ const accountManagers = await createFundedInitializerlessAccounts(wallet, initialAccounts);
171
+ const accLogs = await createAccountLogs(accountManagers, wallet);
152
172
  userLog(accLogs.join(''));
153
- await setupBananaFPC(initialAccounts, wallet, userLog);
173
+ userLog('Publishing standard AuthRegistry contract...');
174
+ await publishStandardAuthRegistry(wallet, initialAccounts[0].address, setupWaitOpts);
175
+ await setupBananaFPC(initialAccounts, wallet, userLog, setupWaitOpts);
154
176
  userLog(`SponsoredFPC: ${await getSponsoredFPCAddress()}`);
155
177
  // We no longer need the wallet once we've setup the accounts so we stop the underlying PXE job queue
156
178
  await wallet.stop();
157
179
  }
158
180
  const stop = async ()=>{
159
181
  await node.stop();
160
- await watcher?.stop();
161
182
  };
162
183
  return {
163
184
  node,
@@ -169,15 +190,16 @@ const localAnvil = foundry;
169
190
  * @param config - Optional Aztec node settings.
170
191
  */ export async function createAztecNode(config = {}, deps = {}, options = {}) {
171
192
  // TODO(#12272): will clean this up. This is criminal.
172
- const { l1Contracts, ...rest } = getConfigEnvVars();
193
+ // Not sure why this was ever done. Will be fixed in A-989, A-991, A-990.
173
194
  const aztecNodeConfig = {
174
- ...rest,
175
- ...config,
176
- l1Contracts: {
177
- ...l1Contracts,
178
- ...config.l1Contracts
179
- }
195
+ ...getConfigEnvVars(),
196
+ ...config
180
197
  };
181
- const node = await AztecNodeService.createAndSync(aztecNodeConfig, deps, options);
198
+ const node = await createAztecNodeService(aztecNodeConfig, {
199
+ ...deps,
200
+ proverNodeDeps: {
201
+ broker: deps.proverBroker
202
+ }
203
+ }, options);
182
204
  return node;
183
205
  }
@@ -1,15 +1,14 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
2
  import type { DateProvider } from '@aztec/foundation/timer';
3
- import type { SequencerClient } from '@aztec/sequencer-client';
4
- import type { AztecNode } from '@aztec/stdlib/interfaces/client';
3
+ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
5
4
  /**
6
- * A class that provides utility functions for interacting with the chain.
7
- * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
8
- * they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
9
- * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
5
+ * Wrapper for Aztec Debug API.
6
+ * @deprecated use the AztecNode debug API directly.
10
7
  */
11
8
  export declare class CheatCodes {
9
+ /** Cheat codes for L1.*/
12
10
  eth: EthCheatCodes;
11
+ /** Cheat codes for the Aztec Rollup contract on L1. */
13
12
  rollup: RollupCheatCodes;
14
13
  constructor(
15
14
  /** Cheat codes for L1.*/
@@ -18,24 +17,21 @@ export declare class CheatCodes {
18
17
  rollup: RollupCheatCodes);
19
18
  static create(rpcUrls: string[], node: AztecNode, dateProvider: DateProvider): Promise<CheatCodes>;
20
19
  /**
21
- * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
22
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
23
- * by the slot number, which advances in fixed intervals.
24
- * This is useful for testing time-dependent contract behavior.
25
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
26
- * @param node - The Aztec node used to query if a new block has been mined.
27
- * @param targetTimestamp - The target timestamp to warp to (in seconds)
20
+ * Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
21
+ * the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
22
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
23
+ * @param targetTimestamp - The target timestamp to warp to (in seconds).
24
+ * @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
28
25
  */
29
- warpL2TimeAtLeastTo(sequencerClient: SequencerClient, node: AztecNode, targetTimestamp: bigint | number): Promise<void>;
26
+ warpL2TimeAtLeastTo(node: AztecNode & AztecNodeDebug, targetTimestamp: bigint | number): Promise<void>;
30
27
  /**
31
- * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
32
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
33
- * number, which advances in fixed intervals.
34
- * This is useful for testing time-dependent contract behavior.
35
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
36
- * @param node - The Aztec node used to query if a new block has been mined.
37
- * @param duration - The duration to advance time by (in seconds)
28
+ * Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
29
+ * least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
30
+ * queue.
31
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
32
+ * @param duration - The duration to advance time by (in seconds).
33
+ * @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
38
34
  */
39
- warpL2TimeAtLeastBy(sequencerClient: SequencerClient, node: AztecNode, duration: bigint | number): Promise<void>;
35
+ warpL2TimeAtLeastBy(node: AztecNode & AztecNodeDebug, duration: bigint | number): Promise<void>;
40
36
  }
41
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlYXRfY29kZXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2NoZWF0X2NvZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUd2RSxPQUFPLEtBQUssRUFBRSxZQUFZLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUM1RCxPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMvRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsTUFBTSxpQ0FBaUMsQ0FBQztBQUVqRTs7Ozs7R0FLRztBQUNILHFCQUFhLFVBQVU7SUFHWixHQUFHLEVBQUUsYUFBYTtJQUVsQixNQUFNLEVBQUUsZ0JBQWdCO0lBSmpDO0lBQ0UseUJBQXlCO0lBQ2xCLEdBQUcsRUFBRSxhQUFhO0lBQ3pCLHVEQUF1RDtJQUNoRCxNQUFNLEVBQUUsZ0JBQWdCLEVBQzdCO0lBRUosT0FBYSxNQUFNLENBQUMsT0FBTyxFQUFFLE1BQU0sRUFBRSxFQUFFLElBQUksRUFBRSxTQUFTLEVBQUUsWUFBWSxFQUFFLFlBQVksR0FBRyxPQUFPLENBQUMsVUFBVSxDQUFDLENBT3ZHO0lBRUQ7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AQG;IACG,mBAAmB,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,iBAIrG;CACF"}
1
+ {"version":3,"file":"cheat_codes.d.ts","sourceRoot":"","sources":["../../src/testing/cheat_codes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF;;;GAGG;AACH,qBAAa,UAAU;IAEnB,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB;IAJjC;IACE,yBAAyB;IAClB,GAAG,EAAE,aAAa;IACzB,uDAAuD;IAChD,MAAM,EAAE,gBAAgB,EAC7B;IAEJ,OAAa,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAOvG;IAED;;;;;;OAMG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErG;IAED;;;;;;;OAOG;IACH,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9F;CACF"}
@@ -1,10 +1,7 @@
1
1
  import { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
2
- import { retryUntil } from '@aztec/foundation/retry';
3
2
  /**
4
- * A class that provides utility functions for interacting with the chain.
5
- * @deprecated There used to be 3 kinds of cheat codes: eth, rollup and aztec. We have nuked the Aztec ones because
6
- * they became unused (we now have better testing tools). If you are introducing a new functionality to the cheat
7
- * codes, please consider whether it makes sense to just introduce new utils in your tests instead.
3
+ * Wrapper for Aztec Debug API.
4
+ * @deprecated use the AztecNode debug API directly.
8
5
  */ export class CheatCodes {
9
6
  eth;
10
7
  rollup;
@@ -18,45 +15,22 @@ import { retryUntil } from '@aztec/foundation/retry';
18
15
  return new CheatCodes(ethCheatCodes, rollupCheatCodes);
19
16
  }
20
17
  /**
21
- * Warps the L1 timestamp to a target timestamp and mines an L2 block that advances the L2 timestamp to at least
22
- * the target timestamp. L2 timestamp is not advanced exactly to the target timestamp because it is determined
23
- * by the slot number, which advances in fixed intervals.
24
- * This is useful for testing time-dependent contract behavior.
25
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
26
- * @param node - The Aztec node used to query if a new block has been mined.
27
- * @param targetTimestamp - The target timestamp to warp to (in seconds)
28
- */ async warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp) {
29
- const currentL2BlockNumber = await node.getBlockNumber();
30
- // We warp the L1 timestamp
31
- await this.eth.warp(targetTimestamp, {
32
- resetBlockInterval: true
33
- });
34
- // Wait until an L2 block is mined
35
- const sequencer = sequencerClient.getSequencer();
36
- const minTxsPerBlock = sequencer.getConfig().minTxsPerBlock;
37
- sequencer.updateConfig({
38
- minTxsPerBlock: 0
39
- });
40
- await retryUntil(async ()=>{
41
- const newL2BlockNumber = await node.getBlockNumber();
42
- return newL2BlockNumber > currentL2BlockNumber;
43
- }, 'new block after warping L2 time', 36, 1);
44
- // Restore original minTxsPerBlock
45
- sequencer.updateConfig({
46
- minTxsPerBlock
47
- });
18
+ * Warps the L1 timestamp to at least `targetTimestamp` and mines an L2 block advancing the L2 timestamp to at least
19
+ * the target. Forwards to the node's debug API, which serializes the warp through the automine sequencer queue.
20
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
21
+ * @param targetTimestamp - The target timestamp to warp to (in seconds).
22
+ * @deprecated Call `node.warpL2TimeAtLeastTo(targetTimestamp)` on the node debug API directly.
23
+ */ warpL2TimeAtLeastTo(node, targetTimestamp) {
24
+ return node.warpL2TimeAtLeastTo(Number(targetTimestamp));
48
25
  }
49
26
  /**
50
- * Warps the L1 timestamp forward by a specified duration and mines an L2 block that advances the L2 timestamp at
51
- * least by the duration. L2 timestamp is not advanced exactly by the duration because it is determined by the slot
52
- * number, which advances in fixed intervals.
53
- * This is useful for testing time-dependent contract behavior.
54
- * @param sequencerClient - The sequencer client to use to force an empty block to be mined.
55
- * @param node - The Aztec node used to query if a new block has been mined.
56
- * @param duration - The duration to advance time by (in seconds)
57
- */ async warpL2TimeAtLeastBy(sequencerClient, node, duration) {
58
- const currentTimestamp = await this.eth.timestamp();
59
- const targetTimestamp = BigInt(currentTimestamp) + BigInt(duration);
60
- await this.warpL2TimeAtLeastTo(sequencerClient, node, targetTimestamp);
27
+ * Warps the L1 timestamp forward by at least `duration` seconds and mines an L2 block advancing the L2 timestamp at
28
+ * least by the duration. Forwards to the node's debug API, which serializes the warp through the automine sequencer
29
+ * queue.
30
+ * @param node - The Aztec node whose debug API performs the warp. Must run an automine sequencer.
31
+ * @param duration - The duration to advance time by (in seconds).
32
+ * @deprecated Call `node.warpL2TimeAtLeastBy(duration)` on the node debug API directly.
33
+ */ warpL2TimeAtLeastBy(node, duration) {
34
+ return node.warpL2TimeAtLeastBy(Number(duration));
61
35
  }
62
36
  }
@@ -0,0 +1,19 @@
1
+ import { type EthCheatCodes } from '@aztec/ethereum/test';
2
+ import type { EpochNumber } from '@aztec/foundation/branded-types';
3
+ import type { Logger } from '@aztec/foundation/log';
4
+ import type { EthAddress, L2BlockSource } from '@aztec/stdlib/block';
5
+ export declare class EpochTestSettler {
6
+ private l2BlockSource;
7
+ private log;
8
+ private options;
9
+ private rollupCheatCodes;
10
+ private epochMonitor?;
11
+ constructor(cheatcodes: EthCheatCodes, rollupAddress: EthAddress, l2BlockSource: L2BlockSource, log: Logger, options: {
12
+ pollingIntervalMs: number;
13
+ provingDelayMs?: number;
14
+ });
15
+ start(): Promise<void>;
16
+ stop(): Promise<void>;
17
+ handleEpochReadyToProve(epoch: EpochNumber): Promise<boolean>;
18
+ }
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZXBvY2hfdGVzdF9zZXR0bGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdGluZy9lcG9jaF90ZXN0X3NldHRsZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLEtBQUssYUFBYSxFQUFvQixNQUFNLHNCQUFzQixDQUFDO0FBQzVFLE9BQU8sS0FBSyxFQUFFLFdBQVcsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ25FLE9BQU8sS0FBSyxFQUFFLE1BQU0sRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBR3BELE9BQU8sS0FBSyxFQUFFLFVBQVUsRUFBRSxhQUFhLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVyRSxxQkFBYSxnQkFBZ0I7SUFPekIsT0FBTyxDQUFDLGFBQWE7SUFDckIsT0FBTyxDQUFDLEdBQUc7SUFDWCxPQUFPLENBQUMsT0FBTztJQVJqQixPQUFPLENBQUMsZ0JBQWdCLENBQW1CO0lBQzNDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBZTtJQUVwQyxZQUNFLFVBQVUsRUFBRSxhQUFhLEVBQ3pCLGFBQWEsRUFBRSxVQUFVLEVBQ2pCLGFBQWEsRUFBRSxhQUFhLEVBQzVCLEdBQUcsRUFBRSxNQUFNLEVBQ1gsT0FBTyxFQUFFO1FBQUUsaUJBQWlCLEVBQUUsTUFBTSxDQUFDO1FBQUMsY0FBYyxDQUFDLEVBQUUsTUFBTSxDQUFBO0tBQUUsRUFHeEU7SUFFSyxLQUFLLGtCQUlWO0lBRUssSUFBSSxrQkFFVDtJQUVLLHVCQUF1QixDQUFDLEtBQUssRUFBRSxXQUFXLEdBQUcsT0FBTyxDQUFDLE9BQU8sQ0FBQyxDQWNsRTtDQUNGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"epoch_test_settler.d.ts","sourceRoot":"","sources":["../../src/testing/epoch_test_settler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IARjB,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,YAAY,CAAC,CAAe;IAEpC,YACE,UAAU,EAAE,aAAa,EACzB,aAAa,EAAE,UAAU,EACjB,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAGxE;IAEK,KAAK,kBAIV;IAEK,IAAI,kBAET;IAEK,uBAAuB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAclE;CACF"}
@@ -0,0 +1,42 @@
1
+ import { RollupCheatCodes } from '@aztec/ethereum/test';
2
+ import { settleEpochOutbox } from '@aztec/prover-client/test';
3
+ import { EpochMonitor } from '@aztec/prover-node';
4
+ export class EpochTestSettler {
5
+ l2BlockSource;
6
+ log;
7
+ options;
8
+ rollupCheatCodes;
9
+ epochMonitor;
10
+ constructor(cheatcodes, rollupAddress, l2BlockSource, log, options){
11
+ this.l2BlockSource = l2BlockSource;
12
+ this.log = log;
13
+ this.options = options;
14
+ this.rollupCheatCodes = new RollupCheatCodes(cheatcodes, {
15
+ rollupAddress
16
+ });
17
+ }
18
+ async start() {
19
+ const { epochDuration } = await this.rollupCheatCodes.getConfig();
20
+ this.epochMonitor = new EpochMonitor(this.l2BlockSource, {
21
+ epochDuration: Number(epochDuration)
22
+ }, this.options);
23
+ this.epochMonitor.start(this);
24
+ }
25
+ async stop() {
26
+ await this.epochMonitor?.stop();
27
+ }
28
+ async handleEpochReadyToProve(epoch) {
29
+ const lastCheckpoint = await settleEpochOutbox({
30
+ rollupCheatCodes: this.rollupCheatCodes,
31
+ l2BlockSource: this.l2BlockSource,
32
+ epoch,
33
+ log: this.log
34
+ });
35
+ if (lastCheckpoint !== undefined) {
36
+ await this.rollupCheatCodes.markAsProven(lastCheckpoint);
37
+ } else {
38
+ this.log.warn(`No checkpoint found for epoch ${epoch}`);
39
+ }
40
+ return true;
41
+ }
42
+ }
@@ -1,4 +1,6 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
1
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
2
  export { CheatCodes } from './cheat_codes.js';
4
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQzNELE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUMifQ==
3
+ export { EpochTestSettler } from './epoch_test_settler.js';
4
+ export { setupLocalNetwork, TEST_FEE_PADDING, type LocalNetwork, type LocalNetworkOptions } from './local-network.js';
5
+ export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
6
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0aW5nL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxhQUFhLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFDOUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0seUJBQXlCLENBQUM7QUFDM0QsT0FBTyxFQUFFLGlCQUFpQixFQUFFLGdCQUFnQixFQUFFLEtBQUssWUFBWSxFQUFFLEtBQUssbUJBQW1CLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN0SCxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQyJ9
@@ -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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,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,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtH,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1,3 +1,5 @@
1
- export { AnvilTestWatcher } from './anvil_test_watcher.js';
2
1
  export { EthCheatCodes, RollupCheatCodes } from '@aztec/ethereum/test';
3
2
  export { CheatCodes } from './cheat_codes.js';
3
+ export { EpochTestSettler } from './epoch_test_settler.js';
4
+ export { setupLocalNetwork, TEST_FEE_PADDING } from './local-network.js';
5
+ export { getTokenAllowedSetupFunctions } from './token_allowed_setup.js';
@@ -0,0 +1,51 @@
1
+ import type { AztecNodeService } from '@aztec/aztec-node';
2
+ import type { AztecNodeConfig } from '@aztec/aztec-node/config';
3
+ import type { Fr } from '@aztec/aztec.js/fields';
4
+ import type { AztecAddress } from '@aztec/stdlib/aztec-address';
5
+ /** A running in-process local network: an inline Aztec node backed by its own anvil L1. */
6
+ export interface LocalNetwork extends AsyncDisposable {
7
+ /** Fully-synced Aztec node, ready to serve client requests. */
8
+ node: AztecNodeService;
9
+ /** RPC URL of the spawned anvil instance. */
10
+ l1RpcUrl: string;
11
+ /** Chain id used on L1 (foundry's default 31337). */
12
+ l1ChainId: number;
13
+ /** Stops every process started by the fixture: node and anvil. Also invoked by `await using`. */
14
+ stop: () => Promise<void>;
15
+ }
16
+ /** Options for {@link setupLocalNetwork}. */
17
+ export interface LocalNetworkOptions {
18
+ /**
19
+ * Addresses that should hold fee juice at genesis. Saves each of these the round-trip of bridging
20
+ * + claiming fee juice before they can pay for gas.
21
+ */
22
+ fundedAddresses?: AztecAddress[];
23
+ /** Override the default per-address genesis fee juice granted to {@link fundedAddresses}. */
24
+ initialAccountFeeJuice?: Fr;
25
+ /** Node config overrides, e.g. `realProofs`, `aztecEpochDuration`, `p2pEnabled`. */
26
+ config?: Partial<AztecNodeConfig>;
27
+ }
28
+ /**
29
+ * Spin up an in-process local network with the given addresses pre-funded.
30
+ *
31
+ * Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
32
+ * the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
33
+ * sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
34
+ * The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
35
+ *
36
+ * Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
37
+ * are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
38
+ * pin specific ones.
39
+ */
40
+ export declare function setupLocalNetwork(opts?: LocalNetworkOptions): Promise<LocalNetwork>;
41
+ /**
42
+ * Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
43
+ * The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
44
+ * pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
45
+ * network's congestion base fee can swing sharply between the wallet's fee estimate and the block
46
+ * the tx actually lands in. The default wallet padding isn't enough and trips
47
+ * `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
48
+ * `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
49
+ */
50
+ export declare const TEST_FEE_PADDING = 30;
51
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbmV0d29yay5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3Rlc3RpbmcvbG9jYWwtbmV0d29yay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxnQkFBZ0IsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBQzFELE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLDBCQUEwQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLEVBQUUsRUFBRSxNQUFNLHdCQUF3QixDQUFDO0FBRWpELE9BQU8sS0FBSyx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AAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAMhE,2FAA2F;AAC3F,MAAM,WAAW,YAAa,SAAQ,eAAe;IACnD,+DAA+D;IAC/D,IAAI,EAAE,gBAAgB,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,iGAAiG;IACjG,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IACjC,6FAA6F;IAC7F,sBAAsB,CAAC,EAAE,EAAE,CAAC;IAC5B,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,CAsC7F;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,KAAK,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { startAnvil } from '@aztec/ethereum/test';
2
+ import { foundry } from 'viem/chains';
3
+ import { createLocalNetwork } from '../local-network/local-network.js';
4
+ /**
5
+ * Spin up an in-process local network with the given addresses pre-funded.
6
+ *
7
+ * Each call spawns its own anvil on an OS-assigned random port and runs the Aztec node inline via
8
+ * the same {@link createLocalNetwork} codepath that backs `aztec start --local-network` (with the
9
+ * sandbox account/FPC/token setup skipped). Distinct ports let independent suites run in parallel.
10
+ * The caller must `await result.stop()` in its teardown (or hold the result with `await using`).
11
+ *
12
+ * Requires a Foundry toolchain (`anvil`/`forge`), installed via `aztec-up` or `foundryup`. Binaries
13
+ * are located in the standard install directories or on `PATH`; set `$ANVIL_BIN` / `$FORGE_BIN` to
14
+ * pin specific ones.
15
+ */ export async function setupLocalNetwork(opts = {}) {
16
+ // `--port 0` → anvil binds an ephemeral port that `startAnvil` reads back, so parallel suites
17
+ // never collide on a fixed port.
18
+ const { rpcUrl, stop: stopAnvil } = await startAnvil({
19
+ port: 0
20
+ });
21
+ try {
22
+ const { node, stop: stopNode } = await createLocalNetwork({
23
+ ...opts.config,
24
+ l1RpcUrls: [
25
+ rpcUrl
26
+ ],
27
+ testAccounts: false,
28
+ prefundAddresses: (opts.fundedAddresses ?? []).map((a)=>a.toString()),
29
+ initialAccountFeeJuice: opts.initialAccountFeeJuice
30
+ }, ()=>{});
31
+ // Stop the node before anvil (its teardown still talks to L1); the finally guarantees anvil is
32
+ // reaped even if node shutdown throws.
33
+ const stop = async ()=>{
34
+ try {
35
+ await stopNode();
36
+ } finally{
37
+ await stopAnvil();
38
+ }
39
+ };
40
+ return {
41
+ node,
42
+ l1RpcUrl: rpcUrl,
43
+ l1ChainId: foundry.id,
44
+ stop,
45
+ [Symbol.asyncDispose]: stop
46
+ };
47
+ } catch (err) {
48
+ await stopAnvil();
49
+ throw err;
50
+ }
51
+ }
52
+ /**
53
+ * Min-fee padding multiplier for test wallets whose txs may mine well after their fee estimate.
54
+ * The automine sequencer builds one block per tx and advances L1 time in big jumps, and proposer
55
+ * pipelining evolves the fee-asset price across the build/publish gap (~20x observed in CI), so the
56
+ * network's congestion base fee can swing sharply between the wallet's fee estimate and the block
57
+ * the tx actually lands in. The default wallet padding isn't enough and trips
58
+ * `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
59
+ * `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
60
+ */ export const TEST_FEE_PADDING = 30;