@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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 (165) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +4 -3
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +2 -2
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -15
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +111 -90
  7. package/dest/bench/client_flows/config.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +10 -30
  10. package/dest/bench/utils.d.ts +3 -12
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +17 -37
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +35 -35
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  22. package/dest/e2e_epochs/epochs_test.d.ts +20 -12
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +36 -27
  25. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  26. package/dest/e2e_fees/bridging_race.notest.js +14 -11
  27. package/dest/e2e_fees/fees_test.d.ts +13 -9
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +39 -40
  30. package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
  31. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  32. package/dest/e2e_l1_publisher/write_json.js +9 -8
  33. package/dest/e2e_multi_validator/utils.d.ts +2 -2
  34. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  35. package/dest/e2e_multi_validator/utils.js +4 -10
  36. package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
  37. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  38. package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
  39. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  40. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  41. package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
  42. package/dest/e2e_p2p/p2p_network.d.ts +238 -18
  43. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  44. package/dest/e2e_p2p/p2p_network.js +50 -25
  45. package/dest/e2e_p2p/shared.d.ts +16 -17
  46. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  47. package/dest/e2e_p2p/shared.js +57 -56
  48. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
  49. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  50. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  51. package/dest/fixtures/e2e_prover_test.d.ts +13 -11
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +57 -66
  54. package/dest/fixtures/fixtures.d.ts +2 -3
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +2 -3
  57. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  58. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  59. package/dest/fixtures/get_acvm_config.js +1 -1
  60. package/dest/fixtures/get_bb_config.d.ts +2 -2
  61. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  62. package/dest/fixtures/get_bb_config.js +2 -2
  63. package/dest/fixtures/index.d.ts +1 -1
  64. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  66. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  67. package/dest/fixtures/logging.d.ts +1 -1
  68. package/dest/fixtures/setup_p2p_test.d.ts +12 -11
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +50 -24
  71. package/dest/fixtures/snapshot_manager.d.ts +16 -15
  72. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  73. package/dest/fixtures/snapshot_manager.js +84 -88
  74. package/dest/fixtures/token_utils.d.ts +10 -5
  75. package/dest/fixtures/token_utils.d.ts.map +1 -1
  76. package/dest/fixtures/token_utils.js +17 -18
  77. package/dest/fixtures/utils.d.ts +44 -47
  78. package/dest/fixtures/utils.d.ts.map +1 -1
  79. package/dest/fixtures/utils.js +128 -185
  80. package/dest/fixtures/web3signer.d.ts +5 -0
  81. package/dest/fixtures/web3signer.d.ts.map +1 -0
  82. package/dest/fixtures/web3signer.js +53 -0
  83. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  84. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  85. package/dest/fixtures/with_telemetry_utils.js +2 -2
  86. package/dest/index.d.ts +1 -1
  87. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  88. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  89. package/dest/shared/cross_chain_test_harness.d.ts +20 -23
  90. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  91. package/dest/shared/cross_chain_test_harness.js +14 -16
  92. package/dest/shared/gas_portal_test_harness.d.ts +10 -17
  93. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  94. package/dest/shared/gas_portal_test_harness.js +11 -8
  95. package/dest/shared/index.d.ts +1 -1
  96. package/dest/shared/jest_setup.d.ts +1 -1
  97. package/dest/shared/jest_setup.js +1 -1
  98. package/dest/shared/submit-transactions.d.ts +6 -4
  99. package/dest/shared/submit-transactions.d.ts.map +1 -1
  100. package/dest/shared/submit-transactions.js +8 -7
  101. package/dest/shared/uniswap_l1_l2.d.ts +13 -9
  102. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  103. package/dest/shared/uniswap_l1_l2.js +44 -58
  104. package/dest/simulators/index.d.ts +1 -1
  105. package/dest/simulators/lending_simulator.d.ts +4 -7
  106. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  107. package/dest/simulators/lending_simulator.js +8 -5
  108. package/dest/simulators/token_simulator.d.ts +4 -2
  109. package/dest/simulators/token_simulator.d.ts.map +1 -1
  110. package/dest/simulators/token_simulator.js +2 -2
  111. package/dest/spartan/setup_test_wallets.d.ts +22 -14
  112. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  113. package/dest/spartan/setup_test_wallets.js +144 -86
  114. package/dest/spartan/tx_metrics.d.ts +39 -0
  115. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  116. package/dest/spartan/tx_metrics.js +95 -0
  117. package/dest/spartan/utils.d.ts +101 -16
  118. package/dest/spartan/utils.d.ts.map +1 -1
  119. package/dest/spartan/utils.js +414 -52
  120. package/package.json +43 -40
  121. package/src/bench/client_flows/benchmark.ts +8 -8
  122. package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
  123. package/src/bench/client_flows/data_extractor.ts +9 -31
  124. package/src/bench/utils.ts +15 -39
  125. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  126. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
  127. package/src/e2e_deploy_contract/deploy_test.ts +18 -36
  128. package/src/e2e_epochs/epochs_test.ts +59 -42
  129. package/src/e2e_fees/bridging_race.notest.ts +16 -11
  130. package/src/e2e_fees/fees_test.ts +48 -52
  131. package/src/e2e_l1_publisher/write_json.ts +12 -9
  132. package/src/e2e_multi_validator/utils.ts +5 -11
  133. package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
  134. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  135. package/src/e2e_p2p/p2p_network.ts +125 -89
  136. package/src/e2e_p2p/shared.ts +69 -60
  137. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  138. package/src/fixtures/e2e_prover_test.ts +65 -105
  139. package/src/fixtures/fixtures.ts +2 -5
  140. package/src/fixtures/get_acvm_config.ts +2 -2
  141. package/src/fixtures/get_bb_config.ts +3 -2
  142. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  143. package/src/fixtures/setup_p2p_test.ts +79 -32
  144. package/src/fixtures/snapshot_manager.ts +120 -131
  145. package/src/fixtures/token_utils.ts +16 -24
  146. package/src/fixtures/utils.ts +175 -269
  147. package/src/fixtures/web3signer.ts +63 -0
  148. package/src/fixtures/with_telemetry_utils.ts +2 -2
  149. package/src/guides/up_quick_start.sh +3 -11
  150. package/src/quality_of_service/alert_checker.ts +1 -1
  151. package/src/shared/cross_chain_test_harness.ts +23 -31
  152. package/src/shared/gas_portal_test_harness.ts +14 -21
  153. package/src/shared/jest_setup.ts +1 -1
  154. package/src/shared/submit-transactions.ts +12 -8
  155. package/src/shared/uniswap_l1_l2.ts +80 -88
  156. package/src/simulators/lending_simulator.ts +9 -6
  157. package/src/simulators/token_simulator.ts +5 -2
  158. package/src/spartan/DEVELOP.md +15 -3
  159. package/src/spartan/setup_test_wallets.ts +171 -127
  160. package/src/spartan/tx_metrics.ts +130 -0
  161. package/src/spartan/utils.ts +543 -45
  162. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  163. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  164. package/dest/fixtures/setup_l1_contracts.js +0 -17
  165. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -1,48 +1,27 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import {
3
- type InitialAccountData,
4
- deployFundedSchnorrAccounts,
5
- generateSchnorrAccounts,
6
- getDeployedTestAccounts,
7
- getDeployedTestAccountsWallets,
8
- } from '@aztec/accounts/testing';
2
+ import { type InitialAccountData, generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
9
3
  import { type Archiver, createArchiver } from '@aztec/archiver';
10
4
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
11
- import {
12
- AccountManager,
13
- type AccountWalletWithSecretKey,
14
- type AztecAddress,
15
- type AztecNode,
16
- BatchCall,
17
- type ContractMethod,
18
- type Logger,
19
- type PXE,
20
- type Wallet,
21
- createAztecNodeClient,
22
- createLogger,
23
- createPXEClient,
24
- makeFetch,
25
- sleep,
26
- waitForPXE,
27
- } from '@aztec/aztec.js';
5
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
6
+ import { BatchCall, type ContractMethod } from '@aztec/aztec.js/contracts';
28
7
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
+ import { Fr } from '@aztec/aztec.js/fields';
9
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
10
+ import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
+ import type { Wallet } from '@aztec/aztec.js/wallet';
29
12
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
30
- import { createBlobSinkClient } from '@aztec/blob-sink/client';
31
- import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
32
- import { GENESIS_ARCHIVE_ROOT, SPONSORED_FPC_SALT } from '@aztec/constants';
13
+ import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
14
+ import { SPONSORED_FPC_SALT } from '@aztec/constants';
15
+ import { isAnvilTestChain } from '@aztec/ethereum/chain';
16
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
17
+ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
18
+ import { NULL_KEY } from '@aztec/ethereum/constants';
33
19
  import {
34
- type DeployL1ContractsArgs,
35
- type DeployL1ContractsReturnType,
36
- FeeAssetArtifact,
37
- NULL_KEY,
20
+ type DeployAztecL1ContractsReturnType,
38
21
  type Operator,
39
- RollupContract,
40
- createExtendedL1Client,
41
- deployL1Contracts,
42
- deployMulticall3,
43
- getL1ContractsConfigEnvVars,
44
- isAnvilTestChain,
45
- } from '@aztec/ethereum';
22
+ type ZKPassportArgs,
23
+ deployAztecL1Contracts,
24
+ } from '@aztec/ethereum/deploy-aztec-l1-contracts';
46
25
  import {
47
26
  DelayedTxUtils,
48
27
  EthCheatCodes,
@@ -50,31 +29,24 @@ import {
50
29
  createDelayedL1TxUtilsFromViemWallet,
51
30
  startAnvil,
52
31
  } from '@aztec/ethereum/test';
32
+ import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
53
33
  import { SecretValue } from '@aztec/foundation/config';
54
- import { randomBytes } from '@aztec/foundation/crypto';
55
34
  import { EthAddress } from '@aztec/foundation/eth-address';
56
- import { Fr } from '@aztec/foundation/fields';
57
35
  import { tryRmDir } from '@aztec/foundation/fs';
58
36
  import { withLogNameSuffix } from '@aztec/foundation/log';
59
37
  import { retryUntil } from '@aztec/foundation/retry';
38
+ import { sleep } from '@aztec/foundation/sleep';
60
39
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
61
40
  import type { DataStoreConfig } from '@aztec/kv-store/config';
62
41
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
63
42
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
64
43
  import type { P2PClientDeps } from '@aztec/p2p';
65
44
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
66
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
45
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
67
46
  import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
68
- import {
69
- type PXEService,
70
- type PXEServiceConfig,
71
- createPXEServiceWithSimulator,
72
- getPXEServiceConfig,
73
- } from '@aztec/pxe/server';
47
+ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
74
48
  import type { SequencerClient } from '@aztec/sequencer-client';
75
49
  import type { TestSequencerClient } from '@aztec/sequencer-client/test';
76
- import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
77
- import { FileCircuitRecorder } from '@aztec/simulator/testing';
78
50
  import {
79
51
  type ContractInstanceWithAddress,
80
52
  getContractClassFromArtifact,
@@ -91,16 +63,23 @@ import {
91
63
  initTelemetryClient,
92
64
  } from '@aztec/telemetry-client';
93
65
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
66
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
94
67
  import { getGenesisValues } from '@aztec/world-state/testing';
95
68
 
96
69
  import type { Anvil } from '@viem/anvil';
70
+ import { randomBytes } from 'crypto';
97
71
  import fs from 'fs/promises';
98
- import getPort from 'get-port';
99
72
  import { tmpdir } from 'os';
100
73
  import * as path from 'path';
101
- import { type Chain, type HDAccount, type Hex, type PrivateKeyAccount, getContract } from 'viem';
102
- import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
103
- import { foundry } from 'viem/chains';
74
+ import type { Hex } from 'viem';
75
+ import {
76
+ type HDAccount,
77
+ type PrivateKeyAccount,
78
+ generatePrivateKey,
79
+ mnemonicToAccount,
80
+ privateKeyToAccount,
81
+ } from 'viem/accounts';
82
+ import { type Chain, foundry } from 'viem/chains';
104
83
 
105
84
  import { MNEMONIC, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
106
85
  import { getACVMConfig } from './get_acvm_config.js';
@@ -110,14 +89,24 @@ import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
110
89
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
111
90
  export { startAnvil };
112
91
 
113
- const { PXE_URL = '' } = process.env;
114
- const getAztecUrl = () => PXE_URL;
92
+ /**
93
+ * Sets up shared blob storage using FileStore in the data directory.
94
+ */
95
+ export async function setupSharedBlobStorage(config: { dataDirectory?: string } & Record<string, any>): Promise<void> {
96
+ const sharedBlobPath = path.join(config.dataDirectory!, 'shared-blobs');
97
+ await fs.mkdir(sharedBlobPath, { recursive: true });
98
+ config.blobFileStoreUrls = [`file://${sharedBlobPath}`];
99
+ config.blobFileStoreUploadUrl = `file://${sharedBlobPath}`;
100
+ }
101
+
102
+ const { AZTEC_NODE_URL = '' } = process.env;
103
+ const getAztecUrl = () => AZTEC_NODE_URL;
115
104
 
116
105
  let telemetry: TelemetryClient | undefined = undefined;
117
- function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
106
+ async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
118
107
  if (!telemetry) {
119
108
  const config = { ...getTelemetryConfig(), ...partialConfig };
120
- telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
109
+ telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
121
110
  }
122
111
  return telemetry;
123
112
  }
@@ -133,45 +122,24 @@ export const getPrivateKeyFromIndex = (index: number): Buffer | null => {
133
122
  return privKeyRaw === null ? null : Buffer.from(privKeyRaw);
134
123
  };
135
124
 
136
- export const setupL1Contracts = async (
137
- l1RpcUrls: string[],
138
- account: HDAccount | PrivateKeyAccount,
139
- logger: Logger,
140
- args: Partial<DeployL1ContractsArgs> = {},
141
- chain: Chain = foundry,
142
- ) => {
143
- const l1Data = await deployL1Contracts(l1RpcUrls, account, chain, logger, {
144
- vkTreeRoot: getVKTreeRoot(),
145
- protocolContractTreeRoot,
146
- genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
147
- salt: args.salt,
148
- initialValidators: args.initialValidators,
149
- ...getL1ContractsConfigEnvVars(),
150
- realVerifier: false,
151
- ...args,
152
- });
153
-
154
- return l1Data;
155
- };
156
-
157
125
  /**
158
- * Sets up Private eXecution Environment (PXE).
126
+ * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
159
127
  * @param aztecNode - An instance of Aztec Node.
160
- * @param opts - Partial configuration for the PXE service.
128
+ * @param opts - Partial configuration for the PXE.
161
129
  * @param logger - The logger to be used.
162
130
  * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
163
- * @returns Private eXecution Environment (PXE), logger and teardown function.
131
+ * @returns A test wallet, logger and teardown function.
164
132
  */
165
- export async function setupPXEService(
133
+ export async function setupPXEAndGetWallet(
166
134
  aztecNode: AztecNode,
167
- opts: Partial<PXEServiceConfig> = {},
135
+ opts: Partial<PXEConfig> = {},
168
136
  logger = getLogger(),
169
137
  useLogSuffix = false,
170
138
  ): Promise<{
171
139
  /**
172
- * The PXE instance.
140
+ * The wallet instance.
173
141
  */
174
- pxe: PXEService;
142
+ wallet: TestWallet;
175
143
  /**
176
144
  * Logger instance named as the current test.
177
145
  */
@@ -181,29 +149,24 @@ export async function setupPXEService(
181
149
  */
182
150
  teardown: () => Promise<void>;
183
151
  }> {
184
- const pxeServiceConfig = { ...getPXEServiceConfig(), ...opts };
152
+ const PXEConfig = { ...getPXEConfig(), ...opts };
185
153
  // For tests we only want proving enabled if specifically requested
186
- pxeServiceConfig.proverEnabled = !!opts.proverEnabled;
154
+ PXEConfig.proverEnabled = !!opts.proverEnabled;
187
155
 
188
156
  // If no data directory provided, create a temp directory and clean up afterwards
189
- const configuredDataDirectory = pxeServiceConfig.dataDirectory;
157
+ const configuredDataDirectory = PXEConfig.dataDirectory;
190
158
  if (!configuredDataDirectory) {
191
- pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
159
+ PXEConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
192
160
  }
193
161
 
194
- const simulator = new WASMSimulator();
195
- const recorder = process.env.CIRCUIT_RECORD_DIR
196
- ? new FileCircuitRecorder(process.env.CIRCUIT_RECORD_DIR)
197
- : new MemoryCircuitRecorder();
198
- const simulatorWithRecorder = new SimulatorRecorderWrapper(simulator, recorder);
199
- const pxe = await createPXEServiceWithSimulator(aztecNode, simulatorWithRecorder, pxeServiceConfig, {
162
+ const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
163
+
164
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
200
165
  useLogSuffix,
201
166
  });
202
167
 
203
- const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(pxeServiceConfig.dataDirectory!);
204
-
205
168
  return {
206
- pxe,
169
+ wallet,
207
170
  logger,
208
171
  teardown,
209
172
  };
@@ -228,45 +191,48 @@ async function setupWithRemoteEnvironment(
228
191
  const aztecNodeUrl = getAztecUrl();
229
192
  logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
230
193
  const aztecNode = createAztecNodeClient(aztecNodeUrl);
231
- logger.verbose(`Creating PXE client to remote host ${PXE_URL}`);
232
- const pxeClient = createPXEClient(PXE_URL, {}, makeFetch([1, 2, 3], true));
233
- await waitForPXE(pxeClient, logger);
234
- logger.verbose('JSON RPC client connected to PXE');
235
- logger.verbose(`Retrieving contract addresses from ${PXE_URL}`);
236
- const { l1ContractAddresses, rollupVersion } = await pxeClient.getNodeInfo();
194
+ await waitForNode(aztecNode, logger);
195
+ logger.verbose('JSON RPC client connected to Aztec Node');
196
+ logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
197
+ const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
237
198
 
238
199
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
239
200
 
240
- const deployL1ContractsValues: DeployL1ContractsReturnType = {
201
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
241
202
  l1ContractAddresses,
242
203
  l1Client,
243
204
  rollupVersion,
244
205
  };
245
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
246
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!);
206
+ const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
207
+ const wallet = await TestWallet.create(aztecNode);
208
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
247
209
  const teardown = () => Promise.resolve();
248
210
 
249
- logger.verbose('Constructing available wallets from already registered accounts...');
250
- const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
251
- const wallets = await getDeployedTestAccountsWallets(pxeClient);
211
+ logger.verbose('Populating wallet from already registered accounts...');
212
+ const initialFundedAccounts = await getInitialTestAccountsData();
252
213
 
253
- if (wallets.length < numberOfAccounts) {
254
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
214
+ if (initialFundedAccounts.length < numberOfAccounts) {
215
+ throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
255
216
  // Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
256
217
  }
257
218
 
219
+ const testAccounts = await Promise.all(
220
+ initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
221
+ const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
222
+ return accountManager.address;
223
+ }),
224
+ );
225
+
258
226
  return {
259
227
  aztecNode,
260
228
  aztecNodeAdmin: undefined,
261
229
  sequencer: undefined,
262
230
  proverNode: undefined,
263
- pxe: pxeClient,
264
231
  deployL1ContractsValues,
265
232
  config,
266
233
  initialFundedAccounts,
267
- wallets,
268
- wallet: wallets[0],
269
- accounts: wallets.slice(0, numberOfAccounts).map(w => w.getAddress()),
234
+ wallet,
235
+ accounts: testAccounts,
270
236
  logger,
271
237
  cheatCodes,
272
238
  ethCheatCodes,
@@ -274,7 +240,6 @@ async function setupWithRemoteEnvironment(
274
240
  mockGossipSubNetwork: undefined,
275
241
  watcher: undefined,
276
242
  dateProvider: undefined,
277
- blobSink: undefined,
278
243
  telemetryClient: undefined,
279
244
  teardown,
280
245
  };
@@ -287,17 +252,13 @@ export type SetupOptions = {
287
252
  /** Whether to enable metrics collection, if undefined, metrics collection is disabled */
288
253
  metricsPort?: number | undefined;
289
254
  /** Previously deployed contracts on L1 */
290
- deployL1ContractsValues?: DeployL1ContractsReturnType;
291
- /** Whether to skip deployment of protocol contracts (auth registry, etc) */
292
- skipProtocolContracts?: boolean;
255
+ deployL1ContractsValues?: DeployAztecL1ContractsReturnType;
293
256
  /** Initial fee juice for default accounts */
294
257
  initialAccountFeeJuice?: Fr;
295
258
  /** Number of initial accounts funded with fee juice */
296
259
  numberOfInitialFundedAccounts?: number;
297
260
  /** Data of the initial funded accounts */
298
261
  initialFundedAccounts?: InitialAccountData[];
299
- /** Salt to use in L1 contract deployment */
300
- salt?: number;
301
262
  /** An initial set of validators */
302
263
  initialValidators?: (Operator & { privateKey: `0x${string}` })[];
303
264
  /** Anvil Start time */
@@ -306,8 +267,6 @@ export type SetupOptions = {
306
267
  l2StartTime?: number;
307
268
  /** Whether to start a prover node */
308
269
  startProverNode?: boolean;
309
- /** Whether to fund the rewardDistributor */
310
- fundRewardDistributor?: boolean;
311
270
  /** Manual config for the telemetry client */
312
271
  telemetryConfig?: Partial<TelemetryClientConfig> & { benchmark?: boolean };
313
272
  /** Public data that will be inserted in the tree in genesis */
@@ -326,6 +285,8 @@ export type SetupOptions = {
326
285
  anvilPort?: number;
327
286
  /** Key to use for publishing L1 contracts */
328
287
  l1PublisherKey?: SecretValue<`0x${string}`>;
288
+ /** ZkPassport configuration (domain, scope, mock verifier) */
289
+ zkPassportArgs?: ZKPassportArgs;
329
290
  } & Partial<AztecNodeConfig>;
330
291
 
331
292
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -338,19 +299,15 @@ export type EndToEndContext = {
338
299
  proverNode: ProverNode | undefined;
339
300
  /** A client to the sequencer service (undefined if connected to remote environment) */
340
301
  sequencer: SequencerClient | undefined;
341
- /** The Private eXecution Environment (PXE). */
342
- pxe: PXE;
343
- /** Return values from deployL1Contracts function. */
344
- deployL1ContractsValues: DeployL1ContractsReturnType;
302
+ /** Return values from deployAztecL1Contracts function. */
303
+ deployL1ContractsValues: DeployAztecL1ContractsReturnType;
345
304
  /** The Aztec Node configuration. */
346
305
  config: AztecNodeConfig;
347
306
  /** The data for the initial funded accounts. */
348
307
  initialFundedAccounts: InitialAccountData[];
349
- /* Wallets created for the initial funded accounts, with secret keys. */
350
- wallets: AccountWalletWithSecretKey[];
351
- /** The first wallet to be used. */
352
- wallet: AccountWalletWithSecretKey;
353
- /** The accounts to be used. */
308
+ /** The wallet to be used. */
309
+ wallet: TestWallet;
310
+ /** The wallets to be used. */
354
311
  accounts: AztecAddress[];
355
312
  /** Logger instance named as the current test. */
356
313
  logger: Logger;
@@ -362,8 +319,6 @@ export type EndToEndContext = {
362
319
  watcher: AnvilTestWatcher | undefined;
363
320
  /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
364
321
  dateProvider: TestDateProvider | undefined;
365
- /** The blob sink (undefined if connected to remote environment) */
366
- blobSink: BlobSinkServer | undefined;
367
322
  /** Telemetry client */
368
323
  telemetryClient: TelemetryClient | undefined;
369
324
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
@@ -383,7 +338,7 @@ export type EndToEndContext = {
383
338
  export async function setup(
384
339
  numberOfAccounts = 1,
385
340
  opts: SetupOptions = {},
386
- pxeOpts: Partial<PXEServiceConfig> = {},
341
+ pxeOpts: Partial<PXEConfig> = {},
387
342
  chain: Chain = foundry,
388
343
  ): Promise<EndToEndContext> {
389
344
  let anvil: Anvil | undefined;
@@ -414,9 +369,9 @@ export async function setup(
414
369
  if (!isAnvilTestChain(chain.id)) {
415
370
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
416
371
  }
417
- if (PXE_URL) {
372
+ if (AZTEC_NODE_URL) {
418
373
  throw new Error(
419
- `PXE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
374
+ `AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
420
375
  );
421
376
  }
422
377
 
@@ -436,7 +391,8 @@ export async function setup(
436
391
  setupMetricsLogger(filename);
437
392
  }
438
393
 
439
- const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
394
+ const dateProvider = new TestDateProvider();
395
+ const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
440
396
 
441
397
  if (opts.stateLoad) {
442
398
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -446,29 +402,34 @@ export async function setup(
446
402
  await ethCheatCodes.warp(opts.l1StartTime, { resetBlockInterval: true });
447
403
  }
448
404
 
449
- let publisherPrivKey = undefined;
450
- let publisherHdAccount = undefined;
405
+ let publisherPrivKeyHex: `0x${string}` | undefined = undefined;
406
+ let publisherHdAccount: HDAccount | PrivateKeyAccount | undefined = undefined;
451
407
 
452
408
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
453
- publisherHdAccount = privateKeyToAccount(opts.l1PublisherKey.getValue());
409
+ publisherPrivKeyHex = opts.l1PublisherKey.getValue();
410
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
454
411
  } else if (
455
412
  config.publisherPrivateKeys &&
456
413
  config.publisherPrivateKeys.length > 0 &&
457
414
  config.publisherPrivateKeys[0].getValue() != NULL_KEY
458
415
  ) {
459
- publisherHdAccount = privateKeyToAccount(config.publisherPrivateKeys[0].getValue());
416
+ publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
417
+ publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
460
418
  } else if (!MNEMONIC) {
461
419
  throw new Error(`Mnemonic not provided and no publisher private key`);
462
420
  } else {
463
421
  publisherHdAccount = mnemonicToAccount(MNEMONIC, { addressIndex: 0 });
464
422
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
465
- publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
466
- config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
423
+ const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
424
+ publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
425
+ config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
467
426
  }
468
427
 
469
- config.coinbase = EthAddress.fromString(publisherHdAccount.address);
428
+ if (config.coinbase === undefined) {
429
+ config.coinbase = EthAddress.fromString(publisherHdAccount.address);
430
+ }
470
431
 
471
- if (PXE_URL) {
432
+ if (AZTEC_NODE_URL) {
472
433
  // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
473
434
  return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
474
435
  }
@@ -489,54 +450,30 @@ export async function setup(
489
450
  }
490
451
 
491
452
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount!, chain);
492
- await deployMulticall3(l1Client, logger);
493
-
494
- const deployL1ContractsValues =
495
- opts.deployL1ContractsValues ??
496
- (await setupL1Contracts(
497
- config.l1RpcUrls,
498
- publisherHdAccount!,
499
- logger,
500
- {
501
- ...opts,
502
- genesisArchiveRoot,
503
- feeJuicePortalInitialBalance: fundingNeeded,
504
- initialValidators: opts.initialValidators,
505
- },
506
- chain,
507
- ));
453
+
454
+ const deployL1ContractsValues: DeployAztecL1ContractsReturnType = await deployAztecL1Contracts(
455
+ config.l1RpcUrls[0],
456
+ publisherPrivKeyHex!,
457
+ chain.id,
458
+ {
459
+ ...getL1ContractsConfigEnvVars(),
460
+ ...opts,
461
+ vkTreeRoot: getVKTreeRoot(),
462
+ protocolContractsHash,
463
+ genesisArchiveRoot,
464
+ initialValidators: opts.initialValidators,
465
+ feeJuicePortalInitialBalance: fundingNeeded,
466
+ realVerifier: false,
467
+ },
468
+ );
508
469
 
509
470
  config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
510
471
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
511
472
 
512
- if (opts.fundRewardDistributor) {
513
- // Mints block rewards for 10000 blocks to the rewardDistributor contract
514
-
515
- const rollup = new RollupContract(
516
- deployL1ContractsValues.l1Client,
517
- deployL1ContractsValues.l1ContractAddresses.rollupAddress,
518
- );
519
-
520
- const blockReward = await rollup.getBlockReward();
521
- const mintAmount = 10_000n * (blockReward as bigint);
522
-
523
- const feeJuice = getContract({
524
- address: deployL1ContractsValues.l1ContractAddresses.feeJuiceAddress.toString(),
525
- abi: FeeAssetArtifact.contractAbi,
526
- client: deployL1ContractsValues.l1Client,
527
- });
528
-
529
- const rewardDistributorMintTxHash = await feeJuice.write.mint(
530
- [deployL1ContractsValues.l1ContractAddresses.rewardDistributorAddress.toString(), mintAmount],
531
- {} as any,
532
- );
533
- await deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: rewardDistributorMintTxHash });
534
- logger.info(`Funding rewardDistributor in ${rewardDistributorMintTxHash}`);
535
- }
536
-
537
473
  if (enableAutomine) {
538
474
  await ethCheatCodes.setAutomine(false);
539
475
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
476
+ dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
540
477
  }
541
478
 
542
479
  if (opts.l2StartTime) {
@@ -545,11 +482,8 @@ export async function setup(
545
482
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
546
483
  }
547
484
 
548
- const dateProvider = new TestDateProvider();
549
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
550
-
551
485
  const watcher = new AnvilTestWatcher(
552
- new EthCheatCodesWithState(config.l1RpcUrls),
486
+ new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
553
487
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
554
488
  deployL1ContractsValues.l1Client,
555
489
  dateProvider,
@@ -558,25 +492,11 @@ export async function setup(
558
492
  await watcher.start();
559
493
  }
560
494
 
561
- const telemetry = getTelemetryClient(opts.telemetryConfig);
495
+ const telemetry = await getTelemetryClient(opts.telemetryConfig);
562
496
 
563
- // Blob sink service - blobs get posted here and served from here
564
- const blobSinkPort = await getPort();
565
- const blobSink = await createBlobSinkServer(
566
- {
567
- l1ChainId: config.l1ChainId,
568
- l1RpcUrls: config.l1RpcUrls,
569
- l1Contracts: config.l1Contracts,
570
- port: blobSinkPort,
571
- dataDirectory: config.dataDirectory,
572
- dataStoreMapSizeKB: config.dataStoreMapSizeKB,
573
- },
574
- telemetry,
575
- );
576
- await blobSink.start();
577
- config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
497
+ await setupSharedBlobStorage(config);
578
498
 
579
- logger.verbose('Creating and synching an aztec node...');
499
+ logger.verbose('Creating and synching an aztec node', config);
580
500
 
581
501
  const acvmConfig = await getACVMConfig(logger);
582
502
  if (acvmConfig) {
@@ -589,9 +509,6 @@ export async function setup(
589
509
  config.bbBinaryPath = bbConfig.bbBinaryPath;
590
510
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
591
511
  }
592
- config.l1PublishRetryIntervalMS = 100;
593
-
594
- const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
595
512
 
596
513
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
597
514
  let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
@@ -631,7 +548,7 @@ export async function setup(
631
548
 
632
549
  const aztecNode = await AztecNodeService.createAndSync(
633
550
  config, // REFACTOR: createAndSync mutates this config
634
- { dateProvider, blobSinkClient, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
551
+ { dateProvider, telemetry, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
635
552
  { prefilledPublicData },
636
553
  );
637
554
  const sequencerClient = aztecNode.getSequencer();
@@ -658,39 +575,42 @@ export async function setup(
658
575
  }
659
576
 
660
577
  logger.verbose('Creating a pxe...');
661
- const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode!, pxeOpts, logger);
578
+ const { wallet, teardown: pxeTeardown } = await setupPXEAndGetWallet(aztecNode!, pxeOpts, logger);
662
579
 
663
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe!);
580
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, dateProvider);
664
581
 
665
582
  if (
666
583
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
667
584
  (opts.initialValidators && opts.initialValidators.length > 0)
668
585
  ) {
669
- // We need to advance to epoch 2 such that the committee is set up.
670
- logger.info(`Advancing to epoch 2`);
671
- await cheatCodes.rollup.advanceToEpoch(2n, { updateDateProvider: dateProvider });
586
+ // We need to advance such that the committee is set up.
587
+ await cheatCodes.rollup.advanceToEpoch(
588
+ EpochNumber.fromBigInt(
589
+ BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
590
+ ),
591
+ );
672
592
  await cheatCodes.rollup.setupEpoch();
673
593
  await cheatCodes.rollup.debugRollup();
674
594
  }
675
-
595
+ let accounts: AztecAddress[] = [];
676
596
  // Below we continue with what we described in the long comment on line 571.
677
- let accountManagers: AccountManager[] = [];
678
597
  if (numberOfAccounts === 0) {
679
598
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
680
- while ((await pxe.getBlockNumber()) === 0) {
599
+ while ((await aztecNode.getBlockNumber()) === 0) {
681
600
  await sleep(2000);
682
601
  }
683
602
  } else {
684
603
  logger.info(
685
604
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
686
605
  );
687
- accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
606
+ const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
607
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
608
+ accounts = accountManagers.map(accountManager => accountManager.address);
688
609
  }
689
610
 
690
611
  // Now we restore the original minTxsPerBlock setting.
691
612
  sequencerClient!.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
692
613
 
693
- const wallets = await Promise.all(accountManagers.map(account => account.getWallet()));
694
614
  if (initialFundedAccounts.length < numberOfAccounts) {
695
615
  // TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
696
616
  throw new Error(
@@ -716,7 +636,6 @@ export async function setup(
716
636
  await tryStop(watcher, logger);
717
637
  await tryStop(anvil, logger);
718
638
 
719
- await tryStop(blobSink, logger);
720
639
  await tryRmDir(directoryToCleanup, logger);
721
640
  } catch (err) {
722
641
  logger.error(`Error during e2e test teardown`, err);
@@ -726,7 +645,6 @@ export async function setup(
726
645
  return {
727
646
  aztecNode,
728
647
  aztecNodeAdmin: aztecNode,
729
- blobSink,
730
648
  cheatCodes,
731
649
  ethCheatCodes,
732
650
  config,
@@ -737,13 +655,11 @@ export async function setup(
737
655
  mockGossipSubNetwork,
738
656
  prefilledPublicData,
739
657
  proverNode,
740
- pxe,
741
658
  sequencer: sequencerClient,
742
659
  teardown,
743
660
  telemetryClient: telemetry,
744
- wallets,
745
- wallet: wallets[0],
746
- accounts: wallets.map(w => w.getAddress()),
661
+ wallet,
662
+ accounts,
747
663
  watcher,
748
664
  };
749
665
  } catch (err) {
@@ -760,16 +676,14 @@ export async function setup(
760
676
  * @param accountsToDeploy - Which accounts to publicly deploy.
761
677
  */
762
678
 
763
- // docs:start:public_deploy_accounts
764
- export async function ensureAccountContractsPublished(sender: Wallet, accountsToDeploy: Wallet[]) {
679
+ export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
765
680
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
766
- // the sandbox and the test accounts exist
681
+ // the local network and the test accounts exist
767
682
  const accountsAndAddresses = await Promise.all(
768
- accountsToDeploy.map(async account => {
769
- const address = account.getAddress();
683
+ accountsToDeploy.map(async address => {
770
684
  return {
771
685
  address,
772
- deployed: (await sender.getContractMetadata(address)).isContractPublished,
686
+ deployed: (await wallet.getContractMetadata(address)).isContractPublished,
773
687
  };
774
688
  }),
775
689
  );
@@ -777,33 +691,18 @@ export async function ensureAccountContractsPublished(sender: Wallet, accountsTo
777
691
  await Promise.all(
778
692
  accountsAndAddresses
779
693
  .filter(({ deployed }) => !deployed)
780
- .map(({ address }) => sender.getContractMetadata(address)),
694
+ .map(({ address }) => wallet.getContractMetadata(address)),
781
695
  )
782
696
  ).map(contractMetadata => contractMetadata.contractInstance);
783
697
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
784
- if (!(await sender.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
785
- await (await publishContractClass(sender, SchnorrAccountContractArtifact))
786
- .send({ from: accountsToDeploy[0].getAddress() })
698
+ if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
699
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
700
+ .send({ from: accountsToDeploy[0] })
787
701
  .wait();
788
702
  }
789
- const requests = await Promise.all(instances.map(async instance => await publishInstance(sender, instance!)));
790
- const batch = new BatchCall(sender, requests);
791
- await batch.send({ from: accountsToDeploy[0].getAddress() }).wait();
792
- }
793
- // docs:end:public_deploy_accounts
794
-
795
- /**
796
- * Sets the timestamp of the next block.
797
- * @param rpcUrl - rpc url of the blockchain instance to connect to
798
- * @param timestamp - the timestamp for the next block
799
- */
800
- export async function setNextBlockTimestamp(rpcUrl: string, timestamp: number) {
801
- const params = `[${timestamp}]`;
802
- await fetch(rpcUrl, {
803
- body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
804
- method: 'POST',
805
- headers: { 'Content-Type': 'application/json' },
806
- });
703
+ const requests = await Promise.all(instances.map(async instance => await publishInstance(wallet, instance!)));
704
+ const batch = new BatchCall(wallet, requests);
705
+ await batch.send({ from: accountsToDeploy[0] }).wait();
807
706
  }
808
707
 
809
708
  /** Returns the job name for the current test. */
@@ -869,7 +768,7 @@ export async function expectMappingDelta<K, V extends number | bigint>(
869
768
  }
870
769
 
871
770
  /**
872
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
771
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
873
772
  * but by conventions its address is computed with a salt of 0.
874
773
  * @returns The address of the sponsored FPC contract
875
774
  */
@@ -882,7 +781,7 @@ export function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress>
882
781
  }
883
782
 
884
783
  /**
885
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
784
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
886
785
  * but by conventions its address is computed with a salt of 0.
887
786
  * @returns The address of the sponsored FPC contract
888
787
  */
@@ -894,25 +793,25 @@ export async function getSponsoredFPCAddress() {
894
793
  /**
895
794
  * Deploy a sponsored FPC contract to a running instance.
896
795
  */
897
- export async function setupSponsoredFPC(pxe: PXE) {
796
+ export async function setupSponsoredFPC(wallet: Wallet) {
898
797
  const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
899
798
  salt: new Fr(SPONSORED_FPC_SALT),
900
799
  });
901
800
 
902
- await pxe.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
801
+ await wallet.registerContract(instance, SponsoredFPCContract.artifact);
903
802
  getLogger().info(`SponsoredFPC: ${instance.address}`);
904
803
  return instance;
905
804
  }
906
805
 
907
806
  /**
908
807
  * Registers the SponsoredFPC in this PXE instance
909
- * @param pxe - The pxe client
808
+ * @param wallet - The wallet
910
809
  */
911
- export async function registerSponsoredFPC(pxe: PXE): Promise<void> {
912
- await pxe.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
810
+ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
811
+ await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
913
812
  }
914
813
 
915
- export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
814
+ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
916
815
  targetBlock ??= await node.getBlockNumber();
917
816
 
918
817
  await retryUntil(
@@ -926,7 +825,7 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: number,
926
825
  export function createAndSyncProverNode(
927
826
  proverNodePrivateKey: `0x${string}`,
928
827
  aztecNodeConfig: AztecNodeConfig,
929
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
828
+ proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
930
829
  aztecNode: AztecNode | undefined,
931
830
  prefilledPublicData: PublicDataTreeLeaf[] = [],
932
831
  proverNodeDeps: ProverNodeDeps = {},
@@ -940,11 +839,15 @@ export function createAndSyncProverNode(
940
839
  stop: () => Promise.resolve(),
941
840
  };
942
841
 
943
- const blobSinkClient = createBlobSinkClient(aztecNodeConfig);
842
+ const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
944
843
 
945
844
  // Creating temp store and archiver for simulated prover node
946
845
  const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
947
- const archiver = await createArchiver(archiverConfig, { blobSinkClient }, { blockUntilSync: true });
846
+ const archiver = await createArchiver(
847
+ archiverConfig,
848
+ { blobClient, dateProvider: proverNodeDeps.dateProvider },
849
+ { blockUntilSync: true },
850
+ );
948
851
 
949
852
  // Prover node config is for simulated proofs
950
853
  const proverConfig: ProverNodeConfig = {
@@ -962,6 +865,7 @@ export function createAndSyncProverNode(
962
865
  txGatheringTimeoutMs: 24_000,
963
866
  proverNodeFailedEpochStore: undefined,
964
867
  proverId: EthAddress.fromNumber(1),
868
+ proverNodeEpochProvingDelayMs: undefined,
965
869
  ...proverNodeConfig,
966
870
  };
967
871
 
@@ -978,7 +882,9 @@ export function createAndSyncProverNode(
978
882
  { prefilledPublicData },
979
883
  );
980
884
  getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
981
- await proverNode.start();
885
+ if (!proverNodeConfig.dontStart) {
886
+ await proverNode.start();
887
+ }
982
888
  return proverNode;
983
889
  });
984
890
  }