@aztec/end-to-end 0.0.1-commit.e3c1de76 → 0.0.1-commit.e57c76e

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 (230) 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 +33 -8
  24. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  25. package/dest/e2e_epochs/epochs_test.js +143 -44
  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_nested_contract/nested_contract_test.d.ts +3 -3
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.js +6 -7
  32. package/dest/e2e_p2p/inactivity_slash_test.d.ts +1 -1
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  34. package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
  35. package/dest/e2e_p2p/p2p_network.d.ts +14 -12
  36. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  37. package/dest/e2e_p2p/p2p_network.js +70 -34
  38. package/dest/e2e_p2p/reqresp/utils.d.ts +3 -3
  39. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -1
  40. package/dest/e2e_p2p/reqresp/utils.js +67 -14
  41. package/dest/e2e_p2p/shared.d.ts +37 -8
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +91 -51
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  45. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  46. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  50. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -4
  51. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  52. package/dest/e2e_token_contract/token_contract_test.js +23 -11
  53. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  54. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  55. package/dest/fixtures/authwit_proxy.js +34 -0
  56. package/dest/fixtures/e2e_prover_test.d.ts +9 -8
  57. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  58. package/dest/fixtures/e2e_prover_test.js +39 -50
  59. package/dest/fixtures/elu_monitor.d.ts +21 -0
  60. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  61. package/dest/fixtures/elu_monitor.js +102 -0
  62. package/dest/fixtures/fixtures.d.ts +74 -1
  63. package/dest/fixtures/fixtures.d.ts.map +1 -1
  64. package/dest/fixtures/fixtures.js +71 -0
  65. package/dest/fixtures/get_bb_config.d.ts +1 -1
  66. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  67. package/dest/fixtures/get_bb_config.js +5 -5
  68. package/dest/fixtures/ha_setup.d.ts +71 -0
  69. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  70. package/dest/fixtures/ha_setup.js +116 -0
  71. package/dest/fixtures/index.d.ts +2 -1
  72. package/dest/fixtures/index.d.ts.map +1 -1
  73. package/dest/fixtures/index.js +1 -0
  74. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts +25 -0
  75. package/dest/fixtures/schnorr_hardcoded_account_contract.d.ts.map +1 -0
  76. package/dest/fixtures/schnorr_hardcoded_account_contract.js +37 -0
  77. package/dest/fixtures/setup.d.ts +86 -32
  78. package/dest/fixtures/setup.d.ts.map +1 -1
  79. package/dest/fixtures/setup.js +209 -169
  80. package/dest/fixtures/setup_p2p_test.d.ts +22 -10
  81. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  82. package/dest/fixtures/setup_p2p_test.js +23 -17
  83. package/dest/fixtures/token_utils.d.ts +2 -2
  84. package/dest/fixtures/token_utils.d.ts.map +1 -1
  85. package/dest/fixtures/token_utils.js +5 -7
  86. package/dest/fixtures/utils.d.ts +2 -2
  87. package/dest/fixtures/utils.d.ts.map +1 -1
  88. package/dest/fixtures/utils.js +1 -1
  89. package/dest/forward-compatibility/wallet_rpc_client.d.ts +7 -0
  90. package/dest/forward-compatibility/wallet_rpc_client.d.ts.map +1 -0
  91. package/dest/forward-compatibility/wallet_rpc_client.js +15 -0
  92. package/dest/forward-compatibility/wallet_service.d.ts +3 -0
  93. package/dest/forward-compatibility/wallet_service.d.ts.map +1 -0
  94. package/dest/forward-compatibility/wallet_service.js +109 -0
  95. package/dest/install_legacy_contracts.d.cts +10 -0
  96. package/dest/install_legacy_contracts.d.cts.map +1 -0
  97. package/dest/legacy-jest-resolver.d.cts +3 -0
  98. package/dest/legacy-jest-resolver.d.cts.map +1 -0
  99. package/dest/shared/cross_chain_test_harness.d.ts +4 -2
  100. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  101. package/dest/shared/cross_chain_test_harness.js +22 -18
  102. package/dest/shared/gas_portal_test_harness.d.ts +8 -5
  103. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  104. package/dest/shared/gas_portal_test_harness.js +19 -10
  105. package/dest/shared/index.d.ts +2 -1
  106. package/dest/shared/index.d.ts.map +1 -1
  107. package/dest/shared/index.js +1 -0
  108. package/dest/shared/jest_setup.js +41 -1
  109. package/dest/shared/mock_state_view.d.ts +86 -0
  110. package/dest/shared/mock_state_view.d.ts.map +1 -0
  111. package/dest/shared/mock_state_view.js +186 -0
  112. package/dest/shared/submit-transactions.d.ts +2 -2
  113. package/dest/shared/submit-transactions.d.ts.map +1 -1
  114. package/dest/shared/submit-transactions.js +1 -1
  115. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  116. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  117. package/dest/shared/uniswap_l1_l2.js +57 -40
  118. package/dest/shared/wait_for_l1_to_l2_message.d.ts +13 -0
  119. package/dest/shared/wait_for_l1_to_l2_message.d.ts.map +1 -0
  120. package/dest/shared/wait_for_l1_to_l2_message.js +10 -0
  121. package/dest/simulators/lending_simulator.d.ts +10 -3
  122. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  123. package/dest/simulators/lending_simulator.js +26 -14
  124. package/dest/simulators/token_simulator.d.ts +1 -1
  125. package/dest/simulators/token_simulator.d.ts.map +1 -1
  126. package/dest/simulators/token_simulator.js +3 -24
  127. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  128. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  129. package/dest/spartan/setup_test_wallets.js +108 -41
  130. package/dest/spartan/tx_metrics.d.ts +18 -4
  131. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  132. package/dest/spartan/tx_metrics.js +74 -21
  133. package/dest/spartan/utils/bot.d.ts +3 -2
  134. package/dest/spartan/utils/bot.d.ts.map +1 -1
  135. package/dest/spartan/utils/bot.js +2 -1
  136. package/dest/spartan/utils/config.d.ts +11 -28
  137. package/dest/spartan/utils/config.d.ts.map +1 -1
  138. package/dest/spartan/utils/config.js +4 -1
  139. package/dest/spartan/utils/index.d.ts +5 -3
  140. package/dest/spartan/utils/index.d.ts.map +1 -1
  141. package/dest/spartan/utils/index.js +5 -1
  142. package/dest/spartan/utils/k8s.d.ts +3 -1
  143. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  144. package/dest/spartan/utils/k8s.js +6 -0
  145. package/dest/spartan/utils/nodes.d.ts +4 -5
  146. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  147. package/dest/spartan/utils/nodes.js +11 -11
  148. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  149. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  150. package/dest/spartan/utils/pod_logs.js +74 -0
  151. package/dest/spartan/utils/scripts.d.ts +18 -4
  152. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  153. package/dest/spartan/utils/scripts.js +19 -4
  154. package/dest/test-wallet/test_wallet.d.ts +85 -0
  155. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  156. package/dest/test-wallet/test_wallet.js +273 -0
  157. package/dest/test-wallet/utils.d.ts +41 -0
  158. package/dest/test-wallet/utils.d.ts.map +1 -0
  159. package/dest/test-wallet/utils.js +66 -0
  160. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  161. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  162. package/dest/test-wallet/wallet_worker_script.js +53 -0
  163. package/dest/test-wallet/worker_wallet.d.ts +53 -0
  164. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  165. package/dest/test-wallet/worker_wallet.js +155 -0
  166. package/dest/test-wallet/worker_wallet_schema.d.ts +160 -0
  167. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  168. package/dest/test-wallet/worker_wallet_schema.js +22 -0
  169. package/package.json +52 -45
  170. package/src/bench/client_flows/benchmark.ts +19 -0
  171. package/src/bench/client_flows/client_flows_benchmark.ts +64 -49
  172. package/src/bench/client_flows/config.ts +9 -1
  173. package/src/bench/utils.ts +10 -4
  174. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +52 -25
  175. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +56 -19
  176. package/src/e2e_deploy_contract/deploy_test.ts +6 -5
  177. package/src/e2e_epochs/epochs_test.ts +166 -68
  178. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  179. package/src/e2e_fees/fees_test.ts +57 -32
  180. package/src/e2e_nested_contract/nested_contract_test.ts +10 -6
  181. package/src/e2e_p2p/inactivity_slash_test.ts +8 -7
  182. package/src/e2e_p2p/p2p_network.ts +93 -49
  183. package/src/e2e_p2p/reqresp/utils.ts +84 -17
  184. package/src/e2e_p2p/shared.ts +109 -65
  185. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  186. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  187. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  188. package/src/e2e_token_contract/token_contract_test.ts +38 -11
  189. package/src/fixtures/authwit_proxy.ts +54 -0
  190. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  191. package/src/fixtures/e2e_prover_test.ts +49 -56
  192. package/src/fixtures/elu_monitor.ts +126 -0
  193. package/src/fixtures/fixtures.ts +93 -0
  194. package/src/fixtures/get_bb_config.ts +7 -6
  195. package/src/fixtures/ha_setup.ts +188 -0
  196. package/src/fixtures/index.ts +1 -0
  197. package/src/fixtures/schnorr_hardcoded_account_contract.ts +49 -0
  198. package/src/fixtures/setup.ts +272 -233
  199. package/src/fixtures/setup_p2p_test.ts +37 -32
  200. package/src/fixtures/token_utils.ts +3 -3
  201. package/src/fixtures/utils.ts +2 -0
  202. package/src/forward-compatibility/wallet_rpc_client.ts +14 -0
  203. package/src/forward-compatibility/wallet_service.ts +104 -0
  204. package/src/guides/up_quick_start.sh +3 -5
  205. package/src/install_legacy_contracts.cjs +75 -0
  206. package/src/legacy-jest-resolver.cjs +112 -0
  207. package/src/shared/cross_chain_test_harness.ts +27 -13
  208. package/src/shared/gas_portal_test_harness.ts +21 -11
  209. package/src/shared/index.ts +1 -0
  210. package/src/shared/jest_setup.ts +51 -1
  211. package/src/shared/mock_state_view.ts +188 -0
  212. package/src/shared/submit-transactions.ts +3 -2
  213. package/src/shared/uniswap_l1_l2.ts +103 -54
  214. package/src/shared/wait_for_l1_to_l2_message.ts +23 -0
  215. package/src/simulators/lending_simulator.ts +32 -14
  216. package/src/simulators/token_simulator.ts +6 -30
  217. package/src/spartan/setup_test_wallets.ts +146 -35
  218. package/src/spartan/tx_metrics.ts +82 -24
  219. package/src/spartan/utils/bot.ts +4 -1
  220. package/src/spartan/utils/config.ts +3 -0
  221. package/src/spartan/utils/index.ts +8 -1
  222. package/src/spartan/utils/k8s.ts +8 -0
  223. package/src/spartan/utils/nodes.ts +17 -12
  224. package/src/spartan/utils/pod_logs.ts +99 -0
  225. package/src/spartan/utils/scripts.ts +43 -7
  226. package/src/test-wallet/test_wallet.ts +376 -0
  227. package/src/test-wallet/utils.ts +108 -0
  228. package/src/test-wallet/wallet_worker_script.ts +63 -0
  229. package/src/test-wallet/worker_wallet.ts +218 -0
  230. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -1,15 +1,13 @@
1
1
  import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
2
- import { generateSchnorrAccounts, getInitialTestAccountsData } from '@aztec/accounts/testing';
3
- import { createArchiver } from '@aztec/archiver';
2
+ import { generateSchnorrAccounts } from '@aztec/accounts/testing';
4
3
  import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
5
- import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
4
+ import { NO_FROM } from '@aztec/aztec.js/account';
5
+ import { EthAddress } from '@aztec/aztec.js/addresses';
6
6
  import { BatchCall, getContractClassFromArtifact, waitForProven } from '@aztec/aztec.js/contracts';
7
7
  import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
8
8
  import { Fr } from '@aztec/aztec.js/fields';
9
9
  import { createLogger } from '@aztec/aztec.js/log';
10
- import { createAztecNodeClient, waitForNode } from '@aztec/aztec.js/node';
11
10
  import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
12
- import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
13
11
  import { SPONSORED_FPC_SALT } from '@aztec/constants';
14
12
  import { isAnvilTestChain } from '@aztec/ethereum/chain';
15
13
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -17,7 +15,7 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
17
15
  import { NULL_KEY } from '@aztec/ethereum/constants';
18
16
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
19
17
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
20
- import { DelayedTxUtils, EthCheatCodes, EthCheatCodesWithState, createDelayedL1TxUtilsFromViemWallet, startAnvil } from '@aztec/ethereum/test';
18
+ import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
21
19
  import { EpochNumber } from '@aztec/foundation/branded-types';
22
20
  import { SecretValue } from '@aztec/foundation/config';
23
21
  import { randomBytes } from '@aztec/foundation/crypto/random';
@@ -25,32 +23,34 @@ import { tryRmDir } from '@aztec/foundation/fs';
25
23
  import { withLoggerBindings } from '@aztec/foundation/log/server';
26
24
  import { retryUntil } from '@aztec/foundation/retry';
27
25
  import { sleep } from '@aztec/foundation/sleep';
28
- import { DateProvider, TestDateProvider } from '@aztec/foundation/timer';
26
+ import { TestDateProvider } from '@aztec/foundation/timer';
29
27
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
30
28
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
31
29
  import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
32
30
  import { protocolContractsHash } from '@aztec/protocol-contracts';
33
- import { createProverNode } from '@aztec/prover-node';
34
31
  import { getPXEConfig } from '@aztec/pxe/server';
32
+ import { AuthRegistryArtifact, getStandardAuthRegistry } from '@aztec/standard-contracts/auth-registry';
33
+ import { HandshakeRegistryArtifact, getStandardHandshakeRegistry } from '@aztec/standard-contracts/handshake-registry';
34
+ import { PublicChecksArtifact, getStandardPublicChecks } from '@aztec/standard-contracts/public-checks';
35
+ import { ARTIFACT_VERSION_BEFORE_INJECTION } from '@aztec/stdlib/abi';
35
36
  import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contract';
36
37
  import { tryStop } from '@aztec/stdlib/interfaces/server';
37
38
  import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
38
39
  import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
39
- import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet/server';
40
+ import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
40
41
  import { getGenesisValues } from '@aztec/world-state/testing';
41
42
  import fs from 'fs/promises';
42
43
  import { tmpdir } from 'os';
43
44
  import path from 'path';
44
45
  import { generatePrivateKey, mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
45
46
  import { foundry } from 'viem/chains';
47
+ import { TestWallet } from '../test-wallet/test_wallet.js';
46
48
  import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
47
49
  import { getACVMConfig } from './get_acvm_config.js';
48
50
  import { getBBConfig } from './get_bb_config.js';
49
51
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
50
52
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
51
53
  export { startAnvil };
52
- const { AZTEC_NODE_URL = '' } = process.env;
53
- const getAztecUrl = ()=>AZTEC_NODE_URL;
54
54
  let telemetry = undefined;
55
55
  async function getTelemetryClient(partialConfig = {}) {
56
56
  if (!telemetry) {
@@ -111,63 +111,23 @@ export const getPrivateKeyFromIndex = (index)=>{
111
111
  };
112
112
  }
113
113
  /**
114
- * Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
115
- */ async function setupWithRemoteEnvironment(account, config, logger, numberOfAccounts) {
116
- const aztecNodeUrl = getAztecUrl();
117
- logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
118
- const aztecNode = createAztecNodeClient(aztecNodeUrl);
119
- await waitForNode(aztecNode, logger);
120
- logger.verbose('JSON RPC client connected to Aztec Node');
121
- logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
122
- const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
123
- const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
124
- const deployL1ContractsValues = {
125
- l1ContractAddresses,
126
- l1Client,
127
- rollupVersion
128
- };
129
- const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
130
- const wallet = await TestWallet.create(aztecNode);
131
- if (config.walletMinFeePadding !== undefined) {
132
- wallet.setMinFeePadding(config.walletMinFeePadding);
114
+ * When CONTRACT_ARTIFACTS_VERSION is set (backwards compatibility testing), asserts that the loaded artifact's
115
+ * aztecVersion matches the expected version. This is a sanity check verifying that the legacy artifact resolver
116
+ * actually swapped in the correct version.
117
+ */ function assertContractArtifactsVersion() {
118
+ const expected = process.env.CONTRACT_ARTIFACTS_VERSION;
119
+ if (!expected) {
120
+ return;
133
121
  }
134
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
135
- const teardown = ()=>Promise.resolve();
136
- logger.verbose('Populating wallet from already registered accounts...');
137
- const initialFundedAccounts = await getInitialTestAccountsData();
138
- if (initialFundedAccounts.length < numberOfAccounts) {
139
- throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
122
+ const { aztecVersion } = SponsoredFPCContract.artifact;
123
+ // TODO(F-557): Remove this bypass once pre-version artifacts are no longer tested.
124
+ if (aztecVersion === ARTIFACT_VERSION_BEFORE_INJECTION) {
125
+ createLogger('e2e:setup').info(`Skipping artifact version check: artifact predates version injection (CONTRACT_ARTIFACTS_VERSION=${expected})`);
126
+ return;
127
+ }
128
+ if (aztecVersion !== expected) {
129
+ throw new Error(`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` + `The legacy artifact resolver may not have swapped in the correct version.`);
140
130
  }
141
- const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
142
- const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
143
- return accountManager.address;
144
- }));
145
- return {
146
- anvil: undefined,
147
- aztecNode,
148
- aztecNodeService: undefined,
149
- aztecNodeAdmin: undefined,
150
- sequencer: undefined,
151
- proverNode: undefined,
152
- deployL1ContractsValues,
153
- config,
154
- aztecNodeConfig: config,
155
- initialFundedAccounts,
156
- wallet,
157
- accounts: testAccounts,
158
- logger,
159
- cheatCodes,
160
- ethCheatCodes,
161
- prefilledPublicData: undefined,
162
- mockGossipSubNetwork: undefined,
163
- watcher: undefined,
164
- dateProvider: undefined,
165
- telemetryClient: undefined,
166
- acvmConfig: undefined,
167
- bbConfig: undefined,
168
- directoryToCleanup: undefined,
169
- teardown
170
- };
171
131
  }
172
132
  /**
173
133
  * Sets up the environment for the end-to-end tests.
@@ -175,10 +135,11 @@ export const getPrivateKeyFromIndex = (index)=>{
175
135
  * @param opts - Options to pass to the node initialization and to the setup script.
176
136
  * @param pxeOpts - Options to pass to the PXE initialization.
177
137
  */ export async function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
138
+ assertContractArtifactsVersion();
178
139
  let anvil;
179
140
  try {
180
141
  opts.aztecTargetCommitteeSize ??= 0;
181
- opts.slasherFlavor ??= 'none';
142
+ opts.slasherEnabled ??= false;
182
143
  const config = {
183
144
  ...getConfigEnvVars(),
184
145
  ...opts
@@ -191,7 +152,10 @@ export const getPrivateKeyFromIndex = (index)=>{
191
152
  config.realProofs = !!opts.realProofs;
192
153
  // Only enforce the time table if requested
193
154
  config.enforceTimeTable = !!opts.enforceTimeTable;
155
+ // Enable the tx delayer for tests (default config has it disabled, so we force-enable it here)
156
+ config.enableDelayer = true;
194
157
  config.listenAddress = '127.0.0.1';
158
+ config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
195
159
  const logger = getLogger();
196
160
  // Create a temp directory for any services that need it and cleanup later
197
161
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
@@ -201,17 +165,17 @@ export const getPrivateKeyFromIndex = (index)=>{
201
165
  if (!config.dataDirectory) {
202
166
  config.dataDirectory = directoryToCleanup;
203
167
  }
168
+ const dateProvider = new TestDateProvider();
204
169
  if (!config.l1RpcUrls?.length) {
205
170
  if (!isAnvilTestChain(chain.id)) {
206
171
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
207
172
  }
208
- if (AZTEC_NODE_URL) {
209
- throw new Error(`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`);
210
- }
211
173
  const res = await startAnvil({
212
174
  l1BlockTime: opts.ethereumSlotDuration,
213
175
  accounts: opts.anvilAccounts,
214
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined)
176
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
177
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
178
+ dateProvider
215
179
  });
216
180
  anvil = res.anvil;
217
181
  config.l1RpcUrls = [
@@ -224,7 +188,6 @@ export const getPrivateKeyFromIndex = (index)=>{
224
188
  logger.info(`Logging metrics to ${filename}`);
225
189
  setupMetricsLogger(filename);
226
190
  }
227
- const dateProvider = new TestDateProvider();
228
191
  const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
229
192
  if (opts.stateLoad) {
230
193
  await ethCheatCodes.loadChainState(opts.stateLoad);
@@ -239,8 +202,8 @@ export const getPrivateKeyFromIndex = (index)=>{
239
202
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
240
203
  publisherPrivKeyHex = opts.l1PublisherKey.getValue();
241
204
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
242
- } else if (config.publisherPrivateKeys && config.publisherPrivateKeys.length > 0 && config.publisherPrivateKeys[0].getValue() != NULL_KEY) {
243
- publisherPrivKeyHex = config.publisherPrivateKeys[0].getValue();
205
+ } else if (config.sequencerPublisherPrivateKeys && config.sequencerPublisherPrivateKeys.length > 0 && config.sequencerPublisherPrivateKeys[0].getValue() != NULL_KEY) {
206
+ publisherPrivKeyHex = config.sequencerPublisherPrivateKeys[0].getValue();
244
207
  publisherHdAccount = privateKeyToAccount(publisherPrivKeyHex);
245
208
  } else if (!MNEMONIC) {
246
209
  throw new Error(`Mnemonic not provided and no publisher private key`);
@@ -251,17 +214,13 @@ export const getPrivateKeyFromIndex = (index)=>{
251
214
  const publisherPrivKeyRaw = publisherHdAccount.getHdKey().privateKey;
252
215
  const publisherPrivKey = publisherPrivKeyRaw === null ? null : Buffer.from(publisherPrivKeyRaw);
253
216
  publisherPrivKeyHex = `0x${publisherPrivKey.toString('hex')}`;
254
- config.publisherPrivateKeys = [
217
+ config.sequencerPublisherPrivateKeys = [
255
218
  new SecretValue(publisherPrivKeyHex)
256
219
  ];
257
220
  }
258
221
  if (config.coinbase === undefined) {
259
222
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
260
223
  }
261
- if (AZTEC_NODE_URL) {
262
- // we are setting up against a remote environment, l1 contracts are assumed to already be deployed
263
- return await setupWithRemoteEnvironment(publisherHdAccount, config, logger, numberOfAccounts);
264
- }
265
224
  // Determine which addresses to fund in genesis
266
225
  const initialFundedAccounts = opts.initialFundedAccounts ?? await generateSchnorrAccounts(opts.numberOfInitialFundedAccounts ?? Math.max(numberOfAccounts, 10));
267
226
  const addressesToFund = initialFundedAccounts.map((a)=>a.address);
@@ -270,7 +229,8 @@ export const getPrivateKeyFromIndex = (index)=>{
270
229
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
271
230
  addressesToFund.push(sponsoredFPCAddress);
272
231
  }
273
- const { genesisArchiveRoot, prefilledPublicData, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData);
232
+ const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
233
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
274
234
  const wasAutomining = await ethCheatCodes.isAutoMining();
275
235
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
276
236
  if (enableAutomine) {
@@ -295,19 +255,41 @@ export const getPrivateKeyFromIndex = (index)=>{
295
255
  feeJuicePortalInitialBalance: fundingNeeded,
296
256
  realVerifier: false
297
257
  });
298
- config.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
258
+ Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
299
259
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
260
+ // Propagate L1-contracts-config overrides back to the node config so the archiver's
261
+ // `l1Constants` (and any other node-side consumer) agrees with what was actually deployed.
262
+ // Without this, a per-test override like `aztecEpochDuration: 4` lands on the rollup contract
263
+ // but the node config keeps the default (32), so `archiver.isEpochComplete(0)` computes
264
+ // `endSlot=31` and `EpochTestSettler`/`EpochMonitor` never fires — letting the
265
+ // `aztecProofSubmissionEpochs` window expire mid-test and prune the pending chain.
266
+ // Skip undefined values: callers (e.g. `P2PNetworkTest`) sometimes build `l1ContractsArgs`
267
+ // by spreading a partial `AztecNodeConfig`, which leaves unset fields (notably `dataDirectory`)
268
+ // as `undefined`. A blind Object.assign would then clobber the temp `dataDirectory` set earlier
269
+ // in this function and crash `setupSharedBlobStorage`.
270
+ if (opts.l1ContractsArgs) {
271
+ for (const [key, value] of Object.entries(opts.l1ContractsArgs)){
272
+ if (value !== undefined) {
273
+ config[key] = value;
274
+ }
275
+ }
276
+ }
300
277
  if (enableAutomine) {
301
278
  await ethCheatCodes.setAutomine(false);
302
279
  await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
303
- dateProvider.setTime(await ethCheatCodes.timestamp() * 1000);
280
+ }
281
+ // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
282
+ // ahead of system time due to the local-network watcher warping time forward on each filled slot.
283
+ // When running with a local anvil, the dateProvider is kept in sync via the stdout listener.
284
+ if (!anvil) {
285
+ dateProvider.setTime(await ethCheatCodes.lastBlockTimestamp() * 1000);
304
286
  }
305
287
  if (opts.l2StartTime) {
306
288
  await ethCheatCodes.warp(opts.l2StartTime, {
307
289
  resetBlockInterval: true
308
290
  });
309
291
  }
310
- const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider);
292
+ const watcher = new AnvilTestWatcher(new EthCheatCodesWithState(config.l1RpcUrls, dateProvider), deployL1ContractsValues.l1ContractAddresses.rollupAddress, deployL1ContractsValues.l1Client, dateProvider, opts.anvilTestWatcherOpts);
311
293
  if (!opts.disableAnvilTestWatcher) {
312
294
  await watcher.start();
313
295
  }
@@ -328,7 +310,7 @@ export const getPrivateKeyFromIndex = (index)=>{
328
310
  let mockGossipSubNetwork;
329
311
  let p2pClientDeps = undefined;
330
312
  if (opts.mockGossipSubNetwork) {
331
- mockGossipSubNetwork = new MockGossipSubNetwork();
313
+ mockGossipSubNetwork = new MockGossipSubNetwork(opts.mockGossipSubNetworkLatency);
332
314
  p2pClientDeps = {
333
315
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
334
316
  };
@@ -341,11 +323,17 @@ export const getPrivateKeyFromIndex = (index)=>{
341
323
  if (originalMinTxsPerBlock === undefined) {
342
324
  throw new Error('minTxsPerBlock is undefined in e2e test setup');
343
325
  }
344
- // Only set minTxsPerBlock=1 if we're going to deploy accounts and need reliable block inclusion
326
+ // Whether we're deploying accounts (and therefore need reliable block inclusion past genesis)
345
327
  const shouldDeployAccounts = numberOfAccounts > 0 && !opts.skipAccountDeployment;
346
328
  // Only set minTxsPerBlock=0 if we need an empty block (no accounts at all, not skipped deployment)
347
329
  const needsEmptyBlock = numberOfAccounts === 0 && !opts.skipAccountDeployment;
348
- config.minTxsPerBlock = shouldDeployAccounts ? 1 : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
330
+ // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at
331
+ // slot N start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on
332
+ // alternating slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) for account
333
+ // deployment. Automine is unaffected: its runBuild clamps mempool builds to
334
+ // Math.max(minTxsPerBlock ?? 1, 1) and still requires minValidTxs: 1.
335
+ const accountsDeployMinTxs = 0;
336
+ config.minTxsPerBlock = shouldDeployAccounts ? accountsDeployMinTxs : needsEmptyBlock ? 0 : originalMinTxsPerBlock;
349
337
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
350
338
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
351
339
  if (!config.disableValidator) {
@@ -355,33 +343,53 @@ export const getPrivateKeyFromIndex = (index)=>{
355
343
  ]);
356
344
  }
357
345
  }
346
+ // When skipInitialSequencer is set, the initial node is a lightweight RPC-only node.
347
+ // We apply these overrides to a copy so they don't leak into the returned config.
348
+ // Keep P2P enabled if mockGossipSubNetwork is used (needed for tx propagation to validators).
349
+ const initialNodeConfig = opts.skipInitialSequencer ? {
350
+ ...config,
351
+ disableValidator: true,
352
+ ...opts.mockGossipSubNetwork ? {} : {
353
+ p2pEnabled: false,
354
+ bootstrapNodes: []
355
+ }
356
+ } : config;
358
357
  const aztecNodeService = await withLoggerBindings({
359
358
  actor: 'node-0'
360
- }, ()=>AztecNodeService.createAndSync(config, {
359
+ }, ()=>AztecNodeService.createAndSync(initialNodeConfig, {
361
360
  dateProvider,
362
361
  telemetry: telemetryClient,
363
362
  p2pClientDeps
364
363
  }, {
365
- prefilledPublicData
364
+ genesis,
365
+ dontStartSequencer: opts.skipInitialSequencer
366
366
  }));
367
367
  const sequencerClient = aztecNodeService.getSequencer();
368
- if (sequencerClient) {
369
- const publisher = sequencerClient.sequencer.publisher;
370
- publisher.l1TxUtils = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, config.ethereumSlotDuration, l1Client);
371
- }
372
368
  let proverNode = undefined;
373
369
  if (opts.startProverNode) {
374
370
  logger.verbose('Creating and syncing a simulated prover node...');
375
371
  const proverNodePrivateKey = getPrivateKeyFromIndex(2);
376
372
  const proverNodePrivateKeyHex = `0x${proverNodePrivateKey.toString('hex')}`;
377
373
  const proverNodeDataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
378
- const proverNodeConfig = {
379
- ...config.proverNodeConfig,
380
- dataDirectory: proverNodeDataDirectory,
381
- p2pEnabled: false
374
+ const p2pClientDeps = {
375
+ p2pServiceFactory: mockGossipSubNetwork && getMockPubSubP2PServiceFactory(mockGossipSubNetwork),
376
+ rpcTxProviders: [
377
+ aztecNodeService
378
+ ]
382
379
  };
383
- proverNode = await createAndSyncProverNode(proverNodePrivateKeyHex, config, proverNodeConfig, aztecNodeService, prefilledPublicData);
380
+ ({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
381
+ ...config.proverNodeConfig,
382
+ dataDirectory: proverNodeDataDirectory
383
+ }, {
384
+ dateProvider,
385
+ p2pClientDeps,
386
+ telemetry: telemetryClient
387
+ }, {
388
+ genesis
389
+ }));
384
390
  }
391
+ const sequencerDelayer = sequencerClient?.getDelayer();
392
+ const proverDelayer = proverNode?.getProverNode()?.getDelayer();
385
393
  logger.verbose('Creating a pxe...');
386
394
  const pxeConfig = {
387
395
  ...getPXEConfig(),
@@ -391,12 +399,13 @@ export const getPrivateKeyFromIndex = (index)=>{
391
399
  // For tests we only want proving enabled if specifically requested
392
400
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
393
401
  const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
394
- loggerActorLabel: 'pxe-0'
402
+ loggerActorLabel: 'pxe-0',
403
+ ...opts.pxeCreationOptions
395
404
  });
396
405
  if (opts.walletMinFeePadding !== undefined) {
397
406
  wallet.setMinFeePadding(opts.walletMinFeePadding);
398
407
  }
399
- const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
408
+ const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider, aztecNodeService.getAutomineSequencer());
400
409
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
401
410
  // We need to advance such that the committee is set up.
402
411
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
@@ -404,13 +413,20 @@ export const getPrivateKeyFromIndex = (index)=>{
404
413
  await cheatCodes.rollup.debugRollup();
405
414
  }
406
415
  let accounts = [];
407
- if (shouldDeployAccounts) {
408
- logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
416
+ if (opts.skipInitialSequencer) {
417
+ logger.info('Sequencer not started on initial node, skipping block progression');
418
+ } else if (shouldDeployAccounts) {
419
+ logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by waiting for the accounts to be deployed`);
409
420
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
410
421
  const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
411
422
  accounts = accountManagers.map((accountManager)=>accountManager.address);
412
423
  } else if (needsEmptyBlock) {
413
424
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
425
+ // AutomineSequencer only builds on tx arrival; explicitly request an empty block.
426
+ const automine = aztecNodeService.getAutomineSequencer();
427
+ if (automine) {
428
+ await automine.buildEmptyBlock();
429
+ }
414
430
  while(await aztecNodeService.getBlockNumber() === 0){
415
431
  await sleep(2000);
416
432
  }
@@ -443,7 +459,7 @@ export const getPrivateKeyFromIndex = (index)=>{
443
459
  logger.error(`Error during e2e test teardown`, err);
444
460
  } finally{
445
461
  try {
446
- await telemetryClient?.stop();
462
+ await telemetryClient.stop();
447
463
  } catch (err) {
448
464
  logger.error(`Error during telemetry client stop`, err);
449
465
  }
@@ -463,8 +479,10 @@ export const getPrivateKeyFromIndex = (index)=>{
463
479
  initialFundedAccounts,
464
480
  logger,
465
481
  mockGossipSubNetwork,
466
- prefilledPublicData,
482
+ genesis,
467
483
  proverNode,
484
+ sequencerDelayer,
485
+ proverDelayer,
468
486
  sequencer: sequencerClient,
469
487
  teardown,
470
488
  telemetryClient,
@@ -523,79 +541,43 @@ export const getPrivateKeyFromIndex = (index)=>{
523
541
  }
524
542
  export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
525
543
  targetBlock ??= await node.getBlockNumber();
526
- await retryUntil(async ()=>await node.getProvenBlockNumber() >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
544
+ await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
527
545
  }
528
- export function createAndSyncProverNode(proverNodePrivateKey, aztecNodeConfig, proverNodeConfig, aztecNode, prefilledPublicData = [], proverNodeDeps = {}) {
546
+ /**
547
+ * Creates an AztecNodeService with the prover node enabled as a subsystem.
548
+ * Returns both the aztec node service (for lifecycle management) and the prover node (for test internals access).
549
+ */ export function createAndSyncProverNode(proverNodePrivateKey, baseConfig, configOverrides, deps, options) {
529
550
  return withLoggerBindings({
530
551
  actor: 'prover-0'
531
552
  }, async ()=>{
532
- const aztecNodeTxProvider = aztecNode && {
533
- getTxByHash: aztecNode.getTxByHash.bind(aztecNode),
534
- getTxsByHash: aztecNode.getTxsByHash.bind(aztecNode),
535
- stop: ()=>Promise.resolve()
536
- };
537
- const blobClient = await createBlobClientWithFileStores(aztecNodeConfig, createLogger('blob-client:prover-node'));
538
- const archiverConfig = {
539
- ...aztecNodeConfig,
540
- dataDirectory: proverNodeConfig.dataDirectory
541
- };
542
- const archiver = await createArchiver(archiverConfig, {
543
- blobClient,
544
- dateProvider: proverNodeDeps.dateProvider
545
- }, {
546
- blockUntilSync: true
547
- });
548
- const proverConfig = {
549
- ...aztecNodeConfig,
550
- txCollectionNodeRpcUrls: [],
551
- realProofs: false,
552
- proverAgentCount: 2,
553
- publisherPrivateKeys: [
553
+ const proverNode = await AztecNodeService.createAndSync({
554
+ ...baseConfig,
555
+ ...configOverrides,
556
+ p2pPort: 0,
557
+ enableProverNode: true,
558
+ disableValidator: true,
559
+ proverPublisherPrivateKeys: [
554
560
  new SecretValue(proverNodePrivateKey)
555
- ],
556
- proverNodeMaxPendingJobs: 10,
557
- proverNodeMaxParallelBlocksPerEpoch: 32,
558
- proverNodePollingIntervalMs: 200,
559
- txGatheringIntervalMs: 1000,
560
- txGatheringBatchSize: 10,
561
- txGatheringMaxParallelRequestsPerNode: 10,
562
- txGatheringTimeoutMs: 24_000,
563
- proverNodeFailedEpochStore: undefined,
564
- proverId: EthAddress.fromNumber(1),
565
- proverNodeEpochProvingDelayMs: undefined,
566
- ...proverNodeConfig
567
- };
568
- const l1TxUtils = createDelayedL1TxUtils(aztecNodeConfig, proverNodePrivateKey, 'prover-node', proverNodeDeps.dateProvider);
569
- const proverNode = await createProverNode(proverConfig, {
570
- ...proverNodeDeps,
571
- aztecNodeTxProvider,
572
- archiver: archiver,
573
- l1TxUtils
574
- }, {
575
- prefilledPublicData
576
- });
577
- getLogger().info(`Created and synced prover node`, {
578
- publisherAddress: l1TxUtils.client.account.address
561
+ ]
562
+ }, deps, {
563
+ genesis: options.genesis,
564
+ dontStartProverNode: options.dontStart
579
565
  });
580
- if (!proverNodeConfig.dontStart) {
581
- await proverNode.start();
566
+ if (!proverNode.getProverNode()) {
567
+ throw new Error('Prover node subsystem was not created despite enableProverNode being set');
582
568
  }
583
- return proverNode;
569
+ getLogger().info(`Created and synced prover node`);
570
+ return {
571
+ proverNode
572
+ };
584
573
  });
585
574
  }
586
- function createDelayedL1TxUtils(aztecNodeConfig, privateKey, logName, dateProvider) {
587
- const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, privateKey, foundry);
588
- const log = createLogger(logName);
589
- const l1TxUtils = createDelayedL1TxUtilsFromViemWallet(l1Client, log, dateProvider, aztecNodeConfig);
590
- l1TxUtils.enableDelayer(aztecNodeConfig.ethereumSlotDuration);
591
- return l1TxUtils;
592
- }
593
- export function getBalancesFn(symbol, method, from, logger) {
575
+ export function getBalancesFn(symbol, method, logger) {
594
576
  const balances = async (...addressLikes)=>{
595
577
  const addresses = addressLikes.map((addressLike)=>'address' in addressLike ? addressLike.address : addressLike);
596
- const b = await Promise.all(addresses.map((address)=>method(address).simulate({
597
- from
598
- })));
578
+ const b = await Promise.all(addresses.map(async (address)=>(await method(address).simulate({
579
+ from: address
580
+ })).result));
599
581
  const debugString = `${symbol} balances: ${addresses.map((address, i)=>`${address}: ${b[i]}`).join(', ')}`;
600
582
  logger.verbose(debugString);
601
583
  return b;
@@ -613,6 +595,63 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
613
595
  const diffs = outputs.map((output, i)=>output - initialValues[i]);
614
596
  expect(diffs).toEqual(expectedDiffs);
615
597
  }
598
+ /**
599
+ * Registers the auth_registry contract class and publishes its standard instance if not already
600
+ * present, and registers the artifact with PXE. Publishing is required before exercising the public
601
+ * authwit path (which relies on the AVM's deployment-nullifier check); the PXE-side registration is
602
+ * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
603
+ * surface as generic "Assertion failed:" and tests that match on the real message fail).
604
+ */ export async function ensureAuthRegistryPublished(wallet, from) {
605
+ const { instance, contractClass } = await getStandardAuthRegistry();
606
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
607
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
608
+ from
609
+ });
610
+ }
611
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
612
+ await publishInstance(wallet, instance).send({
613
+ from
614
+ });
615
+ }
616
+ await wallet.registerContract(instance, AuthRegistryArtifact);
617
+ }
618
+ /**
619
+ * Registers the public_checks contract class and publishes its standard instance if not already
620
+ * present, and registers the artifact with PXE. Required for any contract that calls
621
+ * `privately_check_timestamp` / `privately_check_block_number` (which dispatch into the
622
+ * deployed PublicChecks contract via an enqueued public call).
623
+ */ export async function ensurePublicChecksPublished(wallet, from) {
624
+ const { instance, contractClass } = await getStandardPublicChecks();
625
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
626
+ await (await publishContractClass(wallet, PublicChecksArtifact)).send({
627
+ from
628
+ });
629
+ }
630
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
631
+ await publishInstance(wallet, instance).send({
632
+ from
633
+ });
634
+ }
635
+ await wallet.registerContract(instance, PublicChecksArtifact);
636
+ }
637
+ /**
638
+ * Registers the handshake_registry contract class and publishes its standard instance if not
639
+ * already present, and registers the artifact with PXE. Required for constrained-delivery flows
640
+ * that call into the HandshakeRegistry at its well-known address.
641
+ */ export async function ensureHandshakeRegistryPublished(wallet, from) {
642
+ const { instance, contractClass } = await getStandardHandshakeRegistry();
643
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
644
+ await (await publishContractClass(wallet, HandshakeRegistryArtifact)).send({
645
+ from
646
+ });
647
+ }
648
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
649
+ await publishInstance(wallet, instance).send({
650
+ from
651
+ });
652
+ }
653
+ await wallet.registerContract(instance, HandshakeRegistryArtifact);
654
+ }
616
655
  /**
617
656
  * Registers the contract class used for test accounts and publicly deploys the instances requested.
618
657
  * Use this when you need to make a public call to an account contract, such as for requesting a public authwit.
@@ -639,7 +678,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
639
678
  /**
640
679
  * Helper function to deploy accounts.
641
680
  * Returns deployed account data that can be used by tests.
642
- */ export const deployAccounts = (numberOfAccounts, logger)=>async ({ wallet, initialFundedAccounts })=>{
681
+ */ export const deployAccounts = (numberOfAccounts, logger, deployOptions)=>async ({ wallet, initialFundedAccounts })=>{
643
682
  if (initialFundedAccounts.length < numberOfAccounts) {
644
683
  throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
645
684
  }
@@ -650,8 +689,9 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
650
689
  const accountManager = await wallet.createSchnorrAccount(deployedAccounts[i].secret, deployedAccounts[i].salt, deployedAccounts[i].signingKey);
651
690
  const deployMethod = await accountManager.getDeployMethod();
652
691
  await deployMethod.send({
653
- from: AztecAddress.ZERO,
654
- skipClassPublication: i !== 0
692
+ from: NO_FROM,
693
+ skipClassPublication: i !== 0,
694
+ ...deployOptions
655
695
  });
656
696
  }
657
697
  return {
@@ -672,7 +712,7 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
672
712
  ...instances.map((instance)=>publishInstance(wallet, instance))
673
713
  ]);
674
714
  const batch = new BatchCall(wallet, calls);
675
- const txReceipt = await batch.send({
715
+ const { receipt: txReceipt } = await batch.send({
676
716
  from: accountsToDeploy[0]
677
717
  });
678
718
  if (waitUntilProven) {