@aztec/end-to-end 0.0.1-commit.1142ef1 → 0.0.1-commit.135b523

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 (163) 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 +12 -13
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +117 -132
  7. package/dest/bench/utils.d.ts +6 -5
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
  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 +96 -112
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +6 -7
  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 +65 -62
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  19. package/dest/e2e_epochs/epochs_test.d.ts +7 -1
  20. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  21. package/dest/e2e_epochs/epochs_test.js +30 -8
  22. package/dest/e2e_fees/bridging_race.notest.js +3 -5
  23. package/dest/e2e_fees/fees_test.d.ts +13 -13
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +122 -140
  26. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +14 -13
  29. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.js +31 -39
  32. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  34. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  35. package/dest/e2e_p2p/p2p_network.d.ts +7 -6
  36. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  37. package/dest/e2e_p2p/p2p_network.js +110 -103
  38. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  39. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  40. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  41. package/dest/e2e_p2p/shared.d.ts +6 -6
  42. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  43. package/dest/e2e_p2p/shared.js +9 -16
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +89 -91
  47. package/dest/fixtures/e2e_prover_test.d.ts +8 -14
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +85 -93
  50. package/dest/fixtures/setup.d.ts +218 -0
  51. package/dest/fixtures/setup.d.ts.map +1 -0
  52. package/dest/fixtures/setup.js +695 -0
  53. package/dest/fixtures/setup_p2p_test.d.ts +4 -5
  54. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  55. package/dest/fixtures/setup_p2p_test.js +24 -19
  56. package/dest/fixtures/token_utils.d.ts +1 -1
  57. package/dest/fixtures/token_utils.d.ts.map +1 -1
  58. package/dest/fixtures/token_utils.js +7 -4
  59. package/dest/fixtures/utils.d.ts +5 -191
  60. package/dest/fixtures/utils.d.ts.map +1 -1
  61. package/dest/fixtures/utils.js +4 -615
  62. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  63. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  64. package/dest/quality_of_service/prometheus_client.js +67 -0
  65. package/dest/shared/cross_chain_test_harness.d.ts +14 -4
  66. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  67. package/dest/shared/cross_chain_test_harness.js +11 -11
  68. package/dest/shared/gas_portal_test_harness.d.ts +11 -1
  69. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  70. package/dest/shared/gas_portal_test_harness.js +1 -1
  71. package/dest/shared/submit-transactions.d.ts +3 -3
  72. package/dest/shared/submit-transactions.d.ts.map +1 -1
  73. package/dest/shared/submit-transactions.js +9 -11
  74. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  75. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  76. package/dest/shared/uniswap_l1_l2.js +12 -12
  77. package/dest/simulators/lending_simulator.d.ts +5 -1
  78. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  79. package/dest/simulators/lending_simulator.js +2 -2
  80. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  81. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  82. package/dest/spartan/setup_test_wallets.js +61 -34
  83. package/dest/spartan/tx_metrics.d.ts +51 -2
  84. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  85. package/dest/spartan/tx_metrics.js +333 -6
  86. package/dest/spartan/utils/bot.d.ts +27 -0
  87. package/dest/spartan/utils/bot.d.ts.map +1 -0
  88. package/dest/spartan/utils/bot.js +141 -0
  89. package/dest/spartan/utils/chaos.d.ts +79 -0
  90. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  91. package/dest/spartan/utils/chaos.js +142 -0
  92. package/dest/spartan/utils/clients.d.ts +39 -0
  93. package/dest/spartan/utils/clients.d.ts.map +1 -0
  94. package/dest/spartan/utils/clients.js +90 -0
  95. package/dest/spartan/utils/config.d.ts +36 -0
  96. package/dest/spartan/utils/config.d.ts.map +1 -0
  97. package/dest/spartan/utils/config.js +20 -0
  98. package/dest/spartan/utils/health.d.ts +63 -0
  99. package/dest/spartan/utils/health.d.ts.map +1 -0
  100. package/dest/spartan/utils/health.js +202 -0
  101. package/dest/spartan/utils/helm.d.ts +15 -0
  102. package/dest/spartan/utils/helm.d.ts.map +1 -0
  103. package/dest/spartan/utils/helm.js +47 -0
  104. package/dest/spartan/utils/index.d.ts +9 -0
  105. package/dest/spartan/utils/index.d.ts.map +1 -0
  106. package/dest/spartan/utils/index.js +18 -0
  107. package/dest/spartan/utils/k8s.d.ts +126 -0
  108. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  109. package/dest/spartan/utils/k8s.js +375 -0
  110. package/dest/spartan/utils/nodes.d.ts +41 -0
  111. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  112. package/dest/spartan/utils/nodes.js +461 -0
  113. package/dest/spartan/utils/scripts.d.ts +16 -0
  114. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  115. package/dest/spartan/utils/scripts.js +66 -0
  116. package/dest/spartan/utils.d.ts +2 -253
  117. package/dest/spartan/utils.d.ts.map +1 -1
  118. package/dest/spartan/utils.js +1 -892
  119. package/package.json +40 -39
  120. package/src/bench/client_flows/benchmark.ts +24 -2
  121. package/src/bench/client_flows/client_flows_benchmark.ts +137 -203
  122. package/src/bench/utils.ts +9 -7
  123. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +104 -142
  124. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +99 -106
  125. package/src/e2e_deploy_contract/deploy_test.ts +21 -14
  126. package/src/e2e_epochs/epochs_test.ts +59 -33
  127. package/src/e2e_fees/bridging_race.notest.ts +3 -9
  128. package/src/e2e_fees/fees_test.ts +171 -217
  129. package/src/e2e_l1_publisher/write_json.ts +16 -13
  130. package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
  131. package/src/e2e_p2p/inactivity_slash_test.ts +5 -5
  132. package/src/e2e_p2p/p2p_network.ts +171 -167
  133. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  134. package/src/e2e_p2p/shared.ts +20 -22
  135. package/src/e2e_token_contract/token_contract_test.ts +103 -118
  136. package/src/fixtures/e2e_prover_test.ts +99 -133
  137. package/src/fixtures/setup.ts +1017 -0
  138. package/src/fixtures/setup_p2p_test.ts +15 -20
  139. package/src/fixtures/token_utils.ts +6 -5
  140. package/src/fixtures/utils.ts +27 -901
  141. package/src/quality_of_service/prometheus_client.ts +113 -0
  142. package/src/shared/cross_chain_test_harness.ts +13 -27
  143. package/src/shared/gas_portal_test_harness.ts +1 -1
  144. package/src/shared/submit-transactions.ts +9 -15
  145. package/src/shared/uniswap_l1_l2.ts +12 -19
  146. package/src/simulators/lending_simulator.ts +2 -2
  147. package/src/spartan/setup_test_wallets.ts +72 -24
  148. package/src/spartan/tx_metrics.ts +255 -9
  149. package/src/spartan/utils/bot.ts +185 -0
  150. package/src/spartan/utils/chaos.ts +253 -0
  151. package/src/spartan/utils/clients.ts +100 -0
  152. package/src/spartan/utils/config.ts +26 -0
  153. package/src/spartan/utils/health.ts +255 -0
  154. package/src/spartan/utils/helm.ts +84 -0
  155. package/src/spartan/utils/index.ts +64 -0
  156. package/src/spartan/utils/k8s.ts +527 -0
  157. package/src/spartan/utils/nodes.ts +538 -0
  158. package/src/spartan/utils/scripts.ts +63 -0
  159. package/src/spartan/utils.ts +1 -1158
  160. package/dest/fixtures/snapshot_manager.d.ts +0 -93
  161. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  162. package/dest/fixtures/snapshot_manager.js +0 -488
  163. package/src/fixtures/snapshot_manager.ts +0 -646
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.0.1-commit.1142ef1",
3
+ "version": "0.0.1-commit.135b523",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -25,43 +25,44 @@
25
25
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
26
26
  },
27
27
  "dependencies": {
28
- "@aztec/accounts": "0.0.1-commit.1142ef1",
29
- "@aztec/archiver": "0.0.1-commit.1142ef1",
30
- "@aztec/aztec": "0.0.1-commit.1142ef1",
31
- "@aztec/aztec-node": "0.0.1-commit.1142ef1",
32
- "@aztec/aztec.js": "0.0.1-commit.1142ef1",
33
- "@aztec/bb-prover": "0.0.1-commit.1142ef1",
34
- "@aztec/bb.js": "0.0.1-commit.1142ef1",
35
- "@aztec/blob-client": "0.0.1-commit.1142ef1",
36
- "@aztec/blob-lib": "0.0.1-commit.1142ef1",
37
- "@aztec/bot": "0.0.1-commit.1142ef1",
38
- "@aztec/cli": "0.0.1-commit.1142ef1",
39
- "@aztec/constants": "0.0.1-commit.1142ef1",
40
- "@aztec/entrypoints": "0.0.1-commit.1142ef1",
41
- "@aztec/epoch-cache": "0.0.1-commit.1142ef1",
42
- "@aztec/ethereum": "0.0.1-commit.1142ef1",
43
- "@aztec/foundation": "0.0.1-commit.1142ef1",
44
- "@aztec/kv-store": "0.0.1-commit.1142ef1",
45
- "@aztec/l1-artifacts": "0.0.1-commit.1142ef1",
46
- "@aztec/merkle-tree": "0.0.1-commit.1142ef1",
47
- "@aztec/node-keystore": "0.0.1-commit.1142ef1",
48
- "@aztec/noir-contracts.js": "0.0.1-commit.1142ef1",
49
- "@aztec/noir-noirc_abi": "0.0.1-commit.1142ef1",
50
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.1142ef1",
51
- "@aztec/noir-test-contracts.js": "0.0.1-commit.1142ef1",
52
- "@aztec/p2p": "0.0.1-commit.1142ef1",
53
- "@aztec/protocol-contracts": "0.0.1-commit.1142ef1",
54
- "@aztec/prover-client": "0.0.1-commit.1142ef1",
55
- "@aztec/prover-node": "0.0.1-commit.1142ef1",
56
- "@aztec/pxe": "0.0.1-commit.1142ef1",
57
- "@aztec/sequencer-client": "0.0.1-commit.1142ef1",
58
- "@aztec/simulator": "0.0.1-commit.1142ef1",
59
- "@aztec/slasher": "0.0.1-commit.1142ef1",
60
- "@aztec/stdlib": "0.0.1-commit.1142ef1",
61
- "@aztec/telemetry-client": "0.0.1-commit.1142ef1",
62
- "@aztec/test-wallet": "0.0.1-commit.1142ef1",
63
- "@aztec/validator-client": "0.0.1-commit.1142ef1",
64
- "@aztec/world-state": "0.0.1-commit.1142ef1",
28
+ "@aztec/accounts": "0.0.1-commit.135b523",
29
+ "@aztec/archiver": "0.0.1-commit.135b523",
30
+ "@aztec/aztec": "0.0.1-commit.135b523",
31
+ "@aztec/aztec-node": "0.0.1-commit.135b523",
32
+ "@aztec/aztec.js": "0.0.1-commit.135b523",
33
+ "@aztec/bb-prover": "0.0.1-commit.135b523",
34
+ "@aztec/bb.js": "0.0.1-commit.135b523",
35
+ "@aztec/blob-client": "0.0.1-commit.135b523",
36
+ "@aztec/blob-lib": "0.0.1-commit.135b523",
37
+ "@aztec/bot": "0.0.1-commit.135b523",
38
+ "@aztec/cli": "0.0.1-commit.135b523",
39
+ "@aztec/constants": "0.0.1-commit.135b523",
40
+ "@aztec/entrypoints": "0.0.1-commit.135b523",
41
+ "@aztec/epoch-cache": "0.0.1-commit.135b523",
42
+ "@aztec/ethereum": "0.0.1-commit.135b523",
43
+ "@aztec/foundation": "0.0.1-commit.135b523",
44
+ "@aztec/kv-store": "0.0.1-commit.135b523",
45
+ "@aztec/l1-artifacts": "0.0.1-commit.135b523",
46
+ "@aztec/merkle-tree": "0.0.1-commit.135b523",
47
+ "@aztec/node-keystore": "0.0.1-commit.135b523",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.135b523",
49
+ "@aztec/noir-noirc_abi": "0.0.1-commit.135b523",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.135b523",
51
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.135b523",
52
+ "@aztec/p2p": "0.0.1-commit.135b523",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.135b523",
54
+ "@aztec/prover-client": "0.0.1-commit.135b523",
55
+ "@aztec/prover-node": "0.0.1-commit.135b523",
56
+ "@aztec/pxe": "0.0.1-commit.135b523",
57
+ "@aztec/sequencer-client": "0.0.1-commit.135b523",
58
+ "@aztec/simulator": "0.0.1-commit.135b523",
59
+ "@aztec/slasher": "0.0.1-commit.135b523",
60
+ "@aztec/stdlib": "0.0.1-commit.135b523",
61
+ "@aztec/telemetry-client": "0.0.1-commit.135b523",
62
+ "@aztec/test-wallet": "0.0.1-commit.135b523",
63
+ "@aztec/validator-client": "0.0.1-commit.135b523",
64
+ "@aztec/validator-ha-signer": "0.0.1-commit.135b523",
65
+ "@aztec/world-state": "0.0.1-commit.135b523",
65
66
  "@iarna/toml": "^2.2.5",
66
67
  "@jest/globals": "^30.0.0",
67
68
  "@noble/curves": "=1.0.0",
@@ -107,7 +108,7 @@
107
108
  "@types/jest": "^30.0.0",
108
109
  "@types/js-yaml": "^4.0.9",
109
110
  "@types/lodash.chunk": "^4.2.9",
110
- "@typescript/native-preview": "7.0.0-dev.20251126.1",
111
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
111
112
  "concurrently": "^7.6.0",
112
113
  "jest": "^30.0.0",
113
114
  "jest-extended": "^6.0.0",
@@ -7,7 +7,13 @@ import {
7
7
  import type { Logger } from '@aztec/aztec.js/log';
8
8
  import { createLogger } from '@aztec/foundation/log';
9
9
  import { type PrivateExecutionStep, serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
10
- import type { ProvingStats, ProvingTimings, SimulationStats, SimulationTimings } from '@aztec/stdlib/tx';
10
+ import type {
11
+ ProvingStats,
12
+ ProvingTimings,
13
+ RoundTripStats,
14
+ SimulationStats,
15
+ SimulationTimings,
16
+ } from '@aztec/stdlib/tx';
11
17
 
12
18
  import assert from 'node:assert';
13
19
  import { mkdir, writeFile } from 'node:fs/promises';
@@ -119,6 +125,7 @@ type ClientFlowBenchmark = {
119
125
  timings: Omit<ProvingTimings & SimulationTimings, 'perFunction'> & { witgen: number };
120
126
  maxMemory: number;
121
127
  rpc: Record<string, CallRecording>;
128
+ roundTrips: RoundTripStats;
122
129
  proverType: ProverType;
123
130
  minimumTrace: StructuredTrace;
124
131
  totalGateCount: number;
@@ -212,6 +219,10 @@ export function generateBenchmark(
212
219
  }, []);
213
220
  const timings = stats.timings;
214
221
  const totalGateCount = steps[steps.length - 1].accGateCount;
222
+ const nodeRPCCalls = stats.nodeRPCCalls ?? {
223
+ perMethod: {},
224
+ roundTrips: { roundTrips: 0, totalBlockingTime: 0, roundTripDurations: [], roundTripMethods: [] },
225
+ };
215
226
  return {
216
227
  name: flow,
217
228
  timings: {
@@ -221,7 +232,7 @@ export function generateBenchmark(
221
232
  unaccounted: timings.unaccounted,
222
233
  witgen: timings.perFunction.reduce((acc, fn) => acc + fn.time, 0),
223
234
  },
224
- rpc: Object.entries(stats.nodeRPCCalls ?? {}).reduce(
235
+ rpc: Object.entries(nodeRPCCalls.perMethod).reduce(
225
236
  (acc, [RPCName, RPCCalls]) => {
226
237
  const total = RPCCalls.times.reduce((sum, time) => sum + time, 0);
227
238
  const calls = RPCCalls.times.length;
@@ -236,6 +247,7 @@ export function generateBenchmark(
236
247
  },
237
248
  {} as Record<string, CallRecording>,
238
249
  ),
250
+ roundTrips: nodeRPCCalls.roundTrips,
239
251
  maxMemory,
240
252
  proverType,
241
253
  minimumTrace: minimumTrace!,
@@ -280,6 +292,16 @@ export function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): Git
280
292
  value: totalRPCCalls,
281
293
  unit: 'calls',
282
294
  },
295
+ {
296
+ name: `${benchmark.name}/round_trips`,
297
+ value: benchmark.roundTrips.roundTrips,
298
+ unit: 'round_trips',
299
+ },
300
+ {
301
+ name: `${benchmark.name}/round_trips_blocking_time`,
302
+ value: benchmark.roundTrips.totalBlockingTime,
303
+ unit: 'ms',
304
+ },
283
305
  ];
284
306
  if (benchmark.timings.proving) {
285
307
  benches.push({
@@ -29,14 +29,9 @@ import { deriveSigningKey } from '@aztec/stdlib/keys';
29
29
  import { TestWallet } from '@aztec/test-wallet/server';
30
30
 
31
31
  import { MNEMONIC } from '../../fixtures/fixtures.js';
32
- import {
33
- type ISnapshotManager,
34
- type SubsystemsContext,
35
- createSnapshotManager,
36
- deployAccounts,
37
- } from '../../fixtures/snapshot_manager.js';
32
+ import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js';
38
33
  import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
39
- import { type SetupOptions, setupSponsoredFPC } from '../../fixtures/utils.js';
34
+ import { setupSponsoredFPC } from '../../fixtures/utils.js';
40
35
  import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
41
36
  import {
42
37
  FeeJuicePortalTestingHarnessFactory,
@@ -45,19 +40,17 @@ import {
45
40
  import { ProxyLogger } from './benchmark.js';
46
41
  import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
47
42
 
48
- const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
43
+ const { BENCHMARK_CONFIG } = process.env;
49
44
 
50
45
  export type AccountType = 'ecdsar1' | 'schnorr';
51
46
  export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
52
47
  export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
53
48
 
54
49
  export class ClientFlowsBenchmark {
55
- private snapshotManager: ISnapshotManager;
56
-
57
50
  public logger: Logger;
58
51
  public aztecNode!: AztecNode;
59
52
  public cheatCodes!: CheatCodes;
60
- public context!: SubsystemsContext;
53
+ public context!: EndToEndContext;
61
54
  public chainMonitor!: ChainMonitor;
62
55
  public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
63
56
  public adminWallet!: TestWallet;
@@ -125,33 +118,37 @@ export class ClientFlowsBenchmark {
125
118
  public config: ClientFlowsConfig;
126
119
 
127
120
  private proxyLogger: ProxyLogger;
121
+ private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs>;
128
122
 
129
123
  constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
130
124
  this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
131
- this.snapshotManager = createSnapshotManager(
132
- `bench_client_flows${testName ? `/${testName}` : ''}`,
133
- dataPath,
134
- { startProverNode: true, ...setupOptions },
135
- { ...setupOptions },
136
- );
125
+ this.setupOptions = { startProverNode: true, ...setupOptions };
137
126
  this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
138
127
  ProxyLogger.create();
139
128
  this.proxyLogger = ProxyLogger.getInstance();
140
129
  }
141
130
 
142
131
  async setup() {
143
- const context = await this.snapshotManager.setup();
144
- await context.aztecNode.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
132
+ this.logger.info('Setting up subsystems from fresh');
133
+ this.context = await setup(0, {
134
+ ...this.setupOptions,
135
+ fundSponsoredFPC: true,
136
+ skipAccountDeployment: true,
137
+ l1ContractsArgs: this.setupOptions,
138
+ });
139
+ await this.applyBaseSetup();
140
+
141
+ await this.context.aztecNodeService!.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
145
142
 
146
- const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
147
- this.chainMonitor = new ChainMonitor(rollupContract, context.dateProvider, this.logger, 200).start();
143
+ const rollupContract = RollupContract.getFromConfig(this.context.config);
144
+ this.chainMonitor = new ChainMonitor(rollupContract, this.context.dateProvider!, this.logger, 200).start();
148
145
 
149
146
  return this;
150
147
  }
151
148
 
152
149
  async teardown() {
153
150
  await this.chainMonitor.stop();
154
- await this.snapshotManager.teardown();
151
+ await teardown(this.context);
155
152
  }
156
153
 
157
154
  async mintAndBridgeFeeJuice(address: AztecAddress) {
@@ -159,8 +156,7 @@ export class ClientFlowsBenchmark {
159
156
  const { claimSecret: secret, messageLeafIndex: index } = claim;
160
157
  await this.feeJuiceContract.methods
161
158
  .claim(address, claim.claimAmount, secret, index)
162
- .send({ from: this.adminAddress })
163
- .wait();
159
+ .send({ from: this.adminAddress });
164
160
  }
165
161
 
166
162
  /** Admin mints bananaCoin tokens privately to the target address and redeems them. */
@@ -193,161 +189,118 @@ export class ClientFlowsBenchmark {
193
189
  }
194
190
  }
195
191
 
196
- public async applyBaseSnapshots() {
197
- await this.applyInitialAccountsSnapshot();
198
- await this.applySetupFeeJuiceSnapshot();
192
+ public async applyBaseSetup() {
193
+ await this.applyInitialAccounts();
194
+ await this.applySetupFeeJuice();
199
195
  }
200
196
 
201
- async applyInitialAccountsSnapshot() {
202
- await this.snapshotManager.snapshot(
203
- 'initial_accounts',
204
- deployAccounts(2, this.logger),
205
- async (
206
- { deployedAccounts: [{ address: adminAddress }, { address: sequencerAddress }] },
207
- { wallet, aztecNode, cheatCodes },
208
- ) => {
209
- this.adminWallet = wallet;
210
- this.aztecNode = aztecNode;
211
- this.cheatCodes = cheatCodes;
212
-
213
- this.adminAddress = adminAddress;
214
- this.sequencerAddress = sequencerAddress;
215
-
216
- const canonicalFeeJuice = await getCanonicalFeeJuice();
217
- this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
218
- this.coinbase = EthAddress.random();
219
-
220
- const userPXEConfig = getPXEConfig();
221
- const userPXEConfigWithContracts = {
222
- ...userPXEConfig,
223
- proverEnabled: this.realProofs,
224
- } as PXEConfig;
225
-
226
- this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
227
- loggers: {
228
- prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
229
- },
230
- });
197
+ async applyInitialAccounts() {
198
+ this.logger.info('Applying initial accounts setup');
199
+ const { deployedAccounts } = await deployAccounts(
200
+ 2,
201
+ this.logger,
202
+ )({
203
+ wallet: this.context.wallet,
204
+ initialFundedAccounts: this.context.initialFundedAccounts,
205
+ });
206
+
207
+ const [{ address: adminAddress }, { address: sequencerAddress }] = deployedAccounts;
208
+
209
+ this.adminWallet = this.context.wallet;
210
+ this.aztecNode = this.context.aztecNodeService!;
211
+ this.cheatCodes = this.context.cheatCodes;
212
+
213
+ this.adminAddress = adminAddress;
214
+ this.sequencerAddress = sequencerAddress;
215
+
216
+ const canonicalFeeJuice = await getCanonicalFeeJuice();
217
+ this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
218
+ this.coinbase = EthAddress.random();
219
+
220
+ const userPXEConfig = getPXEConfig();
221
+ const userPXEConfigWithContracts = {
222
+ ...userPXEConfig,
223
+ proverEnabled: this.realProofs,
224
+ } as PXEConfig;
225
+
226
+ this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
227
+ loggers: {
228
+ prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
231
229
  },
232
- );
230
+ });
233
231
  }
234
232
 
235
- async applySetupFeeJuiceSnapshot() {
236
- await this.snapshotManager.snapshot(
237
- 'setup_fee_juice',
238
- async () => {},
239
- async (_data, context) => {
240
- this.context = context;
241
-
242
- this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
243
-
244
- this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
245
- aztecNode: context.aztecNode,
246
- aztecNodeAdmin: context.aztecNode,
247
- l1Client: context.deployL1ContractsValues.l1Client,
248
- wallet: this.adminWallet,
249
- logger: this.logger,
250
- });
251
- },
252
- );
233
+ async applySetupFeeJuice() {
234
+ this.logger.info('Applying fee juice setup');
235
+ this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
236
+
237
+ this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
238
+ aztecNode: this.context.aztecNodeService!,
239
+ aztecNodeAdmin: this.context.aztecNodeService!,
240
+ l1Client: this.context.deployL1ContractsValues.l1Client,
241
+ wallet: this.adminWallet,
242
+ logger: this.logger,
243
+ });
253
244
  }
254
245
 
255
- async applyDeployBananaTokenSnapshot() {
256
- await this.snapshotManager.snapshot(
257
- 'deploy_banana_token',
258
- async () => {
259
- const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
260
- this.adminWallet,
261
- this.adminAddress,
262
- 'BC',
263
- 'BC',
264
- 18n,
265
- )
266
- .send({ from: this.adminAddress })
267
- .wait();
268
- this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
269
- return { bananaCoinAddress: bananaCoin.address, bananaCoinInstance };
270
- },
271
- ({ bananaCoinAddress, bananaCoinInstance }) => {
272
- this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.adminWallet);
273
- this.bananaCoinInstance = bananaCoinInstance;
274
- return Promise.resolve();
275
- },
276
- );
246
+ async applyDeployBananaToken() {
247
+ this.logger.info('Applying banana token deployment');
248
+ const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
249
+ this.adminWallet,
250
+ this.adminAddress,
251
+ 'BC',
252
+ 'BC',
253
+ 18n,
254
+ ).send({ from: this.adminAddress, wait: { returnReceipt: true } });
255
+ this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
256
+ this.bananaCoin = bananaCoin;
257
+ this.bananaCoinInstance = bananaCoinInstance;
277
258
  }
278
259
 
279
- async applyDeployCandyBarTokenSnapshot() {
280
- await this.snapshotManager.snapshot(
281
- 'deploy_candy_bar_token',
282
- async () => {
283
- const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
284
- this.adminWallet,
285
- this.adminAddress,
286
- 'CBC',
287
- 'CBC',
288
- 18n,
289
- )
290
- .send({ from: this.adminAddress })
291
- .wait();
292
- this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
293
- return { candyBarCoinAddress: candyBarCoin.address, candyBarCoinInstance };
294
- },
295
- ({ candyBarCoinAddress, candyBarCoinInstance }) => {
296
- this.candyBarCoin = TokenContract.at(candyBarCoinAddress, this.adminWallet);
297
- this.candyBarCoinInstance = candyBarCoinInstance;
298
- return Promise.resolve();
299
- },
300
- );
260
+ async applyDeployCandyBarToken() {
261
+ this.logger.info('Applying candy bar token deployment');
262
+ const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
263
+ this.adminWallet,
264
+ this.adminAddress,
265
+ 'CBC',
266
+ 'CBC',
267
+ 18n,
268
+ ).send({ from: this.adminAddress, wait: { returnReceipt: true } });
269
+ this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
270
+ this.candyBarCoin = candyBarCoin;
271
+ this.candyBarCoinInstance = candyBarCoinInstance;
301
272
  }
302
273
 
303
- public async applyFPCSetupSnapshot() {
304
- await this.snapshotManager.snapshot(
305
- 'fpc_setup',
306
- async context => {
307
- const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
308
- expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
274
+ public async applyFPCSetup() {
275
+ this.logger.info('Applying FPC setup');
276
+ const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
277
+ expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
309
278
 
310
- const bananaCoin = this.bananaCoin;
311
- const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
312
- this.adminWallet,
313
- bananaCoin.address,
314
- this.adminAddress,
315
- )
316
- .send({ from: this.adminAddress })
317
- .wait();
279
+ const bananaCoin = this.bananaCoin;
280
+ const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
281
+ this.adminWallet,
282
+ bananaCoin.address,
283
+ this.adminAddress,
284
+ ).send({ from: this.adminAddress, wait: { returnReceipt: true } });
318
285
 
319
- this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
286
+ this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
320
287
 
321
- await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
288
+ await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
322
289
 
323
- return { bananaFPCAddress: bananaFPC.address, bananaFPCInstance };
324
- },
325
- data => {
326
- this.bananaFPC = FPCContract.at(data.bananaFPCAddress, this.adminWallet);
327
- this.bananaFPCInstance = data.bananaFPCInstance;
328
- return Promise.resolve();
329
- },
330
- );
290
+ this.bananaFPC = bananaFPC;
291
+ this.bananaFPCInstance = bananaFPCInstance;
331
292
  }
332
293
 
333
- async applyDeploySponsoredFPCSnapshot() {
334
- await this.snapshotManager.snapshot(
335
- 'deploy_sponsored_fpc',
336
- async () => {
337
- const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
338
- this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
339
- return { sponsoredFPCAddress: sponsoredFPCInstance.address, sponsoredFPCInstance };
340
- },
341
- ({ sponsoredFPCAddress, sponsoredFPCInstance }) => {
342
- this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
343
- this.sponsoredFPCInstance = sponsoredFPCInstance;
344
- return Promise.resolve();
345
- },
346
- );
294
+ async applyDeploySponsoredFPC() {
295
+ this.logger.info('Applying sponsored FPC deployment');
296
+ const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
297
+ this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
298
+ this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.adminWallet);
299
+ this.sponsoredFPCInstance = sponsoredFPCInstance;
347
300
  }
348
301
 
349
302
  public async createCrossChainTestHarness(owner: AztecAddress) {
350
- const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
303
+ const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
351
304
 
352
305
  const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
353
306
  'Underlying',
@@ -376,12 +329,10 @@ export class ClientFlowsBenchmark {
376
329
  const benchysAddress = benchysAccountManager.address;
377
330
  const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
378
331
  const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
379
- await behchysDeployMethod
380
- .send({
381
- from: AztecAddress.ZERO,
382
- fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
383
- })
384
- .wait();
332
+ await behchysDeployMethod.send({
333
+ from: AztecAddress.ZERO,
334
+ fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
335
+ });
385
336
  // Register benchy on the user's Wallet, where we're going to be interacting from
386
337
  const accountManager = await this.userWallet.createAccount({
387
338
  secret: benchysAccount.getSecretKey(),
@@ -391,44 +342,27 @@ export class ClientFlowsBenchmark {
391
342
  return accountManager.address;
392
343
  }
393
344
 
394
- public async applyDeployAmmSnapshot() {
395
- await this.snapshotManager.snapshot(
396
- 'deploy_amm',
397
- async () => {
398
- const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
399
- this.adminWallet,
400
- this.adminAddress,
401
- 'LPT',
402
- 'LPT',
403
- 18n,
404
- )
405
- .send({ from: this.adminAddress })
406
- .wait();
407
- const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
408
- this.adminWallet,
409
- this.bananaCoin.address,
410
- this.candyBarCoin.address,
411
- liquidityToken.address,
412
- )
413
- .send({ from: this.adminAddress })
414
- .wait();
415
- this.logger.info(`AMM deployed at ${amm.address}`);
416
- await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
417
- return {
418
- ammAddress: amm.address,
419
- ammInstance,
420
- liquidityTokenAddress: liquidityToken.address,
421
- liquidityTokenInstance,
422
- };
423
- },
424
- ({ ammAddress, ammInstance, liquidityTokenAddress, liquidityTokenInstance }) => {
425
- this.liquidityToken = TokenContract.at(liquidityTokenAddress, this.adminWallet);
426
- this.liquidityTokenInstance = liquidityTokenInstance;
427
- this.amm = AMMContract.at(ammAddress, this.adminWallet);
428
- this.ammInstance = ammInstance;
429
- return Promise.resolve();
430
- },
431
- );
345
+ public async applyDeployAmm() {
346
+ this.logger.info('Applying AMM deployment');
347
+ const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
348
+ this.adminWallet,
349
+ this.adminAddress,
350
+ 'LPT',
351
+ 'LPT',
352
+ 18n,
353
+ ).send({ from: this.adminAddress, wait: { returnReceipt: true } });
354
+ const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
355
+ this.adminWallet,
356
+ this.bananaCoin.address,
357
+ this.candyBarCoin.address,
358
+ liquidityToken.address,
359
+ ).send({ from: this.adminAddress, wait: { returnReceipt: true } });
360
+ this.logger.info(`AMM deployed at ${amm.address}`);
361
+ await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress });
362
+ this.liquidityToken = liquidityToken;
363
+ this.liquidityTokenInstance = liquidityTokenInstance;
364
+ this.amm = amm;
365
+ this.ammInstance = ammInstance;
432
366
  }
433
367
 
434
368
  public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
@@ -1,8 +1,10 @@
1
1
  import type { AztecNodeService } from '@aztec/aztec-node';
2
2
  import { AztecAddress } from '@aztec/aztec.js/addresses';
3
- import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
3
+ import { BatchCall, NO_WAIT, type WaitOpts } from '@aztec/aztec.js/contracts';
4
+ import { waitForTx } from '@aztec/aztec.js/node';
4
5
  import { mean, stdDev, times } from '@aztec/foundation/collection';
5
6
  import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
7
+ import type { TxHash } from '@aztec/stdlib/tx';
6
8
  import type { MetricDefinition } from '@aztec/telemetry-client';
7
9
  import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
8
10
 
@@ -23,7 +25,7 @@ export async function benchmarkSetup(
23
25
  ) {
24
26
  const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
25
27
  const defaultAccountAddress = context.accounts[0];
26
- const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }).deployed();
28
+ const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress });
27
29
  context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
28
30
  const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
29
31
  const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
@@ -142,18 +144,18 @@ export async function sendTxs(
142
144
  context: EndToEndContext,
143
145
  contract: BenchmarkingContract,
144
146
  heavyPublicCompute: boolean = false,
145
- ): Promise<SentTx[]> {
147
+ ): Promise<TxHash[]> {
146
148
  const calls = await Promise.all(times(txCount, index => makeCall(index, context, contract, heavyPublicCompute)));
147
149
  context.logger.info(`Creating ${txCount} txs`);
148
150
  const [from] = context.accounts;
149
151
  context.logger.info(`Sending ${txCount} txs`);
150
- return calls.map(call => call.send({ from }));
152
+ return Promise.all(calls.map(call => call.send({ from, wait: NO_WAIT })));
151
153
  }
152
154
 
153
- export async function waitTxs(txs: SentTx[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
155
+ export async function waitTxs(txs: TxHash[], context: EndToEndContext, txWaitOpts?: WaitOpts) {
154
156
  context.logger.info(`Awaiting ${txs.length} txs to be mined`);
155
- await Promise.all(txs.map(tx => tx.wait(txWaitOpts)));
156
- context.logger.info(`All ${txs.length} txs have been mined`);
157
+ await Promise.all(txs.map(txHash => waitForTx(context.aztecNode, txHash, txWaitOpts)));
158
+ context.logger.info(`${txs.length} txs have been mined`);
157
159
  }
158
160
 
159
161
  function randomBytesAsBigInts(length: number): bigint[] {