@aztec/end-to-end 5.0.0-rc.2 → 5.0.1

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 (246) hide show
  1. package/README.md +215 -27
  2. package/dest/automine/automine_test_context.d.ts +85 -0
  3. package/dest/automine/automine_test_context.d.ts.map +1 -0
  4. package/dest/automine/automine_test_context.js +98 -0
  5. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts +2 -0
  6. package/dest/automine/contracts/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  7. package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.d.ts +1 -1
  8. package/dest/automine/contracts/fixtures/storage_proof_fixture.d.ts.map +1 -0
  9. package/dest/automine/delivery/interactive_handshake_responder.d.ts +48 -0
  10. package/dest/automine/delivery/interactive_handshake_responder.d.ts.map +1 -0
  11. package/dest/automine/delivery/interactive_handshake_responder.js +76 -0
  12. package/dest/automine/delivery/onchain_delivery_harness.d.ts +19 -0
  13. package/dest/automine/delivery/onchain_delivery_harness.d.ts.map +1 -0
  14. package/dest/automine/delivery/onchain_delivery_harness.js +141 -0
  15. package/dest/automine/token/blacklist_token_contract_test.d.ts +49 -0
  16. package/dest/automine/token/blacklist_token_contract_test.d.ts.map +1 -0
  17. package/dest/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.js +17 -24
  18. package/dest/automine/token/token_contract_test.d.ts +40 -0
  19. package/dest/automine/token/token_contract_test.d.ts.map +1 -0
  20. package/dest/{e2e_token_contract → automine/token}/token_contract_test.js +22 -28
  21. package/dest/automine/token/token_test_helpers.d.ts +73 -0
  22. package/dest/automine/token/token_test_helpers.d.ts.map +1 -0
  23. package/dest/automine/token/token_test_helpers.js +97 -0
  24. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  25. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  26. package/dest/bench/client_flows/benchmark.js +3 -1
  27. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  28. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  29. package/dest/bench/client_flows/client_flows_benchmark.js +16 -4
  30. package/dest/bench/utils.d.ts +1 -1
  31. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  32. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  33. package/dest/composed/ha/ha_full_setup.js +383 -0
  34. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  35. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  36. package/dest/fixtures/e2e_prover_test.d.ts +10 -7
  37. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  38. package/dest/fixtures/e2e_prover_test.js +30 -11
  39. package/dest/fixtures/fixtures.d.ts +9 -6
  40. package/dest/fixtures/fixtures.d.ts.map +1 -1
  41. package/dest/fixtures/fixtures.js +11 -7
  42. package/dest/fixtures/ha_setup.d.ts +3 -3
  43. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  44. package/dest/fixtures/ha_setup.js +4 -1
  45. package/dest/fixtures/index.d.ts +2 -1
  46. package/dest/fixtures/index.d.ts.map +1 -1
  47. package/dest/fixtures/index.js +1 -0
  48. package/dest/fixtures/setup.d.ts +34 -9
  49. package/dest/fixtures/setup.d.ts.map +1 -1
  50. package/dest/fixtures/setup.js +165 -160
  51. package/dest/fixtures/standard_contracts_genesis.d.ts +16 -0
  52. package/dest/fixtures/standard_contracts_genesis.d.ts.map +1 -0
  53. package/dest/fixtures/standard_contracts_genesis.js +25 -0
  54. package/dest/fixtures/timing.d.ts +42 -0
  55. package/dest/fixtures/timing.d.ts.map +1 -0
  56. package/dest/fixtures/timing.js +72 -0
  57. package/dest/fixtures/wait_helpers.d.ts +135 -0
  58. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  59. package/dest/fixtures/wait_helpers.js +154 -0
  60. package/dest/forward-compatibility/wallet_service.js +1 -1
  61. package/dest/multi-node/block-production/setup.d.ts +97 -0
  62. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  63. package/dest/multi-node/block-production/setup.js +158 -0
  64. package/dest/multi-node/governance/setup.d.ts +67 -0
  65. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  66. package/dest/multi-node/governance/setup.js +126 -0
  67. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  68. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  69. package/dest/multi-node/multi_node_test_context.js +347 -0
  70. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  71. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  72. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  73. package/dest/multi-node/slashing/setup.d.ts +167 -0
  74. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  75. package/dest/multi-node/slashing/setup.js +275 -0
  76. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +9 -1
  77. package/dest/p2p/p2p_network.d.ts.map +1 -0
  78. package/dest/{e2e_p2p → p2p}/p2p_network.js +26 -1
  79. package/dest/p2p/reqresp/utils.d.ts +19 -0
  80. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  81. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -15
  82. package/dest/p2p/shared.d.ts +72 -0
  83. package/dest/p2p/shared.d.ts.map +1 -0
  84. package/dest/p2p/shared.js +212 -0
  85. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  86. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  87. package/dest/shared/cross_chain_test_harness.js +24 -16
  88. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  89. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  90. package/dest/shared/gas_portal_test_harness.js +8 -5
  91. package/dest/shared/submit-transactions.d.ts +1 -1
  92. package/dest/shared/submit-transactions.d.ts.map +1 -1
  93. package/dest/shared/submit-transactions.js +12 -5
  94. package/dest/shared/timing_env.d.js +5 -0
  95. package/dest/shared/timing_env.js +158 -47
  96. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  97. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  98. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  99. package/dest/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.js +74 -26
  100. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  101. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  102. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  103. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  104. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  105. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +9 -6
  106. package/dest/single-node/fees/fees_test.d.ts +95 -0
  107. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  108. package/dest/{e2e_fees → single-node/fees}/fees_test.js +121 -45
  109. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  110. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  111. package/dest/single-node/l1-reorgs/setup.js +57 -0
  112. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  113. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  114. package/dest/single-node/partial-proofs/setup.js +5 -0
  115. package/dest/single-node/proving/setup.d.ts +5 -0
  116. package/dest/single-node/proving/setup.d.ts.map +1 -0
  117. package/dest/single-node/proving/setup.js +5 -0
  118. package/dest/single-node/recovery/setup.d.ts +5 -0
  119. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  120. package/dest/single-node/recovery/setup.js +5 -0
  121. package/dest/single-node/setup.d.ts +49 -0
  122. package/dest/single-node/setup.d.ts.map +1 -0
  123. package/dest/single-node/setup.js +56 -0
  124. package/dest/single-node/single_node_test_context.d.ts +374 -0
  125. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  126. package/dest/single-node/single_node_test_context.js +847 -0
  127. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  128. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  129. package/dest/spartan/setup_test_wallets.js +13 -7
  130. package/dest/spartan/tx_metrics.d.ts +10 -1
  131. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  132. package/dest/spartan/tx_metrics.js +32 -0
  133. package/dest/test-wallet/test_wallet.d.ts +23 -4
  134. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  135. package/dest/test-wallet/test_wallet.js +20 -4
  136. package/dest/test-wallet/utils.d.ts +36 -1
  137. package/dest/test-wallet/utils.d.ts.map +1 -1
  138. package/dest/test-wallet/utils.js +64 -4
  139. package/dest/test-wallet/wallet_worker_script.js +5 -2
  140. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  141. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  142. package/dest/test-wallet/worker_wallet.js +2 -2
  143. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  144. package/package.json +40 -40
  145. package/src/automine/README.md +60 -0
  146. package/src/automine/automine_test_context.ts +153 -0
  147. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  148. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  149. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +19 -39
  150. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -43
  151. package/src/automine/token/token_test_helpers.ts +138 -0
  152. package/src/bench/client_flows/benchmark.ts +3 -1
  153. package/src/bench/client_flows/client_flows_benchmark.ts +17 -4
  154. package/src/composed/ha/ha_full_setup.ts +466 -0
  155. package/src/fixtures/e2e_prover_test.ts +36 -20
  156. package/src/fixtures/fixtures.ts +11 -7
  157. package/src/fixtures/ha_setup.ts +7 -3
  158. package/src/fixtures/index.ts +1 -0
  159. package/src/fixtures/setup.ts +204 -162
  160. package/src/fixtures/standard_contracts_genesis.ts +28 -0
  161. package/src/fixtures/timing.ts +97 -0
  162. package/src/fixtures/wait_helpers.ts +333 -0
  163. package/src/forward-compatibility/wallet_service.ts +2 -2
  164. package/src/infra/README.md +12 -0
  165. package/src/multi-node/README.md +96 -0
  166. package/src/multi-node/block-production/setup.ts +272 -0
  167. package/src/multi-node/governance/setup.ts +172 -0
  168. package/src/multi-node/multi_node_test_context.ts +447 -0
  169. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  170. package/src/multi-node/slashing/setup.ts +433 -0
  171. package/src/p2p/README.md +78 -0
  172. package/src/{e2e_p2p → p2p}/p2p_network.ts +26 -0
  173. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -14
  174. package/src/p2p/shared.ts +329 -0
  175. package/src/shared/cross_chain_test_harness.ts +22 -13
  176. package/src/shared/gas_portal_test_harness.ts +13 -5
  177. package/src/shared/submit-transactions.ts +13 -5
  178. package/src/shared/timing_env.d.mts +39 -0
  179. package/src/shared/timing_env.mjs +152 -48
  180. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  181. package/src/single-node/README.md +66 -0
  182. package/src/{e2e_cross_chain_messaging → single-node/cross-chain}/cross_chain_messaging_test.ts +100 -38
  183. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  184. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +11 -7
  185. package/src/{e2e_fees → single-node/fees}/fees_test.ts +132 -47
  186. package/src/single-node/l1-reorgs/setup.ts +93 -0
  187. package/src/single-node/partial-proofs/setup.ts +8 -0
  188. package/src/single-node/proving/setup.ts +15 -0
  189. package/src/single-node/recovery/setup.ts +8 -0
  190. package/src/single-node/setup.ts +63 -0
  191. package/src/single-node/single_node_test_context.ts +1058 -0
  192. package/src/spartan/setup_test_wallets.ts +19 -7
  193. package/src/spartan/tx_metrics.ts +26 -0
  194. package/src/test-wallet/test_wallet.ts +28 -6
  195. package/src/test-wallet/utils.ts +102 -5
  196. package/src/test-wallet/wallet_worker_script.ts +6 -3
  197. package/src/test-wallet/worker_wallet.ts +5 -9
  198. package/src/test-wallet/worker_wallet_schema.ts +1 -1
  199. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  200. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  201. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -59
  202. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  203. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -36
  204. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  205. package/dest/e2e_deploy_contract/deploy_test.js +0 -42
  206. package/dest/e2e_epochs/epochs_test.d.ts +0 -137
  207. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  208. package/dest/e2e_epochs/epochs_test.js +0 -485
  209. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  210. package/dest/e2e_fees/fees_test.d.ts +0 -89
  211. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  212. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  213. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  214. package/dest/e2e_l1_publisher/write_json.js +0 -57
  215. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  216. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  217. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -22
  218. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  219. package/dest/e2e_nested_contract/nested_contract_test.js +0 -40
  220. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  221. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  222. package/dest/e2e_p2p/inactivity_slash_test.js +0 -138
  223. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  224. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  225. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  226. package/dest/e2e_p2p/shared.d.ts +0 -100
  227. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  228. package/dest/e2e_p2p/shared.js +0 -257
  229. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  230. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  231. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  232. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  233. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  234. package/src/e2e_deploy_contract/deploy_test.ts +0 -73
  235. package/src/e2e_epochs/epochs_test.ts +0 -596
  236. package/src/e2e_l1_publisher/write_json.ts +0 -78
  237. package/src/e2e_nested_contract/nested_contract_test.ts +0 -51
  238. package/src/e2e_p2p/inactivity_slash_test.ts +0 -181
  239. package/src/e2e_p2p/shared.ts +0 -391
  240. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  241. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  242. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  243. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  244. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  245. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  246. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
@@ -12,14 +12,13 @@ import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
12
12
  import { NULL_KEY } from '@aztec/ethereum/constants';
13
13
  import { deployMulticall3 } from '@aztec/ethereum/contracts';
14
14
  import { deployAztecL1Contracts } from '@aztec/ethereum/deploy-aztec-l1-contracts';
15
- import { EthCheatCodesWithState, startAnvil } from '@aztec/ethereum/test';
15
+ import { EthCheatCodesWithState, startAnvil, warmBlobKzg } from '@aztec/ethereum/test';
16
16
  import { EpochNumber } from '@aztec/foundation/branded-types';
17
17
  import { SecretValue } from '@aztec/foundation/config';
18
18
  import { randomBytes } from '@aztec/foundation/crypto/random';
19
19
  import { tryRmDir } from '@aztec/foundation/fs';
20
20
  import { withLoggerBindings } from '@aztec/foundation/log/server';
21
21
  import { retryUntil } from '@aztec/foundation/retry';
22
- import { sleep } from '@aztec/foundation/sleep';
23
22
  import { TestDateProvider } from '@aztec/foundation/timer';
24
23
  import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
25
24
  import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
@@ -46,6 +45,8 @@ import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS }
46
45
  import { getACVMConfig } from './get_acvm_config.js';
47
46
  import { getBBConfig } from './get_bb_config.js';
48
47
  import { isMetricsLoggingRequested, setupMetricsLogger } from './logging.js';
48
+ import { getStandardContractGenesisNullifiers } from './standard_contracts_genesis.js';
49
+ import { testSpan } from './timing.js';
49
50
  import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
50
51
  export { startAnvil };
51
52
  let telemetry = undefined;
@@ -129,38 +130,37 @@ export const getPrivateKeyFromIndex = (index)=>{
129
130
  throw new Error(`Artifact version mismatch: expected ${expected} but got ${aztecVersion}. ` + `The legacy artifact resolver may not have swapped in the correct version.`);
130
131
  }
131
132
  }
132
- /**
133
- * Records a function-level timing span into the shared collector installed by the e2e timing
134
- * environment. No-op unless TEST_TIMING_FILE is set (the env only installs the collector then). The
135
- * span is tagged with the name of the currently running test so the env can attribute it to the
136
- * right line; `null` during beforeAll/afterAll lands it on the suite-scoped line.
137
- */ function recordFnSpan(kind, ms) {
138
- const collector = globalThis.__e2eTimings;
139
- collector?.fnSpans.push({
140
- name: collector.current,
141
- kind,
142
- ms
143
- });
144
- }
145
133
  /**
146
134
  * Sets up the environment for the end-to-end tests.
147
135
  * @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
148
136
  * @param opts - Options to pass to the node initialization and to the setup script.
149
137
  * @param pxeOpts - Options to pass to the PXE initialization.
150
- */ export async function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
151
- const setupStart = performance.now();
152
- try {
153
- return await setupInner(numberOfAccounts, opts, pxeOpts, chain);
154
- } finally{
155
- recordFnSpan('setup', performance.now() - setupStart);
156
- }
138
+ */ export function setup(numberOfAccounts = 1, opts = {}, pxeOpts = {}, chain = foundry) {
139
+ // Tag the top-level env spin-up with the prover mode (none → fake → real), the largest config-driven
140
+ // swing in setup cost, so the three factories are comparable on the span leaderboard. The internals
141
+ // (anvil / l1-deploy / sequencer-start / pxe / wallet:create) decompose this further.
142
+ const proverMode = opts.realProofs ? 'real' : opts.startProverNode ? 'fake' : 'none';
143
+ return testSpan(`setup:env:${proverMode}`, async ()=>{
144
+ const ctx = await setupInner(numberOfAccounts, opts, pxeOpts, chain);
145
+ if (process.env.EXIT_E2E_AFTER_SETUP) {
146
+ ctx.logger.info('EXIT_E2E_AFTER_SETUP is set; aborting before the test body runs');
147
+ throw new Error('EXIT_E2E_AFTER_SETUP');
148
+ }
149
+ return ctx;
150
+ });
157
151
  }
158
152
  async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
159
153
  assertContractArtifactsVersion();
154
+ const logger = getLogger();
160
155
  let anvil;
161
156
  try {
162
157
  opts.aztecTargetCommitteeSize ??= 0;
163
158
  opts.slasherEnabled ??= false;
159
+ // Mine the L1 setup txs (Multicall3 + rollup contract deployment) immediately instead of
160
+ // waiting on anvil's block interval — this is the dominant cost of e2e setup. Suites that
161
+ // assert on genesis-relative L1 timing can opt out by passing `automineL1Setup: false`.
162
+ opts.automineL1Setup ??= true;
163
+ logger.trace('Starting e2e test setup');
164
164
  const config = {
165
165
  ...getConfigEnvVars(),
166
166
  ...opts
@@ -175,7 +175,6 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
175
175
  config.enableDelayer = true;
176
176
  config.listenAddress = '127.0.0.1';
177
177
  config.minTxPoolAgeMs = opts.minTxPoolAgeMs ?? 0;
178
- const logger = getLogger();
179
178
  // Create a temp directory for any services that need it and cleanup later
180
179
  const directoryToCleanup = path.join(tmpdir(), randomBytes(8).toString('hex'));
181
180
  await fs.mkdir(directoryToCleanup, {
@@ -189,18 +188,19 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
189
188
  if (!isAnvilTestChain(chain.id)) {
190
189
  throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
191
190
  }
192
- const res = await startAnvil({
193
- l1BlockTime: opts.ethereumSlotDuration,
194
- accounts: opts.anvilAccounts,
195
- port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
196
- slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
197
- dateProvider
198
- });
191
+ const res = await testSpan('setup:env:anvil', ()=>startAnvil({
192
+ l1BlockTime: opts.ethereumSlotDuration,
193
+ accounts: opts.anvilAccounts,
194
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
195
+ slotsInAnEpoch: opts.anvilSlotsInAnEpoch,
196
+ dateProvider
197
+ }));
199
198
  anvil = res.anvil;
200
199
  config.l1RpcUrls = [
201
200
  res.rpcUrl
202
201
  ];
203
202
  }
203
+ logger.trace('Started anvil and L1 RPC client');
204
204
  // Enable logging metrics to a local file named after the test suite
205
205
  if (isMetricsLoggingRequested()) {
206
206
  const filename = path.join('log', getJobName() + '.jsonl');
@@ -216,6 +216,7 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
216
216
  resetBlockInterval: true
217
217
  });
218
218
  }
219
+ logger.trace('Initialized L1 cheat codes and applied state/time overrides');
219
220
  let publisherPrivKeyHex = undefined;
220
221
  let publisherHdAccount = undefined;
221
222
  if (opts.l1PublisherKey && opts.l1PublisherKey.getValue() && opts.l1PublisherKey.getValue() != NULL_KEY) {
@@ -240,6 +241,7 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
240
241
  if (config.coinbase === undefined) {
241
242
  config.coinbase = EthAddress.fromString(publisherHdAccount.address);
242
243
  }
244
+ logger.trace('Resolved L1 publisher account');
243
245
  // The accounts setup creates itself: `numberOfAccounts` initializerless accounts, generated here and
244
246
  // funded at genesis so they are immediately usable.
245
247
  const defaultAccounts = await generateSchnorrAccounts(numberOfAccounts);
@@ -254,14 +256,31 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
254
256
  const sponsoredFPCAddress = await getSponsoredFPCAddress();
255
257
  addressesToFund.push(sponsoredFPCAddress);
256
258
  }
259
+ // Fund any extra addresses whose value depends on the just-generated accounts (e.g. an FPC admin'd
260
+ // by a default account), so a test can genesis-fund them instead of bridging fee juice during setup.
261
+ if (opts.computeExtraGenesisFundedAddresses) {
262
+ addressesToFund.push(...await opts.computeExtraGenesisFundedAddresses(defaultAccounts));
263
+ }
264
+ logger.trace('Generated test accounts to fund at genesis');
265
+ // Preload the standard contracts (AuthRegistry, PublicChecks, HandshakeRegistry) so their `ensure*Published` setup
266
+ // helpers short-circuit their publish txs. The archiver flag seeds the bytecode/instance into every spawned node's
267
+ // contract store; the genesis nullifiers make the AVM's deployment-nullifier check pass when they are called. Both
268
+ // must go together (flag alone would recreate the publish-collision bug), so the flag lives here beside the seeding.
269
+ config.testPreloadStandardContracts = true;
270
+ const standardContractNullifiers = await getStandardContractGenesisNullifiers();
257
271
  const genesisTimestamp = BigInt(Math.floor(Date.now() / 1000));
258
- const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp);
272
+ const { genesisArchiveRoot, genesis, fundingNeeded } = await getGenesisValues(addressesToFund, opts.initialAccountFeeJuice, opts.genesisPublicData, genesisTimestamp, standardContractNullifiers);
273
+ logger.trace('Computed genesis values');
259
274
  const wasAutomining = await ethCheatCodes.isAutoMining();
260
275
  const enableAutomine = opts.automineL1Setup && !wasAutomining && isAnvilTestChain(chain.id);
261
276
  if (enableAutomine) {
262
277
  await ethCheatCodes.setAutomine(true);
263
278
  }
264
279
  const l1Client = createExtendedL1Client(config.l1RpcUrls, publisherHdAccount, chain);
280
+ // Warm both KZG trusted setups (ours + anvil's) in parallel
281
+ if (anvil && isAnvilTestChain(chain.id)) {
282
+ await warmBlobKzg(l1Client, logger);
283
+ }
265
284
  // Deploy Multicall3 if running locally
266
285
  await deployMulticall3(l1Client, logger);
267
286
  // Force viem to refresh its nonce cache to avoid "nonce too low" errors in subsequent transactions
@@ -269,17 +288,18 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
269
288
  await l1Client.getTransactionCount({
270
289
  address: l1Client.account.address
271
290
  });
272
- const deployL1ContractsValues = await deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
273
- ...getL1ContractsConfigEnvVars(),
274
- ...opts,
275
- ...opts.l1ContractsArgs,
276
- vkTreeRoot: getVKTreeRoot(),
277
- protocolContractsHash,
278
- genesisArchiveRoot,
279
- initialValidators: opts.initialValidators,
280
- feeJuicePortalInitialBalance: fundingNeeded,
281
- realVerifier: false
282
- });
291
+ logger.trace('Deployed Multicall3');
292
+ const deployL1ContractsValues = await testSpan('setup:env:l1-deploy', ()=>deployAztecL1Contracts(config.l1RpcUrls[0], publisherPrivKeyHex, chain.id, {
293
+ ...getL1ContractsConfigEnvVars(),
294
+ ...opts,
295
+ ...opts.l1ContractsArgs,
296
+ vkTreeRoot: getVKTreeRoot(),
297
+ protocolContractsHash,
298
+ genesisArchiveRoot,
299
+ initialValidators: opts.initialValidators,
300
+ feeJuicePortalInitialBalance: fundingNeeded,
301
+ realVerifier: false
302
+ }));
283
303
  Object.assign(config, deployL1ContractsValues.l1ContractAddresses);
284
304
  config.rollupVersion = deployL1ContractsValues.rollupVersion;
285
305
  // Propagate L1-contracts-config overrides back to the node config so the archiver's
@@ -299,9 +319,24 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
299
319
  }
300
320
  }
301
321
  }
322
+ // Deploy any test-specific L1 contracts while automine is still on and before the node starts,
323
+ // so they mine instantly rather than paying the L1 block interval once the sequencer is live.
324
+ let extraL1DeployResult = undefined;
325
+ if (opts.deployExtraL1Contracts) {
326
+ logger.trace('Running deployExtraL1Contracts hook');
327
+ extraL1DeployResult = await opts.deployExtraL1Contracts({
328
+ l1Client,
329
+ deployL1ContractsValues,
330
+ logger
331
+ });
332
+ // The hook reused `l1Client` to send deploy txs, so refresh viem's nonce cache to avoid a
333
+ // stale cached nonce for later transactions on the publisher account.
334
+ await l1Client.getTransactionCount({
335
+ address: l1Client.account.address
336
+ });
337
+ }
302
338
  if (enableAutomine) {
303
- await ethCheatCodes.setAutomine(false);
304
- await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
339
+ await ethCheatCodes.startIntervalMiningWithFreshBlock(config.ethereumSlotDuration);
305
340
  }
306
341
  // In compose mode (no local anvil), sync dateProvider to L1 time since it may have drifted
307
342
  // ahead of system time. When running with a local anvil, the dateProvider is kept in sync via
@@ -314,20 +349,30 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
314
349
  resetBlockInterval: true
315
350
  });
316
351
  }
317
- // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
318
- const telemetryClient = opts.metricsPort ? await getEndToEndTestTelemetryClient(opts.metricsPort) : await getTelemetryClient(opts.telemetryConfig);
319
- await setupSharedBlobStorage(config);
320
- logger.verbose('Creating and synching an aztec node', config);
321
- const acvmConfig = await getACVMConfig(logger);
352
+ logger.trace('Deployed L1 rollup contracts');
353
+ // These boot steps are independent and write disjoint config keys, so run them concurrently:
354
+ // telemetry returns a client (no config write), shared blob storage writes blobFileStore* keys,
355
+ // and the ACVM/BB config resolvers write their own acvm*/bb* keys.
356
+ const [telemetryClient, , acvmConfig, bbConfig] = await Promise.all([
357
+ // Use metricsPort-based telemetry if provided, otherwise use the regular telemetry client
358
+ opts.metricsPort ? getEndToEndTestTelemetryClient(opts.metricsPort) : getTelemetryClient(opts.telemetryConfig),
359
+ setupSharedBlobStorage(config),
360
+ getACVMConfig(logger),
361
+ getBBConfig(logger)
362
+ ]);
363
+ logger.trace('Created telemetry client');
364
+ logger.trace('Set up shared blob storage');
322
365
  if (acvmConfig) {
323
366
  config.acvmWorkingDirectory = acvmConfig.acvmWorkingDirectory;
324
367
  config.acvmBinaryPath = acvmConfig.acvmBinaryPath;
325
368
  }
326
- const bbConfig = await getBBConfig(logger);
369
+ logger.trace('Resolved ACVM config');
327
370
  if (bbConfig) {
328
371
  config.bbBinaryPath = bbConfig.bbBinaryPath;
329
372
  config.bbWorkingDirectory = bbConfig.bbWorkingDirectory;
330
373
  }
374
+ logger.trace('Resolved Barretenberg config');
375
+ logger.verbose('Creating and synching an aztec node', config);
331
376
  let mockGossipSubNetwork;
332
377
  let p2pClientDeps = undefined;
333
378
  if (opts.mockGossipSubNetwork) {
@@ -336,25 +381,6 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
336
381
  p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork)
337
382
  };
338
383
  }
339
- // Transactions built against the genesis state must be included in block 1, otherwise they are dropped.
340
- // To avoid test failures from dropped transactions, we ensure progression beyond genesis before proceeding.
341
- const originalMinTxsPerBlock = config.minTxsPerBlock;
342
- if (originalMinTxsPerBlock === undefined) {
343
- throw new Error('minTxsPerBlock is undefined in e2e test setup');
344
- }
345
- const originalBuildCheckpointIfEmpty = config.buildCheckpointIfEmpty ?? false;
346
- // Allow an empty checkpoint so the empty block can be built; leave untouched when not advancing.
347
- const advancePastGenesis = (opts.advancePastGenesis ?? true) && !opts.skipInitialSequencer;
348
- config.minTxsPerBlock = advancePastGenesis ? 0 : originalMinTxsPerBlock;
349
- // Pipelining is always on: the proposer builds during slot N-1 for slot N. A tx submitted at slot N
350
- // start arrives after that build, so forcing minTxsPerBlock=1 would stall the chain on alternating
351
- // slots -- hence empty checkpoints are allowed (minTxsPerBlock=0) while advancing past genesis.
352
- // Automine is unaffected: its runBuild clamps mempool builds to Math.max(minTxsPerBlock ?? 1, 1) and
353
- // still requires minValidTxs: 1.
354
- const shouldTemporarilyBuildEmptyCheckpoints = advancePastGenesis && config.useAutomineSequencer !== true;
355
- if (shouldTemporarilyBuildEmptyCheckpoints) {
356
- config.buildCheckpointIfEmpty = true;
357
- }
358
384
  config.p2pEnabled = opts.mockGossipSubNetwork || config.p2pEnabled;
359
385
  config.p2pIp = opts.p2pIp ?? config.p2pIp ?? '127.0.0.1';
360
386
  if (!config.disableValidator) {
@@ -375,17 +401,19 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
375
401
  bootstrapNodes: []
376
402
  }
377
403
  } : config;
378
- const aztecNodeService = await withLoggerBindings({
379
- actor: 'node-0'
380
- }, ()=>createAztecNodeService(initialNodeConfig, {
381
- dateProvider,
382
- telemetry: telemetryClient,
383
- p2pClientDeps
384
- }, {
385
- genesis,
386
- dontStartSequencer: opts.skipInitialSequencer
387
- }));
404
+ logger.trace('Prepared aztec node config');
405
+ const aztecNodeService = await testSpan('setup:env:sequencer-start', ()=>withLoggerBindings({
406
+ actor: 'node-0'
407
+ }, ()=>createAztecNodeService(initialNodeConfig, {
408
+ dateProvider,
409
+ telemetry: telemetryClient,
410
+ p2pClientDeps
411
+ }, {
412
+ genesis,
413
+ dontStartSequencer: opts.skipInitialSequencer
414
+ })));
388
415
  const sequencerClient = aztecNodeService.getSequencer();
416
+ logger.trace('Created and synced aztec node');
389
417
  let proverNode = undefined;
390
418
  if (opts.startProverNode) {
391
419
  logger.verbose('Creating and syncing a simulated prover node...');
@@ -398,16 +426,17 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
398
426
  aztecNodeService
399
427
  ]
400
428
  };
401
- ({ proverNode } = await createAndSyncProverNode(proverNodePrivateKeyHex, config, {
402
- ...config.proverNodeConfig,
403
- dataDirectory: proverNodeDataDirectory
404
- }, {
405
- dateProvider,
406
- p2pClientDeps,
407
- telemetry: telemetryClient
408
- }, {
409
- genesis
410
- }));
429
+ ({ proverNode } = await testSpan('setup:env:prover-node', ()=>createAndSyncProverNode(proverNodePrivateKeyHex, config, {
430
+ ...config.proverNodeConfig,
431
+ dataDirectory: proverNodeDataDirectory
432
+ }, {
433
+ dateProvider,
434
+ p2pClientDeps,
435
+ telemetry: telemetryClient
436
+ }, {
437
+ genesis
438
+ })));
439
+ logger.trace('Created prover node');
411
440
  }
412
441
  const sequencerDelayer = sequencerClient?.getDelayer();
413
442
  const proverDelayer = proverNode?.getProverNode()?.getDelayer();
@@ -419,84 +448,57 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
419
448
  pxeConfig.dataDirectory = path.join(directoryToCleanup, randomBytes(8).toString('hex'));
420
449
  // For tests we only want proving enabled if specifically requested
421
450
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
422
- const wallet = await TestWallet.create(aztecNodeService, pxeConfig, {
423
- loggerActorLabel: 'pxe-0',
424
- // In-process node implements the debug API, so register public function signatures for named traces.
425
- nodeDebug: aztecNodeService,
426
- ...opts.pxeCreationOptions
427
- });
451
+ const wallet = await testSpan('setup:env:pxe', ()=>TestWallet.create(aztecNodeService, pxeConfig, {
452
+ loggerActorLabel: 'pxe-0',
453
+ // In-process node implements the debug API, so register public function signatures for named traces.
454
+ nodeDebug: aztecNodeService,
455
+ ...opts.pxeCreationOptions
456
+ }));
428
457
  if (opts.walletMinFeePadding !== undefined) {
429
458
  wallet.setMinFeePadding(opts.walletMinFeePadding);
430
459
  }
460
+ logger.trace('Created PXE and test wallet');
431
461
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
462
+ logger.trace('Created cheat codes');
432
463
  if (opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0 || opts.initialValidators && opts.initialValidators.length > 0) {
433
464
  // We need to advance such that the committee is set up.
434
465
  await cheatCodes.rollup.advanceToEpoch(EpochNumber.fromBigInt(BigInt(await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochsForValidatorSet + 1)));
435
466
  await cheatCodes.rollup.setupEpoch();
436
467
  await cheatCodes.rollup.debugRollup();
468
+ logger.trace('Advanced chain to set up validator committee');
437
469
  }
438
470
  let accounts = [];
439
471
  // Create the default accounts. They are initializerless, so this is a PXE-side operation (registration
440
472
  // + a simulated store call) with no on-chain tx, independent of the sequencer.
441
473
  if (numberOfAccounts > 0) {
442
474
  logger.info(`Creating ${numberOfAccounts} initializerless test accounts`);
443
- await createFundedInitializerlessAccounts(wallet, defaultAccounts);
475
+ await testSpan('wallet:create', ()=>createFundedInitializerlessAccounts(wallet, defaultAccounts));
444
476
  accounts = defaultAccounts.map((a)=>a.address);
445
477
  }
446
- // Advancing past genesis needs a running sequencer to build the empty block; advancePastGenesis is
447
- // already false when skipInitialSequencer is set.
448
- if (advancePastGenesis) {
449
- logger.info('Mining an empty block to progress past genesis');
450
- const automine = aztecNodeService.getAutomineSequencer();
451
- if (automine) {
452
- await automine.buildEmptyBlock();
453
- }
454
- while(await aztecNodeService.getBlockNumber() === 0){
455
- await sleep(2000);
456
- }
457
- } else if (opts.skipInitialSequencer) {
458
- logger.info('Sequencer not started on initial node, skipping block progression');
459
- }
460
- // Now we restore the original minTxsPerBlock setting if we changed it.
461
- if (sequencerClient) {
462
- const sequencer = sequencerClient.getSequencer();
463
- if (config.minTxsPerBlock !== originalMinTxsPerBlock) {
464
- sequencer.updateConfig({
465
- minTxsPerBlock: originalMinTxsPerBlock
466
- });
467
- }
468
- if (shouldTemporarilyBuildEmptyCheckpoints) {
469
- sequencer.updateConfig({
470
- buildCheckpointIfEmpty: originalBuildCheckpointIfEmpty
471
- });
472
- config.buildCheckpointIfEmpty = originalBuildCheckpointIfEmpty;
473
- }
474
- }
475
- const teardown = async ()=>{
476
- const teardownStart = performance.now();
477
- try {
478
- await tryStop(wallet, logger);
479
- await tryStop(aztecNodeService, logger);
480
- await tryStop(proverNode, logger);
481
- if (acvmConfig?.cleanup) {
482
- await acvmConfig.cleanup();
483
- }
484
- if (bbConfig?.cleanup) {
485
- await bbConfig.cleanup();
486
- }
487
- await tryStop(anvil, logger);
488
- await tryRmDir(directoryToCleanup, logger);
489
- } catch (err) {
490
- logger.error(`Error during e2e test teardown`, err);
491
- } finally{
478
+ logger.trace('Created funded test accounts');
479
+ const teardown = ()=>testSpan('teardown:env', async ()=>{
492
480
  try {
493
- await telemetryClient.stop();
481
+ await tryStop(wallet, logger);
482
+ await tryStop(aztecNodeService, logger);
483
+ await tryStop(proverNode, logger);
484
+ if (acvmConfig?.cleanup) {
485
+ await acvmConfig.cleanup();
486
+ }
487
+ if (bbConfig?.cleanup) {
488
+ await bbConfig.cleanup();
489
+ }
490
+ await tryStop(anvil, logger);
491
+ await tryRmDir(directoryToCleanup, logger);
494
492
  } catch (err) {
495
- logger.error(`Error during telemetry client stop`, err);
493
+ logger.error(`Error during e2e test teardown`, err);
494
+ } finally{
495
+ try {
496
+ await telemetryClient.stop();
497
+ } catch (err) {
498
+ logger.error(`Error during telemetry client stop`, err);
499
+ }
496
500
  }
497
- recordFnSpan('teardown', performance.now() - teardownStart);
498
- }
499
- };
501
+ });
500
502
  return {
501
503
  anvil,
502
504
  aztecNode: aztecNodeService,
@@ -512,6 +514,7 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
512
514
  logger,
513
515
  mockGossipSubNetwork,
514
516
  genesis,
517
+ extraL1DeployResult,
515
518
  proverNode,
516
519
  sequencerDelayer,
517
520
  proverDelayer,
@@ -570,7 +573,7 @@ async function setupInner(numberOfAccounts, opts, pxeOpts, chain) {
570
573
  */ export async function registerSponsoredFPC(wallet) {
571
574
  await wallet.registerContract(await getSponsoredFPCInstance(), SponsoredFPCContract.artifact);
572
575
  }
573
- export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 1) {
576
+ export async function waitForProvenChain(node, targetBlock, timeoutSec = 60, intervalSec = 0.25) {
574
577
  targetBlock ??= await node.getBlockNumber();
575
578
  await retryUntil(async ()=>await node.getBlockNumber('proven') >= targetBlock, 'proven chain status', timeoutSec, intervalSec);
576
579
  }
@@ -633,18 +636,20 @@ export async function expectMappingDelta(initialValues, fn, inputs, expectedDiff
633
636
  * required so revert messages from AuthRegistry calls can be enriched (otherwise assertion strings
634
637
  * surface as generic "Assertion failed:" and tests that match on the real message fail).
635
638
  */ export async function ensureAuthRegistryPublished(wallet, from) {
636
- const { instance, contractClass } = await getStandardAuthRegistry();
637
- if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
638
- await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
639
- from
640
- });
641
- }
642
- if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
643
- await publishInstance(wallet, instance).send({
644
- from
645
- });
646
- }
647
- await wallet.registerContract(instance, AuthRegistryArtifact);
639
+ await testSpan('setup:auth-registry', async ()=>{
640
+ const { instance, contractClass } = await getStandardAuthRegistry();
641
+ if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
642
+ await (await publishContractClass(wallet, AuthRegistryArtifact)).send({
643
+ from
644
+ });
645
+ }
646
+ if (!(await wallet.getContractMetadata(instance.address)).isContractPublished) {
647
+ await publishInstance(wallet, instance).send({
648
+ from
649
+ });
650
+ }
651
+ await wallet.registerContract(instance, AuthRegistryArtifact);
652
+ });
648
653
  }
649
654
  /**
650
655
  * Registers the public_checks contract class and publishes its standard instance if not already
@@ -0,0 +1,16 @@
1
+ import type { Fr } from '@aztec/foundation/curves/bn254';
2
+ /**
3
+ * Computes the genesis nullifiers that pre-publish the standard contracts (AuthRegistry, PublicChecks,
4
+ * HandshakeRegistry) in e2e environments, mirroring the nullifiers their on-chain publish txs would emit. Per contract:
5
+ * - `siloNullifier(ContractClassRegistry, classId)` — the class-registration nullifier that `ContractClassRegistry.publish` pushes.
6
+ * - `siloNullifier(ContractInstanceRegistry, instanceAddress)` — the instance-deployment nullifier that
7
+ * `ContractInstanceRegistry.publish_for_public_execution` pushes, using the contract's real derived address (standard
8
+ * contracts are deployed at artifact-derived addresses, not magic protocol addresses).
9
+ *
10
+ * Seed these into the genesis nullifier tree (as the 5th `getGenesisValues` arg) alongside the archiver's
11
+ * `testPreloadStandardContracts` preload: the store preload makes the `ensure*Published` guards short-circuit, and these
12
+ * nullifiers make the AVM's deployment-nullifier check pass when the contracts are called. Every e2e node genesis that
13
+ * feeds an L1 `genesisArchiveRoot` must seed the same set, or the world-state root diverges from the deployed rollup.
14
+ */
15
+ export declare function getStandardContractGenesisNullifiers(): Promise<Fr[]>;
16
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhbmRhcmRfY29udHJhY3RzX2dlbmVzaXMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9maXh0dXJlcy9zdGFuZGFyZF9jb250cmFjdHNfZ2VuZXNpcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxFQUFFLEVBQUUsTUFBTSxnQ0FBZ0MsQ0FBQztBQUt6RDs7Ozs7Ozs7Ozs7O0dBWUc7QUFDSCx3QkFBc0Isb0NBQW9DLElBQUksT0FBTyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBUzFFIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard_contracts_genesis.d.ts","sourceRoot":"","sources":["../../src/fixtures/standard_contracts_genesis.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAKzD;;;;;;;;;;;;GAYG;AACH,wBAAsB,oCAAoC,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC,CAS1E"}
@@ -0,0 +1,25 @@
1
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
2
+ import { getPublishableStandardContracts } from '@aztec/standard-contracts';
3
+ import { siloNullifier } from '@aztec/stdlib/hash';
4
+ /**
5
+ * Computes the genesis nullifiers that pre-publish the standard contracts (AuthRegistry, PublicChecks,
6
+ * HandshakeRegistry) in e2e environments, mirroring the nullifiers their on-chain publish txs would emit. Per contract:
7
+ * - `siloNullifier(ContractClassRegistry, classId)` — the class-registration nullifier that `ContractClassRegistry.publish` pushes.
8
+ * - `siloNullifier(ContractInstanceRegistry, instanceAddress)` — the instance-deployment nullifier that
9
+ * `ContractInstanceRegistry.publish_for_public_execution` pushes, using the contract's real derived address (standard
10
+ * contracts are deployed at artifact-derived addresses, not magic protocol addresses).
11
+ *
12
+ * Seed these into the genesis nullifier tree (as the 5th `getGenesisValues` arg) alongside the archiver's
13
+ * `testPreloadStandardContracts` preload: the store preload makes the `ensure*Published` guards short-circuit, and these
14
+ * nullifiers make the AVM's deployment-nullifier check pass when the contracts are called. Every e2e node genesis that
15
+ * feeds an L1 `genesisArchiveRoot` must seed the same set, or the world-state root diverges from the deployed rollup.
16
+ */ export async function getStandardContractGenesisNullifiers() {
17
+ const classRegistry = ProtocolContractAddress.ContractClassRegistry;
18
+ const instanceRegistry = ProtocolContractAddress.ContractInstanceRegistry;
19
+ const nullifiers = [];
20
+ for (const { contractClass, address } of (await getPublishableStandardContracts())){
21
+ nullifiers.push(await siloNullifier(classRegistry, contractClass.id));
22
+ nullifiers.push(await siloNullifier(instanceRegistry, address.toField()));
23
+ }
24
+ return nullifiers;
25
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Runs `fn` with every {@link testSpan} inside its async call tree attributed to `owner` instead of the
3
+ * currently running test. Use a non-test sentinel owner (e.g. `other:mempool-feeder`) to keep a
4
+ * background producer's spans out of the per-test view.
5
+ */
6
+ export declare function withTestSpanOwner<T>(owner: string, fn: () => Promise<T>): Promise<T>;
7
+ /** One recorded span occurrence on the process-wide `performance.now()` clock. */
8
+ export type TimingSpan = {
9
+ /** Full name of the test running when the span started, or `null` if inside a beforeAll/afterAll hook. */
10
+ owner: string | null;
11
+ /** Stable `category:label` tag, aggregated across occurrences (e.g. `wait:checkpoint`, `setup:node`). */
12
+ name: string;
13
+ /** `performance.now()` at span start. */
14
+ start: number;
15
+ /** `performance.now()` at span end. */
16
+ end: number;
17
+ };
18
+ /**
19
+ * The collector shared by the timing environment on `globalThis.__e2eTimings`. `current` is the full
20
+ * name of the test currently running (`null` during beforeAll/afterAll); the environment sets it. The
21
+ * `spans` array accumulates every recorded span until the environment folds it into the per-test /
22
+ * per-suite JSONL line at flush.
23
+ */
24
+ export type SpanCollector = {
25
+ /** Full name of the running test, or `null` during a beforeAll/afterAll hook. */
26
+ current: string | null;
27
+ /** All recorded spans, drained by the timing environment at flush time. */
28
+ spans: TimingSpan[];
29
+ };
30
+ /**
31
+ * Times `fn` and records a span tagged `name`, attributed to the test (or suite) running when it
32
+ * started. The span is recorded even when `fn` throws. Pure passthrough: when no collector is
33
+ * installed (i.e. `TEST_TIMING_FILE` is unset) this calls `fn()` directly with zero overhead.
34
+ *
35
+ * Use stable `category:label` tags and prefer wrapping at the leaf wait/setup/tx level — labels are
36
+ * forever aggregation keys, and leaf-level tagging keeps spans additive. See `SPEEDUP_FOLLOWUPS` and
37
+ * the A-1179 design doc for the tag taxonomy.
38
+ */
39
+ export declare function testSpan<T>(name: string, fn: () => Promise<T>): Promise<T>;
40
+ /** Synchronous variant of {@link testSpan} for non-async helpers. Same zero-cost guarantee when unset. */
41
+ export declare function testSpanSync<T>(name: string, fn: () => T): T;
42
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGltaW5nLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvZml4dHVyZXMvdGltaW5nLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQXNCQTs7OztHQUlHO0FBQ0gsd0JBQWdCLGlCQUFpQixDQUFDLENBQUMsRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLEVBQUUsRUFBRSxNQUFNLE9BQU8sQ0FBQyxDQUFDLENBQUMsR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBRXBGO0FBRUQsa0ZBQWtGO0FBQ2xGLE1BQU0sTUFBTSxVQUFVLEdBQUc7SUFDdkIsMEdBQTBHO0lBQzFHLEtBQUssRUFBRSxNQUFNLEdBQUcsSUFBSSxDQUFDO0lBQ3JCLHlHQUF5RztJQUN6RyxJQUFJLEVBQUUsTUFBTSxDQUFDO0lBQ2IseUNBQXlDO0lBQ3pDLEtBQUssRUFBRSxNQUFNLENBQUM7SUFDZCx1Q0FBdUM7SUFDdkMsR0FBRyxFQUFFLE1BQU0sQ0FBQztDQUNiLENBQUM7QUFFRjs7Ozs7R0FLRztBQUNILE1BQU0sTUFBTSxhQUFhLEdBQUc7SUFDMUIsaUZBQWlGO0lBQ2pGLE9BQU8sRUFBRSxNQUFNLEdBQUcsSUFBSSxDQUFDO0lBQ3ZCLDJFQUEyRTtJQUMzRSxLQUFLLEVBQUUsVUFBVSxFQUFFLENBQUM7Q0FDckIsQ0FBQztBQU1GOzs7Ozs7OztHQVFHO0FBQ0gsd0JBQXNCLFFBQVEsQ0FBQyxDQUFDLEVBQUUsSUFBSSxFQUFFLE1BQU0sRUFBRSxFQUFFLEVBQUUsTUFBTSxPQUFPLENBQUMsQ0FBQyxDQUFDLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQVloRjtBQUVELDBHQUEwRztBQUMxRyx3QkFBZ0IsWUFBWSxDQUFDLENBQUMsRUFBRSxJQUFJLEVBQUUsTUFBTSxFQUFFLEVBQUUsRUFBRSxNQUFNLENBQUMsR0FBRyxDQUFDLENBWTVEIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../../src/fixtures/timing.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEpF;AAED,kFAAkF;AAClF,MAAM,MAAM,UAAU,GAAG;IACvB,0GAA0G;IAC1G,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,yGAAyG;IACzG,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iFAAiF;IACjF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2EAA2E;IAC3E,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB,CAAC;AAMF;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYhF;AAED,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAY5D"}