@aztec/end-to-end 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52

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 (167) 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 +21 -15
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +116 -121
  7. package/dest/bench/client_flows/config.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +7 -27
  10. package/dest/bench/utils.d.ts +5 -5
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +18 -11
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +98 -113
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  18. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +91 -70
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +18 -13
  22. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +19 -16
  25. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  26. package/dest/e2e_fees/bridging_race.notest.js +4 -6
  27. package/dest/e2e_fees/fees_test.d.ts +20 -16
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +127 -139
  30. package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
  31. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  32. package/dest/e2e_l1_publisher/write_json.js +23 -18
  33. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  34. package/dest/e2e_multi_validator/utils.js +1 -1
  35. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  36. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  37. package/dest/e2e_nested_contract/nested_contract_test.js +32 -39
  38. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  39. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  40. package/dest/e2e_p2p/inactivity_slash_test.js +7 -6
  41. package/dest/e2e_p2p/p2p_network.d.ts +225 -18
  42. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  43. package/dest/e2e_p2p/p2p_network.js +117 -110
  44. package/dest/e2e_p2p/shared.d.ts +6 -6
  45. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  46. package/dest/e2e_p2p/shared.js +6 -5
  47. package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
  48. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  49. package/dest/e2e_token_contract/token_contract_test.js +90 -92
  50. package/dest/fixtures/e2e_prover_test.d.ts +12 -18
  51. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  52. package/dest/fixtures/e2e_prover_test.js +98 -109
  53. package/dest/fixtures/fixtures.d.ts +2 -3
  54. package/dest/fixtures/fixtures.d.ts.map +1 -1
  55. package/dest/fixtures/fixtures.js +2 -3
  56. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  57. package/dest/fixtures/get_acvm_config.js +1 -1
  58. package/dest/fixtures/get_bb_config.d.ts +1 -1
  59. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  60. package/dest/fixtures/index.d.ts +1 -1
  61. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  62. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  63. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  64. package/dest/fixtures/logging.d.ts +1 -1
  65. package/dest/fixtures/setup.d.ts +216 -0
  66. package/dest/fixtures/setup.d.ts.map +1 -0
  67. package/dest/fixtures/setup.js +684 -0
  68. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +18 -10
  71. package/dest/fixtures/token_utils.d.ts +5 -2
  72. package/dest/fixtures/token_utils.d.ts.map +1 -1
  73. package/dest/fixtures/token_utils.js +7 -4
  74. package/dest/fixtures/utils.d.ts +5 -192
  75. package/dest/fixtures/utils.d.ts.map +1 -1
  76. package/dest/fixtures/utils.js +4 -648
  77. package/dest/fixtures/web3signer.d.ts +1 -1
  78. package/dest/fixtures/web3signer.js +1 -1
  79. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  80. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  81. package/dest/fixtures/with_telemetry_utils.js +2 -2
  82. package/dest/index.d.ts +1 -1
  83. package/dest/quality_of_service/grafana_client.d.ts +41 -0
  84. package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
  85. package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
  86. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  87. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  88. package/dest/quality_of_service/prometheus_client.js +67 -0
  89. package/dest/shared/cross_chain_test_harness.d.ts +5 -3
  90. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  91. package/dest/shared/cross_chain_test_harness.js +3 -3
  92. package/dest/shared/gas_portal_test_harness.d.ts +2 -2
  93. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  94. package/dest/shared/gas_portal_test_harness.js +1 -1
  95. package/dest/shared/index.d.ts +2 -2
  96. package/dest/shared/index.d.ts.map +1 -1
  97. package/dest/shared/jest_setup.d.ts +1 -1
  98. package/dest/shared/submit-transactions.d.ts +1 -1
  99. package/dest/shared/submit-transactions.d.ts.map +1 -1
  100. package/dest/shared/uniswap_l1_l2.d.ts +3 -27
  101. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  102. package/dest/shared/uniswap_l1_l2.js +43 -23
  103. package/dest/simulators/index.d.ts +1 -1
  104. package/dest/simulators/lending_simulator.d.ts +2 -2
  105. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  106. package/dest/simulators/lending_simulator.js +5 -3
  107. package/dest/simulators/token_simulator.d.ts +1 -1
  108. package/dest/simulators/token_simulator.d.ts.map +1 -1
  109. package/dest/spartan/setup_test_wallets.d.ts +8 -5
  110. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  111. package/dest/spartan/setup_test_wallets.js +45 -10
  112. package/dest/spartan/tx_metrics.d.ts +52 -0
  113. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  114. package/dest/spartan/tx_metrics.js +248 -0
  115. package/dest/spartan/utils.d.ts +66 -24
  116. package/dest/spartan/utils.d.ts.map +1 -1
  117. package/dest/spartan/utils.js +326 -133
  118. package/package.json +43 -40
  119. package/src/bench/client_flows/benchmark.ts +24 -2
  120. package/src/bench/client_flows/client_flows_benchmark.ts +157 -162
  121. package/src/bench/client_flows/data_extractor.ts +6 -28
  122. package/src/bench/utils.ts +22 -14
  123. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +107 -142
  124. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -124
  125. package/src/e2e_deploy_contract/deploy_test.ts +22 -15
  126. package/src/e2e_epochs/epochs_test.ts +39 -25
  127. package/src/e2e_fees/bridging_race.notest.ts +4 -7
  128. package/src/e2e_fees/fees_test.ts +180 -215
  129. package/src/e2e_l1_publisher/write_json.ts +26 -20
  130. package/src/e2e_multi_validator/utils.ts +1 -1
  131. package/src/e2e_nested_contract/nested_contract_test.ts +35 -55
  132. package/src/e2e_p2p/inactivity_slash_test.ts +10 -9
  133. package/src/e2e_p2p/p2p_network.ts +175 -180
  134. package/src/e2e_p2p/shared.ts +15 -7
  135. package/src/e2e_token_contract/token_contract_test.ts +105 -118
  136. package/src/fixtures/e2e_prover_test.ts +120 -153
  137. package/src/fixtures/fixtures.ts +2 -5
  138. package/src/fixtures/get_acvm_config.ts +1 -1
  139. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  140. package/src/fixtures/setup.ts +1010 -0
  141. package/src/fixtures/setup_p2p_test.ts +23 -9
  142. package/src/fixtures/token_utils.ts +4 -4
  143. package/src/fixtures/utils.ts +27 -947
  144. package/src/fixtures/web3signer.ts +1 -1
  145. package/src/fixtures/with_telemetry_utils.ts +2 -2
  146. package/src/guides/up_quick_start.sh +1 -1
  147. package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
  148. package/src/quality_of_service/prometheus_client.ts +113 -0
  149. package/src/shared/cross_chain_test_harness.ts +6 -9
  150. package/src/shared/gas_portal_test_harness.ts +2 -2
  151. package/src/shared/index.ts +1 -1
  152. package/src/shared/uniswap_l1_l2.ts +53 -67
  153. package/src/simulators/lending_simulator.ts +6 -4
  154. package/src/spartan/DEVELOP.md +7 -0
  155. package/src/spartan/setup_test_wallets.ts +56 -13
  156. package/src/spartan/tx_metrics.ts +231 -0
  157. package/src/spartan/utils.ts +379 -75
  158. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  159. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  160. package/dest/fixtures/setup_l1_contracts.js +0 -17
  161. package/dest/fixtures/snapshot_manager.d.ts +0 -95
  162. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  163. package/dest/fixtures/snapshot_manager.js +0 -505
  164. package/dest/quality_of_service/alert_checker.d.ts +0 -41
  165. package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
  166. package/src/fixtures/setup_l1_contracts.ts +0 -26
  167. package/src/fixtures/snapshot_manager.ts +0 -665
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "0.0.1-commit.24de95ac",
3
+ "version": "0.0.1-commit.3469e52",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "inherits": [
@@ -8,8 +8,8 @@
8
8
  "./package.local.json"
9
9
  ],
10
10
  "scripts": {
11
- "build": "yarn clean && tsc -b",
12
- "build:dev": "tsc -b --watch",
11
+ "build": "yarn clean && ../scripts/tsc.sh",
12
+ "build:dev": "../scripts/tsc.sh --watch",
13
13
  "clean": "rm -rf ./dest .tsbuildinfo",
14
14
  "test:with-alerts": "./scripts/test-with-alerts.sh",
15
15
  "test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
@@ -25,42 +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.24de95ac",
29
- "@aztec/archiver": "0.0.1-commit.24de95ac",
30
- "@aztec/aztec": "0.0.1-commit.24de95ac",
31
- "@aztec/aztec-node": "0.0.1-commit.24de95ac",
32
- "@aztec/aztec.js": "0.0.1-commit.24de95ac",
33
- "@aztec/bb-prover": "0.0.1-commit.24de95ac",
34
- "@aztec/blob-lib": "0.0.1-commit.24de95ac",
35
- "@aztec/blob-sink": "0.0.1-commit.24de95ac",
36
- "@aztec/bot": "0.0.1-commit.24de95ac",
37
- "@aztec/cli": "0.0.1-commit.24de95ac",
38
- "@aztec/constants": "0.0.1-commit.24de95ac",
39
- "@aztec/entrypoints": "0.0.1-commit.24de95ac",
40
- "@aztec/epoch-cache": "0.0.1-commit.24de95ac",
41
- "@aztec/ethereum": "0.0.1-commit.24de95ac",
42
- "@aztec/foundation": "0.0.1-commit.24de95ac",
43
- "@aztec/kv-store": "0.0.1-commit.24de95ac",
44
- "@aztec/l1-artifacts": "0.0.1-commit.24de95ac",
45
- "@aztec/merkle-tree": "0.0.1-commit.24de95ac",
46
- "@aztec/node-keystore": "0.0.1-commit.24de95ac",
47
- "@aztec/noir-contracts.js": "0.0.1-commit.24de95ac",
48
- "@aztec/noir-noirc_abi": "0.0.1-commit.24de95ac",
49
- "@aztec/noir-protocol-circuits-types": "0.0.1-commit.24de95ac",
50
- "@aztec/noir-test-contracts.js": "0.0.1-commit.24de95ac",
51
- "@aztec/p2p": "0.0.1-commit.24de95ac",
52
- "@aztec/protocol-contracts": "0.0.1-commit.24de95ac",
53
- "@aztec/prover-client": "0.0.1-commit.24de95ac",
54
- "@aztec/prover-node": "0.0.1-commit.24de95ac",
55
- "@aztec/pxe": "0.0.1-commit.24de95ac",
56
- "@aztec/sequencer-client": "0.0.1-commit.24de95ac",
57
- "@aztec/simulator": "0.0.1-commit.24de95ac",
58
- "@aztec/slasher": "0.0.1-commit.24de95ac",
59
- "@aztec/stdlib": "0.0.1-commit.24de95ac",
60
- "@aztec/telemetry-client": "0.0.1-commit.24de95ac",
61
- "@aztec/test-wallet": "0.0.1-commit.24de95ac",
62
- "@aztec/validator-client": "0.0.1-commit.24de95ac",
63
- "@aztec/world-state": "0.0.1-commit.24de95ac",
28
+ "@aztec/accounts": "0.0.1-commit.3469e52",
29
+ "@aztec/archiver": "0.0.1-commit.3469e52",
30
+ "@aztec/aztec": "0.0.1-commit.3469e52",
31
+ "@aztec/aztec-node": "0.0.1-commit.3469e52",
32
+ "@aztec/aztec.js": "0.0.1-commit.3469e52",
33
+ "@aztec/bb-prover": "0.0.1-commit.3469e52",
34
+ "@aztec/bb.js": "0.0.1-commit.3469e52",
35
+ "@aztec/blob-client": "0.0.1-commit.3469e52",
36
+ "@aztec/blob-lib": "0.0.1-commit.3469e52",
37
+ "@aztec/bot": "0.0.1-commit.3469e52",
38
+ "@aztec/cli": "0.0.1-commit.3469e52",
39
+ "@aztec/constants": "0.0.1-commit.3469e52",
40
+ "@aztec/entrypoints": "0.0.1-commit.3469e52",
41
+ "@aztec/epoch-cache": "0.0.1-commit.3469e52",
42
+ "@aztec/ethereum": "0.0.1-commit.3469e52",
43
+ "@aztec/foundation": "0.0.1-commit.3469e52",
44
+ "@aztec/kv-store": "0.0.1-commit.3469e52",
45
+ "@aztec/l1-artifacts": "0.0.1-commit.3469e52",
46
+ "@aztec/merkle-tree": "0.0.1-commit.3469e52",
47
+ "@aztec/node-keystore": "0.0.1-commit.3469e52",
48
+ "@aztec/noir-contracts.js": "0.0.1-commit.3469e52",
49
+ "@aztec/noir-noirc_abi": "0.0.1-commit.3469e52",
50
+ "@aztec/noir-protocol-circuits-types": "0.0.1-commit.3469e52",
51
+ "@aztec/noir-test-contracts.js": "0.0.1-commit.3469e52",
52
+ "@aztec/p2p": "0.0.1-commit.3469e52",
53
+ "@aztec/protocol-contracts": "0.0.1-commit.3469e52",
54
+ "@aztec/prover-client": "0.0.1-commit.3469e52",
55
+ "@aztec/prover-node": "0.0.1-commit.3469e52",
56
+ "@aztec/pxe": "0.0.1-commit.3469e52",
57
+ "@aztec/sequencer-client": "0.0.1-commit.3469e52",
58
+ "@aztec/simulator": "0.0.1-commit.3469e52",
59
+ "@aztec/slasher": "0.0.1-commit.3469e52",
60
+ "@aztec/stdlib": "0.0.1-commit.3469e52",
61
+ "@aztec/telemetry-client": "0.0.1-commit.3469e52",
62
+ "@aztec/test-wallet": "0.0.1-commit.3469e52",
63
+ "@aztec/validator-client": "0.0.1-commit.3469e52",
64
+ "@aztec/validator-ha-signer": "0.0.1-commit.3469e52",
65
+ "@aztec/world-state": "0.0.1-commit.3469e52",
64
66
  "@iarna/toml": "^2.2.5",
65
67
  "@jest/globals": "^30.0.0",
66
68
  "@noble/curves": "=1.0.0",
@@ -97,7 +99,7 @@
97
99
  "tslib": "^2.4.0",
98
100
  "typescript": "^5.3.3",
99
101
  "util": "^0.12.5",
100
- "viem": "npm:@spalladino/viem@2.38.2-eip7594.0",
102
+ "viem": "npm:@aztec/viem@2.38.2",
101
103
  "zod": "^3.23.8"
102
104
  },
103
105
  "devDependencies": {
@@ -106,6 +108,7 @@
106
108
  "@types/jest": "^30.0.0",
107
109
  "@types/js-yaml": "^4.0.9",
108
110
  "@types/lodash.chunk": "^4.2.9",
111
+ "@typescript/native-preview": "7.0.0-dev.20260113.1",
109
112
  "concurrently": "^7.6.0",
110
113
  "jest": "^30.0.0",
111
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({
@@ -5,11 +5,14 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
5
  import type { AztecNode } from '@aztec/aztec.js/node';
6
6
  import type { Wallet } from '@aztec/aztec.js/wallet';
7
7
  import { CheatCodes } from '@aztec/aztec/testing';
8
- import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
8
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
9
+ import { RollupContract } from '@aztec/ethereum/contracts';
10
+ import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
11
+ import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
9
12
  import { ChainMonitor } from '@aztec/ethereum/test';
10
- import { randomBytes } from '@aztec/foundation/crypto';
13
+ import { randomBytes } from '@aztec/foundation/crypto/random';
14
+ import { Fr } from '@aztec/foundation/curves/bn254';
11
15
  import { EthAddress } from '@aztec/foundation/eth-address';
12
- import { Fr } from '@aztec/foundation/fields';
13
16
  import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
14
17
  import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
15
18
  import { AMMContract } from '@aztec/noir-contracts.js/AMM';
@@ -20,19 +23,15 @@ import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contract
20
23
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
21
24
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
22
25
  import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
26
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
23
27
  import { GasSettings } from '@aztec/stdlib/gas';
24
28
  import { deriveSigningKey } from '@aztec/stdlib/keys';
25
29
  import { TestWallet } from '@aztec/test-wallet/server';
26
30
 
27
31
  import { MNEMONIC } from '../../fixtures/fixtures.js';
28
- import {
29
- type ISnapshotManager,
30
- type SubsystemsContext,
31
- createSnapshotManager,
32
- deployAccounts,
33
- } from '../../fixtures/snapshot_manager.js';
32
+ import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js';
34
33
  import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
35
- import { type SetupOptions, setupSponsoredFPC } from '../../fixtures/utils.js';
34
+ import { setupSponsoredFPC } from '../../fixtures/utils.js';
36
35
  import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
37
36
  import {
38
37
  FeeJuicePortalTestingHarnessFactory,
@@ -41,19 +40,17 @@ import {
41
40
  import { ProxyLogger } from './benchmark.js';
42
41
  import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
43
42
 
44
- const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
43
+ const { BENCHMARK_CONFIG } = process.env;
45
44
 
46
45
  export type AccountType = 'ecdsar1' | 'schnorr';
47
46
  export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
48
47
  export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
49
48
 
50
49
  export class ClientFlowsBenchmark {
51
- private snapshotManager: ISnapshotManager;
52
-
53
50
  public logger: Logger;
54
51
  public aztecNode!: AztecNode;
55
52
  public cheatCodes!: CheatCodes;
56
- public context!: SubsystemsContext;
53
+ public context!: EndToEndContext;
57
54
  public chainMonitor!: ChainMonitor;
58
55
  public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
59
56
  public adminWallet!: TestWallet;
@@ -69,15 +66,21 @@ export class ClientFlowsBenchmark {
69
66
  public feeJuiceContract!: FeeJuiceContract;
70
67
  // Asset in which fees are paid via FPC
71
68
  public bananaCoin!: BananaCoin;
69
+ public bananaCoinInstance!: ContractInstanceWithAddress;
72
70
  public bananaFPC!: FPCContract;
71
+ public bananaFPCInstance!: ContractInstanceWithAddress;
73
72
  // Random asset we want to trade
74
73
  public candyBarCoin!: TokenContract;
74
+ public candyBarCoinInstance!: ContractInstanceWithAddress;
75
75
  // AMM contract
76
76
  public amm!: AMMContract;
77
+ public ammInstance!: ContractInstanceWithAddress;
77
78
  // Liquidity token for AMM
78
79
  public liquidityToken!: TokenContract;
80
+ public liquidityTokenInstance!: ContractInstanceWithAddress;
79
81
  // Sponsored FPC contract
80
82
  public sponsoredFPC!: SponsoredFPCContract;
83
+ public sponsoredFPCInstance!: ContractInstanceWithAddress;
81
84
 
82
85
  // PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
83
86
  public userWallet!: TestWallet;
@@ -115,33 +118,37 @@ export class ClientFlowsBenchmark {
115
118
  public config: ClientFlowsConfig;
116
119
 
117
120
  private proxyLogger: ProxyLogger;
121
+ private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs>;
118
122
 
119
- constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployL1ContractsArgs> = {}) {
123
+ constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
120
124
  this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
121
- this.snapshotManager = createSnapshotManager(
122
- `bench_client_flows${testName ? `/${testName}` : ''}`,
123
- dataPath,
124
- { startProverNode: true, ...setupOptions },
125
- { ...setupOptions },
126
- );
125
+ this.setupOptions = { startProverNode: true, ...setupOptions };
127
126
  this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
128
127
  ProxyLogger.create();
129
128
  this.proxyLogger = ProxyLogger.getInstance();
130
129
  }
131
130
 
132
131
  async setup() {
133
- const context = await this.snapshotManager.setup();
134
- 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();
135
140
 
136
- const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
137
- this.chainMonitor = new ChainMonitor(rollupContract, context.dateProvider, this.logger, 200).start();
141
+ await this.context.aztecNodeService!.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
142
+
143
+ const rollupContract = RollupContract.getFromConfig(this.context.config);
144
+ this.chainMonitor = new ChainMonitor(rollupContract, this.context.dateProvider!, this.logger, 200).start();
138
145
 
139
146
  return this;
140
147
  }
141
148
 
142
149
  async teardown() {
143
150
  await this.chainMonitor.stop();
144
- await this.snapshotManager.teardown();
151
+ await teardown(this.context);
145
152
  }
146
153
 
147
154
  async mintAndBridgeFeeJuice(address: AztecAddress) {
@@ -183,137 +190,124 @@ export class ClientFlowsBenchmark {
183
190
  }
184
191
  }
185
192
 
186
- public async applyBaseSnapshots() {
187
- await this.applyInitialAccountsSnapshot();
188
- await this.applySetupFeeJuiceSnapshot();
193
+ public async applyBaseSetup() {
194
+ await this.applyInitialAccounts();
195
+ await this.applySetupFeeJuice();
189
196
  }
190
197
 
191
- async applyInitialAccountsSnapshot() {
192
- await this.snapshotManager.snapshot(
193
- 'initial_accounts',
194
- deployAccounts(2, this.logger),
195
- async (
196
- { deployedAccounts: [{ address: adminAddress }, { address: sequencerAddress }] },
197
- { wallet, aztecNode, cheatCodes },
198
- ) => {
199
- this.adminWallet = wallet;
200
- this.aztecNode = aztecNode;
201
- this.cheatCodes = cheatCodes;
202
-
203
- this.adminAddress = adminAddress;
204
- this.sequencerAddress = sequencerAddress;
205
-
206
- const canonicalFeeJuice = await getCanonicalFeeJuice();
207
- this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
208
- this.coinbase = EthAddress.random();
209
-
210
- const userPXEConfig = getPXEConfig();
211
- const userPXEConfigWithContracts = {
212
- ...userPXEConfig,
213
- proverEnabled: this.realProofs,
214
- } as PXEConfig;
215
-
216
- this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
217
- loggers: {
218
- prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
219
- },
220
- });
198
+ async applyInitialAccounts() {
199
+ this.logger.info('Applying initial accounts setup');
200
+ const { deployedAccounts } = await deployAccounts(
201
+ 2,
202
+ this.logger,
203
+ )({
204
+ wallet: this.context.wallet,
205
+ initialFundedAccounts: this.context.initialFundedAccounts,
206
+ });
207
+
208
+ const [{ address: adminAddress }, { address: sequencerAddress }] = deployedAccounts;
209
+
210
+ this.adminWallet = this.context.wallet;
211
+ this.aztecNode = this.context.aztecNodeService!;
212
+ this.cheatCodes = this.context.cheatCodes;
213
+
214
+ this.adminAddress = adminAddress;
215
+ this.sequencerAddress = sequencerAddress;
216
+
217
+ const canonicalFeeJuice = await getCanonicalFeeJuice();
218
+ this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
219
+ this.coinbase = EthAddress.random();
220
+
221
+ const userPXEConfig = getPXEConfig();
222
+ const userPXEConfigWithContracts = {
223
+ ...userPXEConfig,
224
+ proverEnabled: this.realProofs,
225
+ } as PXEConfig;
226
+
227
+ this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
228
+ loggers: {
229
+ prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
221
230
  },
222
- );
231
+ });
223
232
  }
224
233
 
225
- async applySetupFeeJuiceSnapshot() {
226
- await this.snapshotManager.snapshot(
227
- 'setup_fee_juice',
228
- async () => {},
229
- async (_data, context) => {
230
- this.context = context;
231
-
232
- this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
233
-
234
- this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
235
- aztecNode: context.aztecNode,
236
- aztecNodeAdmin: context.aztecNode,
237
- l1Client: context.deployL1ContractsValues.l1Client,
238
- wallet: this.adminWallet,
239
- logger: this.logger,
240
- });
241
- },
242
- );
234
+ async applySetupFeeJuice() {
235
+ this.logger.info('Applying fee juice setup');
236
+ this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
237
+
238
+ this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
239
+ aztecNode: this.context.aztecNodeService!,
240
+ aztecNodeAdmin: this.context.aztecNodeService!,
241
+ l1Client: this.context.deployL1ContractsValues.l1Client,
242
+ wallet: this.adminWallet,
243
+ logger: this.logger,
244
+ });
243
245
  }
244
246
 
245
- async applyDeployBananaTokenSnapshot() {
246
- await this.snapshotManager.snapshot(
247
- 'deploy_banana_token',
248
- async () => {
249
- const bananaCoin = await BananaCoin.deploy(this.adminWallet, this.adminAddress, 'BC', 'BC', 18n)
250
- .send({ from: this.adminAddress })
251
- .deployed();
252
- this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
253
- return { bananaCoinAddress: bananaCoin.address };
254
- },
255
- async ({ bananaCoinAddress }) => {
256
- this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.adminWallet);
257
- },
258
- );
247
+ async applyDeployBananaToken() {
248
+ this.logger.info('Applying banana token deployment');
249
+ const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
250
+ this.adminWallet,
251
+ this.adminAddress,
252
+ 'BC',
253
+ 'BC',
254
+ 18n,
255
+ )
256
+ .send({ from: this.adminAddress })
257
+ .wait();
258
+ this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
259
+ this.bananaCoin = bananaCoin;
260
+ this.bananaCoinInstance = bananaCoinInstance;
259
261
  }
260
262
 
261
- async applyDeployCandyBarTokenSnapshot() {
262
- await this.snapshotManager.snapshot(
263
- 'deploy_candy_bar_token',
264
- async () => {
265
- const candyBarCoin = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'CBC', 'CBC', 18n)
266
- .send({ from: this.adminAddress })
267
- .deployed();
268
- this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
269
- return { candyBarCoinAddress: candyBarCoin.address };
270
- },
271
- async ({ candyBarCoinAddress }) => {
272
- this.candyBarCoin = await TokenContract.at(candyBarCoinAddress, this.adminWallet);
273
- },
274
- );
263
+ async applyDeployCandyBarToken() {
264
+ this.logger.info('Applying candy bar token deployment');
265
+ const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
266
+ this.adminWallet,
267
+ this.adminAddress,
268
+ 'CBC',
269
+ 'CBC',
270
+ 18n,
271
+ )
272
+ .send({ from: this.adminAddress })
273
+ .wait();
274
+ this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
275
+ this.candyBarCoin = candyBarCoin;
276
+ this.candyBarCoinInstance = candyBarCoinInstance;
275
277
  }
276
278
 
277
- public async applyFPCSetupSnapshot() {
278
- await this.snapshotManager.snapshot(
279
- 'fpc_setup',
280
- async context => {
281
- const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
282
- expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
279
+ public async applyFPCSetup() {
280
+ this.logger.info('Applying FPC setup');
281
+ const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
282
+ expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
283
283
 
284
- const bananaCoin = this.bananaCoin;
285
- const bananaFPC = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress)
286
- .send({ from: this.adminAddress })
287
- .deployed();
284
+ const bananaCoin = this.bananaCoin;
285
+ const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
286
+ this.adminWallet,
287
+ bananaCoin.address,
288
+ this.adminAddress,
289
+ )
290
+ .send({ from: this.adminAddress })
291
+ .wait();
288
292
 
289
- this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
293
+ this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
290
294
 
291
- await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
295
+ await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
292
296
 
293
- return { bananaFPCAddress: bananaFPC.address };
294
- },
295
- async data => {
296
- this.bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.adminWallet);
297
- },
298
- );
297
+ this.bananaFPC = bananaFPC;
298
+ this.bananaFPCInstance = bananaFPCInstance;
299
299
  }
300
300
 
301
- async applyDeploySponsoredFPCSnapshot() {
302
- await this.snapshotManager.snapshot(
303
- 'deploy_sponsored_fpc',
304
- async () => {
305
- const sponsoredFPC = await setupSponsoredFPC(this.adminWallet);
306
- this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
307
- return { sponsoredFPCAddress: sponsoredFPC.address };
308
- },
309
- async ({ sponsoredFPCAddress }) => {
310
- this.sponsoredFPC = await SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
311
- },
312
- );
301
+ async applyDeploySponsoredFPC() {
302
+ this.logger.info('Applying sponsored FPC deployment');
303
+ const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
304
+ this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
305
+ this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.adminWallet);
306
+ this.sponsoredFPCInstance = sponsoredFPCInstance;
313
307
  }
314
308
 
315
309
  public async createCrossChainTestHarness(owner: AztecAddress) {
316
- const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
310
+ const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
317
311
 
318
312
  const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
319
313
  'Underlying',
@@ -357,30 +351,31 @@ export class ClientFlowsBenchmark {
357
351
  return accountManager.address;
358
352
  }
359
353
 
360
- public async applyDeployAmmSnapshot() {
361
- await this.snapshotManager.snapshot(
362
- 'deploy_amm',
363
- async () => {
364
- const liquidityToken = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'LPT', 'LPT', 18n)
365
- .send({ from: this.adminAddress })
366
- .deployed();
367
- const amm = await AMMContract.deploy(
368
- this.adminWallet,
369
- this.bananaCoin.address,
370
- this.candyBarCoin.address,
371
- liquidityToken.address,
372
- )
373
- .send({ from: this.adminAddress })
374
- .deployed();
375
- this.logger.info(`AMM deployed at ${amm.address}`);
376
- await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
377
- return { ammAddress: amm.address, liquidityTokenAddress: liquidityToken.address };
378
- },
379
- async ({ ammAddress, liquidityTokenAddress }) => {
380
- this.liquidityToken = await TokenContract.at(liquidityTokenAddress, this.adminWallet);
381
- this.amm = await AMMContract.at(ammAddress, this.adminWallet);
382
- },
383
- );
354
+ public async applyDeployAmm() {
355
+ this.logger.info('Applying AMM deployment');
356
+ const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
357
+ this.adminWallet,
358
+ this.adminAddress,
359
+ 'LPT',
360
+ 'LPT',
361
+ 18n,
362
+ )
363
+ .send({ from: this.adminAddress })
364
+ .wait();
365
+ const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
366
+ this.adminWallet,
367
+ this.bananaCoin.address,
368
+ this.candyBarCoin.address,
369
+ liquidityToken.address,
370
+ )
371
+ .send({ from: this.adminAddress })
372
+ .wait();
373
+ this.logger.info(`AMM deployed at ${amm.address}`);
374
+ await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
375
+ this.liquidityToken = liquidityToken;
376
+ this.liquidityTokenInstance = liquidityTokenInstance;
377
+ this.amm = amm;
378
+ this.ammInstance = ammInstance;
384
379
  }
385
380
 
386
381
  public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
@@ -391,7 +386,7 @@ export class ClientFlowsBenchmark {
391
386
  public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
392
387
  // The private fee paying method assembled on the app side requires knowledge of the maximum
393
388
  // fee the user is willing to pay
394
- const maxFeesPerGas = (await this.aztecNode.getCurrentBaseFees()).mul(1.5);
389
+ const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1.5);
395
390
  const gasSettings = GasSettings.default({ maxFeesPerGas });
396
391
  return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
397
392
  }