@aztec/end-to-end 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2 → 0.77.0-testnet-ignition.21

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 (138) hide show
  1. package/README.md +2 -0
  2. package/dest/bench/utils.d.ts +70 -0
  3. package/dest/bench/utils.d.ts.map +1 -0
  4. package/dest/bench/utils.js +24 -8
  5. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +46 -0
  6. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -0
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +17 -17
  8. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +47 -0
  9. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -0
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +27 -16
  11. package/dest/e2e_deploy_contract/deploy_test.d.ts +28 -0
  12. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -0
  13. package/dest/e2e_deploy_contract/deploy_test.js +4 -7
  14. package/dest/e2e_epochs/epochs_test.d.ts +51 -0
  15. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -0
  16. package/dest/e2e_epochs/epochs_test.js +155 -0
  17. package/dest/e2e_fees/fees_test.d.ts +73 -0
  18. package/dest/e2e_fees/fees_test.d.ts.map +1 -0
  19. package/dest/e2e_fees/fees_test.js +75 -32
  20. package/dest/e2e_nested_contract/nested_contract_test.d.ts +26 -0
  21. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -0
  22. package/dest/e2e_nested_contract/nested_contract_test.js +14 -12
  23. package/dest/e2e_p2p/p2p_network.d.ts +61 -0
  24. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -0
  25. package/dest/e2e_p2p/p2p_network.js +54 -30
  26. package/dest/e2e_p2p/shared.d.ts +10 -0
  27. package/dest/e2e_p2p/shared.d.ts.map +1 -0
  28. package/dest/e2e_p2p/shared.js +7 -8
  29. package/dest/e2e_prover/e2e_prover_test.d.ts +56 -0
  30. package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -0
  31. package/dest/e2e_prover/e2e_prover_test.js +20 -24
  32. package/dest/e2e_token_contract/token_contract_test.d.ts +29 -0
  33. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -0
  34. package/dest/e2e_token_contract/token_contract_test.js +4 -7
  35. package/dest/fixtures/fixtures.d.ts +17 -0
  36. package/dest/fixtures/fixtures.d.ts.map +1 -0
  37. package/dest/fixtures/fixtures.js +2 -2
  38. package/dest/fixtures/get_acvm_config.d.ts +8 -0
  39. package/dest/fixtures/get_acvm_config.d.ts.map +1 -0
  40. package/dest/fixtures/get_acvm_config.js +10 -5
  41. package/dest/fixtures/get_bb_config.d.ts +6 -0
  42. package/dest/fixtures/get_bb_config.d.ts.map +1 -0
  43. package/dest/fixtures/get_bb_config.js +9 -4
  44. package/dest/fixtures/index.d.ts +6 -0
  45. package/dest/fixtures/index.d.ts.map +1 -0
  46. package/dest/fixtures/l1_to_l2_messaging.d.ts +13 -0
  47. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -0
  48. package/dest/fixtures/l1_to_l2_messaging.js +1 -1
  49. package/dest/fixtures/logging.d.ts +8 -0
  50. package/dest/fixtures/logging.d.ts.map +1 -0
  51. package/dest/fixtures/setup_l1_contracts.d.ts +6 -0
  52. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -0
  53. package/dest/fixtures/setup_l1_contracts.js +6 -4
  54. package/dest/fixtures/setup_p2p_test.d.ts +22 -0
  55. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -0
  56. package/dest/fixtures/setup_p2p_test.js +5 -3
  57. package/dest/fixtures/snapshot_manager.d.ts +87 -0
  58. package/dest/fixtures/snapshot_manager.d.ts.map +1 -0
  59. package/dest/fixtures/snapshot_manager.js +67 -74
  60. package/dest/fixtures/token_utils.d.ts +6 -0
  61. package/dest/fixtures/token_utils.d.ts.map +1 -0
  62. package/dest/fixtures/token_utils.js +1 -1
  63. package/dest/fixtures/utils.d.ts +155 -0
  64. package/dest/fixtures/utils.d.ts.map +1 -0
  65. package/dest/fixtures/utils.js +97 -71
  66. package/dest/fixtures/with_telemetry_utils.d.ts +3 -0
  67. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -0
  68. package/dest/index.d.ts +2 -0
  69. package/dest/index.d.ts.map +1 -0
  70. package/dest/quality_of_service/alert_checker.d.ts +41 -0
  71. package/dest/quality_of_service/alert_checker.d.ts.map +1 -0
  72. package/dest/quality_of_service/alert_checker.js +4 -1
  73. package/dest/sample-dapp/index.js +1 -1
  74. package/dest/shared/cross_chain_test_harness.d.ts +124 -0
  75. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -0
  76. package/dest/shared/cross_chain_test_harness.js +6 -17
  77. package/dest/shared/gas_portal_test_harness.d.ts +80 -0
  78. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -0
  79. package/dest/shared/gas_portal_test_harness.js +11 -4
  80. package/dest/shared/index.d.ts +2 -0
  81. package/dest/shared/index.d.ts.map +1 -0
  82. package/dest/shared/index.js +0 -1
  83. package/dest/shared/jest_setup.d.ts +2 -0
  84. package/dest/shared/jest_setup.d.ts.map +1 -0
  85. package/dest/shared/submit-transactions.d.ts +4 -0
  86. package/dest/shared/submit-transactions.d.ts.map +1 -0
  87. package/dest/shared/submit-transactions.js +9 -17
  88. package/dest/shared/uniswap_l1_l2.d.ts +25 -0
  89. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -0
  90. package/dest/shared/uniswap_l1_l2.js +5 -10
  91. package/dest/simulators/index.d.ts +3 -0
  92. package/dest/simulators/index.d.ts.map +1 -0
  93. package/dest/simulators/lending_simulator.d.ts +69 -0
  94. package/dest/simulators/lending_simulator.d.ts.map +1 -0
  95. package/dest/simulators/lending_simulator.js +1 -3
  96. package/dest/simulators/token_simulator.d.ts +29 -0
  97. package/dest/simulators/token_simulator.d.ts.map +1 -0
  98. package/dest/spartan/setup_test_wallets.d.ts +20 -0
  99. package/dest/spartan/setup_test_wallets.d.ts.map +1 -0
  100. package/dest/spartan/setup_test_wallets.js +72 -38
  101. package/dest/spartan/utils.d.ts +415 -0
  102. package/dest/spartan/utils.d.ts.map +1 -0
  103. package/dest/spartan/utils.js +169 -43
  104. package/package.json +35 -40
  105. package/src/bench/utils.ts +30 -13
  106. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +40 -30
  107. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +34 -18
  108. package/src/e2e_deploy_contract/deploy_test.ts +6 -11
  109. package/src/e2e_epochs/epochs_test.ts +217 -0
  110. package/src/e2e_fees/fees_test.ts +84 -38
  111. package/src/e2e_nested_contract/nested_contract_test.ts +14 -16
  112. package/src/e2e_p2p/p2p_network.ts +67 -47
  113. package/src/e2e_p2p/shared.ts +16 -10
  114. package/src/e2e_prover/e2e_prover_test.ts +56 -37
  115. package/src/e2e_token_contract/token_contract_test.ts +10 -11
  116. package/src/fixtures/fixtures.ts +2 -2
  117. package/src/fixtures/get_acvm_config.ts +7 -3
  118. package/src/fixtures/get_bb_config.ts +6 -2
  119. package/src/fixtures/l1_to_l2_messaging.ts +6 -13
  120. package/src/fixtures/setup_l1_contracts.ts +8 -7
  121. package/src/fixtures/setup_p2p_test.ts +8 -6
  122. package/src/fixtures/snapshot_manager.ts +72 -79
  123. package/src/fixtures/token_utils.ts +2 -2
  124. package/src/fixtures/utils.ts +135 -97
  125. package/src/guides/up_quick_start.sh +10 -5
  126. package/src/quality_of_service/alert_checker.ts +6 -2
  127. package/src/sample-dapp/index.mjs +1 -1
  128. package/src/shared/cross_chain_test_harness.ts +17 -35
  129. package/src/shared/gas_portal_test_harness.ts +21 -11
  130. package/src/shared/index.ts +0 -1
  131. package/src/shared/submit-transactions.ts +16 -20
  132. package/src/shared/uniswap_l1_l2.ts +35 -26
  133. package/src/simulators/lending_simulator.ts +5 -6
  134. package/src/simulators/token_simulator.ts +1 -1
  135. package/src/spartan/setup_test_wallets.ts +111 -37
  136. package/src/spartan/utils.ts +161 -54
  137. package/dest/shared/browser.js +0 -163
  138. package/src/shared/browser.ts +0 -272
@@ -6,20 +6,33 @@ import { z } from 'zod';
6
6
  import { AlertChecker } from '../quality_of_service/alert_checker.js';
7
7
  const execAsync = promisify(exec);
8
8
  const logger = createLogger('e2e:k8s-utils');
9
+ const ethereumHostsSchema = z.string().refine((str)=>str.split(',').every((url)=>{
10
+ try {
11
+ new URL(url.trim());
12
+ return true;
13
+ } catch {
14
+ return false;
15
+ }
16
+ }), 'ETHEREUM_HOSTS must be a comma-separated list of valid URLs');
9
17
  const k8sLocalConfigSchema = z.object({
18
+ ETHEREUM_SLOT_DURATION: z.coerce.number().min(1, 'ETHEREUM_SLOT_DURATION env variable must be set'),
19
+ AZTEC_SLOT_DURATION: z.coerce.number().min(1, 'AZTEC_SLOT_DURATION env variable must be set'),
20
+ AZTEC_EPOCH_DURATION: z.coerce.number().min(1, 'AZTEC_EPOCH_DURATION env variable must be set'),
21
+ AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().min(1, 'AZTEC_PROOF_SUBMISSION_WINDOW env variable must be set'),
10
22
  INSTANCE_NAME: z.string().min(1, 'INSTANCE_NAME env variable must be set'),
11
23
  NAMESPACE: z.string().min(1, 'NAMESPACE env variable must be set'),
12
- HOST_NODE_PORT: z.coerce.number().min(1, 'HOST_NODE_PORT env variable must be set'),
13
24
  CONTAINER_NODE_PORT: z.coerce.number().default(8080),
14
- HOST_PXE_PORT: z.coerce.number().min(1, 'HOST_PXE_PORT env variable must be set'),
25
+ CONTAINER_SEQUENCER_PORT: z.coerce.number().default(8080),
26
+ CONTAINER_PROVER_NODE_PORT: z.coerce.number().default(8080),
15
27
  CONTAINER_PXE_PORT: z.coerce.number().default(8080),
16
- HOST_ETHEREUM_PORT: z.coerce.number().min(1, 'HOST_ETHEREUM_PORT env variable must be set'),
17
28
  CONTAINER_ETHEREUM_PORT: z.coerce.number().default(8545),
18
- HOST_METRICS_PORT: z.coerce.number().min(1, 'HOST_METRICS_PORT env variable must be set'),
19
29
  CONTAINER_METRICS_PORT: z.coerce.number().default(80),
20
30
  GRAFANA_PASSWORD: z.string().optional(),
21
31
  METRICS_API_PATH: z.string().default('/api/datasources/proxy/uid/spartan-metrics-prometheus/api/v1'),
22
32
  SPARTAN_DIR: z.string().min(1, 'SPARTAN_DIR env variable must be set'),
33
+ ETHEREUM_HOSTS: ethereumHostsSchema.optional(),
34
+ L1_ACCOUNT_MNEMONIC: z.string().default('test test test test test test test test test test test junk'),
35
+ SEPOLIA_RUN: z.string().default('false'),
23
36
  K8S: z.literal('local')
24
37
  });
25
38
  const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
@@ -30,7 +43,7 @@ const k8sGCloudConfigSchema = k8sLocalConfigSchema.extend({
30
43
  const directConfigSchema = z.object({
31
44
  PXE_URL: z.string().url('PXE_URL must be a valid URL'),
32
45
  NODE_URL: z.string().url('NODE_URL must be a valid URL'),
33
- ETHEREUM_HOST: z.string().url('ETHEREUM_HOST must be a valid URL'),
46
+ ETHEREUM_HOSTS: ethereumHostsSchema,
34
47
  K8S: z.literal('false')
35
48
  });
36
49
  const envSchema = z.discriminatedUnion('K8S', [
@@ -53,25 +66,14 @@ export function setupEnvironment(env) {
53
66
  return config;
54
67
  }
55
68
  export async function startPortForward({ resource, namespace, containerPort, hostPort }) {
56
- // check if kubectl is already forwarding this port
57
- try {
58
- const command = `ps aux | grep 'kubectl.*${hostPort}:${containerPort}' | grep -v grep | awk '{print $2}'`;
59
- const { stdout: processId } = await execAsync(command);
60
- if (processId) {
61
- logger.info(`Restarting port forward for ${resource}:${hostPort}`);
62
- // kill the existing port forward
63
- await execAsync(`kill -9 ${processId}`);
64
- }
65
- } catch (e) {
66
- logger.info(`No existing port forward found for ${resource}:${hostPort}`);
67
- }
68
- logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPort}:${containerPort}`);
69
+ const hostPortAsString = hostPort ? hostPort.toString() : '';
70
+ logger.info(`kubectl port-forward -n ${namespace} ${resource} ${hostPortAsString}:${containerPort}`);
69
71
  const process = spawn('kubectl', [
70
72
  'port-forward',
71
73
  '-n',
72
74
  namespace,
73
75
  resource,
74
- `${hostPort}:${containerPort}`
76
+ `${hostPortAsString}:${containerPort}`
75
77
  ], {
76
78
  detached: true,
77
79
  windowsHide: true,
@@ -81,24 +83,54 @@ export async function startPortForward({ resource, namespace, containerPort, hos
81
83
  'pipe'
82
84
  ]
83
85
  });
84
- process.stdout?.on('data', (data)=>{
85
- const str = data.toString();
86
- if (str.includes('Starting port forward')) {
87
- logger.info(str);
88
- } else {
89
- logger.debug(str);
90
- }
91
- });
92
- process.stderr?.on('data', (data)=>{
93
- // It's a strange thing:
94
- // If we don't pipe stderr, then the port forwarding does not work.
95
- // Log to silent because this doesn't actually report errors,
96
- // just extremely verbose debug logs.
97
- logger.silent(data.toString());
86
+ let isResolved = false;
87
+ const connected = new Promise((resolve)=>{
88
+ process.stdout?.on('data', (data)=>{
89
+ const str = data.toString();
90
+ if (!isResolved && str.includes('Forwarding from')) {
91
+ isResolved = true;
92
+ logger.info(str);
93
+ const port = str.search(/:\d+/);
94
+ if (port === -1) {
95
+ throw new Error('Port not found in port forward output');
96
+ }
97
+ const portNumber = parseInt(str.slice(port + 1));
98
+ logger.info(`Port forward connected: ${portNumber}`);
99
+ logger.info(`Port forward connected: ${portNumber}`);
100
+ resolve(portNumber);
101
+ } else {
102
+ logger.silent(str);
103
+ }
104
+ });
105
+ process.stderr?.on('data', (data)=>{
106
+ logger.info(data.toString());
107
+ // It's a strange thing:
108
+ // If we don't pipe stderr, then the port forwarding does not work.
109
+ // Log to silent because this doesn't actually report errors,
110
+ // just extremely verbose debug logs.
111
+ logger.silent(data.toString());
112
+ });
113
+ process.on('close', ()=>{
114
+ if (!isResolved) {
115
+ isResolved = true;
116
+ logger.warn('Port forward closed before connection established');
117
+ resolve(0);
118
+ }
119
+ });
120
+ process.on('error', (error)=>{
121
+ logger.error(`Port forward error: ${error}`);
122
+ resolve(0);
123
+ });
124
+ process.on('exit', (code)=>{
125
+ logger.info(`Port forward exited with code ${code}`);
126
+ resolve(0);
127
+ });
98
128
  });
99
- // Wait a moment for the port forward to establish
100
- await new Promise((resolve)=>setTimeout(resolve, 2000));
101
- return process;
129
+ const port = await connected;
130
+ return {
131
+ process,
132
+ port
133
+ };
102
134
  }
103
135
  export async function deleteResourceByName({ resource, namespace, name, force = false }) {
104
136
  const command = `kubectl delete ${resource} ${name} -n ${namespace} --ignore-not-found=true --wait=true ${force ? '--force' : ''}`;
@@ -196,6 +228,26 @@ export function applyProverFailure({ namespace, spartanDir, durationSeconds, log
196
228
  logger
197
229
  });
198
230
  }
231
+ export function applyProverKill({ namespace, spartanDir, logger }) {
232
+ return installChaosMeshChart({
233
+ instanceName: 'prover-kill',
234
+ targetNamespace: namespace,
235
+ valuesFile: 'prover-kill.yaml',
236
+ helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
237
+ clean: true,
238
+ logger
239
+ });
240
+ }
241
+ export function applyProverBrokerKill({ namespace, spartanDir, logger }) {
242
+ return installChaosMeshChart({
243
+ instanceName: 'prover-broker-kill',
244
+ targetNamespace: namespace,
245
+ valuesFile: 'prover-broker-kill.yaml',
246
+ helmChartDir: getChartDir(spartanDir, 'aztec-chaos-scenarios'),
247
+ clean: true,
248
+ logger
249
+ });
250
+ }
199
251
  export function applyBootNodeFailure({ namespace, spartanDir, durationSeconds, logger }) {
200
252
  return installChaosMeshChart({
201
253
  instanceName: 'boot-node-failure',
@@ -273,11 +325,17 @@ export async function enableValidatorDynamicBootNode(instanceName, namespace, sp
273
325
  }
274
326
  export async function runAlertCheck(config, alerts, logger) {
275
327
  if (isK8sConfig(config)) {
328
+ const { process, port } = await startPortForward({
329
+ resource: `svc/metrics-grafana`,
330
+ namespace: 'metrics',
331
+ containerPort: config.CONTAINER_METRICS_PORT
332
+ });
276
333
  const alertChecker = new AlertChecker(logger, {
277
- grafanaEndpoint: `http://localhost:${config.HOST_METRICS_PORT}${config.METRICS_API_PATH}`,
334
+ grafanaEndpoint: `http://localhost:${port}${config.METRICS_API_PATH}`,
278
335
  grafanaCredentials: `admin:${config.GRAFANA_PASSWORD}`
279
336
  });
280
337
  await alertChecker.runAlertCheck(alerts);
338
+ process.kill();
281
339
  } else {
282
340
  logger.info('Not running alert check in non-k8s environment');
283
341
  }
@@ -292,24 +350,23 @@ export async function getSequencers(namespace) {
292
350
  return stdout.split(' ');
293
351
  }
294
352
  export async function updateK8sSequencersConfig(args) {
295
- const { containerPort, hostPort, namespace, config } = args;
353
+ const { containerPort, namespace, config } = args;
296
354
  const sequencers = await getSequencers(namespace);
297
355
  for (const sequencer of sequencers){
298
- await startPortForward({
356
+ const { process, port } = await startPortForward({
299
357
  resource: `pod/${sequencer}`,
300
358
  namespace,
301
- containerPort,
302
- hostPort
359
+ containerPort
303
360
  });
304
- const url = `http://localhost:${hostPort}`;
361
+ const url = `http://localhost:${port}`;
305
362
  await updateSequencerConfig(url, config);
363
+ process.kill();
306
364
  }
307
365
  }
308
366
  export async function updateSequencersConfig(env, config) {
309
367
  if (isK8sConfig(env)) {
310
368
  await updateK8sSequencersConfig({
311
369
  containerPort: env.CONTAINER_NODE_PORT,
312
- hostPort: env.HOST_NODE_PORT,
313
370
  namespace: env.NAMESPACE,
314
371
  config
315
372
  });
@@ -317,3 +374,72 @@ export async function updateSequencersConfig(env, config) {
317
374
  await updateSequencerConfig(env.NODE_URL, config);
318
375
  }
319
376
  }
377
+ /**
378
+ * Rolls the Aztec pods in the given namespace.
379
+ * @param namespace - The namespace to roll the Aztec pods in.
380
+ * @dev - IMPORTANT: This function DOES NOT delete the underlying PVCs.
381
+ * This means that the pods will be restarted with the same persistent storage.
382
+ * This is useful for testing, but you should be aware of the implications.
383
+ */ export async function rollAztecPods(namespace) {
384
+ await deleteResourceByLabel({
385
+ resource: 'pods',
386
+ namespace: namespace,
387
+ label: 'app=boot-node'
388
+ });
389
+ await deleteResourceByLabel({
390
+ resource: 'pods',
391
+ namespace: namespace,
392
+ label: 'app=prover-node'
393
+ });
394
+ await deleteResourceByLabel({
395
+ resource: 'pods',
396
+ namespace: namespace,
397
+ label: 'app=prover-broker'
398
+ });
399
+ await deleteResourceByLabel({
400
+ resource: 'pods',
401
+ namespace: namespace,
402
+ label: 'app=prover-agent'
403
+ });
404
+ await deleteResourceByLabel({
405
+ resource: 'pods',
406
+ namespace: namespace,
407
+ label: 'app=validator'
408
+ });
409
+ await deleteResourceByLabel({
410
+ resource: 'pods',
411
+ namespace: namespace,
412
+ label: 'app=pxe'
413
+ });
414
+ await sleep(10 * 1000);
415
+ await waitForResourceByLabel({
416
+ resource: 'pods',
417
+ namespace: namespace,
418
+ label: 'app=boot-node'
419
+ });
420
+ await waitForResourceByLabel({
421
+ resource: 'pods',
422
+ namespace: namespace,
423
+ label: 'app=prover-node'
424
+ });
425
+ await waitForResourceByLabel({
426
+ resource: 'pods',
427
+ namespace: namespace,
428
+ label: 'app=prover-broker'
429
+ });
430
+ await waitForResourceByLabel({
431
+ resource: 'pods',
432
+ namespace: namespace,
433
+ label: 'app=prover-agent'
434
+ });
435
+ await waitForResourceByLabel({
436
+ resource: 'pods',
437
+ namespace: namespace,
438
+ label: 'app=validator'
439
+ });
440
+ await waitForResourceByLabel({
441
+ resource: 'pods',
442
+ namespace: namespace,
443
+ label: 'app=pxe'
444
+ });
445
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
3
+ "version": "0.77.0-testnet-ignition.21",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -8,8 +8,7 @@
8
8
  "./package.local.json"
9
9
  ],
10
10
  "scripts": {
11
- "build": "yarn clean && tsc -b && webpack",
12
- "build:e2e": "yarn clean && tsc -b",
11
+ "build": "yarn clean && tsc -b",
13
12
  "build:dev": "tsc -b --watch",
14
13
  "clean": "rm -rf ./dest .tsbuildinfo",
15
14
  "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
@@ -27,36 +26,36 @@
27
26
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
28
27
  },
29
28
  "dependencies": {
30
- "@aztec/accounts": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
31
- "@aztec/archiver": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
32
- "@aztec/aztec-node": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
33
- "@aztec/aztec.js": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
34
- "@aztec/bb-prover": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
35
- "@aztec/blob-lib": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
36
- "@aztec/blob-sink": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
37
- "@aztec/bot": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
38
- "@aztec/circuit-types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
39
- "@aztec/circuits.js": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
40
- "@aztec/entrypoints": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
41
- "@aztec/epoch-cache": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
42
- "@aztec/ethereum": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
43
- "@aztec/foundation": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
44
- "@aztec/kv-store": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
45
- "@aztec/l1-artifacts": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
46
- "@aztec/merkle-tree": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
47
- "@aztec/noir-contracts.js": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
48
- "@aztec/noir-protocol-circuits-types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
49
- "@aztec/p2p": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
50
- "@aztec/protocol-contracts": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
51
- "@aztec/prover-client": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
52
- "@aztec/prover-node": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
53
- "@aztec/pxe": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
54
- "@aztec/sequencer-client": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
55
- "@aztec/simulator": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
56
- "@aztec/telemetry-client": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
57
- "@aztec/types": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
58
- "@aztec/validator-client": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
59
- "@aztec/world-state": "0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2",
29
+ "@aztec/accounts": "0.77.0-testnet-ignition.21",
30
+ "@aztec/archiver": "0.77.0-testnet-ignition.21",
31
+ "@aztec/aztec": "0.77.0-testnet-ignition.21",
32
+ "@aztec/aztec-node": "0.77.0-testnet-ignition.21",
33
+ "@aztec/aztec.js": "0.77.0-testnet-ignition.21",
34
+ "@aztec/bb-prover": "0.77.0-testnet-ignition.21",
35
+ "@aztec/blob-lib": "0.77.0-testnet-ignition.21",
36
+ "@aztec/blob-sink": "0.77.0-testnet-ignition.21",
37
+ "@aztec/bot": "0.77.0-testnet-ignition.21",
38
+ "@aztec/constants": "0.77.0-testnet-ignition.21",
39
+ "@aztec/entrypoints": "0.77.0-testnet-ignition.21",
40
+ "@aztec/epoch-cache": "0.77.0-testnet-ignition.21",
41
+ "@aztec/ethereum": "0.77.0-testnet-ignition.21",
42
+ "@aztec/foundation": "0.77.0-testnet-ignition.21",
43
+ "@aztec/kv-store": "0.77.0-testnet-ignition.21",
44
+ "@aztec/l1-artifacts": "0.77.0-testnet-ignition.21",
45
+ "@aztec/merkle-tree": "0.77.0-testnet-ignition.21",
46
+ "@aztec/noir-contracts.js": "0.77.0-testnet-ignition.21",
47
+ "@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.21",
48
+ "@aztec/p2p": "0.77.0-testnet-ignition.21",
49
+ "@aztec/protocol-contracts": "0.77.0-testnet-ignition.21",
50
+ "@aztec/prover-client": "0.77.0-testnet-ignition.21",
51
+ "@aztec/prover-node": "0.77.0-testnet-ignition.21",
52
+ "@aztec/pxe": "0.77.0-testnet-ignition.21",
53
+ "@aztec/sequencer-client": "0.77.0-testnet-ignition.21",
54
+ "@aztec/simulator": "0.77.0-testnet-ignition.21",
55
+ "@aztec/stdlib": "0.77.0-testnet-ignition.21",
56
+ "@aztec/telemetry-client": "0.77.0-testnet-ignition.21",
57
+ "@aztec/validator-client": "0.77.0-testnet-ignition.21",
58
+ "@aztec/world-state": "0.77.0-testnet-ignition.21",
60
59
  "@iarna/toml": "^2.2.5",
61
60
  "@jest/globals": "^29.5.0",
62
61
  "@noble/curves": "^1.0.0",
@@ -85,6 +84,7 @@
85
84
  "lodash.chunk": "^4.2.0",
86
85
  "lodash.compact": "^3.0.1",
87
86
  "lodash.every": "^4.6.0",
87
+ "lodash.omit": "^4.5.0",
88
88
  "memdown": "^6.1.1",
89
89
  "process": "^0.11.10",
90
90
  "stream-browserify": "^3.0.0",
@@ -145,19 +145,14 @@
145
145
  ]
146
146
  },
147
147
  "reporters": [
148
- [
149
- "summary",
150
- {
151
- "summaryThreshold": 0
152
- }
153
- ]
148
+ "default"
154
149
  ],
155
150
  "moduleNameMapper": {
156
151
  "^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
157
152
  },
158
153
  "testRegex": "./src/.*\\.test\\.(js|mjs|ts)$",
159
154
  "rootDir": "./src",
160
- "testTimeout": 30000,
155
+ "testTimeout": 120000,
161
156
  "setupFiles": [
162
157
  "../../foundation/src/jest/setup.mjs"
163
158
  ]
@@ -1,15 +1,11 @@
1
- import { type AztecNodeService } from '@aztec/aztec-node';
1
+ import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { type AztecNode, BatchCall, INITIAL_L2_BLOCK_NUM, type SentTx, type WaitOpts } from '@aztec/aztec.js';
3
3
  import { mean, stdDev, timesParallel } from '@aztec/foundation/collection';
4
4
  import { randomInt } from '@aztec/foundation/crypto';
5
5
  import { BenchmarkingContract } from '@aztec/noir-contracts.js/Benchmarking';
6
6
  import { type PXEService, type PXEServiceConfig, createPXEService } from '@aztec/pxe';
7
- import { type MetricsType } from '@aztec/telemetry-client';
8
- import {
9
- type BenchmarkDataPoint,
10
- type BenchmarkMetricsType,
11
- type BenchmarkTelemetryClient,
12
- } from '@aztec/telemetry-client/bench';
7
+ import type { MetricsType } from '@aztec/telemetry-client';
8
+ import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
13
9
 
14
10
  import { writeFileSync } from 'fs';
15
11
  import { mkdirpSync } from 'fs-extra';
@@ -127,15 +123,27 @@ export function getFolderSize(path: string): number {
127
123
  * @param index - Index of the call within a block.
128
124
  * @param context - End to end context.
129
125
  * @param contract - Benchmarking contract.
126
+ * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
130
127
  * @returns A BatchCall instance.
131
128
  */
132
- export async function makeCall(index: number, context: EndToEndContext, contract: BenchmarkingContract) {
129
+ export async function makeCall(
130
+ index: number,
131
+ context: EndToEndContext,
132
+ contract: BenchmarkingContract,
133
+ heavyPublicCompute: boolean,
134
+ ) {
133
135
  const owner = context.wallet.getAddress();
134
136
  const sender = owner;
135
- return new BatchCall(context.wallet, [
136
- await contract.methods.create_note(owner, sender, index + 1).request(),
137
- await contract.methods.increment_balance(owner, index + 1).request(),
138
- ]);
137
+ if (heavyPublicCompute) {
138
+ return new BatchCall(context.wallet, [
139
+ await contract.methods.sha256_hash_2048(randomBytesAsBigInts(2048)).request(),
140
+ ]);
141
+ } else {
142
+ return new BatchCall(context.wallet, [
143
+ await contract.methods.create_note(owner, sender, index + 1).request(),
144
+ await contract.methods.increment_balance(owner, index + 1).request(),
145
+ ]);
146
+ }
139
147
  }
140
148
 
141
149
  /**
@@ -144,14 +152,16 @@ export async function makeCall(index: number, context: EndToEndContext, contract
144
152
  * @param txCount - How many txs to send
145
153
  * @param context - End to end context.
146
154
  * @param contract - Target contract.
155
+ * @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
147
156
  * @returns Array of sent txs.
148
157
  */
149
158
  export async function sendTxs(
150
159
  txCount: number,
151
160
  context: EndToEndContext,
152
161
  contract: BenchmarkingContract,
162
+ heavyPublicCompute: boolean = false,
153
163
  ): Promise<SentTx[]> {
154
- const calls = await timesParallel(txCount, index => makeCall(index, context, contract));
164
+ const calls = await timesParallel(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
155
165
  context.logger.info(`Creating ${txCount} txs`);
156
166
  const provenTxs = await Promise.all(calls.map(call => call.prove({ skipPublicSimulation: true })));
157
167
  context.logger.info(`Sending ${txCount} txs`);
@@ -177,14 +187,21 @@ export async function createNewPXE(
177
187
  startingBlock: number = INITIAL_L2_BLOCK_NUM,
178
188
  ): Promise<PXEService> {
179
189
  const l1Contracts = await node.getL1ContractAddresses();
190
+ const { l1ChainId, protocolVersion } = await node.getNodeInfo();
180
191
  const pxeConfig = {
181
192
  l2StartingBlock: startingBlock,
182
193
  l2BlockPollingIntervalMS: 100,
183
194
  dataDirectory: undefined,
184
195
  dataStoreMapSizeKB: 1024 * 1024,
185
196
  l1Contracts,
197
+ l1ChainId,
198
+ version: protocolVersion,
186
199
  } as PXEServiceConfig;
187
200
  const pxe = await createPXEService(node, pxeConfig);
188
201
  await pxe.registerContract(contract);
189
202
  return pxe;
190
203
  }
204
+
205
+ function randomBytesAsBigInts(length: number): bigint[] {
206
+ return [...Array(length)].map(_ => BigInt(Math.floor(Math.random() * 255)));
207
+ }
@@ -1,17 +1,16 @@
1
- import { getSchnorrAccount } from '@aztec/accounts/schnorr';
1
+ import { getSchnorrWallet } from '@aztec/accounts/schnorr';
2
2
  import {
3
3
  type AccountWallet,
4
4
  type CompleteAddress,
5
- ExtendedNote,
6
5
  Fr,
7
6
  type Logger,
8
- Note,
9
7
  type TxHash,
10
8
  computeSecretHash,
11
9
  createLogger,
12
10
  } from '@aztec/aztec.js';
11
+ import { MAX_NOTE_HASHES_PER_TX } from '@aztec/constants';
13
12
  import { DocsExampleContract } from '@aztec/noir-contracts.js/DocsExample';
14
- import { type TokenContract } from '@aztec/noir-contracts.js/Token';
13
+ import type { TokenContract } from '@aztec/noir-contracts.js/Token';
15
14
  import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist';
16
15
 
17
16
  import { jest } from '@jest/globals';
@@ -19,8 +18,8 @@ import { jest } from '@jest/globals';
19
18
  import {
20
19
  type ISnapshotManager,
21
20
  type SubsystemsContext,
22
- addAccounts,
23
21
  createSnapshotManager,
22
+ deployAccounts,
24
23
  publicDeployAccounts,
25
24
  } from '../fixtures/snapshot_manager.js';
26
25
  import { TokenSimulator } from '../simulators/token_simulator.js';
@@ -91,18 +90,17 @@ export class BlacklistTokenContractTest {
91
90
  // Adding a timeout of 2 minutes in here such that it is propagated to the underlying tests
92
91
  jest.setTimeout(120_000);
93
92
 
94
- await this.snapshotManager.snapshot('3_accounts', addAccounts(3, this.logger), async ({ accountKeys }, { pxe }) => {
95
- this.wallets = await Promise.all(
96
- accountKeys.map(async ak => {
97
- const account = await getSchnorrAccount(pxe, ak[0], ak[1], 1);
98
- return account.getWallet();
99
- }),
100
- );
101
- this.admin = this.wallets[0];
102
- this.other = this.wallets[1];
103
- this.blacklisted = this.wallets[2];
104
- this.accounts = this.wallets.map(w => w.getCompleteAddress());
105
- });
93
+ await this.snapshotManager.snapshot(
94
+ '3_accounts',
95
+ deployAccounts(3, this.logger),
96
+ async ({ deployedAccounts }, { pxe }) => {
97
+ this.wallets = await Promise.all(deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)));
98
+ this.admin = this.wallets[0];
99
+ this.other = this.wallets[1];
100
+ this.blacklisted = this.wallets[2];
101
+ this.accounts = this.wallets.map(w => w.getCompleteAddress());
102
+ },
103
+ );
106
104
 
107
105
  await this.snapshotManager.snapshot(
108
106
  'e2e_blacklist_token_contract',
@@ -160,24 +158,36 @@ export class BlacklistTokenContractTest {
160
158
  await this.snapshotManager.teardown();
161
159
  }
162
160
 
163
- async addPendingShieldNoteToPXE(accountIndex: number, amount: bigint, secretHash: Fr, txHash: TxHash) {
164
- const note = new Note([new Fr(amount), secretHash]);
165
- const extendedNote = new ExtendedNote(
166
- note,
167
- this.accounts[accountIndex].address,
168
- this.asset.address,
169
- TokenBlacklistContract.storage.pending_shields.slot,
170
- TokenBlacklistContract.notes.TransparentNote.id,
171
- txHash,
172
- );
173
- await this.wallets[accountIndex].addNote(extendedNote);
161
+ #toBoundedVec(arr: Fr[], maxLen: number) {
162
+ return { len: arr.length, storage: arr.concat(new Array(maxLen - arr.length).fill(new Fr(0))) };
163
+ }
164
+
165
+ async addPendingShieldNoteToPXE(
166
+ contract: TokenBlacklistContract,
167
+ wallet: AccountWallet,
168
+ amount: bigint,
169
+ secretHash: Fr,
170
+ txHash: TxHash,
171
+ ) {
172
+ const txEffects = await wallet.getTxEffect(txHash);
173
+ await contract.methods
174
+ .deliver_transparent_note(
175
+ contract.address,
176
+ amount,
177
+ secretHash,
178
+ txHash.hash,
179
+ this.#toBoundedVec(txEffects!.data.noteHashes, MAX_NOTE_HASHES_PER_TX),
180
+ txEffects!.data.nullifiers[0],
181
+ wallet.getAddress(),
182
+ )
183
+ .simulate();
174
184
  }
175
185
 
176
186
  async applyMintSnapshot() {
177
187
  await this.snapshotManager.snapshot(
178
188
  'mint',
179
189
  async () => {
180
- const { asset, accounts } = this;
190
+ const { asset, accounts, wallets } = this;
181
191
  const amount = 10000n;
182
192
 
183
193
  const adminMinterRole = new Role().withAdmin().withMinter();
@@ -208,7 +218,7 @@ export class BlacklistTokenContractTest {
208
218
  const secretHash = await computeSecretHash(secret);
209
219
  const receipt = await asset.methods.mint_private(amount, secretHash).send().wait();
210
220
 
211
- await this.addPendingShieldNoteToPXE(0, amount, secretHash, receipt.txHash);
221
+ await this.addPendingShieldNoteToPXE(asset, wallets[0], amount, secretHash, receipt.txHash);
212
222
  const txClaim = asset.methods.redeem_shield(accounts[0].address, amount, secret).send();
213
223
  await txClaim.wait({ debug: true });
214
224
  this.logger.verbose(`Minting complete.`);