@aztec/end-to-end 0.0.1-commit.b9865e97 → 0.0.1-commit.be03c316

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 (270) hide show
  1. package/README.md +203 -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 +18 -40
  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 -39
  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 +4 -4
  28. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  29. package/dest/bench/client_flows/client_flows_benchmark.js +31 -19
  30. package/dest/bench/client_flows/data_extractor.js +1 -0
  31. package/dest/bench/utils.d.ts +3 -3
  32. package/dest/bench/utils.d.ts.map +1 -1
  33. package/dest/bench/utils.js +95 -6
  34. package/dest/composed/ha/ha_full_setup.d.ts +77 -0
  35. package/dest/composed/ha/ha_full_setup.d.ts.map +1 -0
  36. package/dest/composed/ha/ha_full_setup.js +383 -0
  37. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts +12 -0
  38. package/dest/composed/web3signer/multi_validator_keystore_utils.d.ts.map +1 -0
  39. package/dest/fixtures/e2e_prover_test.d.ts +12 -9
  40. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  41. package/dest/fixtures/e2e_prover_test.js +47 -28
  42. package/dest/fixtures/fixtures.d.ts +19 -10
  43. package/dest/fixtures/fixtures.d.ts.map +1 -1
  44. package/dest/fixtures/fixtures.js +26 -11
  45. package/dest/fixtures/ha_setup.d.ts +3 -3
  46. package/dest/fixtures/ha_setup.d.ts.map +1 -1
  47. package/dest/fixtures/ha_setup.js +4 -1
  48. package/dest/fixtures/index.d.ts +2 -1
  49. package/dest/fixtures/index.d.ts.map +1 -1
  50. package/dest/fixtures/index.js +1 -0
  51. package/dest/fixtures/setup.d.ts +38 -41
  52. package/dest/fixtures/setup.d.ts.map +1 -1
  53. package/dest/fixtures/setup.js +181 -228
  54. package/dest/fixtures/setup_p2p_test.d.ts +1 -1
  55. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  56. package/dest/fixtures/setup_p2p_test.js +3 -3
  57. package/dest/fixtures/timing.d.ts +42 -0
  58. package/dest/fixtures/timing.d.ts.map +1 -0
  59. package/dest/fixtures/timing.js +72 -0
  60. package/dest/fixtures/token_utils.d.ts +22 -4
  61. package/dest/fixtures/token_utils.d.ts.map +1 -1
  62. package/dest/fixtures/token_utils.js +21 -1
  63. package/dest/fixtures/utils.d.ts +2 -2
  64. package/dest/fixtures/utils.d.ts.map +1 -1
  65. package/dest/fixtures/utils.js +1 -1
  66. package/dest/fixtures/wait_helpers.d.ts +135 -0
  67. package/dest/fixtures/wait_helpers.d.ts.map +1 -0
  68. package/dest/fixtures/wait_helpers.js +154 -0
  69. package/dest/forward-compatibility/wallet_service.js +3 -3
  70. package/dest/multi-node/block-production/setup.d.ts +97 -0
  71. package/dest/multi-node/block-production/setup.d.ts.map +1 -0
  72. package/dest/multi-node/block-production/setup.js +158 -0
  73. package/dest/multi-node/governance/setup.d.ts +67 -0
  74. package/dest/multi-node/governance/setup.d.ts.map +1 -0
  75. package/dest/multi-node/governance/setup.js +126 -0
  76. package/dest/multi-node/multi_node_test_context.d.ts +212 -0
  77. package/dest/multi-node/multi_node_test_context.d.ts.map +1 -0
  78. package/dest/multi-node/multi_node_test_context.js +347 -0
  79. package/dest/multi-node/slashing/inactivity_setup.d.ts +27 -0
  80. package/dest/multi-node/slashing/inactivity_setup.d.ts.map +1 -0
  81. package/dest/multi-node/slashing/inactivity_setup.js +111 -0
  82. package/dest/multi-node/slashing/setup.d.ts +167 -0
  83. package/dest/multi-node/slashing/setup.d.ts.map +1 -0
  84. package/dest/multi-node/slashing/setup.js +275 -0
  85. package/dest/{e2e_p2p → p2p}/p2p_network.d.ts +10 -2
  86. package/dest/p2p/p2p_network.d.ts.map +1 -0
  87. package/dest/{e2e_p2p → p2p}/p2p_network.js +39 -15
  88. package/dest/p2p/reqresp/utils.d.ts +19 -0
  89. package/dest/p2p/reqresp/utils.d.ts.map +1 -0
  90. package/dest/{e2e_p2p → p2p}/reqresp/utils.js +4 -17
  91. package/dest/p2p/shared.d.ts +72 -0
  92. package/dest/p2p/shared.d.ts.map +1 -0
  93. package/dest/p2p/shared.js +212 -0
  94. package/dest/shared/cross_chain_test_harness.d.ts +3 -3
  95. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  96. package/dest/shared/cross_chain_test_harness.js +16 -15
  97. package/dest/shared/gas_portal_test_harness.d.ts +1 -1
  98. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  99. package/dest/shared/gas_portal_test_harness.js +8 -5
  100. package/dest/shared/submit-transactions.d.ts +1 -1
  101. package/dest/shared/submit-transactions.d.ts.map +1 -1
  102. package/dest/shared/submit-transactions.js +12 -5
  103. package/dest/shared/timing_env.d.js +5 -0
  104. package/dest/shared/timing_env.js +365 -0
  105. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  106. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  107. package/dest/shared/uniswap_l1_l2.js +1 -6
  108. package/dest/shared/wait_for_l1_to_l2_message.js +1 -1
  109. package/dest/simulators/lending_simulator.js +1 -1
  110. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts +75 -0
  111. package/dest/single-node/cross-chain/cross_chain_messaging_test.d.ts.map +1 -0
  112. package/dest/single-node/cross-chain/cross_chain_messaging_test.js +209 -0
  113. package/dest/single-node/cross-chain/message_test_helpers.d.ts +38 -0
  114. package/dest/single-node/cross-chain/message_test_helpers.d.ts.map +1 -0
  115. package/dest/single-node/cross-chain/message_test_helpers.js +70 -0
  116. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.d.ts +1 -1
  117. package/dest/single-node/fees/bridging_race.notest.d.ts.map +1 -0
  118. package/dest/{e2e_fees → single-node/fees}/bridging_race.notest.js +17 -4
  119. package/dest/single-node/fees/fees_test.d.ts +93 -0
  120. package/dest/single-node/fees/fees_test.d.ts.map +1 -0
  121. package/dest/{e2e_fees → single-node/fees}/fees_test.js +48 -55
  122. package/dest/single-node/l1-reorgs/setup.d.ts +42 -0
  123. package/dest/single-node/l1-reorgs/setup.d.ts.map +1 -0
  124. package/dest/single-node/l1-reorgs/setup.js +57 -0
  125. package/dest/single-node/partial-proofs/setup.d.ts +5 -0
  126. package/dest/single-node/partial-proofs/setup.d.ts.map +1 -0
  127. package/dest/single-node/partial-proofs/setup.js +5 -0
  128. package/dest/single-node/proving/setup.d.ts +5 -0
  129. package/dest/single-node/proving/setup.d.ts.map +1 -0
  130. package/dest/single-node/proving/setup.js +5 -0
  131. package/dest/single-node/recovery/setup.d.ts +5 -0
  132. package/dest/single-node/recovery/setup.d.ts.map +1 -0
  133. package/dest/single-node/recovery/setup.js +5 -0
  134. package/dest/single-node/setup.d.ts +49 -0
  135. package/dest/single-node/setup.d.ts.map +1 -0
  136. package/dest/single-node/setup.js +56 -0
  137. package/dest/single-node/single_node_test_context.d.ts +360 -0
  138. package/dest/single-node/single_node_test_context.d.ts.map +1 -0
  139. package/dest/single-node/single_node_test_context.js +833 -0
  140. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  141. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  142. package/dest/spartan/setup_test_wallets.js +19 -9
  143. package/dest/spartan/tx_metrics.d.ts +10 -1
  144. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  145. package/dest/spartan/tx_metrics.js +32 -0
  146. package/dest/test-wallet/test_wallet.d.ts +23 -3
  147. package/dest/test-wallet/test_wallet.d.ts.map +1 -1
  148. package/dest/test-wallet/test_wallet.js +56 -9
  149. package/dest/test-wallet/utils.d.ts +36 -1
  150. package/dest/test-wallet/utils.d.ts.map +1 -1
  151. package/dest/test-wallet/utils.js +64 -4
  152. package/dest/test-wallet/wallet_worker_script.js +5 -2
  153. package/dest/test-wallet/worker_wallet.d.ts +5 -5
  154. package/dest/test-wallet/worker_wallet.d.ts.map +1 -1
  155. package/dest/test-wallet/worker_wallet.js +5 -3
  156. package/dest/test-wallet/worker_wallet_schema.d.ts +3 -159
  157. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -1
  158. package/dest/test-wallet/worker_wallet_schema.js +2 -1
  159. package/package.json +41 -41
  160. package/src/automine/README.md +60 -0
  161. package/src/automine/automine_test_context.ts +153 -0
  162. package/src/automine/delivery/interactive_handshake_responder.ts +125 -0
  163. package/src/automine/delivery/onchain_delivery_harness.ts +213 -0
  164. package/src/{e2e_blacklist_token_contract → automine/token}/blacklist_token_contract_test.ts +20 -57
  165. package/src/{e2e_token_contract → automine/token}/token_contract_test.ts +24 -57
  166. package/src/automine/token/token_test_helpers.ts +138 -0
  167. package/src/bench/client_flows/benchmark.ts +3 -1
  168. package/src/bench/client_flows/client_flows_benchmark.ts +45 -26
  169. package/src/bench/client_flows/data_extractor.ts +1 -0
  170. package/src/bench/utils.ts +109 -6
  171. package/src/composed/ha/ha_full_setup.ts +466 -0
  172. package/src/fixtures/e2e_prover_test.ts +58 -47
  173. package/src/fixtures/fixtures.ts +28 -11
  174. package/src/fixtures/ha_setup.ts +7 -3
  175. package/src/fixtures/index.ts +1 -0
  176. package/src/fixtures/setup.ts +220 -289
  177. package/src/fixtures/setup_p2p_test.ts +3 -3
  178. package/src/fixtures/timing.ts +97 -0
  179. package/src/fixtures/token_utils.ts +39 -4
  180. package/src/fixtures/utils.ts +0 -3
  181. package/src/fixtures/wait_helpers.ts +333 -0
  182. package/src/forward-compatibility/wallet_service.ts +6 -4
  183. package/src/guides/up_quick_start.sh +5 -0
  184. package/src/infra/README.md +12 -0
  185. package/src/multi-node/README.md +95 -0
  186. package/src/multi-node/block-production/setup.ts +272 -0
  187. package/src/multi-node/governance/setup.ts +172 -0
  188. package/src/multi-node/multi_node_test_context.ts +447 -0
  189. package/src/multi-node/slashing/inactivity_setup.ts +139 -0
  190. package/src/multi-node/slashing/setup.ts +433 -0
  191. package/src/p2p/README.md +78 -0
  192. package/src/{e2e_p2p → p2p}/p2p_network.ts +38 -13
  193. package/src/{e2e_p2p → p2p}/reqresp/utils.ts +5 -16
  194. package/src/p2p/shared.ts +329 -0
  195. package/src/shared/cross_chain_test_harness.ts +21 -10
  196. package/src/shared/gas_portal_test_harness.ts +13 -5
  197. package/src/shared/submit-transactions.ts +13 -5
  198. package/src/shared/timing_env.d.mts +39 -0
  199. package/src/shared/timing_env.mjs +363 -0
  200. package/src/shared/uniswap_l1_l2.ts +1 -8
  201. package/src/shared/wait_for_l1_to_l2_message.ts +1 -1
  202. package/src/simulators/lending_simulator.ts +1 -1
  203. package/src/single-node/README.md +60 -0
  204. package/src/single-node/cross-chain/cross_chain_messaging_test.ts +302 -0
  205. package/src/single-node/cross-chain/message_test_helpers.ts +125 -0
  206. package/src/{e2e_fees → single-node/fees}/bridging_race.notest.ts +19 -5
  207. package/src/{e2e_fees → single-node/fees}/fees_test.ts +69 -65
  208. package/src/single-node/l1-reorgs/setup.ts +93 -0
  209. package/src/single-node/partial-proofs/setup.ts +8 -0
  210. package/src/single-node/proving/setup.ts +15 -0
  211. package/src/single-node/recovery/setup.ts +8 -0
  212. package/src/single-node/setup.ts +63 -0
  213. package/src/single-node/single_node_test_context.ts +1041 -0
  214. package/src/spartan/setup_test_wallets.ts +24 -9
  215. package/src/spartan/tx_metrics.ts +26 -0
  216. package/src/test-wallet/test_wallet.ts +60 -10
  217. package/src/test-wallet/utils.ts +102 -5
  218. package/src/test-wallet/wallet_worker_script.ts +6 -3
  219. package/src/test-wallet/worker_wallet.ts +10 -12
  220. package/src/test-wallet/worker_wallet_schema.ts +3 -2
  221. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +0 -56
  222. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +0 -1
  223. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -58
  224. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +0 -1
  225. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +0 -161
  226. package/dest/e2e_deploy_contract/deploy_test.d.ts +0 -37
  227. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +0 -1
  228. package/dest/e2e_deploy_contract/deploy_test.js +0 -51
  229. package/dest/e2e_epochs/epochs_test.d.ts +0 -125
  230. package/dest/e2e_epochs/epochs_test.d.ts.map +0 -1
  231. package/dest/e2e_epochs/epochs_test.js +0 -460
  232. package/dest/e2e_fees/bridging_race.notest.d.ts.map +0 -1
  233. package/dest/e2e_fees/fees_test.d.ts +0 -91
  234. package/dest/e2e_fees/fees_test.d.ts.map +0 -1
  235. package/dest/e2e_l1_publisher/write_json.d.ts +0 -11
  236. package/dest/e2e_l1_publisher/write_json.d.ts.map +0 -1
  237. package/dest/e2e_l1_publisher/write_json.js +0 -56
  238. package/dest/e2e_multi_validator/utils.d.ts +0 -12
  239. package/dest/e2e_multi_validator/utils.d.ts.map +0 -1
  240. package/dest/e2e_nested_contract/nested_contract_test.d.ts +0 -26
  241. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +0 -1
  242. package/dest/e2e_nested_contract/nested_contract_test.js +0 -55
  243. package/dest/e2e_p2p/inactivity_slash_test.d.ts +0 -31
  244. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +0 -1
  245. package/dest/e2e_p2p/inactivity_slash_test.js +0 -137
  246. package/dest/e2e_p2p/p2p_network.d.ts.map +0 -1
  247. package/dest/e2e_p2p/reqresp/utils.d.ts +0 -22
  248. package/dest/e2e_p2p/reqresp/utils.d.ts.map +0 -1
  249. package/dest/e2e_p2p/shared.d.ts +0 -75
  250. package/dest/e2e_p2p/shared.d.ts.map +0 -1
  251. package/dest/e2e_p2p/shared.js +0 -217
  252. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +0 -2
  253. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +0 -1
  254. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +0 -1
  255. package/dest/e2e_token_contract/token_contract_test.d.ts +0 -44
  256. package/dest/e2e_token_contract/token_contract_test.d.ts.map +0 -1
  257. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +0 -231
  258. package/src/e2e_deploy_contract/deploy_test.ts +0 -86
  259. package/src/e2e_epochs/epochs_test.ts +0 -575
  260. package/src/e2e_l1_publisher/write_json.ts +0 -77
  261. package/src/e2e_nested_contract/nested_contract_test.ts +0 -77
  262. package/src/e2e_p2p/inactivity_slash_test.ts +0 -180
  263. package/src/e2e_p2p/shared.ts +0 -332
  264. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.js +0 -0
  265. /package/dest/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.js +0 -0
  266. /package/dest/{e2e_multi_validator/utils.js → composed/web3signer/multi_validator_keystore_utils.js} +0 -0
  267. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof.json +0 -0
  268. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fetcher.ts +0 -0
  269. /package/src/{e2e_storage_proof → automine/contracts}/fixtures/storage_proof_fixture.ts +0 -0
  270. /package/src/{e2e_multi_validator/utils.ts → composed/web3signer/multi_validator_keystore_utils.ts} +0 -0
package/README.md CHANGED
@@ -1,47 +1,223 @@
1
- # End to End
1
+ # End-to-end tests
2
2
 
3
- This package includes end-to-end tests that cover Aztec's main milestones.
4
- These can be run locally either by starting anvil on a different terminal.
3
+ This package holds Aztec's end-to-end (e2e) tests: full-stack scenarios that spin up an Aztec node (or
4
+ several), a PXE, and an L1 (anvil) and exercise the system the way a real deployment would. It is the
5
+ integration layer above the per-package unit tests.
5
6
 
6
- ```
7
- anvil -p 8545 --host 0.0.0.0 --chain-id 31337
8
- ```
7
+ > **Two audiences.** The top of this document is a quick orientation for humans. The
8
+ > [Reference for agents](#reference-for-agents) section at the bottom is the detailed, exhaustive
9
+ > version — read that when you are placing, moving, or wiring up a test.
9
10
 
10
- and then running
11
+ ## Quick start
11
12
 
12
- ```
13
- yarn test
13
+ Run a single test (spawns its own in-process anvil):
14
+
15
+ ```bash
16
+ yarn test:e2e src/automine/token/access_control.parallel.test.ts
17
+ yarn test:e2e src/single-node/block-building/block_building.test.ts -t 'rejects double spend'
14
18
  ```
15
19
 
16
- Or by running
20
+ Turn up logging with `LOG_LEVEL` (`verbose` is the useful default; `debug:sequencer,archiver` scopes it):
17
21
 
22
+ ```bash
23
+ LOG_LEVEL=verbose yarn test:e2e src/single-node/proving/empty_blocks.test.ts
18
24
  ```
19
- yarn test:integration
20
- ```
21
25
 
22
- which will spawn the two processes.
26
+ Compose-based tests (those under `src/composed/`) need a running local network — see
27
+ [Compose / HA / web3signer tests](#compose--ha--web3signer-tests).
28
+
29
+ ## Test categories
30
+
31
+ Tests are grouped by **node topology** — the shape of the network a test needs. The top-level folder is
32
+ the category; the second level names the behavior under test. Each category owns a base class that builds
33
+ its environment, so a test file only describes the scenario, not the wiring.
34
+
35
+ | Category | Topology | A test belongs here when… | README |
36
+ |---|---|---|---|
37
+ | [`automine/`](src/automine/README.md) | One node, deterministic `AutomineSequencer` — one block per tx, no committee/prover/validator. Fast. | it exercises contract or protocol behavior that doesn't depend on real block-building or consensus (transfers, nested calls, note discovery, tx semantics). | yes |
38
+ | [`single-node/`](src/single-node/README.md) | One node, production sequencer (interval block production), optional prover. | it asserts on sequencer, proving, partial-proof, L1-reorg, recovery, fee, or cross-chain behavior on a single sequencer. | yes |
39
+ | [`multi-node/`](src/multi-node/README.md) | N validators on an in-memory mock-gossip bus. | it needs a committee: consensus, attestations, slashing, governance, or multi-validator block production. | yes |
40
+ | `p2p/` | Real libp2p transport between nodes. | the networking transport itself is under test (gossip, rediscovery, req/resp). | — |
41
+ | [`infra/`](src/infra/README.md) | Targets a deployed/external network (local anvil or a public testnet). | its concern is deployment or network targeting, not a specific protocol behavior. | yes |
42
+
43
+ A handful of tests live **outside** this package, next to the code they test — see
44
+ [Tests that live elsewhere](#tests-that-live-elsewhere). Other non-category test groups (`composed/`,
45
+ `guides/`, `bench/`) are described in the reference section.
46
+
47
+ ## Where does my test go?
48
+
49
+ 1. **Does it need real networking transport?** → `p2p/`.
50
+ 2. **Does it need a validator committee (consensus/slashing/governance)?** → `multi-node/`.
51
+ 3. **Does it assert on the production sequencer, proving, reorgs, fees, or cross-chain flows?** →
52
+ `single-node/`.
53
+ 4. **Is it pure contract/protocol behavior that's happy with one-block-per-tx?** → `automine/` (the
54
+ default home for most contract tests).
55
+ 5. **Is it really a unit/integration test of one package with no Aztec node?** → it probably belongs in
56
+ that package, not here (see [Tests that live elsewhere](#tests-that-live-elsewhere)).
57
+
58
+ When in doubt, prefer `automine/` for contract behavior and `single-node/` for anything that watches the
59
+ chain advance.
60
+
61
+ ---
62
+
63
+ ## Reference for agents
64
+
65
+ This section is the detailed contract for adding, moving, and wiring tests. It assumes you've read the
66
+ overview above.
67
+
68
+ ### Category base classes
69
+
70
+ Each category centralizes its environment in a base class. The hierarchy:
71
+
72
+ - `single-node/single_node_test_context.ts` → **`SingleNodeTestContext`**. Owns the environment
73
+ (in-process anvil + L1 deploy), node spawning (`createNonValidatorNode`, `createProverNode`), the
74
+ `ChainMonitor`, and the epoch/checkpoint/proof-window/reorg waiters.
75
+ - `multi-node/multi_node_test_context.ts` → **`MultiNodeTestContext extends SingleNodeTestContext`**.
76
+ Adds the N-validator topology over a mock-gossip bus, inheriting the base environment and waiters.
77
+ - `automine/automine_test_context.ts` → **`AutomineTestContext`**. A sibling of `SingleNodeTestContext`
78
+ (both wrap `fixtures/setup.ts:setup()`), but fixes the automine topology and makes `AUTOMINE_E2E_OPTS`
79
+ the default. Exposes `markProvenAndWarp`, `registerContract`, `applyManualParentChild`.
80
+ - `p2p/p2p_network.ts` → **`P2PNetworkTest`**. Real libp2p; node creation goes through
81
+ `setup_p2p_test.ts`.
82
+ - `infra/` has no shared base — its tests target a network selected by `L1_CHAIN_ID` (local anvil in CI,
83
+ a public testnet with credentials).
84
+
85
+ All of the above ultimately wrap `fixtures/setup.ts:setup(numberOfAccounts, opts)`, the single entry point
86
+ that deploys L1 contracts, starts the node(s), and provisions a PXE and accounts.
87
+
88
+ ### Setup factories
89
+
90
+ Categories expose thin factories over their base's static `setup`, named by what the test wants, so a test
91
+ calls the factory instead of spreading option presets:
92
+
93
+ - `single-node/setup.ts`: `setupWithProver` (fake in-process prover — the single-node default) and
94
+ `setupBlockProducer` (no prover; raises `aztecProofSubmissionEpochs` to `1024` so unproven blocks
95
+ aren't pruned, and points the PXE at `syncChainTip: 'proposed'`).
96
+ - `automine` tests call `AutomineTestContext.setup({ numberOfAccounts })` directly.
97
+
98
+ ### The harness pattern (domain setup on top of a category)
99
+
100
+ A test suite with bespoke domain setup does **not** fork `setup()`. It subclasses the category base and
101
+ overrides a `protected hydrateFromContext(context)` split out of `setup`, so it reuses the base's
102
+ rollup/epoch-cache/chain-monitor/waiter/teardown machinery while adding its own domain state. Examples:
103
+
104
+ - `single-node/prover/` → `FullProverTest` (real Barretenberg env) extends `SingleNodeTestContext`.
105
+ - `single-node/fees/` → `FeesTest`; `single-node/cross-chain/` → `CrossChainMessagingTest`.
106
+ - `automine/token/` → `TokenContractTest` and `BlacklistTokenContractTest` extend `AutomineTestContext`
107
+ and run their `TokenSimulator`/snapshot setup after `super.setup()`.
108
+
109
+ When two suites share behavior: if their public APIs are nearly identical, use inheritance; if behavior
110
+ overlaps but APIs differ, compose. Don't duplicate a category's environment wiring.
111
+
112
+ ### The `.parallel` suffix
23
113
 
24
- You can also run this by `docker-compose up` which will spawn 2 different containers for Anvil and the test runner.
114
+ CI splits each `it` in a `.parallel.test.ts` file into its own docker job, running it in isolation via
115
+ `jest --testNamePattern` (the names come from `extract_test_names` in `bootstrap.sh`, which matches
116
+ `it`/`test` at **any** nesting depth, not just top level). When an `it` runs alone its enclosing
117
+ `beforeAll`/`beforeEach` hooks still run, but sibling `it`s do not. Rules:
25
118
 
26
- You can run a single test by running `yarn test:compose <test_name>`.
119
+ - The `.parallel` suffix is for files whose `it`s are **independent**: every `it` must pass when run
120
+ entirely on its own. That holds only when all shared state is built in `beforeAll`/`beforeEach` and no
121
+ `it` reads or asserts on state produced by a sibling `it`.
122
+ - A file with sequential or stateful `it`s (progressive mutation across `it`s, a describe-scope variable
123
+ assigned in one `it` and read in another, a note/token created in an earlier `it` and used later) stays
124
+ a plain `.test.ts` **even if it has many top-level `it`s** — it runs as one ordered job. Adding
125
+ `.parallel` to such a file breaks CI, because each `it` then runs without its predecessors.
126
+ - A file with a single top-level `it` is a plain `.test.ts`.
127
+ - `it`/`test` names in a `.parallel` file must avoid regex/shell-special characters —
128
+ `"` `(` `)` `[` `]` `{` `}` `$` `\` and backtick. The split passes each name to
129
+ `run_test.sh ... "<name>"` as a shell-quoted `--testNamePattern` regex: an embedded `"` closes the
130
+ quote early and hard-fails the job, while regex metacharacters (`(` `)` `[` `]` `+` `*` `?` `|` `{` `}`)
131
+ silently match zero tests so the shard runs nothing and passes green — a coverage gap that hides the
132
+ test. Plain `.test.ts` files run as one job and are unaffected, so any name is fine there.
133
+ (`.` `!` `#` `-` `:` `,` are safe in `.parallel` names.)
134
+ - Each file has exactly one top-level `describe`, named to match its path
135
+ (e.g. `describe('automine/token/transfer', …)`).
136
+
137
+ ### CI test discovery — `bootstrap.sh`
27
138
 
28
- ## Running tests against legacy contract artifacts
139
+ `end-to-end/bootstrap.sh` enumerates tests in two arrays, and a test must appear in the relevant one or it
140
+ **won't run in CI**:
141
+
142
+ - `test_cmds` (~line 37) — the standard run.
143
+ - `compat_test_cmds` (~line 290) — the forward/legacy-compat run (a subset).
144
+
145
+ Each leaf folder needs its own single-level glob line (e.g. `src/automine/token/*.test.ts`) in each array;
146
+ globs are not recursive, so every sub-folder is listed explicitly. Folders that organize by behavior get
147
+ one line per leaf. Bespoke handling to be aware of:
148
+
149
+ - **`avm_simulator`** (`automine/simulation/avm_simulator.test.ts`) has a dedicated line in `test_cmds`
150
+ that sets `DUMP_AVM_INPUTS_TO_DIR` (feeds the downstream `avm_check_circuit` job) and is therefore
151
+ excluded from the generic `simulation/` glob there (`!(avm_simulator)`). In `compat_test_cmds` it runs
152
+ as a regular test (no dump line), so it is **not** excluded there.
153
+ - **`kernelless_simulation`** is excluded from `compat_test_cmds` only.
154
+
155
+ After editing the arrays, confirm every `*.test.ts` resolves through exactly one line (no duplicate, no
156
+ omission). Per-test bash `TIMEOUT` overrides live in the `case` block in `test_cmds` and must stay in sync
157
+ with the test's `jest.setTimeout`.
158
+
159
+ ### Flaky tests — `.test_patterns.yml`
160
+
161
+ Flaky/owner entries live in `.test_patterns.yml` at the **git root** (not in this package), keyed on the
162
+ test path. A bare entry flags the test as flaky whenever it fails; add `error_regex` to flag only on a
163
+ matching message; `skip: true` disables it. Blanket regex entries (e.g. `src/automine/.*\.test\.ts`) are
164
+ depth-agnostic and survive folder renames; path-specific entries must be updated when a file moves.
165
+
166
+ ### Compose / HA / web3signer tests
167
+
168
+ `src/composed/` tests run against a **running local network** rather than an in-process stack, via
169
+ `scripts/run_test.sh` in different modes:
170
+
171
+ - `src/composed/*.test.ts` → `compose` mode (e.g. `e2e_persistence`, `uniswap_trade_on_l1_from_l2`,
172
+ `e2e_cheat_codes` — the compose variant, distinct from the relocated unit-style one).
173
+ - `src/composed/web3signer/*.test.ts` → `web3signer` mode (remote-signer scenarios).
174
+ - `src/composed/ha/*.test.ts` → `ha` mode (high-availability multi-process scenarios).
175
+ - `src/guides/*.test.ts` → tutorial/guide flows; `src/bench/` → benchmarks (see `bench_cmds`).
176
+
177
+ Run one compose test locally with `yarn test:compose <name>` (anvil + the test runner are spawned for
178
+ you), or `docker-compose up` for separate containers.
179
+
180
+ ### Tests that live elsewhere
181
+
182
+ Tests with **no Aztec node** that exercise one package belong in that package, not here:
183
+
184
+ - L1 cheat-code behavior (`EthCheatCodes`/`RollupCheatCodes` against raw anvil) → `@aztec/ethereum`
185
+ (`ethereum/src/test/eth_cheat_codes.test.ts`).
186
+ - The `SequencerPublisher` integration test (anvil + L1 deploy, no node) → `@aztec/sequencer-client`
187
+ (`sequencer-client/src/publisher/`).
188
+
189
+ These run in their own package's test lane (both packages already run anvil-backed integration tests).
190
+
191
+ ### Support directories (not test categories)
192
+
193
+ - `fixtures/` — the shared `setup()`, option presets (`fixtures.ts`), `CrossChainTestHarness`,
194
+ `l1_to_l2_messaging`, and common utils.
195
+ - `shared/` — shared test bodies and `timing_env.mjs`, a **custom jest `testEnvironment`** referenced from
196
+ this package's `package.json`. `yarn prepare` / the package-json check will try to revert it to the
197
+ default — don't let it.
198
+ - `simulators/` — in-TS reference models (`TokenSimulator`, `LendingSimulator`) used to assert contract
199
+ behavior.
200
+ - `test-wallet/`, `bench/`, `spartan/`, `quality_of_service/`, `forward-compatibility/` — helpers,
201
+ benchmarks, and network/ops tests outside the topology categories.
202
+
203
+ ### Running tests against legacy contract artifacts
29
204
 
30
205
  To verify that contracts deployed from a previous release still work against the current stack, set
31
- `CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` / `@aztec/noir-test-contracts.js`:
206
+ `CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` /
207
+ `@aztec/noir-test-contracts.js`:
32
208
 
33
- ```
34
- CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/e2e_amm.test.ts
209
+ ```bash
210
+ CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/automine/token/access_control.parallel.test.ts
35
211
  ```
36
212
 
37
213
  Only the JSON artifact files (`.../artifacts/*.json`) are redirected. The TypeScript wrapper classes
38
- (e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` — so this
39
- exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client, not whether the
40
- legacy wrapper code still imports cleanly.
214
+ (e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` —
215
+ so this exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client,
216
+ not whether the legacy wrapper code still imports cleanly.
41
217
 
42
- The first run downloads the pinned packages into `.legacy-contracts/<version>/node_modules/` (cached across runs). A
43
- startup banner and a per-redirect line are printed to stderr so you can confirm the legacy artifacts were actually
44
- loaded:
218
+ The first run downloads the pinned packages into `.legacy-contracts/<version>/node_modules/` (cached across
219
+ runs). A startup banner and a per-redirect line are printed to stderr so you can confirm the legacy
220
+ artifacts were actually loaded:
45
221
 
46
222
  ```
47
223
  [legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=4.1.3
@@ -49,5 +225,5 @@ loaded:
49
225
  [legacy-contracts][jest] redirected token_contract-Token.json -> /abs/.../.legacy-contracts/4.1.3/.../token_contract-Token.json
50
226
  ```
51
227
 
52
- When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The cache is
53
- populated automatically on first use.
228
+ When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The
229
+ cache is populated automatically on first use.
@@ -0,0 +1,85 @@
1
+ import type { ContractArtifact } from '@aztec/aztec.js/abi';
2
+ import type { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import { type ContractBase } from '@aztec/aztec.js/contracts';
4
+ import { Fr } from '@aztec/aztec.js/fields';
5
+ import type { PublicKeys } from '@aztec/aztec.js/keys';
6
+ import type { Logger } from '@aztec/aztec.js/log';
7
+ import type { AztecNode } from '@aztec/aztec.js/node';
8
+ import type { Wallet } from '@aztec/aztec.js/wallet';
9
+ import type { CheatCodes } from '@aztec/aztec/testing';
10
+ import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
11
+ import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
12
+ import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest';
13
+ import type { PXEConfig } from '@aztec/pxe/config';
14
+ import type { SequencerClient } from '@aztec/sequencer-client';
15
+ import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client';
16
+ import { type EndToEndContext, type SetupOptions } from '../fixtures/setup.js';
17
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
18
+ export type AutomineTestOpts = Partial<SetupOptions> & {
19
+ /** Number of accounts to create and deploy during setup. */
20
+ numberOfAccounts?: number;
21
+ /** Options forwarded to PXE creation. */
22
+ pxeOpts?: Partial<PXEConfig>;
23
+ };
24
+ /**
25
+ * Base class for the automine-sequencer test topology: a single in-process node running the
26
+ * deterministic {@link AUTOMINE_E2E_OPTS} preset (one block per submitted tx, synchronous L1 publish,
27
+ * no committee, no prover, no validator client). Owns the environment (in-proc anvil in automine mode
28
+ * plus the L1 deploy) and exposes the handles every automine test uses (`wallet`, `aztecNode`,
29
+ * `cheatCodes`, `sequencer`, `accounts`, `logger`).
30
+ *
31
+ * The sibling of {@link SingleNodeTestContext}: both wrap the same underlying `fixtures/setup.ts:setup()`
32
+ * but fix opposite sequencer topologies. Making {@link AUTOMINE_E2E_OPTS} the base default removes the
33
+ * per-test-file spread every automine test would otherwise repeat.
34
+ *
35
+ * Domain harnesses (the token simulators) compose on top by extending this base and overriding
36
+ * {@link setup} to run their domain steps after `super.setup()`.
37
+ */
38
+ export declare class AutomineTestContext {
39
+ context: EndToEndContext;
40
+ logger: Logger;
41
+ wallet: TestWallet;
42
+ aztecNode: AztecNode & AztecNodeDebug;
43
+ aztecNodeAdmin: AztecNodeAdmin;
44
+ cheatCodes: CheatCodes;
45
+ sequencer: SequencerClient;
46
+ accounts: AztecAddress[];
47
+ defaultAccountAddress: AztecAddress;
48
+ parentContract: ParentContract;
49
+ childContract: ChildContract;
50
+ static setup<T extends AutomineTestContext>(this: new () => T, opts?: AutomineTestOpts): Promise<T>;
51
+ setup(opts?: AutomineTestOpts): Promise<void>;
52
+ /**
53
+ * Populates the context-derived handles from an already-built {@link EndToEndContext}. Split out of
54
+ * {@link setup} so domain harnesses that build the environment with their own bespoke `setup(...)`
55
+ * opts can still reuse the shared handle wiring.
56
+ */
57
+ protected hydrateFromContext(context: EndToEndContext): Promise<void>;
58
+ teardown(): Promise<void>;
59
+ /**
60
+ * Marks the current pending checkpoints as proven, then warps the L2 clock forward by `seconds`.
61
+ *
62
+ * Under {@link AUTOMINE_E2E_OPTS} a long warp crosses many epochs with no proofs being submitted, so
63
+ * without a prior `markAsProven()` the rollup contract's pruning window resets the chain tip to genesis
64
+ * and the warp's own empty-checkpoint propose fails with `Rollup__InvalidArchive`. Marking proven before
65
+ * warping keeps the pending chain alive. Composes the existing `cheatCodes.rollup.markAsProven` and
66
+ * `warpL2TimeAtLeastBy` with that required ordering.
67
+ */
68
+ markProvenAndWarp(seconds: number | bigint): Promise<void>;
69
+ /** Computes and registers a contract instance in the wallet without deploying it on-chain. */
70
+ registerContract<T extends ContractBase>(wallet: Wallet, contractArtifact: ContractArtifactClass<T>, opts?: {
71
+ salt?: Fr;
72
+ publicKeys?: PublicKeys;
73
+ initArgs?: any[];
74
+ constructorName?: string;
75
+ deployer?: AztecAddress;
76
+ }): Promise<T>;
77
+ /** Deploys a Parent and a Child contract from the default account for the nested-call tests. */
78
+ applyManualParentChild(): Promise<void>;
79
+ }
80
+ export type StatefulContractCtorArgs = Parameters<StatefulTestContract['methods']['constructor']>;
81
+ export type ContractArtifactClass<T extends ContractBase> = {
82
+ at(address: AztecAddress, wallet: Wallet): T;
83
+ artifact: ContractArtifact;
84
+ };
85
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0b21pbmVfdGVzdF9jb250ZXh0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXV0b21pbmUvYXV0b21pbmVfdGVzdF9jb250ZXh0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUM7QUFDNUQsT0FBTyxLQUFLLEVBQUUsWUFBWSxFQUFFLE1BQU0sMkJBQTJCLENBQUM7QUFDOUQsT0FBTyxFQUFFLEtBQUssWUFBWSxFQUE4QyxNQUFNLDJCQUEyQixDQUFDO0FBQzFHLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSx3QkFBd0IsQ0FBQztBQUM1QyxPQUFPLEtBQUssRUFBRSxVQUFVLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQztBQUN2RCxPQUFPLEtBQUssRUFBRSxNQUFNLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUNsRCxPQUFPLEtBQUssRUFBRSxTQUFTLEVBQUUsT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} from '@aztec/aztec.js/contracts';
2
+ import { Fr } from '@aztec/aztec.js/fields';
3
+ import { ChildContract } from '@aztec/noir-test-contracts.js/Child';
4
+ import { ParentContract } from '@aztec/noir-test-contracts.js/Parent';
5
+ import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js';
6
+ import { setup, teardown } from '../fixtures/setup.js';
7
+ /**
8
+ * Base class for the automine-sequencer test topology: a single in-process node running the
9
+ * deterministic {@link AUTOMINE_E2E_OPTS} preset (one block per submitted tx, synchronous L1 publish,
10
+ * no committee, no prover, no validator client). Owns the environment (in-proc anvil in automine mode
11
+ * plus the L1 deploy) and exposes the handles every automine test uses (`wallet`, `aztecNode`,
12
+ * `cheatCodes`, `sequencer`, `accounts`, `logger`).
13
+ *
14
+ * The sibling of {@link SingleNodeTestContext}: both wrap the same underlying `fixtures/setup.ts:setup()`
15
+ * but fix opposite sequencer topologies. Making {@link AUTOMINE_E2E_OPTS} the base default removes the
16
+ * per-test-file spread every automine test would otherwise repeat.
17
+ *
18
+ * Domain harnesses (the token simulators) compose on top by extending this base and overriding
19
+ * {@link setup} to run their domain steps after `super.setup()`.
20
+ */ export class AutomineTestContext {
21
+ context;
22
+ logger;
23
+ wallet;
24
+ aztecNode;
25
+ aztecNodeAdmin;
26
+ cheatCodes;
27
+ sequencer;
28
+ accounts;
29
+ defaultAccountAddress;
30
+ parentContract;
31
+ childContract;
32
+ static async setup(opts = {}) {
33
+ const test = new this();
34
+ await test.setup(opts);
35
+ return test;
36
+ }
37
+ async setup(opts = {}) {
38
+ const { numberOfAccounts = 1, pxeOpts, ...setupOpts } = opts;
39
+ const context = await setup(numberOfAccounts, {
40
+ ...AUTOMINE_E2E_OPTS,
41
+ fundSponsoredFPC: true,
42
+ ...setupOpts
43
+ }, pxeOpts);
44
+ await this.hydrateFromContext(context);
45
+ }
46
+ /**
47
+ * Populates the context-derived handles from an already-built {@link EndToEndContext}. Split out of
48
+ * {@link setup} so domain harnesses that build the environment with their own bespoke `setup(...)`
49
+ * opts can still reuse the shared handle wiring.
50
+ */ hydrateFromContext(context) {
51
+ this.context = context;
52
+ this.logger = context.logger;
53
+ this.wallet = context.wallet;
54
+ this.aztecNode = context.aztecNodeService;
55
+ this.aztecNodeAdmin = context.aztecNodeService;
56
+ this.cheatCodes = context.cheatCodes;
57
+ this.sequencer = context.sequencer;
58
+ this.accounts = context.accounts;
59
+ this.defaultAccountAddress = context.accounts[0];
60
+ return Promise.resolve();
61
+ }
62
+ async teardown() {
63
+ await teardown(this.context);
64
+ }
65
+ /**
66
+ * Marks the current pending checkpoints as proven, then warps the L2 clock forward by `seconds`.
67
+ *
68
+ * Under {@link AUTOMINE_E2E_OPTS} a long warp crosses many epochs with no proofs being submitted, so
69
+ * without a prior `markAsProven()` the rollup contract's pruning window resets the chain tip to genesis
70
+ * and the warp's own empty-checkpoint propose fails with `Rollup__InvalidArchive`. Marking proven before
71
+ * warping keeps the pending chain alive. Composes the existing `cheatCodes.rollup.markAsProven` and
72
+ * `warpL2TimeAtLeastBy` with that required ordering.
73
+ */ async markProvenAndWarp(seconds) {
74
+ await this.cheatCodes.rollup.markAsProven();
75
+ await this.cheatCodes.warpL2TimeAtLeastBy(this.aztecNode, seconds);
76
+ }
77
+ /** Computes and registers a contract instance in the wallet without deploying it on-chain. */ async registerContract(wallet, contractArtifact, opts = {}) {
78
+ const { salt, publicKeys, initArgs, constructorName, deployer } = opts;
79
+ const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, {
80
+ constructorArgs: initArgs ?? [],
81
+ constructorArtifact: constructorName,
82
+ salt: salt ?? Fr.random(),
83
+ publicKeys,
84
+ deployer
85
+ });
86
+ await wallet.registerContract(instance, contractArtifact.artifact);
87
+ return contractArtifact.at(instance.address, wallet);
88
+ }
89
+ /** Deploys a Parent and a Child contract from the default account for the nested-call tests. */ async applyManualParentChild() {
90
+ this.logger.info('Deploying parent and child contracts');
91
+ ({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({
92
+ from: this.defaultAccountAddress
93
+ }));
94
+ ({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({
95
+ from: this.defaultAccountAddress
96
+ }));
97
+ }
98
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmFnZV9wcm9vZl9mZXRjaGVyLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYXV0b21pbmUvY29udHJhY3RzL2ZpeHR1cmVzL3N0b3JhZ2VfcHJvb2ZfZmV0Y2hlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage_proof_fetcher.d.ts","sourceRoot":"","sources":["../../../../src/automine/contracts/fixtures/storage_proof_fetcher.ts"],"names":[],"mappings":""}
@@ -15,4 +15,4 @@ export type StorageProofArgs = {
15
15
  export declare function loadStorageProofArgs(): StorageProofArgs;
16
16
  /** Builds all the capsules the StorageProofTest contract expects during private execution. */
17
17
  export declare function buildStorageProofCapsules(contractAddress: AztecAddress): Promise<Capsule[]>;
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RvcmFnZV9wcm9vZl9maXh0dXJlLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZTJlX3N0b3JhZ2VfcHJvb2YvZml4dHVyZXMvc3RvcmFnZV9wcm9vZl9maXh0dXJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLFlBQVksRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRzlELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUMzRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUF3RjNDLG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BQVksRUFBRTtRQUFFLEtBQUssRUFBRSxNQUFNLEVBQUUsQ0FBQztRQUFDLFlBQVksRUFBRSxNQUFNLENBQUE7S0FBRSxDQUFDO0lBQ3hELElBQUksRUFBRSxNQUFNLEVBQUUsQ0FBQztDQUNoQixDQUFDO0FBRUYsK0VBQStFO0FBQy9FLHdCQUFnQixvQkFBb0IsSUFBSSxnQkFBZ0IsQ0FhdkQ7QUFFRCw4RkFBOEY7QUFDOUYsd0JBQXNCLHlCQUF5QixDQUFDLGVBQWUsRUFBRSxZQUFZLEdBQUcsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDLENBdURqRyJ9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage_proof_fixture.d.ts","sourceRoot":"","sources":["../../../../src/automine/contracts/fixtures/storage_proof_fixture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAwF3C,gFAAgF;AAChF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC;AAEF,+EAA+E;AAC/E,wBAAgB,oBAAoB,IAAI,gBAAgB,CAavD;AAED,8FAA8F;AAC9F,wBAAsB,yBAAyB,CAAC,eAAe,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAuDjG"}
@@ -0,0 +1,48 @@
1
+ import { AztecAddress, type CompleteAddress } from '@aztec/aztec.js/addresses';
2
+ import { type SchnorrSignature } from '@aztec/foundation/crypto/schnorr';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import type { GrumpkinScalar } from '@aztec/foundation/curves/grumpkin';
5
+ import type { CustomRequest } from '@aztec/pxe/config';
6
+ import { type PublicKeys } from '@aztec/stdlib/keys';
7
+ /**
8
+ * The decoded payload of the registry's interactive-handshake signature request. Note it never carries the sender,
9
+ * so the recipient authorizes the handshake without learning who initiated it.
10
+ */
11
+ export type InteractiveHandshakeRequest = {
12
+ /** The account whose authorization is being requested. */
13
+ recipient: AztecAddress;
14
+ chainId: Fr;
15
+ version: Fr;
16
+ /** The x-coordinate of the handshake's ephemeral public key (its y-coordinate is positive by construction). */
17
+ ephPkX: Fr;
18
+ };
19
+ /**
20
+ * The recipient's signed authorization for an interactive handshake. Mirrors the registry contract's
21
+ * `RecipientSignature` struct field for field.
22
+ */
23
+ export type RecipientSignature = {
24
+ /** The recipient's master public keys, bound in-circuit to the recipient's address via `partialAddress`. */
25
+ publicKeys: PublicKeys;
26
+ partialAddress: Fr;
27
+ /** The x-coordinate of the recipient's master message-signing public key. */
28
+ mspkX: Fr;
29
+ /** Whether that key's y-coordinate is positive, so the circuit can reconstruct the point from `mspkX`. */
30
+ mspkYIsPositive: boolean;
31
+ /** The schnorr signature over the handshake message. */
32
+ signature: SchnorrSignature;
33
+ };
34
+ /**
35
+ * Parses and validates the registry's interactive-handshake signature request.
36
+ *
37
+ * @throws If the request kind is not {@link INTERACTIVE_HANDSHAKE_REQUEST_KIND}, the issuing contract is not the
38
+ * standard HandshakeRegistry, or the payload does not have the expected shape.
39
+ */
40
+ export declare function parseInteractiveHandshakeRequest(request: CustomRequest): InteractiveHandshakeRequest;
41
+ /**
42
+ * Produces the recipient's signed authorization for an interactive handshake, signing with the master
43
+ * message-signing secret key.
44
+ */
45
+ export declare function signInteractiveHandshake(request: InteractiveHandshakeRequest, completeAddress: CompleteAddress, masterMessageSigningSecretKey: GrumpkinScalar): Promise<RecipientSignature>;
46
+ /** Serializes a {@link RecipientSignature} to the field layout the registry's in-circuit deserialization expects. */
47
+ export declare function recipientSignatureToFields(recipientSignature: RecipientSignature): Fr[];
48
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW50ZXJhY3RpdmVfaGFuZHNoYWtlX3Jlc3BvbmRlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2F1dG9taW5lL2RlbGl2ZXJ5L2ludGVyYWN0aXZlX2hhbmRzaGFrZV9yZXNwb25kZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxLQUFLLGVBQWUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBRy9FLE9BQU8sRUFBVyxLQUFLLGdCQUFnQixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDbEYsT0FBTyxFQUFNLEVBQUUsRUFBRSxNQUFNLGdDQUFnQyxDQUFDO0FBQ3hELE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLG1DQUFtQyxDQUFDO0FBQ3hFLE9BQU8sS0FBSyxFQUFFLGFBQWEsRUFBRSxNQUFNLG1CQUFtQixDQUFDO0FBS3ZELE9BQU8sRUFBRSxLQUFLLFVBQVUsRUFBZ0MsTUFBTSxvQkFBb0IsQ0FBQztBQUVuRjs7O0dBR0c7QUFDSCxNQUFNLE1BQU0sMkJBQTJCLEdBQUc7SUFDeEMsMERBQTBEO0lBQzFELFNBQVMsRUFBRSxZQUFZLENBQUM7SUFDeEIsT0FBTyxFQUFFLEVBQUUsQ0FBQztJQUNaLE9BQU8sRUFBRSxFQUFFLENBQUM7SUFDWiwrR0FBK0c7SUFDL0csTUFBTSxFQUFFLEVBQUUsQ0FBQztDQUNaLENBQUM7QUFFRjs7O0dBR0c7QUFDSCxNQUFNLE1BQU0sa0JBQWtCLEdBQUc7SUFDL0IsNEdBQTRHO0lBQzVHLFVBQVUsRUFBRSxVQUFVLENBQUM7SUFDdkIsY0FBYyxFQUFFLEVBQUUsQ0FBQztJQUNuQiw2RUFBNkU7SUFDN0UsS0FBSyxFQUFFLEVBQUUsQ0FBQztJQUNWLDBHQUEwRztJQUMxRyxlQUFlLEVBQUUsT0FBTyxDQUFDO0lBQ3pCLHdEQUF3RDtJQUN4RCxTQUFTLEVBQUUsZ0JBQWdCLENBQUM7Q0FDN0IsQ0FBQztBQUVGOzs7OztHQUtHO0FBQ0gsd0JBQWdCLGdDQUFnQyxDQUFDLE9BQU8sRUFBRSxhQUFhLEdBQUcsMkJBQTJCLENBZXBHO0FBRUQ7OztHQUdHO0FBQ0gsd0JBQXNCLHdCQUF3QixDQUM1QyxPQUFPLEVBQUUsMkJBQTJCLEVBQ3BDLGVBQWUsRUFBRSxlQUFlLEVBQ2hDLDZCQUE2QixFQUFFLGNBQWMsR0FDNUMsT0FBTyxDQUFDLGtCQUFrQixDQUFDLENBbUI3QjtBQUVELHFIQUFxSDtBQUNySCx3QkFBZ0IsMEJBQTBCLENBQUMsa0JBQWtCLEVBQUUsa0JBQWtCLEdBQUcsRUFBRSxFQUFFLENBYXZGIn0=
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive_handshake_responder.d.ts","sourceRoot":"","sources":["../../../src/automine/delivery/interactive_handshake_responder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG/E,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAM,EAAE,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKvD,OAAO,EAAE,KAAK,UAAU,EAAgC,MAAM,oBAAoB,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,0DAA0D;IAC1D,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,EAAE,CAAC;IACZ,OAAO,EAAE,EAAE,CAAC;IACZ,+GAA+G;IAC/G,MAAM,EAAE,EAAE,CAAC;CACZ,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,4GAA4G;IAC5G,UAAU,EAAE,UAAU,CAAC;IACvB,cAAc,EAAE,EAAE,CAAC;IACnB,6EAA6E;IAC7E,KAAK,EAAE,EAAE,CAAC;IACV,0GAA0G;IAC1G,eAAe,EAAE,OAAO,CAAC;IACzB,wDAAwD;IACxD,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,aAAa,GAAG,2BAA2B,CAepG;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,2BAA2B,EACpC,eAAe,EAAE,eAAe,EAChC,6BAA6B,EAAE,cAAc,GAC5C,OAAO,CAAC,kBAAkB,CAAC,CAmB7B;AAED,qHAAqH;AACrH,wBAAgB,0BAA0B,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,EAAE,EAAE,CAavF"}
@@ -0,0 +1,76 @@
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { DomainSeparator } from '@aztec/constants';
3
+ import { poseidon2HashWithSeparator } from '@aztec/foundation/crypto/poseidon';
4
+ import { Schnorr } from '@aztec/foundation/crypto/schnorr';
5
+ import { Fq, Fr } from '@aztec/foundation/curves/bn254';
6
+ import { INTERACTIVE_HANDSHAKE_REQUEST_KIND, STANDARD_HANDSHAKE_REGISTRY_ADDRESS } from '@aztec/standard-contracts/handshake-registry/constants';
7
+ import { derivePublicKeyFromSecretKey } from '@aztec/stdlib/keys';
8
+ /**
9
+ * Parses and validates the registry's interactive-handshake signature request.
10
+ *
11
+ * @throws If the request kind is not {@link INTERACTIVE_HANDSHAKE_REQUEST_KIND}, the issuing contract is not the
12
+ * standard HandshakeRegistry, or the payload does not have the expected shape.
13
+ */ export function parseInteractiveHandshakeRequest(request) {
14
+ if (!request.kind.equals(INTERACTIVE_HANDSHAKE_REQUEST_KIND)) {
15
+ throw new Error(`Not an interactive-handshake signature request: unexpected kind ${request.kind}`);
16
+ }
17
+ if (!request.contractAddress.equals(STANDARD_HANDSHAKE_REGISTRY_ADDRESS)) {
18
+ throw new Error(`Interactive-handshake signature request issued by ${request.contractAddress}, expected the standard HandshakeRegistry at ${STANDARD_HANDSHAKE_REGISTRY_ADDRESS}`);
19
+ }
20
+ if (request.payload.length !== 4) {
21
+ throw new Error(`Interactive-handshake signature request payload has ${request.payload.length} fields, expected 4`);
22
+ }
23
+ const [recipient, chainId, version, ephPkX] = request.payload;
24
+ return {
25
+ recipient: new AztecAddress(recipient),
26
+ chainId,
27
+ version,
28
+ ephPkX
29
+ };
30
+ }
31
+ /**
32
+ * Produces the recipient's signed authorization for an interactive handshake, signing with the master
33
+ * message-signing secret key.
34
+ */ export async function signInteractiveHandshake(request, completeAddress, masterMessageSigningSecretKey) {
35
+ const mspk = await derivePublicKeyFromSecretKey(masterMessageSigningSecretKey);
36
+ const [mspkX, mspkYIsPositive] = mspk.toXAndSign();
37
+ const message = await computeInteractiveHandshakeSignatureMessage({
38
+ chainId: request.chainId,
39
+ version: request.version,
40
+ registry: STANDARD_HANDSHAKE_REGISTRY_ADDRESS,
41
+ ephPkX: request.ephPkX
42
+ });
43
+ const signature = await new Schnorr().constructSignature(message, masterMessageSigningSecretKey);
44
+ return {
45
+ publicKeys: completeAddress.publicKeys,
46
+ partialAddress: completeAddress.partialAddress,
47
+ mspkX,
48
+ mspkYIsPositive,
49
+ signature
50
+ };
51
+ }
52
+ /** Serializes a {@link RecipientSignature} to the field layout the registry's in-circuit deserialization expects. */ export function recipientSignatureToFields(recipientSignature) {
53
+ const s = Fq.fromBuffer(recipientSignature.signature.s);
54
+ const e = Fq.fromBuffer(recipientSignature.signature.e);
55
+ return [
56
+ ...recipientSignature.publicKeys.toFields(),
57
+ recipientSignature.partialAddress,
58
+ recipientSignature.mspkX,
59
+ new Fr(recipientSignature.mspkYIsPositive),
60
+ s.lo,
61
+ s.hi,
62
+ e.lo,
63
+ e.hi
64
+ ];
65
+ }
66
+ /**
67
+ * The message an interactive-handshake authorization signs: the handshake's ephemeral key and chain context under
68
+ * `DomainSeparator.INTERACTIVE_HANDSHAKE_SIGNATURE`, exactly as the registry recomputes it in-circuit.
69
+ */ function computeInteractiveHandshakeSignatureMessage(args) {
70
+ return poseidon2HashWithSeparator([
71
+ args.chainId,
72
+ args.version,
73
+ args.registry,
74
+ args.ephPkX
75
+ ], DomainSeparator.INTERACTIVE_HANDSHAKE_SIGNATURE);
76
+ }
@@ -0,0 +1,19 @@
1
+ import { type InitialAccountData } from '@aztec/accounts/testing';
2
+ import type { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
3
+ import type { ResolveCustomRequest, ResolveTaggingSecretStrategy } from '@aztec/pxe/config';
4
+ import { TestWallet } from '../../test-wallet/test_wallet.js';
5
+ export type CustomRequestResponder = (recipient: TestWallet, recipientAccount: InitialAccountData, recipientCompleteAddress: CompleteAddress) => ResolveCustomRequest;
6
+ export type Mode = 'constrained' | 'unconstrained';
7
+ export type DeliveryMode = Mode | {
8
+ events: Mode;
9
+ notes: Mode;
10
+ };
11
+ export declare function buildMessageDeliveryTest(opts: {
12
+ strategy: string;
13
+ mode: DeliveryMode;
14
+ senderHook: ResolveTaggingSecretStrategy;
15
+ recipientRegistration?: (recipient: TestWallet, recipientAddress: AztecAddress, sender: AztecAddress) => Promise<void>;
16
+ customRequestResponder?: CustomRequestResponder;
17
+ additionalTests?: () => void;
18
+ }): void;
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib25jaGFpbl9kZWxpdmVyeV9oYXJuZXNzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYXV0b21pbmU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