@aztec/end-to-end 0.0.1-commit.f295ac2 → 0.0.1-commit.f504929

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 (208) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +39 -23
  4. package/dest/bench/client_flows/config.d.ts +2 -2
  5. package/dest/bench/client_flows/config.d.ts.map +1 -1
  6. package/dest/bench/client_flows/config.js +18 -0
  7. package/dest/bench/utils.d.ts +5 -4
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +13 -8
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +27 -18
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +15 -7
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +86 -39
  21. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  22. package/dest/e2e_fees/fees_test.d.ts +2 -2
  23. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  24. package/dest/e2e_fees/fees_test.js +16 -16
  25. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  26. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  27. package/dest/e2e_l1_publisher/write_json.js +1 -7
  28. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  29. package/dest/e2e_p2p/p2p_network.d.ts +4 -3
  30. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  31. package/dest/e2e_p2p/p2p_network.js +28 -7
  32. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  33. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  34. package/dest/e2e_p2p/reqresp/utils.js +177 -0
  35. package/dest/e2e_p2p/shared.d.ts +20 -6
  36. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  37. package/dest/e2e_p2p/shared.js +38 -18
  38. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  39. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +20 -10
  47. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  48. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  49. package/dest/fixtures/authwit_proxy.js +30 -0
  50. package/dest/fixtures/e2e_prover_test.d.ts +4 -4
  51. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  52. package/dest/fixtures/e2e_prover_test.js +41 -45
  53. package/dest/fixtures/elu_monitor.d.ts +21 -0
  54. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  55. package/dest/fixtures/elu_monitor.js +102 -0
  56. package/dest/fixtures/fixtures.d.ts +5 -1
  57. package/dest/fixtures/fixtures.d.ts.map +1 -1
  58. package/dest/fixtures/fixtures.js +6 -0
  59. package/dest/fixtures/ha_setup.d.ts +71 -0
  60. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  61. package/dest/fixtures/ha_setup.js +116 -0
  62. package/dest/fixtures/index.d.ts +2 -1
  63. package/dest/fixtures/index.d.ts.map +1 -1
  64. package/dest/fixtures/index.js +1 -0
  65. package/dest/fixtures/setup.d.ts +43 -25
  66. package/dest/fixtures/setup.d.ts.map +1 -1
  67. package/dest/fixtures/setup.js +90 -169
  68. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +40 -29
  71. package/dest/fixtures/token_utils.d.ts +2 -2
  72. package/dest/fixtures/token_utils.d.ts.map +1 -1
  73. package/dest/fixtures/token_utils.js +12 -8
  74. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  75. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  76. package/dest/shared/cross_chain_test_harness.js +24 -24
  77. package/dest/shared/gas_portal_test_harness.js +3 -3
  78. package/dest/shared/index.d.ts +2 -1
  79. package/dest/shared/index.d.ts.map +1 -1
  80. package/dest/shared/index.js +1 -0
  81. package/dest/shared/jest_setup.js +41 -1
  82. package/dest/shared/mock_state_view.d.ts +86 -0
  83. package/dest/shared/mock_state_view.d.ts.map +1 -0
  84. package/dest/shared/mock_state_view.js +186 -0
  85. package/dest/shared/submit-transactions.d.ts +4 -4
  86. package/dest/shared/submit-transactions.d.ts.map +1 -1
  87. package/dest/shared/submit-transactions.js +9 -11
  88. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  89. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  90. package/dest/shared/uniswap_l1_l2.js +24 -22
  91. package/dest/simulators/lending_simulator.d.ts +1 -1
  92. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  93. package/dest/simulators/lending_simulator.js +4 -4
  94. package/dest/simulators/token_simulator.d.ts +1 -1
  95. package/dest/simulators/token_simulator.d.ts.map +1 -1
  96. package/dest/simulators/token_simulator.js +3 -24
  97. package/dest/spartan/setup_test_wallets.d.ts +9 -2
  98. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  99. package/dest/spartan/setup_test_wallets.js +93 -35
  100. package/dest/spartan/tx_metrics.d.ts +48 -2
  101. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  102. package/dest/spartan/tx_metrics.js +310 -6
  103. package/dest/spartan/utils/bot.d.ts +28 -0
  104. package/dest/spartan/utils/bot.d.ts.map +1 -0
  105. package/dest/spartan/utils/bot.js +142 -0
  106. package/dest/spartan/utils/chaos.d.ts +79 -0
  107. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  108. package/dest/spartan/utils/chaos.js +142 -0
  109. package/dest/spartan/utils/clients.d.ts +39 -0
  110. package/dest/spartan/utils/clients.d.ts.map +1 -0
  111. package/dest/spartan/utils/clients.js +90 -0
  112. package/dest/spartan/utils/config.d.ts +42 -0
  113. package/dest/spartan/utils/config.d.ts.map +1 -0
  114. package/dest/spartan/utils/config.js +22 -0
  115. package/dest/spartan/utils/health.d.ts +63 -0
  116. package/dest/spartan/utils/health.d.ts.map +1 -0
  117. package/dest/spartan/utils/health.js +202 -0
  118. package/dest/spartan/utils/helm.d.ts +15 -0
  119. package/dest/spartan/utils/helm.d.ts.map +1 -0
  120. package/dest/spartan/utils/helm.js +47 -0
  121. package/dest/spartan/utils/index.d.ts +10 -0
  122. package/dest/spartan/utils/index.d.ts.map +1 -0
  123. package/dest/spartan/utils/index.js +20 -0
  124. package/dest/spartan/utils/k8s.d.ts +128 -0
  125. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  126. package/dest/spartan/utils/k8s.js +381 -0
  127. package/dest/spartan/utils/nodes.d.ts +40 -0
  128. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  129. package/dest/spartan/utils/nodes.js +461 -0
  130. package/dest/spartan/utils/scripts.d.ts +30 -0
  131. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  132. package/dest/spartan/utils/scripts.js +81 -0
  133. package/dest/spartan/utils.d.ts +2 -260
  134. package/dest/spartan/utils.d.ts.map +1 -1
  135. package/dest/spartan/utils.js +1 -942
  136. package/dest/test-wallet/test_wallet.d.ts +83 -0
  137. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  138. package/dest/test-wallet/test_wallet.js +214 -0
  139. package/dest/test-wallet/utils.d.ts +41 -0
  140. package/dest/test-wallet/utils.d.ts.map +1 -0
  141. package/dest/test-wallet/utils.js +71 -0
  142. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  143. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  144. package/dest/test-wallet/wallet_worker_script.js +48 -0
  145. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  146. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  147. package/dest/test-wallet/worker_wallet.js +151 -0
  148. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  149. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  150. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  151. package/package.json +46 -43
  152. package/src/bench/client_flows/client_flows_benchmark.ts +45 -57
  153. package/src/bench/client_flows/config.ts +9 -1
  154. package/src/bench/utils.ts +15 -8
  155. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +33 -23
  156. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  157. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  158. package/src/e2e_epochs/epochs_test.ts +129 -93
  159. package/src/e2e_fees/bridging_race.notest.ts +2 -5
  160. package/src/e2e_fees/fees_test.ts +24 -39
  161. package/src/e2e_l1_publisher/write_json.ts +3 -8
  162. package/src/e2e_nested_contract/nested_contract_test.ts +7 -7
  163. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  164. package/src/e2e_p2p/p2p_network.ts +49 -17
  165. package/src/e2e_p2p/reqresp/utils.ts +235 -0
  166. package/src/e2e_p2p/shared.ts +66 -23
  167. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  168. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  169. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  170. package/src/e2e_token_contract/token_contract_test.ts +27 -12
  171. package/src/fixtures/authwit_proxy.ts +50 -0
  172. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  173. package/src/fixtures/e2e_prover_test.ts +43 -52
  174. package/src/fixtures/elu_monitor.ts +126 -0
  175. package/src/fixtures/fixtures.ts +10 -0
  176. package/src/fixtures/ha_setup.ts +186 -0
  177. package/src/fixtures/index.ts +1 -0
  178. package/src/fixtures/setup.ts +120 -233
  179. package/src/fixtures/setup_p2p_test.ts +40 -44
  180. package/src/fixtures/token_utils.ts +10 -6
  181. package/src/guides/up_quick_start.sh +3 -3
  182. package/src/shared/cross_chain_test_harness.ts +24 -34
  183. package/src/shared/gas_portal_test_harness.ts +2 -2
  184. package/src/shared/index.ts +1 -0
  185. package/src/shared/jest_setup.ts +51 -1
  186. package/src/shared/mock_state_view.ts +188 -0
  187. package/src/shared/submit-transactions.ts +11 -16
  188. package/src/shared/uniswap_l1_l2.ts +26 -33
  189. package/src/simulators/lending_simulator.ts +6 -4
  190. package/src/simulators/token_simulator.ts +6 -30
  191. package/src/spartan/setup_test_wallets.ts +120 -25
  192. package/src/spartan/tx_metrics.ts +232 -9
  193. package/src/spartan/utils/bot.ts +188 -0
  194. package/src/spartan/utils/chaos.ts +253 -0
  195. package/src/spartan/utils/clients.ts +100 -0
  196. package/src/spartan/utils/config.ts +28 -0
  197. package/src/spartan/utils/health.ts +255 -0
  198. package/src/spartan/utils/helm.ts +84 -0
  199. package/src/spartan/utils/index.ts +68 -0
  200. package/src/spartan/utils/k8s.ts +535 -0
  201. package/src/spartan/utils/nodes.ts +543 -0
  202. package/src/spartan/utils/scripts.ts +99 -0
  203. package/src/spartan/utils.ts +1 -1246
  204. package/src/test-wallet/test_wallet.ts +306 -0
  205. package/src/test-wallet/utils.ts +112 -0
  206. package/src/test-wallet/wallet_worker_script.ts +60 -0
  207. package/src/test-wallet/worker_wallet.ts +213 -0
  208. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -4,14 +4,12 @@
4
4
  import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
5
5
  import { range } from '@aztec/foundation/array';
6
6
  import { SecretValue } from '@aztec/foundation/config';
7
- import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
7
+ import { withLoggerBindings } from '@aztec/foundation/log/server';
8
8
  import { bufferToHex } from '@aztec/foundation/string';
9
9
  import type { DateProvider } from '@aztec/foundation/timer';
10
- import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
11
10
  import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
12
11
 
13
12
  import getPort from 'get-port';
14
- import { AsyncLocalStorage } from 'node:async_hooks';
15
13
 
16
14
  import { TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
17
15
  import { createAndSyncProverNode, getPrivateKeyFromIndex } from './utils.js';
@@ -22,6 +20,11 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
22
20
  // to avoid running validators with the same key
23
21
  export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
24
22
 
23
+ // Global counters for actor naming (start at 1)
24
+ let validatorCounter = 1;
25
+ let nodeCounter = 1;
26
+ let proverCounter = 1;
27
+
25
28
  export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
26
29
  const privateKeys: `0x${string}`[] = [];
27
30
  // Do not start from 0 as it is used during setup
@@ -44,10 +47,6 @@ export async function createNodes(
44
47
  validatorsPerNode = 1,
45
48
  ): Promise<AztecNodeService[]> {
46
49
  const nodePromises: Promise<AztecNodeService>[] = [];
47
- const loggerIdStorage = new AsyncLocalStorage<string>();
48
- const logNameHandler = (module: string) =>
49
- loggerIdStorage.getStore() ? `${module}:${loggerIdStorage.getStore()}` : module;
50
- addLogNameHandler(logNameHandler);
51
50
 
52
51
  for (let i = 0; i < numNodes; i++) {
53
52
  const index = indexOffset + i;
@@ -69,7 +68,6 @@ export async function createNodes(
69
68
  prefilledPublicData,
70
69
  dataDir,
71
70
  metricsPort,
72
- loggerIdStorage,
73
71
  );
74
72
  nodePromises.push(nodePromise);
75
73
  }
@@ -81,13 +79,20 @@ export async function createNodes(
81
79
  throw new Error('Sequencer not found');
82
80
  }
83
81
 
84
- removeLogNameHandler(logNameHandler);
85
82
  return nodes;
86
83
  }
87
84
 
88
- /** Creates a P2P enabled instance of Aztec Node Service with a validator */
85
+ /** Extended config type for createNode with test-specific overrides. */
86
+ export type CreateNodeConfig = AztecNodeConfig & {
87
+ /** Whether to skip starting the sequencer. */
88
+ dontStartSequencer?: boolean;
89
+ /** Override the private key (instead of deriving from addressIndex). */
90
+ validatorPrivateKey?: `0x${string}`;
91
+ };
92
+
93
+ /** Creates a P2P enabled instance of Aztec Node Service with a validator. */
89
94
  export async function createNode(
90
- config: AztecNodeConfig & { dontStartSequencer?: boolean },
95
+ config: CreateNodeConfig,
91
96
  dateProvider: DateProvider,
92
97
  tcpPort: number,
93
98
  bootstrapNode: string | undefined,
@@ -95,9 +100,9 @@ export async function createNode(
95
100
  prefilledPublicData?: PublicDataTreeLeaf[],
96
101
  dataDirectory?: string,
97
102
  metricsPort?: number,
98
- loggerIdStorage?: AsyncLocalStorage<string>,
99
103
  ) {
100
- const createNode = async () => {
104
+ const actorIndex = validatorCounter++;
105
+ return await withLoggerBindings({ actor: `validator-${actorIndex}` }, async () => {
101
106
  const validatorConfig = await createValidatorConfig(config, bootstrapNode, tcpPort, addressIndex, dataDirectory);
102
107
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
103
108
  return await AztecNodeService.createAndSync(
@@ -105,8 +110,7 @@ export async function createNode(
105
110
  { telemetry, dateProvider },
106
111
  { prefilledPublicData, dontStartSequencer: config.dontStartSequencer },
107
112
  );
108
- };
109
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
113
+ });
110
114
  }
111
115
 
112
116
  /** Creates a P2P enabled instance of Aztec Node Service without a validator */
@@ -118,20 +122,19 @@ export async function createNonValidatorNode(
118
122
  prefilledPublicData?: PublicDataTreeLeaf[],
119
123
  dataDirectory?: string,
120
124
  metricsPort?: number,
121
- loggerIdStorage?: AsyncLocalStorage<string>,
122
125
  ) {
123
- const createNode = async () => {
126
+ const actorIndex = nodeCounter++;
127
+ return await withLoggerBindings({ actor: `node-${actorIndex}` }, async () => {
124
128
  const p2pConfig = await createP2PConfig(baseConfig, bootstrapNode, tcpPort, dataDirectory);
125
129
  const config: AztecNodeConfig = {
126
130
  ...p2pConfig,
127
131
  disableValidator: true,
128
132
  validatorPrivateKeys: undefined,
129
- publisherPrivateKeys: [],
133
+ sequencerPublisherPrivateKeys: [],
130
134
  };
131
135
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
132
136
  return await AztecNodeService.createAndSync(config, { telemetry, dateProvider }, { prefilledPublicData });
133
- };
134
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createNode) : createNode();
137
+ });
135
138
  }
136
139
 
137
140
  export async function createProverNode(
@@ -139,34 +142,26 @@ export async function createProverNode(
139
142
  tcpPort: number,
140
143
  bootstrapNode: string | undefined,
141
144
  addressIndex: number,
142
- proverNodeDeps: ProverNodeDeps & Required<Pick<ProverNodeDeps, 'dateProvider'>>,
145
+ deps: { dateProvider: DateProvider },
143
146
  prefilledPublicData?: PublicDataTreeLeaf[],
144
147
  dataDirectory?: string,
145
148
  metricsPort?: number,
146
- loggerIdStorage?: AsyncLocalStorage<string>,
147
- ) {
148
- const createProverNode = async () => {
149
+ ): Promise<{ proverNode: AztecNodeService }> {
150
+ const actorIndex = proverCounter++;
151
+ return await withLoggerBindings({ actor: `prover-${actorIndex}` }, async () => {
149
152
  const proverNodePrivateKey = getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + addressIndex)!;
150
153
  const telemetry = await getEndToEndTestTelemetryClient(metricsPort);
151
154
 
152
- const proverConfig: Partial<ProverNodeConfig> = await createP2PConfig(
153
- config,
154
- bootstrapNode,
155
- tcpPort,
156
- dataDirectory,
157
- );
155
+ const p2pConfig = await createP2PConfig(config, bootstrapNode, tcpPort, dataDirectory);
158
156
 
159
- const aztecNodeRpcTxProvider = undefined;
160
157
  return await createAndSyncProverNode(
161
158
  bufferToHex(proverNodePrivateKey),
162
- config,
163
- { ...proverConfig, dataDirectory },
164
- aztecNodeRpcTxProvider,
165
- prefilledPublicData,
166
- { ...proverNodeDeps, telemetry },
159
+ { ...config, ...p2pConfig },
160
+ { dataDirectory },
161
+ { ...deps, telemetry },
162
+ { prefilledPublicData: prefilledPublicData ?? [] },
167
163
  );
168
- };
169
- return loggerIdStorage ? await loggerIdStorage.run(tcpPort.toString(), createProverNode) : createProverNode();
164
+ });
170
165
  }
171
166
 
172
167
  export async function createP2PConfig(
@@ -192,26 +187,27 @@ export async function createP2PConfig(
192
187
  }
193
188
 
194
189
  export async function createValidatorConfig(
195
- config: AztecNodeConfig,
190
+ config: CreateNodeConfig,
196
191
  bootstrapNodeEnr?: string,
197
192
  port?: number,
198
193
  addressIndex: number | number[] = 1,
199
194
  dataDirectory?: string,
200
195
  ) {
201
196
  const addressIndices = Array.isArray(addressIndex) ? addressIndex : [addressIndex];
202
- if (addressIndices.length === 0) {
197
+ if (addressIndices.length === 0 && !config.validatorPrivateKey) {
203
198
  throw new Error('At least one address index must be provided to create a validator config');
204
199
  }
205
200
 
206
- const attesterPrivateKeys = addressIndices.map(index =>
207
- bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!),
208
- );
201
+ // Use override private key if provided, otherwise derive from address indices
202
+ const attesterPrivateKeys = config.validatorPrivateKey
203
+ ? [config.validatorPrivateKey]
204
+ : addressIndices.map(index => bufferToHex(getPrivateKeyFromIndex(ATTESTER_PRIVATE_KEYS_START_INDEX + index)!));
209
205
  const p2pConfig = await createP2PConfig(config, bootstrapNodeEnr, port, dataDirectory);
210
206
  const nodeConfig: AztecNodeConfig = {
211
207
  ...config,
212
208
  ...p2pConfig,
213
209
  validatorPrivateKeys: new SecretValue(attesterPrivateKeys),
214
- publisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
210
+ sequencerPublisherPrivateKeys: [new SecretValue(attesterPrivateKeys[0])],
215
211
  };
216
212
 
217
213
  return nodeConfig;
@@ -6,9 +6,12 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
- .send({ from: admin })
11
- .wait();
9
+ const {
10
+ receipt: { contract, instance },
11
+ } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
12
+ from: admin,
13
+ wait: { returnReceipt: true },
14
+ });
12
15
 
13
16
  if (initialAdminBalance > 0n) {
14
17
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -24,8 +27,9 @@ export async function mintTokensToPrivate(
24
27
  minter: AztecAddress,
25
28
  recipient: AztecAddress,
26
29
  amount: bigint,
30
+ additionalScopes?: AztecAddress[],
27
31
  ) {
28
- await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
32
+ await token.methods.mint_to_private(recipient, amount).send({ from: minter, additionalScopes });
29
33
  }
30
34
 
31
35
  export async function expectTokenBalance(
@@ -37,7 +41,7 @@ export async function expectTokenBalance(
37
41
  ) {
38
42
  // Then check the balance
39
43
  const contractWithWallet = TokenContract.at(token.address, wallet);
40
- const balance = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
44
+ const { result: balance } = await contractWithWallet.methods.balance_of_private(owner).simulate({ from: owner });
41
45
  logger.info(`Account ${owner} balance: ${balance}`);
42
46
  expect(balance).toBe(expectedBalance);
43
47
  }
@@ -55,7 +59,7 @@ export async function mintNotes(
55
59
  for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
56
60
  const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
57
61
  const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
58
- await new BatchCall(wallet, actions).send({ from: minter }).wait();
62
+ await new BatchCall(wallet, actions).send({ from: minter });
59
63
  }
60
64
 
61
65
  return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
@@ -23,6 +23,8 @@ aztec-wallet create-account -a alice -f test0
23
23
  aztec-wallet create-account -a bob -f test0
24
24
  # docs:end:declare-accounts
25
25
 
26
+ aztec-wallet bridge-fee-juice 1000000000000000000000 accounts:alice --mint --no-wait
27
+
26
28
  DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
27
29
  TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
28
30
  echo "Deployed contract at $TOKEN_ADDRESS"
@@ -38,9 +40,7 @@ fi
38
40
 
39
41
  TRANSFER_AMOUNT=42
40
42
 
41
- aztec-wallet create-authwit transfer_in_private accounts:test0 -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f alice
42
-
43
- aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
43
+ aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 0 -f alice --payment method=fee_juice,claim
44
44
 
45
45
  # Test end result
46
46
  ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
@@ -18,7 +18,6 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
18
18
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
19
  import { EpochNumber } from '@aztec/foundation/branded-types';
20
20
  import { retryUntil } from '@aztec/foundation/retry';
21
- import type { FieldsOf } from '@aztec/foundation/types';
22
21
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
23
22
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
24
23
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
@@ -74,26 +73,26 @@ export async function deployAndInitializeTokenAndBridgeContracts(
74
73
  });
75
74
 
76
75
  // deploy l2 token
77
- const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
78
- .send({ from: owner })
79
- .deployed();
76
+ const { contract: token } = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({
77
+ from: owner,
78
+ });
80
79
 
81
80
  // deploy l2 token bridge and attach to the portal
82
- const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
83
- .send({ from: owner })
84
- .deployed();
81
+ const { contract: bridge } = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({
82
+ from: owner,
83
+ });
85
84
 
86
- if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
85
+ if ((await token.methods.get_admin().simulate({ from: owner })).result !== owner.toBigInt()) {
87
86
  throw new Error(`Token admin is not ${owner}`);
88
87
  }
89
88
 
90
- if (!(await bridge.methods.get_config().simulate({ from: owner })).token.equals(token.address)) {
89
+ if (!(await bridge.methods.get_config().simulate({ from: owner })).result.token.equals(token.address)) {
91
90
  throw new Error(`Bridge token is not ${token.address}`);
92
91
  }
93
92
 
94
93
  // make the bridge a minter on the token:
95
- await token.methods.set_minter(bridge.address, true).send({ from: owner }).wait();
96
- if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
94
+ await token.methods.set_minter(bridge.address, true).send({ from: owner });
95
+ if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })).result === 1n) {
97
96
  throw new Error(`Bridge is not a minter`);
98
97
  }
99
98
 
@@ -235,7 +234,7 @@ export class CrossChainTestHarness {
235
234
 
236
235
  async mintTokensPublicOnL2(amount: bigint) {
237
236
  this.logger.info('Minting tokens on L2 publicly');
238
- await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress }).wait();
237
+ await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress });
239
238
  }
240
239
 
241
240
  async mintTokensPrivateOnL2(amount: bigint) {
@@ -246,8 +245,7 @@ export class CrossChainTestHarness {
246
245
  // send a transfer tx to force through rollup with the message included
247
246
  await this.l2Token.methods
248
247
  .transfer_in_public(this.ownerAddress, receiverAddress, transferAmount, 0)
249
- .send({ from: this.ownerAddress })
250
- .wait();
248
+ .send({ from: this.ownerAddress });
251
249
  }
252
250
 
253
251
  async consumeMessageOnAztecAndMintPrivately(
@@ -257,8 +255,7 @@ export class CrossChainTestHarness {
257
255
  const { recipient, claimAmount, claimSecret: secretForL2MessageConsumption, messageLeafIndex } = claim;
258
256
  await this.l2Bridge.methods
259
257
  .claim_private(recipient, claimAmount, secretForL2MessageConsumption, messageLeafIndex)
260
- .send({ from: this.ownerAddress })
261
- .wait();
258
+ .send({ from: this.ownerAddress });
262
259
  }
263
260
 
264
261
  async consumeMessageOnAztecAndMintPublicly(
@@ -268,34 +265,31 @@ export class CrossChainTestHarness {
268
265
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
269
266
  await this.l2Bridge.methods
270
267
  .claim_public(this.ownerAddress, claimAmount, claimSecret, messageLeafIndex)
271
- .send({ from: this.ownerAddress })
272
- .wait();
268
+ .send({ from: this.ownerAddress });
273
269
  }
274
270
 
275
271
  async withdrawPrivateFromAztecToL1(
276
272
  withdrawAmount: bigint,
277
273
  authwitNonce: Fr = Fr.ZERO,
278
274
  authWitness: AuthWitness,
279
- ): Promise<FieldsOf<TxReceipt>> {
280
- const withdrawReceipt = await this.l2Bridge.methods
275
+ ): Promise<TxReceipt> {
276
+ const { receipt: withdrawReceipt } = await this.l2Bridge.methods
281
277
  .exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
282
- .send({ authWitnesses: [authWitness], from: this.ownerAddress })
283
- .wait();
278
+ .send({ authWitnesses: [authWitness], from: this.ownerAddress });
284
279
 
285
280
  return withdrawReceipt;
286
281
  }
287
282
 
288
- async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<FieldsOf<TxReceipt>> {
289
- const withdrawReceipt = await this.l2Bridge.methods
283
+ async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
284
+ const { receipt: withdrawReceipt } = await this.l2Bridge.methods
290
285
  .exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
291
- .send({ from: this.ownerAddress })
292
- .wait();
286
+ .send({ from: this.ownerAddress });
293
287
 
294
288
  return withdrawReceipt;
295
289
  }
296
290
 
297
291
  async getL2PrivateBalanceOf(owner: AztecAddress) {
298
- return await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner });
292
+ return (await this.l2Token.methods.balance_of_private(owner).simulate({ from: owner })).result;
299
293
  }
300
294
 
301
295
  async expectPrivateBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -305,7 +299,7 @@ export class CrossChainTestHarness {
305
299
  }
306
300
 
307
301
  async getL2PublicBalanceOf(owner: AztecAddress) {
308
- return await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress });
302
+ return (await this.l2Token.methods.balance_of_public(owner).simulate({ from: this.ownerAddress })).result;
309
303
  }
310
304
 
311
305
  async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -333,18 +327,14 @@ export class CrossChainTestHarness {
333
327
 
334
328
  async transferToPrivateOnL2(shieldAmount: bigint) {
335
329
  this.logger.info('Transferring to private on L2');
336
- await this.l2Token.methods
337
- .transfer_to_private(this.ownerAddress, shieldAmount)
338
- .send({ from: this.ownerAddress })
339
- .wait();
330
+ await this.l2Token.methods.transfer_to_private(this.ownerAddress, shieldAmount).send({ from: this.ownerAddress });
340
331
  }
341
332
 
342
333
  async transferToPublicOnL2(amount: bigint, authwitNonce = Fr.ZERO) {
343
334
  this.logger.info('Transferring tokens to public');
344
335
  await this.l2Token.methods
345
336
  .transfer_to_public(this.ownerAddress, this.ownerAddress, amount, authwitNonce)
346
- .send({ from: this.ownerAddress })
347
- .wait();
337
+ .send({ from: this.ownerAddress });
348
338
  }
349
339
 
350
340
  /**
@@ -127,11 +127,11 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
127
127
  async consumeMessageOnAztecAndClaimPrivately(owner: AztecAddress, claimer: AztecAddress, claim: L2AmountClaim) {
128
128
  this.logger.info('Consuming messages on L2 Privately');
129
129
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
130
- await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer }).wait();
130
+ await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer });
131
131
  }
132
132
 
133
133
  async getL2PublicBalanceOf(owner: AztecAddress) {
134
- return await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner });
134
+ return (await this.feeJuice.methods.balance_of_public(owner).simulate({ from: owner })).result;
135
135
  }
136
136
 
137
137
  async expectPublicBalanceOnL2(owner: AztecAddress, expectedBalance: bigint) {
@@ -1 +1,2 @@
1
1
  export { uniswapL1L2TestSuite } from './uniswap_l1_l2.js';
2
+ export { MockStateView, diffInBps } from './mock_state_view.js';
@@ -1,8 +1,19 @@
1
1
  import { createLogger } from '@aztec/aztec.js/log';
2
2
 
3
- import { beforeEach, expect } from '@jest/globals';
3
+ import { afterAll, afterEach, beforeEach, expect } from '@jest/globals';
4
+ import { readlinkSync } from 'fs';
4
5
  import { basename } from 'path';
5
6
 
7
+ import { EluMonitor } from '../fixtures/elu_monitor.js';
8
+
9
+ const eluMonitor = process.env.ELU_MONITOR_FILE
10
+ ? new EluMonitor(process.env.ELU_MONITOR_FILE, Number(process.env.ELU_MONITOR_INTERVAL_MS) || undefined)
11
+ : undefined;
12
+
13
+ if (eluMonitor) {
14
+ process.on('exit', () => eluMonitor.stop());
15
+ }
16
+
6
17
  beforeEach(() => {
7
18
  const { testPath, currentTestName } = expect.getState();
8
19
  if (!testPath || !currentTestName) {
@@ -10,4 +21,43 @@ beforeEach(() => {
10
21
  }
11
22
  const logger = createLogger(`e2e:${basename(testPath).replace('.test.ts', '')}`);
12
23
  logger.info(`Running test: ${currentTestName}`);
24
+ eluMonitor?.startTest(currentTestName);
25
+ });
26
+
27
+ afterEach(() => {
28
+ eluMonitor?.stopTest();
29
+ });
30
+
31
+ // Log leaked handles after all tests complete. This runs after test-level afterAll hooks,
32
+ // so any handles still alive at this point were not properly cleaned up during teardown.
33
+ // This diagnostic helps identify the source of exit hangs without masking them.
34
+ afterAll(() => {
35
+ const handles = (process as any)._getActiveHandles();
36
+ if (handles.length > 0) {
37
+ const details = handles.map((h: any) => {
38
+ const type = h?.constructor?.name ?? typeof h;
39
+ const fd = h?.fd ?? h?._handle?.fd ?? '?';
40
+ const destroyed = h?.destroyed ?? '?';
41
+ const hasRef = typeof h?.hasRef === 'function' ? h.hasRef() : '?';
42
+ const localAddr = h?.localAddress ?? '';
43
+ const remoteAddr = h?.remoteAddress ?? '';
44
+ const localPort = h?.localPort ?? '';
45
+ const remotePort = h?.remotePort ?? '';
46
+ const proto = Object.getPrototypeOf(h)?.constructor?.name ?? '?';
47
+ const keys = Object.keys(h).slice(0, 10).join(',');
48
+ let fdTarget = '';
49
+ if (typeof fd === 'number') {
50
+ try {
51
+ fdTarget = ` -> ${readlinkSync(`/proc/self/fd/${fd}`)}`;
52
+ } catch {
53
+ // ignore
54
+ }
55
+ }
56
+ return ` ${type}(fd=${fd}, destroyed=${destroyed}, hasRef=${hasRef}${fdTarget}) proto=${proto} addr=${localAddr}:${localPort}->${remoteAddr}:${remotePort} keys=[${keys}]`;
57
+ });
58
+ process.stderr.write(
59
+ `\n[jest_setup] WARNING: ${handles.length} handle(s) still active after teardown:\n${details.join('\n')}\n` +
60
+ `These may prevent Jest from exiting. Investigate and fix the leak.\n\n`,
61
+ );
62
+ }
13
63
  });