@aztec/end-to-end 0.0.1-commit.1142ef1 → 0.0.1-commit.125b3452

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 (236) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +3 -2
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +21 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +13 -14
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +130 -137
  7. package/dest/bench/client_flows/config.d.ts +2 -2
  8. package/dest/bench/client_flows/config.d.ts.map +1 -1
  9. package/dest/bench/client_flows/config.js +18 -0
  10. package/dest/bench/utils.d.ts +6 -5
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +13 -8
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +9 -8
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +107 -113
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +7 -8
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +68 -64
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  22. package/dest/e2e_epochs/epochs_test.d.ts +15 -7
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +87 -39
  25. package/dest/e2e_fees/bridging_race.notest.js +3 -5
  26. package/dest/e2e_fees/fees_test.d.ts +14 -14
  27. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  28. package/dest/e2e_fees/fees_test.js +133 -144
  29. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  30. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  31. package/dest/e2e_l1_publisher/write_json.js +14 -13
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.js +30 -40
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  37. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  38. package/dest/e2e_p2p/p2p_network.d.ts +11 -9
  39. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  40. package/dest/e2e_p2p/p2p_network.js +132 -108
  41. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  42. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  43. package/dest/e2e_p2p/reqresp/utils.js +190 -0
  44. package/dest/e2e_p2p/shared.d.ts +26 -6
  45. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  46. package/dest/e2e_p2p/shared.js +46 -18
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  50. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  51. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  52. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  53. package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
  54. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  55. package/dest/e2e_token_contract/token_contract_test.js +100 -92
  56. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  57. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  58. package/dest/fixtures/authwit_proxy.js +30 -0
  59. package/dest/fixtures/e2e_prover_test.d.ts +11 -17
  60. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  61. package/dest/fixtures/e2e_prover_test.js +112 -127
  62. package/dest/fixtures/elu_monitor.d.ts +21 -0
  63. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  64. package/dest/fixtures/elu_monitor.js +102 -0
  65. package/dest/fixtures/fixtures.d.ts +5 -1
  66. package/dest/fixtures/fixtures.d.ts.map +1 -1
  67. package/dest/fixtures/fixtures.js +6 -0
  68. package/dest/fixtures/ha_setup.d.ts +71 -0
  69. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  70. package/dest/fixtures/ha_setup.js +116 -0
  71. package/dest/fixtures/index.d.ts +2 -1
  72. package/dest/fixtures/index.d.ts.map +1 -1
  73. package/dest/fixtures/index.js +1 -0
  74. package/dest/fixtures/setup.d.ts +239 -0
  75. package/dest/fixtures/setup.d.ts.map +1 -0
  76. package/dest/fixtures/setup.js +606 -0
  77. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  78. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  79. package/dest/fixtures/setup_p2p_test.js +40 -29
  80. package/dest/fixtures/token_utils.d.ts +2 -2
  81. package/dest/fixtures/token_utils.d.ts.map +1 -1
  82. package/dest/fixtures/token_utils.js +12 -8
  83. package/dest/fixtures/utils.d.ts +5 -191
  84. package/dest/fixtures/utils.d.ts.map +1 -1
  85. package/dest/fixtures/utils.js +4 -615
  86. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  87. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  88. package/dest/quality_of_service/prometheus_client.js +67 -0
  89. package/dest/shared/cross_chain_test_harness.d.ts +14 -4
  90. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  91. package/dest/shared/cross_chain_test_harness.js +24 -24
  92. package/dest/shared/gas_portal_test_harness.d.ts +11 -1
  93. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  94. package/dest/shared/gas_portal_test_harness.js +3 -3
  95. package/dest/shared/index.d.ts +2 -1
  96. package/dest/shared/index.d.ts.map +1 -1
  97. package/dest/shared/index.js +1 -0
  98. package/dest/shared/jest_setup.js +41 -1
  99. package/dest/shared/mock_state_view.d.ts +86 -0
  100. package/dest/shared/mock_state_view.d.ts.map +1 -0
  101. package/dest/shared/mock_state_view.js +186 -0
  102. package/dest/shared/submit-transactions.d.ts +4 -4
  103. package/dest/shared/submit-transactions.d.ts.map +1 -1
  104. package/dest/shared/submit-transactions.js +9 -11
  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 +27 -28
  108. package/dest/simulators/lending_simulator.d.ts +5 -1
  109. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  110. package/dest/simulators/lending_simulator.js +4 -4
  111. package/dest/simulators/token_simulator.d.ts +1 -1
  112. package/dest/simulators/token_simulator.d.ts.map +1 -1
  113. package/dest/simulators/token_simulator.js +3 -24
  114. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  115. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  116. package/dest/spartan/setup_test_wallets.js +107 -37
  117. package/dest/spartan/tx_metrics.d.ts +51 -2
  118. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  119. package/dest/spartan/tx_metrics.js +334 -7
  120. package/dest/spartan/utils/bot.d.ts +28 -0
  121. package/dest/spartan/utils/bot.d.ts.map +1 -0
  122. package/dest/spartan/utils/bot.js +142 -0
  123. package/dest/spartan/utils/chaos.d.ts +79 -0
  124. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  125. package/dest/spartan/utils/chaos.js +142 -0
  126. package/dest/spartan/utils/clients.d.ts +39 -0
  127. package/dest/spartan/utils/clients.d.ts.map +1 -0
  128. package/dest/spartan/utils/clients.js +90 -0
  129. package/dest/spartan/utils/config.d.ts +45 -0
  130. package/dest/spartan/utils/config.d.ts.map +1 -0
  131. package/dest/spartan/utils/config.js +23 -0
  132. package/dest/spartan/utils/health.d.ts +63 -0
  133. package/dest/spartan/utils/health.d.ts.map +1 -0
  134. package/dest/spartan/utils/health.js +202 -0
  135. package/dest/spartan/utils/helm.d.ts +15 -0
  136. package/dest/spartan/utils/helm.d.ts.map +1 -0
  137. package/dest/spartan/utils/helm.js +47 -0
  138. package/dest/spartan/utils/index.d.ts +11 -0
  139. package/dest/spartan/utils/index.d.ts.map +1 -0
  140. package/dest/spartan/utils/index.js +22 -0
  141. package/dest/spartan/utils/k8s.d.ts +128 -0
  142. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  143. package/dest/spartan/utils/k8s.js +381 -0
  144. package/dest/spartan/utils/nodes.d.ts +40 -0
  145. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  146. package/dest/spartan/utils/nodes.js +461 -0
  147. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  148. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  149. package/dest/spartan/utils/pod_logs.js +74 -0
  150. package/dest/spartan/utils/scripts.d.ts +30 -0
  151. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  152. package/dest/spartan/utils/scripts.js +81 -0
  153. package/dest/spartan/utils.d.ts +2 -253
  154. package/dest/spartan/utils.d.ts.map +1 -1
  155. package/dest/spartan/utils.js +1 -892
  156. package/dest/test-wallet/test_wallet.d.ts +76 -0
  157. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  158. package/dest/test-wallet/test_wallet.js +214 -0
  159. package/dest/test-wallet/utils.d.ts +41 -0
  160. package/dest/test-wallet/utils.d.ts.map +1 -0
  161. package/dest/test-wallet/utils.js +71 -0
  162. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  163. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  164. package/dest/test-wallet/wallet_worker_script.js +48 -0
  165. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  166. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  167. package/dest/test-wallet/worker_wallet.js +151 -0
  168. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  169. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  170. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  171. package/package.json +46 -43
  172. package/src/bench/client_flows/benchmark.ts +24 -2
  173. package/src/bench/client_flows/client_flows_benchmark.ts +148 -210
  174. package/src/bench/client_flows/config.ts +9 -1
  175. package/src/bench/utils.ts +15 -8
  176. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +120 -145
  177. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +103 -111
  178. package/src/e2e_deploy_contract/deploy_test.ts +22 -15
  179. package/src/e2e_epochs/epochs_test.ts +130 -93
  180. package/src/e2e_fees/bridging_race.notest.ts +4 -10
  181. package/src/e2e_fees/fees_test.ts +170 -224
  182. package/src/e2e_l1_publisher/write_json.ts +16 -13
  183. package/src/e2e_nested_contract/nested_contract_test.ts +35 -56
  184. package/src/e2e_p2p/inactivity_slash_test.ts +3 -3
  185. package/src/e2e_p2p/p2p_network.ts +196 -166
  186. package/src/e2e_p2p/reqresp/utils.ts +256 -0
  187. package/src/e2e_p2p/shared.ts +76 -23
  188. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  189. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  190. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  191. package/src/e2e_token_contract/token_contract_test.ts +121 -119
  192. package/src/fixtures/authwit_proxy.ts +50 -0
  193. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  194. package/src/fixtures/e2e_prover_test.ts +133 -171
  195. package/src/fixtures/elu_monitor.ts +126 -0
  196. package/src/fixtures/fixtures.ts +10 -0
  197. package/src/fixtures/ha_setup.ts +186 -0
  198. package/src/fixtures/index.ts +1 -0
  199. package/src/fixtures/setup.ts +903 -0
  200. package/src/fixtures/setup_p2p_test.ts +40 -44
  201. package/src/fixtures/token_utils.ts +10 -6
  202. package/src/fixtures/utils.ts +27 -901
  203. package/src/guides/up_quick_start.sh +3 -3
  204. package/src/quality_of_service/prometheus_client.ts +113 -0
  205. package/src/shared/cross_chain_test_harness.ts +24 -34
  206. package/src/shared/gas_portal_test_harness.ts +2 -2
  207. package/src/shared/index.ts +1 -0
  208. package/src/shared/jest_setup.ts +51 -1
  209. package/src/shared/mock_state_view.ts +188 -0
  210. package/src/shared/submit-transactions.ts +11 -16
  211. package/src/shared/uniswap_l1_l2.ts +49 -51
  212. package/src/simulators/lending_simulator.ts +6 -4
  213. package/src/simulators/token_simulator.ts +6 -30
  214. package/src/spartan/setup_test_wallets.ts +158 -25
  215. package/src/spartan/tx_metrics.ts +256 -10
  216. package/src/spartan/utils/bot.ts +188 -0
  217. package/src/spartan/utils/chaos.ts +253 -0
  218. package/src/spartan/utils/clients.ts +100 -0
  219. package/src/spartan/utils/config.ts +29 -0
  220. package/src/spartan/utils/health.ts +255 -0
  221. package/src/spartan/utils/helm.ts +84 -0
  222. package/src/spartan/utils/index.ts +71 -0
  223. package/src/spartan/utils/k8s.ts +535 -0
  224. package/src/spartan/utils/nodes.ts +543 -0
  225. package/src/spartan/utils/pod_logs.ts +99 -0
  226. package/src/spartan/utils/scripts.ts +99 -0
  227. package/src/spartan/utils.ts +1 -1158
  228. package/src/test-wallet/test_wallet.ts +294 -0
  229. package/src/test-wallet/utils.ts +112 -0
  230. package/src/test-wallet/wallet_worker_script.ts +60 -0
  231. package/src/test-wallet/worker_wallet.ts +213 -0
  232. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  233. package/dest/fixtures/snapshot_manager.d.ts +0 -93
  234. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  235. package/dest/fixtures/snapshot_manager.js +0 -488
  236. package/src/fixtures/snapshot_manager.ts +0 -646
@@ -1,3 +1,4 @@
1
+ import type { Archiver } from '@aztec/archiver';
1
2
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
2
3
  import { getTimestampRangeForEpoch } from '@aztec/aztec.js/block';
3
4
  import { getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts';
@@ -9,25 +10,21 @@ import { EpochCache } from '@aztec/epoch-cache';
9
10
  import { createExtendedL1Client } from '@aztec/ethereum/client';
10
11
  import { DefaultL1ContractsConfig } from '@aztec/ethereum/config';
11
12
  import { RollupContract } from '@aztec/ethereum/contracts';
12
- import { ChainMonitor, DelayedTxUtils, type Delayer, waitUntilL1Timestamp, withDelayer } from '@aztec/ethereum/test';
13
+ import { Delayer, createDelayer, waitUntilL1Timestamp, wrapClientWithDelayer } from '@aztec/ethereum/l1-tx-utils';
14
+ import { ChainMonitor } from '@aztec/ethereum/test';
13
15
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
14
16
  import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
15
17
  import { SecretValue } from '@aztec/foundation/config';
16
18
  import { randomBytes } from '@aztec/foundation/crypto/random';
17
- import { withLogNameSuffix } from '@aztec/foundation/log';
19
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
18
20
  import { retryUntil } from '@aztec/foundation/retry';
19
21
  import { sleep } from '@aztec/foundation/sleep';
20
22
  import { SpamContract } from '@aztec/noir-test-contracts.js/Spam';
23
+ import { TestContract } from '@aztec/noir-test-contracts.js/Test';
21
24
  import { getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
22
- import { ProverNode, type ProverNodeConfig, ProverNodePublisher } from '@aztec/prover-node';
23
- import type { TestProverNode } from '@aztec/prover-node/test';
24
- import {
25
- type SequencerClient,
26
- type SequencerEvents,
27
- type SequencerPublisher,
28
- SequencerState,
29
- } from '@aztec/sequencer-client';
30
- import type { TestSequencerClient } from '@aztec/sequencer-client/test';
25
+ import type { ProverNodeConfig } from '@aztec/prover-node';
26
+ import type { PXEConfig } from '@aztec/pxe/config';
27
+ import { type SequencerClient, type SequencerEvents, SequencerState } from '@aztec/sequencer-client';
31
28
  import { type BlockParameter, EthAddress } from '@aztec/stdlib/block';
32
29
  import { type L1RollupConstants, getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers';
33
30
  import { tryStop } from '@aztec/stdlib/interfaces/server';
@@ -44,12 +41,16 @@ import {
44
41
  setup,
45
42
  } from '../fixtures/utils.js';
46
43
 
47
- export const WORLD_STATE_BLOCK_HISTORY = 2;
44
+ export const WORLD_STATE_CHECKPOINT_HISTORY = 2;
48
45
  export const WORLD_STATE_BLOCK_CHECK_INTERVAL = 50;
49
46
  export const ARCHIVER_POLL_INTERVAL = 50;
50
47
  export const DEFAULT_L1_BLOCK_TIME = process.env.CI ? 12 : 8;
51
48
 
52
- export type EpochsTestOpts = Partial<SetupOptions> & { numberOfAccounts?: number };
49
+ export type EpochsTestOpts = Partial<SetupOptions> & {
50
+ numberOfAccounts?: number;
51
+ pxeOpts?: Partial<PXEConfig>;
52
+ aztecSlotDurationInL1Slots?: number;
53
+ };
53
54
 
54
55
  export type TrackedSequencerEvent = {
55
56
  [K in keyof SequencerEvents]: Parameters<SequencerEvents[K]>[0] & {
@@ -75,7 +76,7 @@ export class EpochsTestContext {
75
76
  public proverDelayer!: Delayer;
76
77
  public sequencerDelayer!: Delayer;
77
78
 
78
- public proverNodes: ProverNode[] = [];
79
+ public proverNodes: AztecNodeService[] = [];
79
80
  public nodes: AztecNodeService[] = [];
80
81
 
81
82
  public epochDuration!: number;
@@ -94,7 +95,7 @@ export class EpochsTestContext {
94
95
  ? parseInt(process.env.L1_BLOCK_TIME)
95
96
  : DEFAULT_L1_BLOCK_TIME;
96
97
  const ethereumSlotDuration = opts.ethereumSlotDuration ?? envEthereumSlotDuration;
97
- const aztecSlotDuration = opts.aztecSlotDuration ?? ethereumSlotDuration * 2;
98
+ const aztecSlotDuration = opts.aztecSlotDuration ?? (opts.aztecSlotDurationInL1Slots ?? 2) * ethereumSlotDuration;
98
99
  const aztecEpochDuration = opts.aztecEpochDuration ?? 6;
99
100
  const aztecProofSubmissionEpochs = opts.aztecProofSubmissionEpochs ?? 1;
100
101
  const l1PublishingTime = opts.l1PublishingTime ?? 1;
@@ -121,30 +122,36 @@ export class EpochsTestContext {
121
122
 
122
123
  // Set up system without any account nor protocol contracts
123
124
  // and with faster block times and shorter epochs.
124
- const context = await setup(opts.numberOfAccounts ?? 0, {
125
- automineL1Setup: true,
126
- checkIntervalMs: 50,
127
- archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
128
- worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
129
- aztecEpochDuration,
130
- aztecSlotDuration,
131
- ethereumSlotDuration,
132
- aztecProofSubmissionEpochs,
133
- aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
134
- minTxsPerBlock: 0,
135
- realProofs: false,
136
- startProverNode: true,
137
- proverTestDelayMs: opts.proverTestDelayMs ?? 0,
138
- // We use numeric incremental prover ids for simplicity, but we can switch to
139
- // using the prover's eth address if the proverId is used for something in the rollup contract
140
- // Use numeric EthAddress for deterministic prover id
141
- proverId: EthAddress.fromNumber(1),
142
- worldStateBlockHistory: WORLD_STATE_BLOCK_HISTORY,
143
- exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
144
- slasherFlavor: 'none',
145
- l1PublishingTime,
146
- ...opts,
147
- });
125
+ const context = await setup(
126
+ opts.numberOfAccounts ?? 0,
127
+ {
128
+ automineL1Setup: true,
129
+ checkIntervalMs: 50,
130
+ archiverPollingIntervalMS: ARCHIVER_POLL_INTERVAL,
131
+ worldStateBlockCheckIntervalMS: WORLD_STATE_BLOCK_CHECK_INTERVAL,
132
+ aztecEpochDuration,
133
+ aztecSlotDuration,
134
+ ethereumSlotDuration,
135
+ aztecProofSubmissionEpochs,
136
+ aztecTargetCommitteeSize: opts.initialValidators?.length ?? 0,
137
+ minTxsPerBlock: 0,
138
+ realProofs: false,
139
+ startProverNode: true,
140
+ proverTestDelayMs: opts.proverTestDelayMs ?? 0,
141
+ // We use numeric incremental prover ids for simplicity, but we can switch to
142
+ // using the prover's eth address if the proverId is used for something in the rollup contract
143
+ // Use numeric EthAddress for deterministic prover id
144
+ proverId: EthAddress.fromNumber(1),
145
+ worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY,
146
+ exitDelaySeconds: DefaultL1ContractsConfig.exitDelaySeconds,
147
+ slasherFlavor: 'none',
148
+ l1PublishingTime,
149
+ ...opts,
150
+ },
151
+ // Use checkpointed chain tip for PXE by default to avoid issues with blocks being dropped due to pruned anchor blocks.
152
+ // Can be overridden via opts.pxeOpts.
153
+ { syncChainTip: 'checkpointed', ...opts.pxeOpts },
154
+ );
148
155
 
149
156
  this.context = context;
150
157
  this.proverNodes = context.proverNode ? [context.proverNode] : [];
@@ -157,17 +164,8 @@ export class EpochsTestContext {
157
164
  // Loop that tracks L1 and L2 block numbers and logs whenever there's a new one.
158
165
  this.monitor = new ChainMonitor(this.rollup, context.dateProvider, this.logger).start();
159
166
 
160
- // This is hideous.
161
- // We ought to have a definite reference to the l1TxUtils that we're using in both places, provided by the test context.
162
- this.proverDelayer = context.proverNode
163
- ? (((context.proverNode as TestProverNode).publisher as ProverNodePublisher).l1TxUtils as DelayedTxUtils).delayer!
164
- : undefined!;
165
- this.sequencerDelayer = context.sequencer
166
- ? (
167
- ((context.sequencer as TestSequencerClient).sequencer.publisher as SequencerPublisher)
168
- .l1TxUtils as DelayedTxUtils
169
- ).delayer!
170
- : undefined!;
167
+ this.proverDelayer = context.proverDelayer!;
168
+ this.sequencerDelayer = context.sequencerDelayer!;
171
169
 
172
170
  if ((context.proverNode && !this.proverDelayer) || (context.sequencer && !this.sequencerDelayer)) {
173
171
  throw new Error(`Could not find prover or sequencer delayer`);
@@ -182,6 +180,8 @@ export class EpochsTestContext {
182
180
  l1GenesisTime: await this.rollup.getL1GenesisTime(),
183
181
  ethereumSlotDuration,
184
182
  proofSubmissionEpochs: Number(await this.rollup.getProofSubmissionEpochs()),
183
+ targetCommitteeSize: await this.rollup.getTargetCommitteeSize(),
184
+ rollupManaLimit: Number(await this.rollup.getManaLimit()),
185
185
  };
186
186
 
187
187
  this.logger.info(
@@ -199,20 +199,32 @@ export class EpochsTestContext {
199
199
  public async createProverNode(opts: { dontStart?: boolean } & Partial<ProverNodeConfig> = {}) {
200
200
  this.logger.warn('Creating and syncing a simulated prover node...');
201
201
  const proverNodePrivateKey = this.getNextPrivateKey();
202
- const suffix = (this.proverNodes.length + 1).toString();
203
- const proverNode = await withLogNameSuffix(suffix, () =>
202
+ const proverIndex = this.proverNodes.length + 1;
203
+ const { mockGossipSubNetwork } = this.context;
204
+ const { proverNode } = await withLoggerBindings({ actor: `prover-${proverIndex}` }, () =>
204
205
  createAndSyncProverNode(
205
206
  proverNodePrivateKey,
206
- { ...this.context.config },
207
207
  {
208
- dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
209
- proverId: EthAddress.fromNumber(parseInt(suffix, 10)),
208
+ ...this.context.config,
209
+ p2pEnabled: this.context.config.p2pEnabled || mockGossipSubNetwork !== undefined,
210
+ proverId: EthAddress.fromNumber(proverIndex),
210
211
  dontStart: opts.dontStart,
211
212
  ...opts,
212
213
  },
213
- this.context.aztecNode,
214
- undefined,
215
- { dateProvider: this.context.dateProvider },
214
+ {
215
+ dataDirectory: join(this.context.config.dataDirectory!, randomBytes(8).toString('hex')),
216
+ },
217
+ {
218
+ dateProvider: this.context.dateProvider,
219
+ p2pClientDeps: {
220
+ p2pServiceFactory: mockGossipSubNetwork ? getMockPubSubP2PServiceFactory(mockGossipSubNetwork) : undefined,
221
+ rpcTxProviders: [this.context.aztecNode],
222
+ },
223
+ },
224
+ {
225
+ prefilledPublicData: this.context.prefilledPublicData ?? [],
226
+ dontStart: opts.dontStart,
227
+ },
216
228
  ),
217
229
  );
218
230
  this.proverNodes.push(proverNode);
@@ -226,21 +238,20 @@ export class EpochsTestContext {
226
238
 
227
239
  public createValidatorNode(
228
240
  privateKeys: `0x${string}`[],
229
- opts: Partial<AztecNodeConfig> & { txDelayerMaxInclusionTimeIntoSlot?: number; dontStartSequencer?: boolean } = {},
241
+ opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {},
230
242
  ) {
231
243
  this.logger.warn('Creating and syncing a validator node...');
232
244
  return this.createNode({ ...opts, disableValidator: false, validatorPrivateKeys: new SecretValue(privateKeys) });
233
245
  }
234
246
 
235
- private async createNode(
236
- opts: Partial<AztecNodeConfig> & { txDelayerMaxInclusionTimeIntoSlot?: number; dontStartSequencer?: boolean } = {},
237
- ) {
238
- const suffix = (this.nodes.length + 1).toString();
247
+ private async createNode(opts: Partial<AztecNodeConfig> & { dontStartSequencer?: boolean } = {}) {
248
+ const nodeIndex = this.nodes.length + 1;
249
+ const actorPrefix = opts.disableValidator ? 'node' : 'validator';
239
250
  const { mockGossipSubNetwork } = this.context;
240
251
  const resolvedConfig = { ...this.context.config, ...opts };
241
252
  const p2pEnabled = resolvedConfig.p2pEnabled || mockGossipSubNetwork !== undefined;
242
253
  const p2pIp = resolvedConfig.p2pIp ?? (p2pEnabled ? '127.0.0.1' : undefined);
243
- const node = await withLogNameSuffix(suffix, () =>
254
+ const node = await withLoggerBindings({ actor: `${actorPrefix}-${nodeIndex}` }, () =>
244
255
  AztecNodeService.createAndSync(
245
256
  {
246
257
  ...resolvedConfig,
@@ -262,26 +273,6 @@ export class EpochsTestContext {
262
273
  ),
263
274
  );
264
275
 
265
- // REFACTOR: We're getting too much into the internals of the sequencer here.
266
- // We should have a single method for constructing an aztec node that returns a TestAztecNodeService
267
- // which directly exposes the delayer and sets any test config.
268
- if (opts.txDelayerMaxInclusionTimeIntoSlot !== undefined) {
269
- this.logger.info(
270
- `Setting tx delayer max inclusion time into slot to ${opts.txDelayerMaxInclusionTimeIntoSlot} seconds`,
271
- );
272
- // Here we reach into the sequencer and hook in a tx delayer. The problem is that the sequencer's l1 utils only uses a public client, not a wallet.
273
- // The delayer needs a wallet (a client that can sign), so we have to create one here.
274
- const l1Client = createExtendedL1Client(
275
- resolvedConfig.l1RpcUrls!,
276
- resolvedConfig.publisherPrivateKeys![0]!.getValue(),
277
- );
278
- const sequencer = node.getSequencer() as TestSequencerClient;
279
- const publisher = sequencer.sequencer.publisher;
280
- const delayed = DelayedTxUtils.fromL1TxUtils(publisher.l1TxUtils, this.L1_BLOCK_TIME_IN_S, l1Client);
281
- delayed.delayer!.setMaxInclusionTimeIntoSlot(opts.txDelayerMaxInclusionTimeIntoSlot);
282
- publisher.l1TxUtils = delayed;
283
- }
284
-
285
276
  this.nodes.push(node);
286
277
  return node;
287
278
  }
@@ -333,7 +324,10 @@ export class EpochsTestContext {
333
324
  this.logger.info(`Waiting until last slot of submission window for epoch ${epochNumber} at ${date}`, {
334
325
  oneSlotBefore,
335
326
  });
336
- await waitUntilL1Timestamp(this.l1Client, oneSlotBefore);
327
+ // Use a timeout that accounts for the full proof submission window
328
+ const proofSubmissionWindowDuration =
329
+ this.constants.proofSubmissionEpochs * this.epochDuration * this.L2_SLOT_DURATION_IN_S;
330
+ await waitUntilL1Timestamp(this.l1Client, oneSlotBefore, undefined, proofSubmissionWindowDuration * 2);
337
331
  }
338
332
 
339
333
  /** Waits for the aztec node to sync to the target block number. */
@@ -370,17 +364,28 @@ export class EpochsTestContext {
370
364
  return SpamContract.at(instance.address, wallet);
371
365
  }
372
366
 
367
+ /** Registers the TestContract on the given wallet. */
368
+ public async registerTestContract(wallet: Wallet, salt = Fr.ZERO) {
369
+ const instance = await getContractInstanceFromInstantiationParams(TestContract.artifact, {
370
+ constructorArgs: [],
371
+ constructorArtifact: undefined,
372
+ salt,
373
+ publicKeys: undefined,
374
+ deployer: undefined,
375
+ });
376
+ await wallet.registerContract(instance, TestContract.artifact);
377
+ return TestContract.at(instance.address, wallet);
378
+ }
379
+
373
380
  /** Creates an L1 client using a fresh account with funds from anvil, with a tx delayer already set up. */
374
381
  public async createL1Client() {
375
- const { client, delayer } = withDelayer(
376
- createExtendedL1Client(
377
- [...this.l1Client.chain.rpcUrls.default.http],
378
- privateKeyToAccount(this.getNextPrivateKey()),
379
- this.l1Client.chain,
380
- ),
381
- this.context.dateProvider!,
382
- { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S },
382
+ const rawClient = createExtendedL1Client(
383
+ [...this.l1Client.chain.rpcUrls.default.http],
384
+ privateKeyToAccount(this.getNextPrivateKey()),
385
+ this.l1Client.chain,
383
386
  );
387
+ const delayer = createDelayer(this.context.dateProvider, { ethereumSlotDuration: this.L1_BLOCK_TIME_IN_S }, {});
388
+ const client = wrapClientWithDelayer(rawClient, delayer);
384
389
  expect(await client.getBalance({ address: client.account.address })).toBeGreaterThan(0n);
385
390
  return { client, delayer };
386
391
  }
@@ -397,6 +402,38 @@ export class EpochsTestContext {
397
402
  expect(result).toBe(expectedSuccess);
398
403
  }
399
404
 
405
+ /** Verifies at least one checkpoint has the target number of blocks (for MBPS validation). */
406
+ public async assertMultipleBlocksPerSlot(targetBlockCount: number) {
407
+ const archiver = (this.context.aztecNode as AztecNodeService).getBlockSource() as Archiver;
408
+ const checkpoints = await archiver.getCheckpoints(CheckpointNumber(1), 50);
409
+
410
+ this.logger.warn(`Retrieved ${checkpoints.length} checkpoints from archiver`, {
411
+ checkpoints: checkpoints.map(pc => pc.checkpoint.getStats()),
412
+ });
413
+
414
+ let expectedBlockNumber = checkpoints[0].checkpoint.blocks[0].number;
415
+ let targetFound = false;
416
+
417
+ for (const checkpoint of checkpoints) {
418
+ const blockCount = checkpoint.checkpoint.blocks.length;
419
+ targetFound = targetFound || blockCount >= targetBlockCount;
420
+
421
+ this.logger.verbose(`Checkpoint ${checkpoint.checkpoint.number} has ${blockCount} blocks`, {
422
+ checkpoint: checkpoint.checkpoint.getStats(),
423
+ });
424
+
425
+ for (let i = 0; i < blockCount; i++) {
426
+ const block = checkpoint.checkpoint.blocks[i];
427
+ expect(block.indexWithinCheckpoint).toBe(i);
428
+ expect(block.checkpointNumber).toBe(checkpoint.checkpoint.number);
429
+ expect(block.number).toBe(expectedBlockNumber);
430
+ expectedBlockNumber++;
431
+ }
432
+ }
433
+
434
+ expect(targetFound).toBe(true);
435
+ }
436
+
400
437
  public watchSequencerEvents(
401
438
  sequencers: SequencerClient[],
402
439
  getMetadata: (i: number) => Record<string, any> = () => ({}),
@@ -4,11 +4,11 @@ import type { Logger } from '@aztec/aztec.js/log';
4
4
  import { Fq } from '@aztec/foundation/curves/bn254';
5
5
  import { sleep } from '@aztec/foundation/sleep';
6
6
  import type { AztecAddress } from '@aztec/stdlib/aztec-address';
7
- import type { TestWallet } from '@aztec/test-wallet/server';
8
7
 
9
8
  import { jest } from '@jest/globals';
10
9
  import type { Hex } from 'viem';
11
10
 
11
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
12
12
  import { FeesTest } from './fees_test.js';
13
13
 
14
14
  jest.setTimeout(300_000);
@@ -26,11 +26,8 @@ describe('e2e_fees bridging_race', () => {
26
26
  });
27
27
 
28
28
  beforeAll(async () => {
29
- await t.applyInitialAccountsSnapshot();
30
- await t.applyPublicDeployAccountsSnapshot();
31
- await t.applySetupFeeJuiceSnapshot();
32
-
33
- ({ wallet, logger } = await t.setup());
29
+ await t.setup();
30
+ ({ wallet, logger } = t);
34
31
  });
35
32
 
36
33
  afterAll(async () => {
@@ -70,10 +67,7 @@ describe('e2e_fees bridging_race', () => {
70
67
  // Yes, we need to REFACTOR it at some point
71
68
  const claim = await t.feeJuiceBridgeTestHarness.prepareTokensOnL1(bobsAddress);
72
69
  const { claimSecret: secret, messageLeafIndex: index } = claim;
73
- await t.feeJuiceContract.methods
74
- .claim(bobsAddress, claim.claimAmount, secret, index)
75
- .send({ from: bobsAddress })
76
- .wait();
70
+ await t.feeJuiceContract.methods.claim(bobsAddress, claim.claimAmount, secret, index).send({ from: bobsAddress });
77
71
  const [balance] = await t.getGasBalanceFn(bobsAddress);
78
72
  expect(balance).toEqual(claim.claimAmount);
79
73
  });