@aztec/end-to-end 0.0.1-commit.3469e52 → 0.0.1-commit.358457c

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 (208) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +31 -16
  4. package/dest/bench/client_flows/config.d.ts +2 -2
  5. package/dest/bench/client_flows/config.d.ts.map +1 -1
  6. package/dest/bench/client_flows/config.js +18 -0
  7. package/dest/bench/utils.d.ts +5 -4
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +17 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +15 -7
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +86 -39
  21. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  22. package/dest/e2e_fees/fees_test.d.ts +2 -2
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +12 -12
  25. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +1 -7
  28. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
  31. package/dest/e2e_p2p/p2p_network.d.ts +2 -2
  32. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  33. package/dest/e2e_p2p/p2p_network.js +22 -4
  34. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  35. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  36. package/dest/e2e_p2p/reqresp/utils.js +177 -0
  37. package/dest/e2e_p2p/shared.d.ts +6 -6
  38. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  39. package/dest/e2e_p2p/shared.js +14 -17
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  46. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  47. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  48. package/dest/e2e_token_contract/token_contract_test.js +13 -3
  49. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  50. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  51. package/dest/fixtures/authwit_proxy.js +30 -0
  52. package/dest/fixtures/e2e_prover_test.d.ts +4 -4
  53. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  54. package/dest/fixtures/e2e_prover_test.js +35 -39
  55. package/dest/fixtures/elu_monitor.d.ts +21 -0
  56. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  57. package/dest/fixtures/elu_monitor.js +102 -0
  58. package/dest/fixtures/fixtures.d.ts +5 -1
  59. package/dest/fixtures/fixtures.d.ts.map +1 -1
  60. package/dest/fixtures/fixtures.js +6 -0
  61. package/dest/fixtures/ha_setup.d.ts +71 -0
  62. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  63. package/dest/fixtures/ha_setup.js +116 -0
  64. package/dest/fixtures/index.d.ts +2 -1
  65. package/dest/fixtures/index.d.ts.map +1 -1
  66. package/dest/fixtures/index.js +1 -0
  67. package/dest/fixtures/setup.d.ts +43 -24
  68. package/dest/fixtures/setup.d.ts.map +1 -1
  69. package/dest/fixtures/setup.js +87 -166
  70. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  71. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  72. package/dest/fixtures/setup_p2p_test.js +40 -29
  73. package/dest/fixtures/token_utils.d.ts +2 -2
  74. package/dest/fixtures/token_utils.d.ts.map +1 -1
  75. package/dest/fixtures/token_utils.js +10 -6
  76. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  77. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  78. package/dest/shared/cross_chain_test_harness.js +11 -11
  79. package/dest/shared/gas_portal_test_harness.js +1 -1
  80. package/dest/shared/index.d.ts +2 -1
  81. package/dest/shared/index.d.ts.map +1 -1
  82. package/dest/shared/index.js +1 -0
  83. package/dest/shared/jest_setup.js +10 -1
  84. package/dest/shared/mock_state_view.d.ts +86 -0
  85. package/dest/shared/mock_state_view.d.ts.map +1 -0
  86. package/dest/shared/mock_state_view.js +186 -0
  87. package/dest/shared/submit-transactions.d.ts +4 -4
  88. package/dest/shared/submit-transactions.d.ts.map +1 -1
  89. package/dest/shared/submit-transactions.js +9 -11
  90. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  91. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  92. package/dest/shared/uniswap_l1_l2.js +20 -18
  93. package/dest/simulators/lending_simulator.js +2 -2
  94. package/dest/simulators/token_simulator.d.ts +1 -1
  95. package/dest/simulators/token_simulator.d.ts.map +1 -1
  96. package/dest/simulators/token_simulator.js +2 -23
  97. package/dest/spartan/setup_test_wallets.d.ts +9 -2
  98. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  99. package/dest/spartan/setup_test_wallets.js +92 -35
  100. package/dest/spartan/tx_metrics.d.ts +38 -2
  101. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  102. package/dest/spartan/tx_metrics.js +178 -4
  103. package/dest/spartan/utils/bot.d.ts +28 -0
  104. package/dest/spartan/utils/bot.d.ts.map +1 -0
  105. package/dest/spartan/utils/bot.js +142 -0
  106. package/dest/spartan/utils/chaos.d.ts +79 -0
  107. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  108. package/dest/spartan/utils/chaos.js +142 -0
  109. package/dest/spartan/utils/clients.d.ts +39 -0
  110. package/dest/spartan/utils/clients.d.ts.map +1 -0
  111. package/dest/spartan/utils/clients.js +90 -0
  112. package/dest/spartan/utils/config.d.ts +39 -0
  113. package/dest/spartan/utils/config.d.ts.map +1 -0
  114. package/dest/spartan/utils/config.js +21 -0
  115. package/dest/spartan/utils/health.d.ts +63 -0
  116. package/dest/spartan/utils/health.d.ts.map +1 -0
  117. package/dest/spartan/utils/health.js +202 -0
  118. package/dest/spartan/utils/helm.d.ts +15 -0
  119. package/dest/spartan/utils/helm.d.ts.map +1 -0
  120. package/dest/spartan/utils/helm.js +47 -0
  121. package/dest/spartan/utils/index.d.ts +9 -0
  122. package/dest/spartan/utils/index.d.ts.map +1 -0
  123. package/dest/spartan/utils/index.js +18 -0
  124. package/dest/spartan/utils/k8s.d.ts +128 -0
  125. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  126. package/dest/spartan/utils/k8s.js +381 -0
  127. package/dest/spartan/utils/nodes.d.ts +40 -0
  128. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  129. package/dest/spartan/utils/nodes.js +461 -0
  130. package/dest/spartan/utils/scripts.d.ts +30 -0
  131. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  132. package/dest/spartan/utils/scripts.js +81 -0
  133. package/dest/spartan/utils.d.ts +2 -260
  134. package/dest/spartan/utils.d.ts.map +1 -1
  135. package/dest/spartan/utils.js +1 -942
  136. package/dest/test-wallet/test_wallet.d.ts +83 -0
  137. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  138. package/dest/test-wallet/test_wallet.js +214 -0
  139. package/dest/test-wallet/utils.d.ts +41 -0
  140. package/dest/test-wallet/utils.d.ts.map +1 -0
  141. package/dest/test-wallet/utils.js +71 -0
  142. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  143. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  144. package/dest/test-wallet/wallet_worker_script.js +48 -0
  145. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  146. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  147. package/dest/test-wallet/worker_wallet.js +151 -0
  148. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  149. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  150. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  151. package/package.json +43 -39
  152. package/src/bench/client_flows/client_flows_benchmark.ts +19 -36
  153. package/src/bench/client_flows/config.ts +9 -1
  154. package/src/bench/utils.ts +10 -8
  155. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +20 -14
  156. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  157. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  158. package/src/e2e_epochs/epochs_test.ts +129 -93
  159. package/src/e2e_fees/bridging_race.notest.ts +2 -5
  160. package/src/e2e_fees/fees_test.ts +22 -41
  161. package/src/e2e_l1_publisher/write_json.ts +3 -8
  162. package/src/e2e_nested_contract/nested_contract_test.ts +3 -5
  163. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  164. package/src/e2e_p2p/p2p_network.ts +44 -16
  165. package/src/e2e_p2p/reqresp/utils.ts +235 -0
  166. package/src/e2e_p2p/shared.ts +22 -22
  167. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  168. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  169. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  170. package/src/e2e_token_contract/token_contract_test.ts +14 -7
  171. package/src/fixtures/authwit_proxy.ts +50 -0
  172. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  173. package/src/fixtures/e2e_prover_test.ts +32 -47
  174. package/src/fixtures/elu_monitor.ts +126 -0
  175. package/src/fixtures/fixtures.ts +10 -0
  176. package/src/fixtures/ha_setup.ts +186 -0
  177. package/src/fixtures/index.ts +1 -0
  178. package/src/fixtures/setup.ts +116 -230
  179. package/src/fixtures/setup_p2p_test.ts +40 -44
  180. package/src/fixtures/token_utils.ts +7 -5
  181. package/src/guides/up_quick_start.sh +3 -3
  182. package/src/shared/cross_chain_test_harness.ts +13 -27
  183. package/src/shared/gas_portal_test_harness.ts +1 -1
  184. package/src/shared/index.ts +1 -0
  185. package/src/shared/jest_setup.ts +16 -1
  186. package/src/shared/mock_state_view.ts +188 -0
  187. package/src/shared/submit-transactions.ts +14 -16
  188. package/src/shared/uniswap_l1_l2.ts +21 -30
  189. package/src/simulators/lending_simulator.ts +2 -2
  190. package/src/simulators/token_simulator.ts +1 -29
  191. package/src/spartan/setup_test_wallets.ts +127 -25
  192. package/src/spartan/tx_metrics.ts +152 -7
  193. package/src/spartan/utils/bot.ts +188 -0
  194. package/src/spartan/utils/chaos.ts +253 -0
  195. package/src/spartan/utils/clients.ts +100 -0
  196. package/src/spartan/utils/config.ts +27 -0
  197. package/src/spartan/utils/health.ts +255 -0
  198. package/src/spartan/utils/helm.ts +84 -0
  199. package/src/spartan/utils/index.ts +65 -0
  200. package/src/spartan/utils/k8s.ts +535 -0
  201. package/src/spartan/utils/nodes.ts +543 -0
  202. package/src/spartan/utils/scripts.ts +99 -0
  203. package/src/spartan/utils.ts +1 -1246
  204. package/src/test-wallet/test_wallet.ts +306 -0
  205. package/src/test-wallet/utils.ts +112 -0
  206. package/src/test-wallet/wallet_worker_script.ts +60 -0
  207. package/src/test-wallet/worker_wallet.ts +213 -0
  208. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,6 +1,5 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { type InitialAccountData, generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { type Archiver, createArchiver } from '@aztec/archiver';
2
+ import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
4
3
  import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
4
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
5
  import {
@@ -13,10 +12,9 @@ import {
13
12
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
14
13
  import { Fr } from '@aztec/aztec.js/fields';
15
14
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
- import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
15
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
16
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
17
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
20
18
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
19
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
20
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,31 +28,24 @@ import {
30
28
  type ZKPassportArgs,
31
29
  deployAztecL1Contracts,
32
30
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
31
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
32
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
40
33
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
34
  import { SecretValue } from '@aztec/foundation/config';
42
35
  import { randomBytes } from '@aztec/foundation/crypto/random';
43
36
  import { tryRmDir } from '@aztec/foundation/fs';
44
- import { withLogNameSuffix } from '@aztec/foundation/log';
37
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
45
38
  import { retryUntil } from '@aztec/foundation/retry';
46
39
  import { sleep } from '@aztec/foundation/sleep';
47
40
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
41
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
42
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
43
  import type { P2PClientDeps } from '@aztec/p2p';
52
44
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
45
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
46
+ import type { ProverNodeConfig } from '@aztec/prover-node';
55
47
  import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
56
48
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
58
49
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
50
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
60
51
  import { tryStop } from '@aztec/stdlib/interfaces/server';
@@ -67,7 +58,7 @@ import {
67
58
  initTelemetryClient,
68
59
  } from '@aztec/telemetry-client';
69
60
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
61
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
62
  import { getGenesisValues } from '@aztec/world-state/testing';
72
63
 
73
64
  import type { Anvil } from '@viem/anvil';
@@ -84,6 +75,7 @@ import {
84
75
  } from 'viem/accounts';
85
76
  import { type Chain, foundry } from 'viem/chains';
86
77
 
78
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
79
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
80
  import { getACVMConfig } from './get_acvm_config.js';
89
81
  import { getBBConfig } from './get_bb_config.js';
@@ -92,9 +84,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
84
 
93
85
  export { startAnvil };
94
86
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
87
  let telemetry: TelemetryClient | undefined = undefined;
99
88
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
89
  if (!telemetry) {
@@ -125,14 +114,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
125
114
  * @param aztecNode - An instance of Aztec Node.
126
115
  * @param opts - Partial configuration for the PXE.
127
116
  * @param logger - The logger to be used.
128
- * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
117
+ * @param actor - Actor label to include in log output (e.g., 'pxe-test').
129
118
  * @returns A test wallet, logger and teardown function.
130
119
  */
131
120
  export async function setupPXEAndGetWallet(
132
121
  aztecNode: AztecNode,
133
122
  opts: Partial<PXEConfig> = {},
134
123
  logger = getLogger(),
135
- useLogSuffix = false,
124
+ actor?: string,
136
125
  ): Promise<{
137
126
  wallet: TestWallet;
138
127
  logger: Logger;
@@ -150,9 +139,7 @@ export async function setupPXEAndGetWallet(
150
139
 
151
140
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
152
141
 
153
- const wallet = await TestWallet.create(aztecNode, PXEConfig, {
154
- useLogSuffix,
155
- });
142
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
156
143
 
157
144
  return {
158
145
  wallet,
@@ -209,6 +196,8 @@ export type SetupOptions = {
209
196
  skipAccountDeployment?: boolean;
210
197
  /** L1 contracts deployment arguments. */
211
198
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
199
+ /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
200
+ walletMinFeePadding?: number;
212
201
  } & Partial<AztecNodeConfig>;
213
202
 
214
203
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -217,13 +206,13 @@ export type EndToEndContext = {
217
206
  anvil: Anvil | undefined;
218
207
  /** The Aztec Node service or client a connected to it. */
219
208
  aztecNode: AztecNode;
220
- /** The Aztec Node as a service (only set if running locally). */
221
- aztecNodeService: AztecNodeService | undefined;
222
- /** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
223
- aztecNodeAdmin: AztecNodeAdmin | undefined;
224
- /** The prover node service (only set if startProverNode is true) */
225
- proverNode: ProverNode | undefined;
226
- /** A client to the sequencer service (undefined if connected to remote environment) */
209
+ /** The Aztec Node as a service. */
210
+ aztecNodeService: AztecNodeService;
211
+ /** Client to the Aztec Node admin interface. */
212
+ aztecNodeAdmin: AztecNodeAdmin;
213
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
214
+ proverNode: AztecNodeService | undefined;
215
+ /** A client to the sequencer service. */
227
216
  sequencer: SequencerClient | undefined;
228
217
  /** Return values from deployAztecL1Contracts function. */
229
218
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -243,14 +232,18 @@ export type EndToEndContext = {
243
232
  cheatCodes: CheatCodes;
244
233
  /** The cheat codes for L1 */
245
234
  ethCheatCodes: EthCheatCodes;
246
- /** The anvil test watcher (undefined if connected to remote environment) */
247
- watcher: AnvilTestWatcher | undefined;
248
- /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
249
- dateProvider: TestDateProvider | undefined;
235
+ /** The anvil test watcher. */
236
+ watcher: AnvilTestWatcher;
237
+ /** Allows tweaking current system time, used by the epoch cache only. */
238
+ dateProvider: TestDateProvider;
250
239
  /** Telemetry client */
251
- telemetryClient: TelemetryClient | undefined;
240
+ telemetryClient: TelemetryClient;
252
241
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
253
242
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
243
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
244
+ sequencerDelayer: Delayer | undefined;
245
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
246
+ proverDelayer: Delayer | undefined;
254
247
  /** Prefilled public data used for setting up nodes. */
255
248
  prefilledPublicData: PublicDataTreeLeaf[] | undefined;
256
249
  /** ACVM config (only set if running locally). */
@@ -258,82 +251,11 @@ export type EndToEndContext = {
258
251
  /** BB config (only set if running locally). */
259
252
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
260
253
  /** Directory to cleanup on teardown. */
261
- directoryToCleanup: string | undefined;
254
+ directoryToCleanup: string;
262
255
  /** Function to stop the started services. */
263
256
  teardown: () => Promise<void>;
264
257
  };
265
258
 
266
- /**
267
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
268
- */
269
- async function setupWithRemoteEnvironment(
270
- account: HDAccount | PrivateKeyAccount,
271
- config: AztecNodeConfig,
272
- logger: Logger,
273
- numberOfAccounts: number,
274
- ): Promise<EndToEndContext> {
275
- const aztecNodeUrl = getAztecUrl();
276
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
277
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
278
- await waitForNode(aztecNode, logger);
279
- logger.verbose('JSON RPC client connected to Aztec Node');
280
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
281
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
282
-
283
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
284
-
285
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
286
- l1ContractAddresses,
287
- l1Client,
288
- rollupVersion,
289
- };
290
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
291
- const wallet = await TestWallet.create(aztecNode);
292
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
293
- const teardown = () => Promise.resolve();
294
-
295
- logger.verbose('Populating wallet from already registered accounts...');
296
- const initialFundedAccounts = await getInitialTestAccountsData();
297
-
298
- if (initialFundedAccounts.length < numberOfAccounts) {
299
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
300
- }
301
-
302
- const testAccounts = await Promise.all(
303
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
304
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
305
- return accountManager.address;
306
- }),
307
- );
308
-
309
- return {
310
- anvil: undefined,
311
- aztecNode,
312
- aztecNodeService: undefined,
313
- aztecNodeAdmin: undefined,
314
- sequencer: undefined,
315
- proverNode: undefined,
316
- deployL1ContractsValues,
317
- config,
318
- aztecNodeConfig: config,
319
- initialFundedAccounts,
320
- wallet,
321
- accounts: testAccounts,
322
- logger,
323
- cheatCodes,
324
- ethCheatCodes,
325
- prefilledPublicData: undefined,
326
- mockGossipSubNetwork: undefined,
327
- watcher: undefined,
328
- dateProvider: undefined,
329
- telemetryClient: undefined,
330
- acvmConfig: undefined,
331
- bbConfig: undefined,
332
- directoryToCleanup: undefined,
333
- teardown,
334
- };
335
- }
336
-
337
259
  /**
338
260
  * Sets up the environment for the end-to-end tests.
339
261
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
@@ -361,8 +283,12 @@ export async function setup(
361
283
  config.realProofs = !!opts.realProofs;
362
284
  // Only enforce the time table if requested
363
285
  config.enforceTimeTable = !!opts.enforceTimeTable;
286
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
287
+ config.enableDelayer = true;
364
288
  config.listenAddress = '127.0.0.1';
365
289
 
290
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
291
+
366
292
  const logger = getLogger();
367
293
 
368
294
  // Create a temp directory for any services that need it and cleanup later
@@ -376,16 +302,10 @@ export async function setup(
376
302
  if (!isAnvilTestChain(chain.id)) {
377
303
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
378
304
  }
379
- if (AZTEC_NODE_URL) {
380
- throw new Error(
381
- `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`,
382
- );
383
- }
384
-
385
305
  const res = await startAnvil({
386
306
  l1BlockTime: opts.ethereumSlotDuration,
387
307
  accounts: opts.anvilAccounts,
388
- port: opts.anvilPort,
308
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
389
309
  });
390
310
  anvil = res.anvil;
391
311
  config.l1RpcUrls = [res.rpcUrl];
@@ -416,11 +336,11 @@ export async function setup(
416
336
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
417
337
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
418
338
  } else if (
419
- config.publisherPrivateKeys &&
420
- config.publisherPrivateKeys.length > 0 &&
421
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
339
+ config.sequencerPublisherPrivateKeys &&
340
+ config.sequencerPublisherPrivateKeys.length > 0 &&
341
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
422
342
  ) {
423
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
343
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
424
344
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
425
345
  } else if (!MNEMONIC) {
426
346
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -429,18 +349,13 @@ export async function setup(
429
349
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
430
350
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
431
351
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
432
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
352
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
433
353
  }
434
354
 
435
355
  if (config.coinbase === undefined) {
436
356
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
437
357
  }
438
358
 
439
- if (AZTEC_NODE_URL) {
440
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
441
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
442
- }
443
-
444
359
  // Determine which addresses to fund in genesis
445
360
  const initialFundedAccounts =
446
361
  opts.initialFundedAccounts ??
@@ -497,9 +412,14 @@ export async function setup(
497
412
  if (enableAutomine) {
498
413
  await ethCheatCodes.setAutomine(false);
499
414
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
500
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
501
415
  }
502
416
 
417
+ // Always sync dateProvider to L1 time after deploying L1 contracts, regardless of mining mode.
418
+ // In compose mode, L1 time may have drifted ahead of system time due to the local-network watcher
419
+ // warping time forward on each filled slot. Without this sync, the sequencer computes the wrong
420
+ // slot from its dateProvider and cannot propose blocks.
421
+ dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
422
+
503
423
  if (opts.l2StartTime) {
504
424
  await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
505
425
  }
@@ -567,44 +487,52 @@ export async function setup(
567
487
  }
568
488
  }
569
489
 
570
- const aztecNodeService = await AztecNodeService.createAndSync(
571
- config,
572
- { dateProvider, telemetry: telemetryClient, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
573
- { prefilledPublicData },
490
+ const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
491
+ AztecNodeService.createAndSync(
492
+ config,
493
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
494
+ { prefilledPublicData },
495
+ ),
574
496
  );
575
497
  const sequencerClient = aztecNodeService.getSequencer();
576
498
 
577
- if (sequencerClient) {
578
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
579
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
580
- }
581
-
582
- let proverNode: ProverNode | undefined = undefined;
499
+ let proverNode: AztecNodeService | undefined = undefined;
583
500
  if (opts.startProverNode) {
584
501
  logger.verbose('Creating and syncing a simulated prover node...');
585
502
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
586
503
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
587
504
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
588
- const proverNodeConfig = {
589
- ...config.proverNodeConfig,
590
- dataDirectory: proverNodeDataDirectory,
591
- p2pEnabled: false,
505
+
506
+ const p2pClientDeps: Partial<P2PClientDeps<P2PClientType.Full>> = {
507
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
508
+ rpcTxProviders: [aztecNodeService],
592
509
  };
593
- proverNode = await createAndSyncProverNode(
510
+
511
+ ({ proverNode } = await createAndSyncProverNode(
594
512
  proverNodePrivateKeyHex,
595
513
  config,
596
- proverNodeConfig,
597
- aztecNodeService,
598
- prefilledPublicData,
599
- );
514
+ {
515
+ ...config.proverNodeConfig,
516
+ dataDirectory: proverNodeDataDirectory,
517
+ },
518
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
519
+ { prefilledPublicData },
520
+ ));
600
521
  }
601
522
 
523
+ const sequencerDelayer = sequencerClient?.getDelayer();
524
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
525
+
602
526
  logger.verbose('Creating a pxe...');
603
527
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
604
528
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
605
529
  // For tests we only want proving enabled if specifically requested
606
530
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
607
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
531
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, { loggerActorLabel: 'pxe-0' });
532
+
533
+ if (opts.walletMinFeePadding !== undefined) {
534
+ wallet.setMinFeePadding(opts.walletMinFeePadding);
535
+ }
608
536
 
609
537
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
610
538
 
@@ -629,7 +557,7 @@ export async function setup(
629
557
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
630
558
  );
631
559
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
632
- const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
560
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
633
561
  accounts = accountManagers.map(accountManager => accountManager.address);
634
562
  } else if (needsEmptyBlock) {
635
563
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
@@ -672,7 +600,7 @@ export async function setup(
672
600
  logger.error(`Error during e2e test teardown`, err);
673
601
  } finally {
674
602
  try {
675
- await telemetryClient?.stop();
603
+ await telemetryClient.stop();
676
604
  } catch (err) {
677
605
  logger.error(`Error during telemetry client stop`, err);
678
606
  }
@@ -695,6 +623,8 @@ export async function setup(
695
623
  mockGossipSubNetwork,
696
624
  prefilledPublicData,
697
625
  proverNode,
626
+ sequencerDelayer,
627
+ proverDelayer,
698
628
  sequencer: sequencerClient,
699
629
  teardown,
700
630
  telemetryClient,
@@ -778,93 +708,53 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
778
708
  );
779
709
  }
780
710
 
711
+ /**
712
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
713
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
714
+ */
781
715
  export function createAndSyncProverNode(
782
716
  proverNodePrivateKey: `0x${string}`,
783
- aztecNodeConfig: AztecNodeConfig,
784
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
785
- aztecNode: AztecNode | undefined,
786
- prefilledPublicData: PublicDataTreeLeaf[] = [],
787
- proverNodeDeps: ProverNodeDeps = {},
788
- ) {
789
- return withLogNameSuffix('prover-node', async () => {
790
- const aztecNodeTxProvider = aztecNode && {
791
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
792
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
793
- stop: () => Promise.resolve(),
794
- };
795
-
796
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
797
-
798
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
799
- const archiver = await createArchiver(
800
- archiverConfig,
801
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
802
- { blockUntilSync: true },
803
- );
804
-
805
- const proverConfig: ProverNodeConfig = {
806
- ...aztecNodeConfig,
807
- txCollectionNodeRpcUrls: [],
808
- realProofs: false,
809
- proverAgentCount: 2,
810
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
811
- proverNodeMaxPendingJobs: 10,
812
- proverNodeMaxParallelBlocksPerEpoch: 32,
813
- proverNodePollingIntervalMs: 200,
814
- txGatheringIntervalMs: 1000,
815
- txGatheringBatchSize: 10,
816
- txGatheringMaxParallelRequestsPerNode: 10,
817
- txGatheringTimeoutMs: 24_000,
818
- proverNodeFailedEpochStore: undefined,
819
- proverId: EthAddress.fromNumber(1),
820
- proverNodeEpochProvingDelayMs: undefined,
821
- ...proverNodeConfig,
822
- };
823
-
824
- const l1TxUtils = createDelayedL1TxUtils(
825
- aztecNodeConfig,
826
- proverNodePrivateKey,
827
- 'prover-node',
828
- proverNodeDeps.dateProvider,
717
+ baseConfig: AztecNodeConfig,
718
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
719
+ deps: {
720
+ telemetry?: TelemetryClient;
721
+ dateProvider: DateProvider;
722
+ p2pClientDeps?: P2PClientDeps<P2PClientType.Full>;
723
+ },
724
+ options: { prefilledPublicData: PublicDataTreeLeaf[]; dontStart?: boolean },
725
+ ): Promise<{ proverNode: AztecNodeService }> {
726
+ return withLoggerBindings({ actor: 'prover-0' }, async () => {
727
+ const proverNode = await AztecNodeService.createAndSync(
728
+ {
729
+ ...baseConfig,
730
+ ...configOverrides,
731
+ p2pPort: 0,
732
+ enableProverNode: true,
733
+ disableValidator: true,
734
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
735
+ },
736
+ deps,
737
+ { ...options, dontStartProverNode: options.dontStart },
829
738
  );
830
739
 
831
- const proverNode = await createProverNode(
832
- proverConfig,
833
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
834
- { prefilledPublicData },
835
- );
836
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
837
- if (!proverNodeConfig.dontStart) {
838
- await proverNode.start();
740
+ if (!proverNode.getProverNode()) {
741
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
839
742
  }
840
- return proverNode;
841
- });
842
- }
843
743
 
844
- function createDelayedL1TxUtils(
845
- aztecNodeConfig: AztecNodeConfig,
846
- privateKey: `0x${string}`,
847
- logName: string,
848
- dateProvider?: DateProvider,
849
- ) {
850
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
851
-
852
- const log = createLogger(logName);
853
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
854
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
855
- return l1TxUtils;
744
+ getLogger().info(`Created and synced prover node`);
745
+ return { proverNode };
746
+ });
856
747
  }
857
748
 
858
749
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
859
750
  export function getBalancesFn(
860
751
  symbol: string,
861
752
  method: ContractMethod,
862
- from: AztecAddress,
863
753
  logger: any,
864
754
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
865
755
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
866
756
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
867
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
757
+ const b = await Promise.all(addresses.map(address => method(address).simulate({ from: address })));
868
758
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
869
759
  logger.verbose(debugString);
870
760
  return b;
@@ -921,13 +811,11 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
921
811
  ).map(contractMetadata => contractMetadata.instance);
922
812
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
923
813
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
924
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
925
- .send({ from: accountsToDeploy[0] })
926
- .wait();
814
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
927
815
  }
928
816
  const requests = instances.map(instance => publishInstance(wallet, instance!));
929
817
  const batch = new BatchCall(wallet, requests);
930
- await batch.send({ from: accountsToDeploy[0] }).wait();
818
+ await batch.send({ from: accountsToDeploy[0] });
931
819
  }
932
820
 
933
821
  /**
@@ -951,12 +839,10 @@ export const deployAccounts =
951
839
  deployedAccounts[i].signingKey,
952
840
  );
953
841
  const deployMethod = await accountManager.getDeployMethod();
954
- await deployMethod
955
- .send({
956
- from: AztecAddress.ZERO,
957
- skipClassPublication: i !== 0, // Publish the contract class at most once.
958
- })
959
- .wait();
842
+ await deployMethod.send({
843
+ from: AztecAddress.ZERO,
844
+ skipClassPublication: i !== 0, // Publish the contract class at most once.
845
+ });
960
846
  }
961
847
 
962
848
  return { deployedAccounts };
@@ -986,7 +872,7 @@ export async function publicDeployAccounts(
986
872
 
987
873
  const batch = new BatchCall(wallet, calls);
988
874
 
989
- const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
875
+ const txReceipt = await batch.send({ from: accountsToDeploy[0] });
990
876
  if (waitUntilProven) {
991
877
  if (!node) {
992
878
  throw new Error('Need to provide an AztecNode to wait for proven.');