@aztec/end-to-end 3.0.0-canary.a9708bd → 3.0.0-devnet.20251212

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 +25 -14
  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 +8 -30
  10. package/dest/bench/utils.d.ts +4 -13
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +10 -34
  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 +12 -9
  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 +19 -12
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +30 -22
  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 +10 -8
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +35 -38
  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 +139 -0
  42. package/dest/e2e_p2p/p2p_network.d.ts +238 -17
  43. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  44. package/dest/e2e_p2p/p2p_network.js +46 -19
  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 +56 -55
  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 +12 -8
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +53 -58
  54. package/dest/fixtures/fixtures.d.ts +1 -1
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +1 -1
  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_l1_contracts.d.ts +476 -5
  69. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  70. package/dest/fixtures/setup_l1_contracts.js +3 -3
  71. package/dest/fixtures/setup_p2p_test.d.ts +12 -11
  72. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  73. package/dest/fixtures/setup_p2p_test.js +50 -24
  74. package/dest/fixtures/snapshot_manager.d.ts +13 -10
  75. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  76. package/dest/fixtures/snapshot_manager.js +66 -51
  77. package/dest/fixtures/token_utils.d.ts +10 -5
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +17 -18
  80. package/dest/fixtures/utils.d.ts +479 -35
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +106 -125
  83. package/dest/fixtures/web3signer.d.ts +5 -0
  84. package/dest/fixtures/web3signer.d.ts.map +1 -0
  85. package/dest/fixtures/web3signer.js +53 -0
  86. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  87. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  88. package/dest/fixtures/with_telemetry_utils.js +2 -2
  89. package/dest/index.d.ts +1 -1
  90. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  91. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  92. package/dest/shared/cross_chain_test_harness.d.ts +20 -23
  93. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  94. package/dest/shared/cross_chain_test_harness.js +14 -16
  95. package/dest/shared/gas_portal_test_harness.d.ts +10 -17
  96. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  97. package/dest/shared/gas_portal_test_harness.js +11 -8
  98. package/dest/shared/index.d.ts +1 -1
  99. package/dest/shared/jest_setup.d.ts +1 -1
  100. package/dest/shared/jest_setup.js +1 -1
  101. package/dest/shared/submit-transactions.d.ts +6 -4
  102. package/dest/shared/submit-transactions.d.ts.map +1 -1
  103. package/dest/shared/submit-transactions.js +8 -7
  104. package/dest/shared/uniswap_l1_l2.d.ts +12 -8
  105. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  106. package/dest/shared/uniswap_l1_l2.js +44 -58
  107. package/dest/simulators/index.d.ts +1 -1
  108. package/dest/simulators/lending_simulator.d.ts +4 -7
  109. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  110. package/dest/simulators/lending_simulator.js +8 -5
  111. package/dest/simulators/token_simulator.d.ts +4 -2
  112. package/dest/simulators/token_simulator.d.ts.map +1 -1
  113. package/dest/simulators/token_simulator.js +2 -2
  114. package/dest/spartan/setup_test_wallets.d.ts +22 -14
  115. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  116. package/dest/spartan/setup_test_wallets.js +144 -86
  117. package/dest/spartan/tx_metrics.d.ts +39 -0
  118. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  119. package/dest/spartan/tx_metrics.js +95 -0
  120. package/dest/spartan/utils.d.ts +92 -17
  121. package/dest/spartan/utils.d.ts.map +1 -1
  122. package/dest/spartan/utils.js +386 -63
  123. package/package.json +43 -40
  124. package/src/bench/client_flows/benchmark.ts +8 -8
  125. package/src/bench/client_flows/client_flows_benchmark.ts +141 -114
  126. package/src/bench/client_flows/data_extractor.ts +9 -31
  127. package/src/bench/utils.ts +9 -37
  128. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  129. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +38 -51
  130. package/src/e2e_deploy_contract/deploy_test.ts +18 -36
  131. package/src/e2e_epochs/epochs_test.ts +41 -35
  132. package/src/e2e_fees/bridging_race.notest.ts +16 -11
  133. package/src/e2e_fees/fees_test.ts +42 -47
  134. package/src/e2e_l1_publisher/write_json.ts +12 -9
  135. package/src/e2e_multi_validator/utils.ts +5 -11
  136. package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
  137. package/src/e2e_p2p/inactivity_slash_test.ts +184 -0
  138. package/src/e2e_p2p/p2p_network.ts +124 -82
  139. package/src/e2e_p2p/shared.ts +66 -58
  140. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  141. package/src/fixtures/e2e_prover_test.ts +60 -97
  142. package/src/fixtures/fixtures.ts +1 -2
  143. package/src/fixtures/get_acvm_config.ts +2 -2
  144. package/src/fixtures/get_bb_config.ts +3 -2
  145. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  146. package/src/fixtures/setup_l1_contracts.ts +5 -4
  147. package/src/fixtures/setup_p2p_test.ts +79 -32
  148. package/src/fixtures/snapshot_manager.ts +87 -82
  149. package/src/fixtures/token_utils.ts +16 -24
  150. package/src/fixtures/utils.ts +142 -172
  151. package/src/fixtures/web3signer.ts +63 -0
  152. package/src/fixtures/with_telemetry_utils.ts +2 -2
  153. package/src/guides/up_quick_start.sh +3 -11
  154. package/src/quality_of_service/alert_checker.ts +1 -1
  155. package/src/shared/cross_chain_test_harness.ts +23 -31
  156. package/src/shared/gas_portal_test_harness.ts +14 -21
  157. package/src/shared/jest_setup.ts +1 -1
  158. package/src/shared/submit-transactions.ts +12 -8
  159. package/src/shared/uniswap_l1_l2.ts +77 -86
  160. package/src/simulators/lending_simulator.ts +9 -6
  161. package/src/simulators/token_simulator.ts +5 -2
  162. package/src/spartan/DEVELOP.md +15 -3
  163. package/src/spartan/setup_test_wallets.ts +171 -127
  164. package/src/spartan/tx_metrics.ts +130 -0
  165. package/src/spartan/utils.ts +463 -64
@@ -1,48 +1,29 @@
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 { type Logger, createLogger } from '@aztec/aztec.js/log';
9
+ import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
10
+ import type { Wallet } from '@aztec/aztec.js/wallet';
29
11
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
30
12
  import { createBlobSinkClient } from '@aztec/blob-sink/client';
31
13
  import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
32
14
  import { GENESIS_ARCHIVE_ROOT, 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';
19
+ import { RollupContract, deployMulticall3 } from '@aztec/ethereum/contracts';
33
20
  import {
34
21
  type DeployL1ContractsArgs,
35
22
  type DeployL1ContractsReturnType,
36
- FeeAssetArtifact,
37
- NULL_KEY,
38
23
  type Operator,
39
- RollupContract,
40
- createExtendedL1Client,
41
24
  deployL1Contracts,
42
- deployMulticall3,
43
- getL1ContractsConfigEnvVars,
44
- isAnvilTestChain,
45
- } from '@aztec/ethereum';
25
+ } from '@aztec/ethereum/deploy-l1-contracts';
26
+ import { FeeAssetArtifact } from '@aztec/ethereum/l1-artifacts';
46
27
  import {
47
28
  DelayedTxUtils,
48
29
  EthCheatCodes,
@@ -50,31 +31,26 @@ import {
50
31
  createDelayedL1TxUtilsFromViemWallet,
51
32
  startAnvil,
52
33
  } from '@aztec/ethereum/test';
34
+ import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
53
35
  import { SecretValue } from '@aztec/foundation/config';
54
- import { randomBytes } from '@aztec/foundation/crypto';
36
+ import { randomBytes } from '@aztec/foundation/crypto/random';
37
+ import { Fr } from '@aztec/foundation/curves/bn254';
55
38
  import { EthAddress } from '@aztec/foundation/eth-address';
56
- import { Fr } from '@aztec/foundation/fields';
57
39
  import { tryRmDir } from '@aztec/foundation/fs';
58
40
  import { withLogNameSuffix } from '@aztec/foundation/log';
59
41
  import { retryUntil } from '@aztec/foundation/retry';
42
+ import { sleep } from '@aztec/foundation/sleep';
60
43
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
61
44
  import type { DataStoreConfig } from '@aztec/kv-store/config';
62
45
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
63
46
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
64
47
  import type { P2PClientDeps } from '@aztec/p2p';
65
48
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
66
- import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
49
+ import { protocolContractsHash } from '@aztec/protocol-contracts';
67
50
  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';
51
+ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
74
52
  import type { SequencerClient } from '@aztec/sequencer-client';
75
53
  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
54
  import {
79
55
  type ContractInstanceWithAddress,
80
56
  getContractClassFromArtifact,
@@ -91,6 +67,7 @@ import {
91
67
  initTelemetryClient,
92
68
  } from '@aztec/telemetry-client';
93
69
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
+ import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
94
71
  import { getGenesisValues } from '@aztec/world-state/testing';
95
72
 
96
73
  import type { Anvil } from '@viem/anvil';
@@ -110,14 +87,14 @@ import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
110
87
  export { deployAndInitializeTokenAndBridgeContracts } from '../shared/cross_chain_test_harness.js';
111
88
  export { startAnvil };
112
89
 
113
- const { PXE_URL = '' } = process.env;
114
- const getAztecUrl = () => PXE_URL;
90
+ const { AZTEC_NODE_URL = '' } = process.env;
91
+ const getAztecUrl = () => AZTEC_NODE_URL;
115
92
 
116
93
  let telemetry: TelemetryClient | undefined = undefined;
117
- function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
94
+ async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
118
95
  if (!telemetry) {
119
96
  const config = { ...getTelemetryConfig(), ...partialConfig };
120
- telemetry = config.benchmark ? new BenchmarkTelemetryClient() : initTelemetryClient(config);
97
+ telemetry = config.benchmark ? new BenchmarkTelemetryClient() : await initTelemetryClient(config);
121
98
  }
122
99
  return telemetry;
123
100
  }
@@ -140,38 +117,48 @@ export const setupL1Contracts = async (
140
117
  args: Partial<DeployL1ContractsArgs> = {},
141
118
  chain: Chain = foundry,
142
119
  ) => {
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
- });
120
+ const l1Data = await deployL1Contracts(
121
+ l1RpcUrls,
122
+ account,
123
+ chain,
124
+ logger,
125
+ {
126
+ vkTreeRoot: getVKTreeRoot(),
127
+ protocolContractsHash,
128
+ genesisArchiveRoot: args.genesisArchiveRoot ?? new Fr(GENESIS_ARCHIVE_ROOT),
129
+ salt: args.salt,
130
+ initialValidators: args.initialValidators,
131
+ ...getL1ContractsConfigEnvVars(),
132
+ realVerifier: false,
133
+ ...args,
134
+ },
135
+ {
136
+ priorityFeeBumpPercentage: 0,
137
+ priorityFeeRetryBumpPercentage: 0,
138
+ },
139
+ );
153
140
 
154
141
  return l1Data;
155
142
  };
156
143
 
157
144
  /**
158
- * Sets up Private eXecution Environment (PXE).
145
+ * Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
159
146
  * @param aztecNode - An instance of Aztec Node.
160
- * @param opts - Partial configuration for the PXE service.
147
+ * @param opts - Partial configuration for the PXE.
161
148
  * @param logger - The logger to be used.
162
149
  * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
163
- * @returns Private eXecution Environment (PXE), logger and teardown function.
150
+ * @returns A test wallet, logger and teardown function.
164
151
  */
165
- export async function setupPXEService(
152
+ export async function setupPXEAndGetWallet(
166
153
  aztecNode: AztecNode,
167
- opts: Partial<PXEServiceConfig> = {},
154
+ opts: Partial<PXEConfig> = {},
168
155
  logger = getLogger(),
169
156
  useLogSuffix = false,
170
157
  ): Promise<{
171
158
  /**
172
- * The PXE instance.
159
+ * The wallet instance.
173
160
  */
174
- pxe: PXEService;
161
+ wallet: TestWallet;
175
162
  /**
176
163
  * Logger instance named as the current test.
177
164
  */
@@ -181,29 +168,24 @@ export async function setupPXEService(
181
168
  */
182
169
  teardown: () => Promise<void>;
183
170
  }> {
184
- const pxeServiceConfig = { ...getPXEServiceConfig(), ...opts };
171
+ const PXEConfig = { ...getPXEConfig(), ...opts };
185
172
  // For tests we only want proving enabled if specifically requested
186
- pxeServiceConfig.proverEnabled = !!opts.proverEnabled;
173
+ PXEConfig.proverEnabled = !!opts.proverEnabled;
187
174
 
188
175
  // If no data directory provided, create a temp directory and clean up afterwards
189
- const configuredDataDirectory = pxeServiceConfig.dataDirectory;
176
+ const configuredDataDirectory = PXEConfig.dataDirectory;
190
177
  if (!configuredDataDirectory) {
191
- pxeServiceConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
178
+ PXEConfig.dataDirectory = path.join(tmpdir(), randomBytes(8).toString('hex'));
192
179
  }
193
180
 
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, {
181
+ const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
182
+
183
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, {
200
184
  useLogSuffix,
201
185
  });
202
186
 
203
- const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(pxeServiceConfig.dataDirectory!);
204
-
205
187
  return {
206
- pxe,
188
+ wallet,
207
189
  logger,
208
190
  teardown,
209
191
  };
@@ -228,12 +210,10 @@ async function setupWithRemoteEnvironment(
228
210
  const aztecNodeUrl = getAztecUrl();
229
211
  logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
230
212
  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();
213
+ await waitForNode(aztecNode, logger);
214
+ logger.verbose('JSON RPC client connected to Aztec Node');
215
+ logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
216
+ const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
237
217
 
238
218
  const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
239
219
 
@@ -242,31 +222,36 @@ async function setupWithRemoteEnvironment(
242
222
  l1Client,
243
223
  rollupVersion,
244
224
  };
245
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
246
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient!);
225
+ const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
226
+ const wallet = await TestWallet.create(aztecNode);
227
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
247
228
  const teardown = () => Promise.resolve();
248
229
 
249
- logger.verbose('Constructing available wallets from already registered accounts...');
250
- const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
251
- const wallets = await getDeployedTestAccountsWallets(pxeClient);
230
+ logger.verbose('Populating wallet from already registered accounts...');
231
+ const initialFundedAccounts = await getInitialTestAccountsData();
252
232
 
253
- if (wallets.length < numberOfAccounts) {
254
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${wallets.length}.`);
233
+ if (initialFundedAccounts.length < numberOfAccounts) {
234
+ throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
255
235
  // Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
256
236
  }
257
237
 
238
+ const testAccounts = await Promise.all(
239
+ initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
240
+ const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
241
+ return accountManager.address;
242
+ }),
243
+ );
244
+
258
245
  return {
259
246
  aztecNode,
260
247
  aztecNodeAdmin: undefined,
261
248
  sequencer: undefined,
262
249
  proverNode: undefined,
263
- pxe: pxeClient,
264
250
  deployL1ContractsValues,
265
251
  config,
266
252
  initialFundedAccounts,
267
- wallets,
268
- wallet: wallets[0],
269
- accounts: wallets.slice(0, numberOfAccounts).map(w => w.getAddress()),
253
+ wallet,
254
+ accounts: testAccounts,
270
255
  logger,
271
256
  cheatCodes,
272
257
  ethCheatCodes,
@@ -338,19 +323,15 @@ export type EndToEndContext = {
338
323
  proverNode: ProverNode | undefined;
339
324
  /** A client to the sequencer service (undefined if connected to remote environment) */
340
325
  sequencer: SequencerClient | undefined;
341
- /** The Private eXecution Environment (PXE). */
342
- pxe: PXE;
343
326
  /** Return values from deployL1Contracts function. */
344
327
  deployL1ContractsValues: DeployL1ContractsReturnType;
345
328
  /** The Aztec Node configuration. */
346
329
  config: AztecNodeConfig;
347
330
  /** The data for the initial funded accounts. */
348
331
  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. */
332
+ /** The wallet to be used. */
333
+ wallet: TestWallet;
334
+ /** The wallets to be used. */
354
335
  accounts: AztecAddress[];
355
336
  /** Logger instance named as the current test. */
356
337
  logger: Logger;
@@ -382,10 +363,8 @@ export type EndToEndContext = {
382
363
  */
383
364
  export async function setup(
384
365
  numberOfAccounts = 1,
385
- opts: SetupOptions = {
386
- customForwarderContractAddress: EthAddress.ZERO,
387
- },
388
- pxeOpts: Partial<PXEServiceConfig> = {},
366
+ opts: SetupOptions = {},
367
+ pxeOpts: Partial<PXEConfig> = {},
389
368
  chain: Chain = foundry,
390
369
  ): Promise<EndToEndContext> {
391
370
  let anvil: Anvil | undefined;
@@ -416,9 +395,9 @@ export async function setup(
416
395
  if (!isAnvilTestChain(chain.id)) {
417
396
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
418
397
  }
419
- if (PXE_URL) {
398
+ if (AZTEC_NODE_URL) {
420
399
  throw new Error(
421
- `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`,
400
+ `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`,
422
401
  );
423
402
  }
424
403
 
@@ -438,7 +417,8 @@ export async function setup(
438
417
  setupMetricsLogger(filename);
439
418
  }
440
419
 
441
- const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls);
420
+ const dateProvider = new TestDateProvider();
421
+ const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
442
422
 
443
423
  if (opts.stateLoad) {
444
424
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -468,9 +448,11 @@ export async function setup(
468
448
  config.publisherPrivateKeys = [new SecretValue(`0x${publisherPrivKey!.toString('hex')}` as const)];
469
449
  }
470
450
 
471
- config.coinbase = EthAddress.fromString(publisherHdAccount.address);
451
+ if (config.coinbase === undefined) {
452
+ config.coinbase = EthAddress.fromString(publisherHdAccount.address);
453
+ }
472
454
 
473
- if (PXE_URL) {
455
+ if (AZTEC_NODE_URL) {
474
456
  // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
475
457
  return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
476
458
  }
@@ -519,7 +501,7 @@ export async function setup(
519
501
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
520
502
  );
521
503
 
522
- const blockReward = await rollup.getBlockReward();
504
+ const blockReward = await rollup.getCheckpointReward();
523
505
  const mintAmount = 10_000n * (blockReward as bigint);
524
506
 
525
507
  const feeJuice = getContract({
@@ -539,6 +521,7 @@ export async function setup(
539
521
  if (enableAutomine) {
540
522
  await ethCheatCodes.setAutomine(false);
541
523
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
524
+ dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
542
525
  }
543
526
 
544
527
  if (opts.l2StartTime) {
@@ -547,11 +530,8 @@ export async function setup(
547
530
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
548
531
  }
549
532
 
550
- const dateProvider = new TestDateProvider();
551
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
552
-
553
533
  const watcher = new AnvilTestWatcher(
554
- new EthCheatCodesWithState(config.l1RpcUrls),
534
+ new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
555
535
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
556
536
  deployL1ContractsValues.l1Client,
557
537
  dateProvider,
@@ -560,7 +540,7 @@ export async function setup(
560
540
  await watcher.start();
561
541
  }
562
542
 
563
- const telemetry = getTelemetryClient(opts.telemetryConfig);
543
+ const telemetry = await getTelemetryClient(opts.telemetryConfig);
564
544
 
565
545
  // Blob sink service - blobs get posted here and served from here
566
546
  const blobSinkPort = await getPort();
@@ -571,14 +551,14 @@ export async function setup(
571
551
  l1Contracts: config.l1Contracts,
572
552
  port: blobSinkPort,
573
553
  dataDirectory: config.dataDirectory,
574
- dataStoreMapSizeKB: config.dataStoreMapSizeKB,
554
+ dataStoreMapSizeKb: config.dataStoreMapSizeKb,
575
555
  },
576
556
  telemetry,
577
557
  );
578
558
  await blobSink.start();
579
559
  config.blobSinkUrl = `http://localhost:${blobSinkPort}`;
580
560
 
581
- logger.verbose('Creating and synching an aztec node...');
561
+ logger.verbose('Creating and synching an aztec node', config);
582
562
 
583
563
  const acvmConfig = await getACVMConfig(logger);
584
564
  if (acvmConfig) {
@@ -591,7 +571,6 @@ export async function setup(
591
571
  config.bbBinaryPath = bbConfig.bbBinaryPath;
592
572
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
593
573
  }
594
- config.l1PublishRetryIntervalMS = 100;
595
574
 
596
575
  const blobSinkClient = createBlobSinkClient(config, { logger: createLogger('node:blob-sink:client') });
597
576
 
@@ -660,39 +639,42 @@ export async function setup(
660
639
  }
661
640
 
662
641
  logger.verbose('Creating a pxe...');
663
- const { pxe, teardown: pxeTeardown } = await setupPXEService(aztecNode!, pxeOpts, logger);
642
+ const { wallet, teardown: pxeTeardown } = await setupPXEAndGetWallet(aztecNode!, pxeOpts, logger);
664
643
 
665
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxe!);
644
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, dateProvider);
666
645
 
667
646
  if (
668
647
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
669
648
  (opts.initialValidators && opts.initialValidators.length > 0)
670
649
  ) {
671
- // We need to advance to epoch 2 such that the committee is set up.
672
- logger.info(`Advancing to epoch 2`);
673
- await cheatCodes.rollup.advanceToEpoch(2n, { updateDateProvider: dateProvider });
650
+ // We need to advance such that the committee is set up.
651
+ await cheatCodes.rollup.advanceToEpoch(
652
+ EpochNumber.fromBigInt(
653
+ BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1),
654
+ ),
655
+ );
674
656
  await cheatCodes.rollup.setupEpoch();
675
657
  await cheatCodes.rollup.debugRollup();
676
658
  }
677
-
659
+ let accounts: AztecAddress[] = [];
678
660
  // Below we continue with what we described in the long comment on line 571.
679
- let accountManagers: AccountManager[] = [];
680
661
  if (numberOfAccounts === 0) {
681
662
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
682
- while ((await pxe.getBlockNumber()) === 0) {
663
+ while ((await aztecNode.getBlockNumber()) === 0) {
683
664
  await sleep(2000);
684
665
  }
685
666
  } else {
686
667
  logger.info(
687
668
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
688
669
  );
689
- accountManagers = await deployFundedSchnorrAccounts(pxe, initialFundedAccounts.slice(0, numberOfAccounts));
670
+ const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
671
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
672
+ accounts = accountManagers.map(accountManager => accountManager.address);
690
673
  }
691
674
 
692
675
  // Now we restore the original minTxsPerBlock setting.
693
676
  sequencerClient!.getSequencer().updateConfig({ minTxsPerBlock: originalMinTxsPerBlock });
694
677
 
695
- const wallets = await Promise.all(accountManagers.map(account => account.getWallet()));
696
678
  if (initialFundedAccounts.length < numberOfAccounts) {
697
679
  // TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
698
680
  throw new Error(
@@ -739,13 +721,11 @@ export async function setup(
739
721
  mockGossipSubNetwork,
740
722
  prefilledPublicData,
741
723
  proverNode,
742
- pxe,
743
724
  sequencer: sequencerClient,
744
725
  teardown,
745
726
  telemetryClient: telemetry,
746
- wallets,
747
- wallet: wallets[0],
748
- accounts: wallets.map(w => w.getAddress()),
727
+ wallet,
728
+ accounts,
749
729
  watcher,
750
730
  };
751
731
  } catch (err) {
@@ -762,16 +742,14 @@ export async function setup(
762
742
  * @param accountsToDeploy - Which accounts to publicly deploy.
763
743
  */
764
744
 
765
- // docs:start:public_deploy_accounts
766
- export async function ensureAccountContractsPublished(sender: Wallet, accountsToDeploy: Wallet[]) {
745
+ export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
767
746
  // We have to check whether the accounts are already deployed. This can happen if the test runs against
768
- // the sandbox and the test accounts exist
747
+ // the local network and the test accounts exist
769
748
  const accountsAndAddresses = await Promise.all(
770
- accountsToDeploy.map(async account => {
771
- const address = account.getAddress();
749
+ accountsToDeploy.map(async address => {
772
750
  return {
773
751
  address,
774
- deployed: (await sender.getContractMetadata(address)).isContractPublished,
752
+ deployed: (await wallet.getContractMetadata(address)).isContractPublished,
775
753
  };
776
754
  }),
777
755
  );
@@ -779,33 +757,18 @@ export async function ensureAccountContractsPublished(sender: Wallet, accountsTo
779
757
  await Promise.all(
780
758
  accountsAndAddresses
781
759
  .filter(({ deployed }) => !deployed)
782
- .map(({ address }) => sender.getContractMetadata(address)),
760
+ .map(({ address }) => wallet.getContractMetadata(address)),
783
761
  )
784
762
  ).map(contractMetadata => contractMetadata.contractInstance);
785
763
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
786
- if (!(await sender.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
787
- await (await publishContractClass(sender, SchnorrAccountContractArtifact))
788
- .send({ from: accountsToDeploy[0].getAddress() })
764
+ if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
765
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
766
+ .send({ from: accountsToDeploy[0] })
789
767
  .wait();
790
768
  }
791
- const requests = await Promise.all(instances.map(async instance => await publishInstance(sender, instance!)));
792
- const batch = new BatchCall(sender, requests);
793
- await batch.send({ from: accountsToDeploy[0].getAddress() }).wait();
794
- }
795
- // docs:end:public_deploy_accounts
796
-
797
- /**
798
- * Sets the timestamp of the next block.
799
- * @param rpcUrl - rpc url of the blockchain instance to connect to
800
- * @param timestamp - the timestamp for the next block
801
- */
802
- export async function setNextBlockTimestamp(rpcUrl: string, timestamp: number) {
803
- const params = `[${timestamp}]`;
804
- await fetch(rpcUrl, {
805
- body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
806
- method: 'POST',
807
- headers: { 'Content-Type': 'application/json' },
808
- });
769
+ const requests = await Promise.all(instances.map(async instance => await publishInstance(wallet, instance!)));
770
+ const batch = new BatchCall(wallet, requests);
771
+ await batch.send({ from: accountsToDeploy[0] }).wait();
809
772
  }
810
773
 
811
774
  /** Returns the job name for the current test. */
@@ -871,7 +834,7 @@ export async function expectMappingDelta<K, V extends number | bigint>(
871
834
  }
872
835
 
873
836
  /**
874
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
837
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
875
838
  * but by conventions its address is computed with a salt of 0.
876
839
  * @returns The address of the sponsored FPC contract
877
840
  */
@@ -884,7 +847,7 @@ export function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress>
884
847
  }
885
848
 
886
849
  /**
887
- * Computes the address of the "canonical" SponosoredFPCContract. This is not a protocol contract
850
+ * Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
888
851
  * but by conventions its address is computed with a salt of 0.
889
852
  * @returns The address of the sponsored FPC contract
890
853
  */
@@ -896,25 +859,25 @@ export async function getSponsoredFPCAddress() {
896
859
  /**
897
860
  * Deploy a sponsored FPC contract to a running instance.
898
861
  */
899
- export async function setupSponsoredFPC(pxe: PXE) {
862
+ export async function setupSponsoredFPC(wallet: Wallet) {
900
863
  const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
901
864
  salt: new Fr(SPONSORED_FPC_SALT),
902
865
  });
903
866
 
904
- await pxe.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
867
+ await wallet.registerContract(instance, SponsoredFPCContract.artifact);
905
868
  getLogger().info(`SponsoredFPC: ${instance.address}`);
906
869
  return instance;
907
870
  }
908
871
 
909
872
  /**
910
873
  * Registers the SponsoredFPC in this PXE instance
911
- * @param pxe - The pxe client
874
+ * @param wallet - The wallet
912
875
  */
913
- export async function registerSponsoredFPC(pxe: PXE): Promise<void> {
914
- await pxe.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
876
+ export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
877
+ await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
915
878
  }
916
879
 
917
- export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
880
+ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNumber, timeoutSec = 60, intervalSec = 1) {
918
881
  targetBlock ??= await node.getBlockNumber();
919
882
 
920
883
  await retryUntil(
@@ -928,7 +891,7 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: number,
928
891
  export function createAndSyncProverNode(
929
892
  proverNodePrivateKey: `0x${string}`,
930
893
  aztecNodeConfig: AztecNodeConfig,
931
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'>,
894
+ proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
932
895
  aztecNode: AztecNode | undefined,
933
896
  prefilledPublicData: PublicDataTreeLeaf[] = [],
934
897
  proverNodeDeps: ProverNodeDeps = {},
@@ -946,7 +909,11 @@ export function createAndSyncProverNode(
946
909
 
947
910
  // Creating temp store and archiver for simulated prover node
948
911
  const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
949
- const archiver = await createArchiver(archiverConfig, { blobSinkClient }, { blockUntilSync: true });
912
+ const archiver = await createArchiver(
913
+ archiverConfig,
914
+ { blobSinkClient, dateProvider: proverNodeDeps.dateProvider },
915
+ { blockUntilSync: true },
916
+ );
950
917
 
951
918
  // Prover node config is for simulated proofs
952
919
  const proverConfig: ProverNodeConfig = {
@@ -964,6 +931,7 @@ export function createAndSyncProverNode(
964
931
  txGatheringTimeoutMs: 24_000,
965
932
  proverNodeFailedEpochStore: undefined,
966
933
  proverId: EthAddress.fromNumber(1),
934
+ proverNodeEpochProvingDelayMs: undefined,
967
935
  ...proverNodeConfig,
968
936
  };
969
937
 
@@ -980,7 +948,9 @@ export function createAndSyncProverNode(
980
948
  { prefilledPublicData },
981
949
  );
982
950
  getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
983
- await proverNode.start();
951
+ if (!proverNodeConfig.dontStart) {
952
+ await proverNode.start();
953
+ }
984
954
  return proverNode;
985
955
  });
986
956
  }