@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.2f68f620

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 (234) hide show
  1. package/README.md +27 -0
  2. package/dest/bench/client_flows/benchmark.d.ts +15 -1
  3. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  4. package/dest/bench/client_flows/benchmark.js +17 -0
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts +3 -3
  6. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  7. package/dest/bench/client_flows/client_flows_benchmark.js +36 -39
  8. package/dest/bench/client_flows/config.d.ts +2 -2
  9. package/dest/bench/client_flows/config.d.ts.map +1 -1
  10. package/dest/bench/client_flows/config.js +18 -0
  11. package/dest/bench/utils.d.ts +1 -1
  12. package/dest/bench/utils.d.ts.map +1 -1
  13. package/dest/bench/utils.js +8 -3
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -5
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  16. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +36 -17
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +16 -5
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  19. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +42 -9
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -4
  21. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  22. package/dest/e2e_deploy_contract/deploy_test.js +2 -1
  23. package/dest/e2e_epochs/epochs_test.d.ts +39 -8
  24. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  25. package/dest/e2e_epochs/epochs_test.js +170 -52
  26. package/dest/e2e_fees/fees_test.d.ts +6 -3
  27. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  28. package/dest/e2e_fees/fees_test.js +50 -17
  29. package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
  30. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  31. package/dest/e2e_l1_publisher/write_json.js +1 -7
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  37. package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
  38. package/dest/e2e_p2p/p2p_network.d.ts +14 -12
  39. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  40. package/dest/e2e_p2p/p2p_network.js +70 -34
  41. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  42. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  43. package/dest/e2e_p2p/reqresp/utils.js +206 -0
  44. package/dest/e2e_p2p/shared.d.ts +37 -8
  45. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  46. package/dest/e2e_p2p/shared.js +93 -53
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  50. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  51. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  52. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  53. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -4
  54. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  55. package/dest/e2e_token_contract/token_contract_test.js +23 -11
  56. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  57. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  58. package/dest/fixtures/authwit_proxy.js +34 -0
  59. package/dest/fixtures/e2e_prover_test.d.ts +9 -8
  60. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  61. package/dest/fixtures/e2e_prover_test.js +40 -51
  62. package/dest/fixtures/elu_monitor.d.ts +21 -0
  63. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  64. package/dest/fixtures/elu_monitor.js +102 -0
  65. package/dest/fixtures/fixtures.d.ts +74 -1
  66. package/dest/fixtures/fixtures.d.ts.map +1 -1
  67. package/dest/fixtures/fixtures.js +71 -0
  68. package/dest/fixtures/get_bb_config.d.ts +1 -1
  69. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  70. package/dest/fixtures/get_bb_config.js +5 -5
  71. package/dest/fixtures/ha_setup.d.ts +71 -0
  72. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  73. package/dest/fixtures/ha_setup.js +116 -0
  74. package/dest/fixtures/index.d.ts +2 -1
  75. package/dest/fixtures/index.d.ts.map +1 -1
  76. package/dest/fixtures/index.js +1 -0
  77. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  78. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  79. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  80. package/dest/fixtures/setup.d.ts +88 -34
  81. package/dest/fixtures/setup.d.ts.map +1 -1
  82. package/dest/fixtures/setup.js +225 -180
  83. package/dest/fixtures/setup_p2p_test.d.ts +22 -11
  84. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  85. package/dest/fixtures/setup_p2p_test.js +43 -32
  86. package/dest/fixtures/token_utils.d.ts +2 -2
  87. package/dest/fixtures/token_utils.d.ts.map +1 -1
  88. package/dest/fixtures/token_utils.js +5 -7
  89. package/dest/fixtures/utils.d.ts +2 -2
  90. package/dest/fixtures/utils.d.ts.map +1 -1
  91. package/dest/fixtures/utils.js +1 -1
  92. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  93. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  94. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  95. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  96. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  97. package/dest/forward-compatibility/wallet_service.js +109 -0
  98. package/dest/install_legacy_contracts.d.cts +10 -0
  99. package/dest/install_legacy_contracts.d.cts.map +1 -0
  100. package/dest/legacy-jest-resolver.d.cts +3 -0
  101. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  102. package/dest/shared/cross_chain_test_harness.d.ts +4 -2
  103. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  104. package/dest/shared/cross_chain_test_harness.js +22 -18
  105. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  106. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  107. package/dest/shared/gas_portal_test_harness.js +19 -10
  108. package/dest/shared/index.d.ts +2 -1
  109. package/dest/shared/index.d.ts.map +1 -1
  110. package/dest/shared/index.js +1 -0
  111. package/dest/shared/jest_setup.js +41 -1
  112. package/dest/shared/mock_state_view.d.ts +86 -0
  113. package/dest/shared/mock_state_view.d.ts.map +1 -0
  114. package/dest/shared/mock_state_view.js +186 -0
  115. package/dest/shared/submit-transactions.d.ts +2 -2
  116. package/dest/shared/submit-transactions.d.ts.map +1 -1
  117. package/dest/shared/submit-transactions.js +1 -1
  118. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  119. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  120. package/dest/shared/uniswap_l1_l2.js +57 -40
  121. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  122. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  123. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  124. package/dest/simulators/lending_simulator.d.ts +10 -3
  125. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  126. package/dest/simulators/lending_simulator.js +26 -14
  127. package/dest/simulators/token_simulator.d.ts +1 -1
  128. package/dest/simulators/token_simulator.d.ts.map +1 -1
  129. package/dest/simulators/token_simulator.js +3 -24
  130. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  131. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  132. package/dest/spartan/setup_test_wallets.js +108 -41
  133. package/dest/spartan/tx_metrics.d.ts +52 -4
  134. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  135. package/dest/spartan/tx_metrics.js +224 -21
  136. package/dest/spartan/utils/bot.d.ts +3 -2
  137. package/dest/spartan/utils/bot.d.ts.map +1 -1
  138. package/dest/spartan/utils/bot.js +2 -1
  139. package/dest/spartan/utils/config.d.ts +11 -28
  140. package/dest/spartan/utils/config.d.ts.map +1 -1
  141. package/dest/spartan/utils/config.js +4 -1
  142. package/dest/spartan/utils/index.d.ts +6 -4
  143. package/dest/spartan/utils/index.d.ts.map +1 -1
  144. package/dest/spartan/utils/index.js +6 -2
  145. package/dest/spartan/utils/k8s.d.ts +31 -1
  146. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  147. package/dest/spartan/utils/k8s.js +124 -0
  148. package/dest/spartan/utils/nodes.d.ts +14 -5
  149. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  150. package/dest/spartan/utils/nodes.js +204 -33
  151. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  152. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  153. package/dest/spartan/utils/pod_logs.js +74 -0
  154. package/dest/spartan/utils/scripts.d.ts +18 -4
  155. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  156. package/dest/spartan/utils/scripts.js +19 -4
  157. package/dest/test-wallet/test_wallet.d.ts +85 -0
  158. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  159. package/dest/test-wallet/test_wallet.js +273 -0
  160. package/dest/test-wallet/utils.d.ts +41 -0
  161. package/dest/test-wallet/utils.d.ts.map +1 -0
  162. package/dest/test-wallet/utils.js +66 -0
  163. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  164. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  165. package/dest/test-wallet/wallet_worker_script.js +53 -0
  166. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  167. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  168. package/dest/test-wallet/worker_wallet.js +155 -0
  169. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  170. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  171. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  172. package/package.json +52 -45
  173. package/src/bench/client_flows/benchmark.ts +19 -0
  174. package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
  175. package/src/bench/client_flows/config.ts +9 -1
  176. package/src/bench/utils.ts +10 -4
  177. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
  178. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
  179. package/src/e2e_deploy_contract/deploy_test.ts +6 -5
  180. package/src/e2e_epochs/epochs_test.ts +196 -77
  181. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  182. package/src/e2e_fees/fees_test.ts +57 -32
  183. package/src/e2e_l1_publisher/write_json.ts +1 -6
  184. package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
  185. package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
  186. package/src/e2e_p2p/p2p_network.ts +93 -49
  187. package/src/e2e_p2p/reqresp/utils.ts +274 -0
  188. package/src/e2e_p2p/shared.ts +117 -65
  189. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  190. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  191. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  192. package/src/e2e_token_contract/token_contract_test.ts +38 -11
  193. package/src/fixtures/authwit_proxy.ts +54 -0
  194. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  195. package/src/fixtures/e2e_prover_test.ts +50 -57
  196. package/src/fixtures/elu_monitor.ts +126 -0
  197. package/src/fixtures/fixtures.ts +93 -0
  198. package/src/fixtures/get_bb_config.ts +7 -6
  199. package/src/fixtures/ha_setup.ts +188 -0
  200. package/src/fixtures/index.ts +1 -0
  201. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  202. package/src/fixtures/setup.ts +282 -243
  203. package/src/fixtures/setup_p2p_test.ts +52 -52
  204. package/src/fixtures/token_utils.ts +3 -3
  205. package/src/fixtures/utils.ts +2 -0
  206. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  207. package/src/forward-compatibility/wallet_service.ts +104 -0
  208. package/src/guides/up_quick_start.sh +3 -5
  209. package/src/install_legacy_contracts.cjs +75 -0
  210. package/src/legacy-jest-resolver.cjs +112 -0
  211. package/src/shared/cross_chain_test_harness.ts +27 -13
  212. package/src/shared/gas_portal_test_harness.ts +21 -11
  213. package/src/shared/index.ts +1 -0
  214. package/src/shared/jest_setup.ts +51 -1
  215. package/src/shared/mock_state_view.ts +188 -0
  216. package/src/shared/submit-transactions.ts +3 -2
  217. package/src/shared/uniswap_l1_l2.ts +103 -54
  218. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  219. package/src/simulators/lending_simulator.ts +32 -14
  220. package/src/simulators/token_simulator.ts +6 -30
  221. package/src/spartan/setup_test_wallets.ts +146 -35
  222. package/src/spartan/tx_metrics.ts +208 -24
  223. package/src/spartan/utils/bot.ts +4 -1
  224. package/src/spartan/utils/config.ts +3 -0
  225. package/src/spartan/utils/index.ts +10 -1
  226. package/src/spartan/utils/k8s.ts +160 -0
  227. package/src/spartan/utils/nodes.ts +251 -31
  228. package/src/spartan/utils/pod_logs.ts +99 -0
  229. package/src/spartan/utils/scripts.ts +43 -7
  230. package/src/test-wallet/test_wallet.ts +376 -0
  231. package/src/test-wallet/utils.ts +108 -0
  232. package/src/test-wallet/wallet_worker_script.ts +63 -0
  233. package/src/test-wallet/worker_wallet.ts +218 -0
  234. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,22 +1,23 @@
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';
4
+ import { NO_FROM } from '@aztec/aztec.js/account';
5
5
  import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
6
6
  import {
7
7
  BatchCall,
8
8
  type ContractFunctionInteraction,
9
9
  type ContractMethod,
10
+ type DeployOptions,
11
+ type InteractionWaitOptions,
10
12
  getContractClassFromArtifact,
11
13
  waitForProven,
12
14
  } from '@aztec/aztec.js/contracts';
13
15
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
14
16
  import { Fr } from '@aztec/aztec.js/fields';
15
17
  import { type Logger, createLogger } from '@aztec/aztec.js/log';
16
- import { type AztecNode, createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
18
+ import type { AztecNode } from '@aztec/aztec.js/node';
17
19
  import type { Wallet } from '@aztec/aztec.js/wallet';
18
- import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
19
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
20
+ import { AnvilTestWatcher, type AnvilTestWatcherOpts, CheatCodes } from '@aztec/aztec/testing';
20
21
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
21
22
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
22
23
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -30,36 +31,34 @@ import {
30
31
  type ZKPassportArgs,
31
32
  deployAztecL1Contracts,
32
33
  } from '@aztec/ethereum/deploy-aztec-l1-contracts';
33
- import {
34
- DelayedTxUtils,
35
- EthCheatCodes,
36
- EthCheatCodesWithState,
37
- createDelayedL1TxUtilsFromViemWallet,
38
- startAnvil,
39
- } from '@aztec/ethereum/test';
34
+ import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
35
+ import { EthCheatCodes, EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
36
+ import type { Anvil } from '@aztec/ethereum/test';
40
37
  import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
41
38
  import { SecretValue } from '@aztec/foundation/config';
42
39
  import { randomBytes } from '@aztec/foundation/crypto/random';
43
40
  import { tryRmDir } from '@aztec/foundation/fs';
44
- import { withLogNameSuffix } from '@aztec/foundation/log';
41
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
45
42
  import { retryUntil } from '@aztec/foundation/retry';
46
43
  import { sleep } from '@aztec/foundation/sleep';
47
44
  import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
48
- import type { DataStoreConfig } from '@aztec/kv-store/config';
49
45
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
50
46
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
51
47
  import type { P2PClientDeps } from '@aztec/p2p';
52
48
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
53
49
  import { protocolContractsHash } from '@aztec/protocol-contracts';
54
- import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
55
- import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
50
+ import type { ProverNodeConfig } from '@aztec/prover-node';
51
+ import { type PXEConfig, type PXECreationOptions, getPXEConfig } from '@aztec/pxe/server';
56
52
  import type { SequencerClient } from '@aztec/sequencer-client';
57
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
53
+ import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
54
+ import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
55
+ import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
56
+ import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
58
57
  import { type ContractInstanceWithAddress, getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
59
- import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
58
+ import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
60
59
  import { tryStop } from '@aztec/stdlib/interfaces/server';
61
- import type { P2PClientType } from '@aztec/stdlib/p2p';
62
60
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
61
+ import type { GenesisData } from '@aztec/stdlib/world-state';
63
62
  import {
64
63
  type TelemetryClient,
65
64
  type TelemetryClientConfig,
@@ -67,10 +66,9 @@ import {
67
66
  initTelemetryClient,
68
67
  } from '@aztec/telemetry-client';
69
68
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
70
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
69
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
71
70
  import { getGenesisValues } from '@aztec/world-state/testing';
72
71
 
73
- import type { Anvil } from '@viem/anvil';
74
72
  import fs from 'fs/promises';
75
73
  import { tmpdir } from 'os';
76
74
  import path from 'path';
@@ -84,6 +82,7 @@ import {
84
82
  } from 'viem/accounts';
85
83
  import { type Chain, foundry } from 'viem/chains';
86
84
 
85
+ import { TestWallet } from '../test-wallet/test_wallet.js';
87
86
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
88
87
  import { getACVMConfig } from './get_acvm_config.js';
89
88
  import { getBBConfig } from './get_bb_config.js';
@@ -92,9 +91,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
92
91
 
93
92
  export { startAnvil };
94
93
 
95
- const { AZTEC_NODE_URL = '' } = process.env;
96
- const getAztecUrl = () => AZTEC_NODE_URL;
97
-
98
94
  let telemetry: TelemetryClient | undefined = undefined;
99
95
  async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
100
96
  if (!telemetry) {
@@ -125,14 +121,14 @@ export async function setupSharedBlobStorage(config: { dataDirectory?: string }
125
121
  * @param aztecNode - An instance of Aztec Node.
126
122
  * @param opts - Partial configuration for the PXE.
127
123
  * @param logger - The logger to be used.
128
- * @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
124
+ * @param actor - Actor label to include in log output (e.g., 'pxe-test').
129
125
  * @returns A test wallet, logger and teardown function.
130
126
  */
131
127
  export async function setupPXEAndGetWallet(
132
128
  aztecNode: AztecNode,
133
129
  opts: Partial<PXEConfig> = {},
134
130
  logger = getLogger(),
135
- useLogSuffix = false,
131
+ actor?: string,
136
132
  ): Promise<{
137
133
  wallet: TestWallet;
138
134
  logger: Logger;
@@ -150,9 +146,7 @@ export async function setupPXEAndGetWallet(
150
146
 
151
147
  const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(PXEConfig.dataDirectory!);
152
148
 
153
- const wallet = await TestWallet.create(aztecNode, PXEConfig, {
154
- useLogSuffix,
155
- });
149
+ const wallet = await TestWallet.create(aztecNode, PXEConfig, { loggerActorLabel: actor });
156
150
 
157
151
  return {
158
152
  wallet,
@@ -191,14 +185,22 @@ export type SetupOptions = {
191
185
  proverNodeConfig?: Partial<ProverNodeConfig>;
192
186
  /** Whether to use a mock gossip sub network for p2p clients. */
193
187
  mockGossipSubNetwork?: boolean;
188
+ /** Whether to add simulated latency to the mock gossipsub network (in ms) */
189
+ mockGossipSubNetworkLatency?: number;
194
190
  /** Whether to disable the anvil test watcher (can still be manually started) */
195
191
  disableAnvilTestWatcher?: boolean;
192
+ anvilTestWatcherOpts?: AnvilTestWatcherOpts;
196
193
  /** Whether to enable anvil automine during deployment of L1 contracts (consider defaulting this to true). */
197
194
  automineL1Setup?: boolean;
198
195
  /** How many accounts to seed and unlock in anvil. */
199
196
  anvilAccounts?: number;
200
197
  /** Port to start anvil (defaults to 8545) */
201
198
  anvilPort?: number;
199
+ /**
200
+ * Number of slots per epoch for Anvil's finality simulation.
201
+ * Anvil reports `finalized = latest - slotsInAnEpoch * 2`.
202
+ */
203
+ anvilSlotsInAnEpoch?: number;
202
204
  /** Key to use for publishing L1 contracts */
203
205
  l1PublisherKey?: SecretValue<`0x${string}`>;
204
206
  /** ZkPassport configuration (domain, scope, mock verifier) */
@@ -209,8 +211,16 @@ export type SetupOptions = {
209
211
  skipAccountDeployment?: boolean;
210
212
  /** L1 contracts deployment arguments. */
211
213
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
212
- /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
214
+ /** Wallet minimum fee padding multiplier */
213
215
  walletMinFeePadding?: number;
216
+ /** Whether the initial node should be a lightweight RPC-only node (no sequencer, no validator).
217
+ * Use for tests that create their own validator nodes and don't need the initial sequencer. */
218
+ skipInitialSequencer?: boolean;
219
+ /** Whether to swap the production Sequencer for the minimal AutomineSequencer.
220
+ * Use only for single-sequencer non-block-building tests. See AUTOMINE_E2E_OPTS in `fixtures.ts`. */
221
+ useAutomineSequencer?: boolean;
222
+ /** Options forwarded to PXE creation (e.g. execution hooks). */
223
+ pxeCreationOptions?: PXECreationOptions;
214
224
  } & Partial<AztecNodeConfig>;
215
225
 
216
226
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -218,14 +228,14 @@ export type EndToEndContext = {
218
228
  /** The Anvil instance (only set if anvil was started locally). */
219
229
  anvil: Anvil | undefined;
220
230
  /** The Aztec Node service or client a connected to it. */
221
- aztecNode: AztecNode;
222
- /** The Aztec Node as a service (only set if running locally). */
223
- aztecNodeService: AztecNodeService | undefined;
224
- /** Client to the Aztec Node admin interface (undefined if connected to remote environment) */
225
- aztecNodeAdmin: AztecNodeAdmin | undefined;
226
- /** The prover node service (only set if startProverNode is true) */
227
- proverNode: ProverNode | undefined;
228
- /** A client to the sequencer service (undefined if connected to remote environment) */
231
+ aztecNode: AztecNode & AztecNodeDebug;
232
+ /** The Aztec Node as a service. */
233
+ aztecNodeService: AztecNodeService;
234
+ /** Client to the Aztec Node admin interface. */
235
+ aztecNodeAdmin: AztecNodeAdmin;
236
+ /** The aztec node running the prover node subsystem (only set if startProverNode is true). */
237
+ proverNode: AztecNodeService | undefined;
238
+ /** A client to the sequencer service. */
229
239
  sequencer: SequencerClient | undefined;
230
240
  /** Return values from deployAztecL1Contracts function. */
231
241
  deployL1ContractsValues: DeployAztecL1ContractsReturnType;
@@ -245,100 +255,54 @@ export type EndToEndContext = {
245
255
  cheatCodes: CheatCodes;
246
256
  /** The cheat codes for L1 */
247
257
  ethCheatCodes: EthCheatCodes;
248
- /** The anvil test watcher (undefined if connected to remote environment) */
249
- watcher: AnvilTestWatcher | undefined;
250
- /** Allows tweaking current system time, used by the epoch cache only (undefined if connected to remote environment) */
251
- dateProvider: TestDateProvider | undefined;
258
+ /** The anvil test watcher. */
259
+ watcher: AnvilTestWatcher;
260
+ /** Allows tweaking current system time, used by the epoch cache only. */
261
+ dateProvider: TestDateProvider;
252
262
  /** Telemetry client */
253
- telemetryClient: TelemetryClient | undefined;
263
+ telemetryClient: TelemetryClient;
254
264
  /** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
255
265
  mockGossipSubNetwork: MockGossipSubNetwork | undefined;
256
- /** Prefilled public data used for setting up nodes. */
257
- prefilledPublicData: PublicDataTreeLeaf[] | undefined;
266
+ /** Delayer for sequencer L1 txs (only when enableDelayer is true). */
267
+ sequencerDelayer: Delayer | undefined;
268
+ /** Delayer for prover node L1 txs (only when enableDelayer and startProverNode are true). */
269
+ proverDelayer: Delayer | undefined;
270
+ /** Genesis data used for setting up nodes. */
271
+ genesis: GenesisData | undefined;
258
272
  /** ACVM config (only set if running locally). */
259
273
  acvmConfig: Awaited<ReturnType<typeof getACVMConfig>>;
260
274
  /** BB config (only set if running locally). */
261
275
  bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
262
276
  /** Directory to cleanup on teardown. */
263
- directoryToCleanup: string | undefined;
277
+ directoryToCleanup: string;
264
278
  /** Function to stop the started services. */
265
279
  teardown: () => Promise<void>;
266
280
  };
267
281
 
268
282
  /**
269
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
283
+ * When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
284
+ * aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
285
+ * actually swapped in the correct version.
270
286
  */
271
- async function setupWithRemoteEnvironment(
272
- account: HDAccount | PrivateKeyAccount,
273
- config: AztecNodeConfig & SetupOptions,
274
- logger: Logger,
275
- numberOfAccounts: number,
276
- ): Promise<EndToEndContext> {
277
- const aztecNodeUrl = getAztecUrl();
278
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
279
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
280
- await waitForNode(aztecNode, logger);
281
- logger.verbose('JSON RPC client connected to Aztec Node');
282
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
283
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
284
-
285
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
286
-
287
- const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
288
- l1ContractAddresses,
289
- l1Client,
290
- rollupVersion,
291
- };
292
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
293
- const wallet = await TestWallet.create(aztecNode);
294
-
295
- if (config.walletMinFeePadding !== undefined) {
296
- wallet.setMinFeePadding(config.walletMinFeePadding);
287
+ function assertContractArtifactsVersion() {
288
+ const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
289
+ if (!expected) {
290
+ return;
297
291
  }
298
-
299
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
300
- const teardown = () => Promise.resolve();
301
-
302
- logger.verbose('Populating wallet from already registered accounts...');
303
- const initialFundedAccounts = await getInitialTestAccountsData();
304
-
305
- if (initialFundedAccounts.length < numberOfAccounts) {
306
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
292
+ const { aztecVersion } = SponsoredFPCContract.artifact;
293
+ // TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
294
+ if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
295
+ createLogger('e2e:setup').info(
296
+ `Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`,
297
+ );
298
+ return;
299
+ }
300
+ if (aztecVersion !== expected) {
301
+ throw new Error(
302
+ `Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` +
303
+ `The legacy artifact resolver may not have swapped in the correct version.`,
304
+ );
307
305
  }
308
-
309
- const testAccounts = await Promise.all(
310
- initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
311
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
312
- return accountManager.address;
313
- }),
314
- );
315
-
316
- return {
317
- anvil: undefined,
318
- aztecNode,
319
- aztecNodeService: undefined,
320
- aztecNodeAdmin: undefined,
321
- sequencer: undefined,
322
- proverNode: undefined,
323
- deployL1ContractsValues,
324
- config,
325
- aztecNodeConfig: config,
326
- initialFundedAccounts,
327
- wallet,
328
- accounts: testAccounts,
329
- logger,
330
- cheatCodes,
331
- ethCheatCodes,
332
- prefilledPublicData: undefined,
333
- mockGossipSubNetwork: undefined,
334
- watcher: undefined,
335
- dateProvider: undefined,
336
- telemetryClient: undefined,
337
- acvmConfig: undefined,
338
- bbConfig: undefined,
339
- directoryToCleanup: undefined,
340
- teardown,
341
- };
342
306
  }
343
307
 
344
308
  /**
@@ -353,10 +317,11 @@ export async function setup(
353
317
  pxeOpts: Partial<PXEConfig> = {},
354
318
  chain: Chain = foundry,
355
319
  ): Promise<EndToEndContext> {
320
+ assertContractArtifactsVersion();
356
321
  let anvil: Anvil | undefined;
357
322
  try {
358
323
  opts.aztecTargetCommitteeSize ??= 0;
359
- opts.slasherFlavor ??= 'none';
324
+ opts.slasherEnabled ??= false;
360
325
 
361
326
  const config: AztecNodeConfig & SetupOptions = { ...getConfigEnvVars(), ...opts };
362
327
  // use initialValidators for the node config
@@ -368,8 +333,12 @@ export async function setup(
368
333
  config.realProofs = !!opts.realProofs;
369
334
  // Only enforce the time table if requested
370
335
  config.enforceTimeTable = !!opts.enforceTimeTable;
336
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
337
+ config.enableDelayer = true;
371
338
  config.listenAddress = '127.0.0.1';
372
339
 
340
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
341
+
373
342
  const logger = getLogger();
374
343
 
375
344
  // Create a temp directory for any services that need it and cleanup later
@@ -379,20 +348,18 @@ export async function setup(
379
348
  config.dataDirectory = directoryToCleanup;
380
349
  }
381
350
 
351
+ const dateProvider = new TestDateProvider();
352
+
382
353
  if (!config.l1RpcUrls?.length) {
383
354
  if (!isAnvilTestChain(chain.id)) {
384
355
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
385
356
  }
386
- if (AZTEC_NODE_URL) {
387
- throw new Error(
388
- `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`,
389
- );
390
- }
391
-
392
357
  const res = await startAnvil({
393
358
  l1BlockTime: opts.ethereumSlotDuration,
394
359
  accounts: opts.anvilAccounts,
395
- port: opts.anvilPort,
360
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
361
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
362
+ dateProvider,
396
363
  });
397
364
  anvil = res.anvil;
398
365
  config.l1RpcUrls = [res.rpcUrl];
@@ -404,8 +371,6 @@ export async function setup(
404
371
  logger.info(`Logging metrics to ${filename}`);
405
372
  setupMetricsLogger(filename);
406
373
  }
407
-
408
- const dateProvider = new TestDateProvider();
409
374
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
410
375
 
411
376
  if (opts.stateLoad) {
@@ -423,11 +388,11 @@ export async function setup(
423
388
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
424
389
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
425
390
  } else if (
426
- config.publisherPrivateKeys &&
427
- config.publisherPrivateKeys.length > 0 &&
428
- config.publisherPrivateKeys[0].getValue() != NULL_KEY
391
+ config.sequencerPublisherPrivateKeys &&
392
+ config.sequencerPublisherPrivateKeys.length > 0 &&
393
+ config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY
429
394
  ) {
430
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
395
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
431
396
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
432
397
  } else if (!MNEMONIC) {
433
398
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -436,18 +401,13 @@ export async function setup(
436
401
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
437
402
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
438
403
  publisherPrivKeyHex = `0x${publisherPrivKey!.toString('hex')}` as const;
439
- config.publisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
404
+ config.sequencerPublisherPrivateKeys = [new SecretValue(publisherPrivKeyHex)];
440
405
  }
441
406
 
442
407
  if (config.coinbase === undefined) {
443
408
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
444
409
  }
445
410
 
446
- if (AZTEC_NODE_URL) {
447
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
448
- return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
449
- }
450
-
451
411
  // Determine which addresses to fund in genesis
452
412
  const initialFundedAccounts =
453
413
  opts.initialFundedAccounts ??
@@ -460,10 +420,12 @@ export async function setup(
460
420
  addressesToFund.push(sponsoredFPCAddress);
461
421
  }
462
422
 
463
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(
423
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
424
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(
464
425
  addressesToFund,
465
426
  opts.initialAccountFeeJuice,
466
427
  opts.genesisPublicData,
428
+ genesisTimestamp,
467
429
  );
468
430
 
469
431
  const wasAutomining = await ethCheatCodes.isAutoMining();
@@ -498,13 +460,37 @@ export async function setup(
498
460
  },
499
461
  );
500
462
 
501
- config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
463
+ Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
502
464
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
503
465
 
466
+ // Propagate L1-contracts-config overrides back to the node config so the archiver's
467
+ // `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
468
+ // Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
469
+ // but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
470
+ // `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
471
+ // `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
472
+ // Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
473
+ // by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
474
+ // as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
475
+ // in this function and crash `setupSharedBlobStorage`.
476
+ if (opts.l1ContractsArgs) {
477
+ for (const [key, value] of Object.entries(opts.l1ContractsArgs)) {
478
+ if (value !== undefined) {
479
+ (config as unknown as Record<string, unknown>)[key] = value;
480
+ }
481
+ }
482
+ }
483
+
504
484
  if (enableAutomine) {
505
485
  await ethCheatCodes.setAutomine(false);
506
486
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
507
- dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
487
+ }
488
+
489
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
490
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
491
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
492
+ if (!anvil) {
493
+ dateProvider.setTime((await ethCheatCodes.lastBlockTimestamp()) * 1000);
508
494
  }
509
495
 
510
496
  if (opts.l2StartTime) {
@@ -516,6 +502,7 @@ export async function setup(
516
502
  deployL1ContractsValues.l1ContractAddresses.rollupAddress,
517
503
  deployL1ContractsValues.l1Client,
518
504
  dateProvider,
505
+ opts.anvilTestWatcherOpts,
519
506
  );
520
507
  if (!opts.disableAnvilTestWatcher) {
521
508
  await watcher.start();
@@ -543,10 +530,10 @@ export async function setup(
543
530
  }
544
531
 
545
532
  let mockGossipSubNetwork: MockGossipSubNetwork | undefined;
546
- let p2pClientDeps: P2PClientDeps<P2PClientType.Full> | undefined = undefined;
533
+ let p2pClientDeps: P2PClientDeps | undefined = undefined;
547
534
 
548
535
  if (opts.mockGossipSubNetwork) {
549
- mockGossipSubNetwork = new MockGossipSubNetwork();
536
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
550
537
  p2pClientDeps = { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) };
551
538
  }
552
539
 
@@ -559,11 +546,17 @@ export async function setup(
559
546
  throw new Error('minTxsPerBlock is undefined in e2e test setup');
560
547
  }
561
548
 
562
- // Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
549
+ // Whether we're deploying accounts (and therefore need reliable block inclusion past genesis)
563
550
  const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
564
551
  // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
565
552
  const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
566
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
553
+ // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at
554
+ // slot N start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on
555
+ // alternating slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) for account
556
+ // deployment. Automine is unaffected: its runBuild clamps mempool builds to
557
+ // Math.max(minTxsPerBlock ?? 1, 1) and still requires minValidTxs: 1.
558
+ const accountsDeployMinTxs = 0;
559
+ config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
567
560
 
568
561
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
569
562
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
@@ -574,50 +567,73 @@ export async function setup(
574
567
  }
575
568
  }
576
569
 
577
- const aztecNodeService = await AztecNodeService.createAndSync(
578
- config,
579
- { dateProvider, telemetry: telemetryClient, p2pClientDeps, logger: createLogger('node:MAIN-aztec-node') },
580
- { prefilledPublicData },
570
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
571
+ // We apply these overrides to a copy so they don't leak into the returned config.
572
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
573
+ const initialNodeConfig = opts.skipInitialSequencer
574
+ ? {
575
+ ...config,
576
+ disableValidator: true,
577
+ ...(opts.mockGossipSubNetwork ? {} : { p2pEnabled: false, bootstrapNodes: [] as string[] }),
578
+ }
579
+ : config;
580
+
581
+ const aztecNodeService = await withLoggerBindings({ actor: 'node-0' }, () =>
582
+ AztecNodeService.createAndSync(
583
+ initialNodeConfig,
584
+ { dateProvider, telemetry: telemetryClient, p2pClientDeps },
585
+ { genesis, dontStartSequencer: opts.skipInitialSequencer },
586
+ ),
581
587
  );
582
588
  const sequencerClient = aztecNodeService.getSequencer();
583
589
 
584
- if (sequencerClient) {
585
- const publisher = (sequencerClient as TestSequencerClient).sequencer.publisher;
586
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
587
- }
588
-
589
- let proverNode: ProverNode | undefined = undefined;
590
+ let proverNode: AztecNodeService | undefined = undefined;
590
591
  if (opts.startProverNode) {
591
592
  logger.verbose('Creating and syncing a simulated prover node...');
592
593
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
593
594
  const proverNodePrivateKeyHex: Hex = `0x${proverNodePrivateKey!.toString('hex')}`;
594
595
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
595
- const proverNodeConfig = {
596
- ...config.proverNodeConfig,
597
- dataDirectory: proverNodeDataDirectory,
598
- p2pEnabled: false,
596
+
597
+ const p2pClientDeps: Partial<P2PClientDeps> = {
598
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork!),
599
+ rpcTxProviders: [aztecNodeService],
599
600
  };
600
- proverNode = await createAndSyncProverNode(
601
+
602
+ ({ proverNode } = await createAndSyncProverNode(
601
603
  proverNodePrivateKeyHex,
602
604
  config,
603
- proverNodeConfig,
604
- aztecNodeService,
605
- prefilledPublicData,
606
- );
605
+ {
606
+ ...config.proverNodeConfig,
607
+ dataDirectory: proverNodeDataDirectory,
608
+ },
609
+ { dateProvider, p2pClientDeps, telemetry: telemetryClient },
610
+ { genesis },
611
+ ));
607
612
  }
608
613
 
614
+ const sequencerDelayer = sequencerClient?.getDelayer();
615
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
616
+
609
617
  logger.verbose('Creating a pxe...');
610
618
  const pxeConfig = { ...getPXEConfig(), ...pxeOpts };
611
619
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
612
620
  // For tests we only want proving enabled if specifically requested
613
621
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
622
+ const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
623
+ loggerActorLabel: 'pxe-0',
624
+ ...opts.pxeCreationOptions,
625
+ });
615
626
 
616
627
  if (opts.walletMinFeePadding !== undefined) {
617
628
  wallet.setMinFeePadding(opts.walletMinFeePadding);
618
629
  }
619
630
 
620
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
631
+ const cheatCodes = await CheatCodes.create(
632
+ config.l1RpcUrls,
633
+ aztecNodeService,
634
+ dateProvider,
635
+ aztecNodeService.getAutomineSequencer(),
636
+ );
621
637
 
622
638
  if (
623
639
  (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
@@ -635,15 +651,22 @@ export async function setup(
635
651
 
636
652
  let accounts: AztecAddress[] = [];
637
653
 
638
- if (shouldDeployAccounts) {
654
+ if (opts.skipInitialSequencer) {
655
+ logger.info('Sequencer not started on initial node, skipping block progression');
656
+ } else if (shouldDeployAccounts) {
639
657
  logger.info(
640
- `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
658
+ `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by waiting for the accounts to be deployed`,
641
659
  );
642
660
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
643
661
  const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
644
662
  accounts = accountManagers.map(accountManager => accountManager.address);
645
663
  } else if (needsEmptyBlock) {
646
664
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
665
+ // AutomineSequencer only builds on tx arrival; explicitly request an empty block.
666
+ const automine = aztecNodeService.getAutomineSequencer();
667
+ if (automine) {
668
+ await automine.buildEmptyBlock();
669
+ }
647
670
  while ((await aztecNodeService.getBlockNumber()) === 0) {
648
671
  await sleep(2000);
649
672
  }
@@ -683,7 +706,7 @@ export async function setup(
683
706
  logger.error(`Error during e2e test teardown`, err);
684
707
  } finally {
685
708
  try {
686
- await telemetryClient?.stop();
709
+ await telemetryClient.stop();
687
710
  } catch (err) {
688
711
  logger.error(`Error during telemetry client stop`, err);
689
712
  }
@@ -704,8 +727,10 @@ export async function setup(
704
727
  initialFundedAccounts,
705
728
  logger,
706
729
  mockGossipSubNetwork,
707
- prefilledPublicData,
730
+ genesis,
708
731
  proverNode,
732
+ sequencerDelayer,
733
+ proverDelayer,
709
734
  sequencer: sequencerClient,
710
735
  teardown,
711
736
  telemetryClient,
@@ -782,100 +807,62 @@ export async function waitForProvenChain(node: AztecNode, targetBlock?: BlockNum
782
807
  targetBlock ??= await node.getBlockNumber();
783
808
 
784
809
  await retryUntil(
785
- async () => (await node.getProvenBlockNumber()) >= targetBlock,
810
+ async () => (await node.getBlockNumber('proven')) >= targetBlock,
786
811
  'proven chain status',
787
812
  timeoutSec,
788
813
  intervalSec,
789
814
  );
790
815
  }
791
816
 
817
+ /**
818
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
819
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
820
+ */
792
821
  export function createAndSyncProverNode(
793
822
  proverNodePrivateKey: `0x${string}`,
794
- aztecNodeConfig: AztecNodeConfig,
795
- proverNodeConfig: Partial<ProverNodeConfig> & Pick<DataStoreConfig, 'dataDirectory'> & { dontStart?: boolean },
796
- aztecNode: AztecNode | undefined,
797
- prefilledPublicData: PublicDataTreeLeaf[] = [],
798
- proverNodeDeps: ProverNodeDeps = {},
799
- ) {
800
- return withLogNameSuffix('prover-node', async () => {
801
- const aztecNodeTxProvider = aztecNode && {
802
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
803
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
804
- stop: () => Promise.resolve(),
805
- };
806
-
807
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
808
-
809
- const archiverConfig = { ...aztecNodeConfig, dataDirectory: proverNodeConfig.dataDirectory };
810
- const archiver = await createArchiver(
811
- archiverConfig,
812
- { blobClient, dateProvider: proverNodeDeps.dateProvider },
813
- { blockUntilSync: true },
814
- );
815
-
816
- const proverConfig: ProverNodeConfig = {
817
- ...aztecNodeConfig,
818
- txCollectionNodeRpcUrls: [],
819
- realProofs: false,
820
- proverAgentCount: 2,
821
- publisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
822
- proverNodeMaxPendingJobs: 10,
823
- proverNodeMaxParallelBlocksPerEpoch: 32,
824
- proverNodePollingIntervalMs: 200,
825
- txGatheringIntervalMs: 1000,
826
- txGatheringBatchSize: 10,
827
- txGatheringMaxParallelRequestsPerNode: 10,
828
- txGatheringTimeoutMs: 24_000,
829
- proverNodeFailedEpochStore: undefined,
830
- proverId: EthAddress.fromNumber(1),
831
- proverNodeEpochProvingDelayMs: undefined,
832
- ...proverNodeConfig,
833
- };
834
-
835
- const l1TxUtils = createDelayedL1TxUtils(
836
- aztecNodeConfig,
837
- proverNodePrivateKey,
838
- 'prover-node',
839
- proverNodeDeps.dateProvider,
823
+ baseConfig: AztecNodeConfig,
824
+ configOverrides: Pick<AztecNodeConfig, 'dataDirectory'>,
825
+ deps: {
826
+ telemetry?: TelemetryClient;
827
+ dateProvider: DateProvider;
828
+ p2pClientDeps?: P2PClientDeps;
829
+ },
830
+ options: { genesis?: GenesisData; dontStart?: boolean },
831
+ ): Promise<{ proverNode: AztecNodeService }> {
832
+ return withLoggerBindings({ actor: 'prover-0' }, async () => {
833
+ const proverNode = await AztecNodeService.createAndSync(
834
+ {
835
+ ...baseConfig,
836
+ ...configOverrides,
837
+ p2pPort: 0,
838
+ enableProverNode: true,
839
+ disableValidator: true,
840
+ proverPublisherPrivateKeys: [new SecretValue(proverNodePrivateKey)],
841
+ },
842
+ deps,
843
+ { genesis: options.genesis, dontStartProverNode: options.dontStart },
840
844
  );
841
845
 
842
- const proverNode = await createProverNode(
843
- proverConfig,
844
- { ...proverNodeDeps, aztecNodeTxProvider, archiver: archiver as Archiver, l1TxUtils },
845
- { prefilledPublicData },
846
- );
847
- getLogger().info(`Created and synced prover node`, { publisherAddress: l1TxUtils.client.account!.address });
848
- if (!proverNodeConfig.dontStart) {
849
- await proverNode.start();
846
+ if (!proverNode.getProverNode()) {
847
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
850
848
  }
851
- return proverNode;
852
- });
853
- }
854
849
 
855
- function createDelayedL1TxUtils(
856
- aztecNodeConfig: AztecNodeConfig,
857
- privateKey: `0x${string}`,
858
- logName: string,
859
- dateProvider?: DateProvider,
860
- ) {
861
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
862
-
863
- const log = createLogger(logName);
864
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
865
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
866
- return l1TxUtils;
850
+ getLogger().info(`Created and synced prover node`);
851
+ return { proverNode };
852
+ });
867
853
  }
868
854
 
869
855
  export type BalancesFn = ReturnType<typeof getBalancesFn>;
870
856
  export function getBalancesFn(
871
857
  symbol: string,
872
858
  method: ContractMethod,
873
- from: AztecAddress,
874
859
  logger: any,
875
860
  ): (...addresses: (AztecAddress | { address: AztecAddress })[]) => Promise<bigint[]> {
876
861
  const balances = async (...addressLikes: (AztecAddress | { address: AztecAddress })[]) => {
877
862
  const addresses = addressLikes.map(addressLike => ('address' in addressLike ? addressLike.address : addressLike));
878
- const b = await Promise.all(addresses.map(address => method(address).simulate({ from })));
863
+ const b = await Promise.all(
864
+ addresses.map(async address => (await method(address).simulate({ from: address })).result),
865
+ );
879
866
  const debugString = `${symbol} balances: ${addresses.map((address, i) => `${address}: ${b[i]}`).join(', ')}`;
880
867
  logger.verbose(debugString);
881
868
  return b;
@@ -910,6 +897,57 @@ export async function expectMappingDelta<K, V extends number | bigint>(
910
897
  expect(diffs).toEqual(expectedDiffs);
911
898
  }
912
899
 
900
+ /**
901
+ * Registers the auth_registry contract class and publishes its standard instance if not already
902
+ * present, and registers the artifact with PXE. Publishing is required before exercising the public
903
+ * authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
904
+ * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
905
+ * surface as generic "Assertion failed:" and tests that match on the real message fail).
906
+ */
907
+ export async function ensureAuthRegistryPublished(wallet: Wallet, from: AztecAddress) {
908
+ const { instance, contractClass } = await getStandardAuthRegistry();
909
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
910
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({ from });
911
+ }
912
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
913
+ await publishInstance(wallet, instance).send({ from });
914
+ }
915
+ await wallet.registerContract(instance, AuthRegistryArtifact);
916
+ }
917
+
918
+ /**
919
+ * Registers the public_checks contract class and publishes its standard instance if not already
920
+ * present, and registers the artifact with PXE. Required for any contract that calls
921
+ * `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
922
+ * deployed PublicChecks contract via an enqueued public call).
923
+ */
924
+ export async function ensurePublicChecksPublished(wallet: Wallet, from: AztecAddress) {
925
+ const { instance, contractClass } = await getStandardPublicChecks();
926
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
927
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({ from });
928
+ }
929
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
930
+ await publishInstance(wallet, instance).send({ from });
931
+ }
932
+ await wallet.registerContract(instance, PublicChecksArtifact);
933
+ }
934
+
935
+ /**
936
+ * Registers the handshake_registry contract class and publishes its standard instance if not
937
+ * already present, and registers the artifact with PXE. Required for constrained-delivery flows
938
+ * that call into the HandshakeRegistry at its well-known address.
939
+ */
940
+ export async function ensureHandshakeRegistryPublished(wallet: Wallet, from: AztecAddress) {
941
+ const { instance, contractClass } = await getStandardHandshakeRegistry();
942
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
943
+ await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({ from });
944
+ }
945
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
946
+ await publishInstance(wallet, instance).send({ from });
947
+ }
948
+ await wallet.registerContract(instance, HandshakeRegistryArtifact);
949
+ }
950
+
913
951
  /**
914
952
  * Registers the contract class used for test accounts and publicly deploys the instances requested.
915
953
  * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
@@ -944,7 +982,7 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
944
982
  * Returns deployed account data that can be used by tests.
945
983
  */
946
984
  export const deployAccounts =
947
- (numberOfAccounts: number, logger: Logger) =>
985
+ (numberOfAccounts: number, logger: Logger, deployOptions?: Partial<DeployOptions<InteractionWaitOptions>>) =>
948
986
  async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
949
987
  if (initialFundedAccounts.length < numberOfAccounts) {
950
988
  throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
@@ -961,8 +999,9 @@ export const deployAccounts =
961
999
  );
962
1000
  const deployMethod = await accountManager.getDeployMethod();
963
1001
  await deployMethod.send({
964
- from: AztecAddress.ZERO,
1002
+ from: NO_FROM,
965
1003
  skipClassPublication: i !== 0, // Publish the contract class at most once.
1004
+ ...deployOptions,
966
1005
  });
967
1006
  }
968
1007
 
@@ -993,7 +1032,7 @@ export async function publicDeployAccounts(
993
1032
 
994
1033
  const batch = new BatchCall(wallet, calls);
995
1034
 
996
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
1035
+ const { receipt: txReceipt } = await batch.send({ from: accountsToDeploy[0] });
997
1036
  if (waitUntilProven) {
998
1037
  if (!node) {
999
1038
  throw new Error('Need to provide an AztecNode to wait for proven.');