@aztec/end-to-end 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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 (165) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +4 -3
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/benchmark.js +2 -2
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +26 -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 +111 -90
  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 +10 -30
  10. package/dest/bench/utils.d.ts +3 -12
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +17 -37
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +8 -8
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  15. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +42 -42
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +13 -10
  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 +35 -35
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts +12 -6
  20. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  21. package/dest/e2e_deploy_contract/deploy_test.js +9 -18
  22. package/dest/e2e_epochs/epochs_test.d.ts +20 -12
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +36 -27
  25. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  26. package/dest/e2e_fees/bridging_race.notest.js +14 -11
  27. package/dest/e2e_fees/fees_test.d.ts +13 -9
  28. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  29. package/dest/e2e_fees/fees_test.js +39 -40
  30. package/dest/e2e_l1_publisher/write_json.d.ts +4 -2
  31. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  32. package/dest/e2e_l1_publisher/write_json.js +9 -8
  33. package/dest/e2e_multi_validator/utils.d.ts +2 -2
  34. package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
  35. package/dest/e2e_multi_validator/utils.js +4 -10
  36. package/dest/e2e_nested_contract/nested_contract_test.d.ts +7 -4
  37. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  38. package/dest/e2e_nested_contract/nested_contract_test.js +11 -12
  39. package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
  40. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
  41. package/dest/e2e_p2p/inactivity_slash_test.js +136 -0
  42. package/dest/e2e_p2p/p2p_network.d.ts +238 -18
  43. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  44. package/dest/e2e_p2p/p2p_network.js +50 -25
  45. package/dest/e2e_p2p/shared.d.ts +16 -17
  46. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  47. package/dest/e2e_p2p/shared.js +57 -56
  48. package/dest/e2e_token_contract/token_contract_test.d.ts +6 -5
  49. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  50. package/dest/e2e_token_contract/token_contract_test.js +14 -17
  51. package/dest/fixtures/e2e_prover_test.d.ts +13 -11
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +57 -66
  54. package/dest/fixtures/fixtures.d.ts +2 -3
  55. package/dest/fixtures/fixtures.d.ts.map +1 -1
  56. package/dest/fixtures/fixtures.js +2 -3
  57. package/dest/fixtures/get_acvm_config.d.ts +2 -2
  58. package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
  59. package/dest/fixtures/get_acvm_config.js +1 -1
  60. package/dest/fixtures/get_bb_config.d.ts +2 -2
  61. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  62. package/dest/fixtures/get_bb_config.js +2 -2
  63. package/dest/fixtures/index.d.ts +1 -1
  64. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  65. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  66. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  67. package/dest/fixtures/logging.d.ts +1 -1
  68. package/dest/fixtures/setup_p2p_test.d.ts +12 -11
  69. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  70. package/dest/fixtures/setup_p2p_test.js +50 -24
  71. package/dest/fixtures/snapshot_manager.d.ts +16 -15
  72. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  73. package/dest/fixtures/snapshot_manager.js +84 -88
  74. package/dest/fixtures/token_utils.d.ts +10 -5
  75. package/dest/fixtures/token_utils.d.ts.map +1 -1
  76. package/dest/fixtures/token_utils.js +17 -18
  77. package/dest/fixtures/utils.d.ts +44 -47
  78. package/dest/fixtures/utils.d.ts.map +1 -1
  79. package/dest/fixtures/utils.js +128 -185
  80. package/dest/fixtures/web3signer.d.ts +5 -0
  81. package/dest/fixtures/web3signer.d.ts.map +1 -0
  82. package/dest/fixtures/web3signer.js +53 -0
  83. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  84. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  85. package/dest/fixtures/with_telemetry_utils.js +2 -2
  86. package/dest/index.d.ts +1 -1
  87. package/dest/quality_of_service/alert_checker.d.ts +2 -2
  88. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  89. package/dest/shared/cross_chain_test_harness.d.ts +20 -23
  90. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  91. package/dest/shared/cross_chain_test_harness.js +14 -16
  92. package/dest/shared/gas_portal_test_harness.d.ts +10 -17
  93. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  94. package/dest/shared/gas_portal_test_harness.js +11 -8
  95. package/dest/shared/index.d.ts +1 -1
  96. package/dest/shared/jest_setup.d.ts +1 -1
  97. package/dest/shared/jest_setup.js +1 -1
  98. package/dest/shared/submit-transactions.d.ts +6 -4
  99. package/dest/shared/submit-transactions.d.ts.map +1 -1
  100. package/dest/shared/submit-transactions.js +8 -7
  101. package/dest/shared/uniswap_l1_l2.d.ts +13 -9
  102. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  103. package/dest/shared/uniswap_l1_l2.js +44 -58
  104. package/dest/simulators/index.d.ts +1 -1
  105. package/dest/simulators/lending_simulator.d.ts +4 -7
  106. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  107. package/dest/simulators/lending_simulator.js +8 -5
  108. package/dest/simulators/token_simulator.d.ts +4 -2
  109. package/dest/simulators/token_simulator.d.ts.map +1 -1
  110. package/dest/simulators/token_simulator.js +2 -2
  111. package/dest/spartan/setup_test_wallets.d.ts +22 -14
  112. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  113. package/dest/spartan/setup_test_wallets.js +144 -86
  114. package/dest/spartan/tx_metrics.d.ts +39 -0
  115. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  116. package/dest/spartan/tx_metrics.js +95 -0
  117. package/dest/spartan/utils.d.ts +101 -16
  118. package/dest/spartan/utils.d.ts.map +1 -1
  119. package/dest/spartan/utils.js +414 -52
  120. package/package.json +43 -40
  121. package/src/bench/client_flows/benchmark.ts +8 -8
  122. package/src/bench/client_flows/client_flows_benchmark.ts +143 -115
  123. package/src/bench/client_flows/data_extractor.ts +9 -31
  124. package/src/bench/utils.ts +15 -39
  125. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
  126. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +46 -55
  127. package/src/e2e_deploy_contract/deploy_test.ts +18 -36
  128. package/src/e2e_epochs/epochs_test.ts +59 -42
  129. package/src/e2e_fees/bridging_race.notest.ts +16 -11
  130. package/src/e2e_fees/fees_test.ts +48 -52
  131. package/src/e2e_l1_publisher/write_json.ts +12 -9
  132. package/src/e2e_multi_validator/utils.ts +5 -11
  133. package/src/e2e_nested_contract/nested_contract_test.ts +15 -13
  134. package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
  135. package/src/e2e_p2p/p2p_network.ts +125 -89
  136. package/src/e2e_p2p/shared.ts +69 -60
  137. package/src/e2e_token_contract/token_contract_test.ts +17 -17
  138. package/src/fixtures/e2e_prover_test.ts +65 -105
  139. package/src/fixtures/fixtures.ts +2 -5
  140. package/src/fixtures/get_acvm_config.ts +2 -2
  141. package/src/fixtures/get_bb_config.ts +3 -2
  142. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  143. package/src/fixtures/setup_p2p_test.ts +79 -32
  144. package/src/fixtures/snapshot_manager.ts +120 -131
  145. package/src/fixtures/token_utils.ts +16 -24
  146. package/src/fixtures/utils.ts +175 -269
  147. package/src/fixtures/web3signer.ts +63 -0
  148. package/src/fixtures/with_telemetry_utils.ts +2 -2
  149. package/src/guides/up_quick_start.sh +3 -11
  150. package/src/quality_of_service/alert_checker.ts +1 -1
  151. package/src/shared/cross_chain_test_harness.ts +23 -31
  152. package/src/shared/gas_portal_test_harness.ts +14 -21
  153. package/src/shared/jest_setup.ts +1 -1
  154. package/src/shared/submit-transactions.ts +12 -8
  155. package/src/shared/uniswap_l1_l2.ts +80 -88
  156. package/src/simulators/lending_simulator.ts +9 -6
  157. package/src/simulators/token_simulator.ts +5 -2
  158. package/src/spartan/DEVELOP.md +15 -3
  159. package/src/spartan/setup_test_wallets.ts +171 -127
  160. package/src/spartan/tx_metrics.ts +130 -0
  161. package/src/spartan/utils.ts +543 -45
  162. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  163. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  164. package/dest/fixtures/setup_l1_contracts.js +0 -17
  165. package/src/fixtures/setup_l1_contracts.ts +0 -26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/end-to-end",
3
- "version": "4.0.0-nightly.20250907",
3
+ "version": "4.0.0-nightly.20260108",
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,41 +25,43 @@
25
25
  "formatting": "run -T prettier --check ./src && run -T eslint ./src"
26
26
  },
27
27
  "dependencies": {
28
- "@aztec/accounts": "4.0.0-nightly.20250907",
29
- "@aztec/archiver": "4.0.0-nightly.20250907",
30
- "@aztec/aztec": "4.0.0-nightly.20250907",
31
- "@aztec/aztec-node": "4.0.0-nightly.20250907",
32
- "@aztec/aztec.js": "4.0.0-nightly.20250907",
33
- "@aztec/bb-prover": "4.0.0-nightly.20250907",
34
- "@aztec/blob-lib": "4.0.0-nightly.20250907",
35
- "@aztec/blob-sink": "4.0.0-nightly.20250907",
36
- "@aztec/bot": "4.0.0-nightly.20250907",
37
- "@aztec/cli": "4.0.0-nightly.20250907",
38
- "@aztec/constants": "4.0.0-nightly.20250907",
39
- "@aztec/entrypoints": "4.0.0-nightly.20250907",
40
- "@aztec/epoch-cache": "4.0.0-nightly.20250907",
41
- "@aztec/ethereum": "4.0.0-nightly.20250907",
42
- "@aztec/foundation": "4.0.0-nightly.20250907",
43
- "@aztec/kv-store": "4.0.0-nightly.20250907",
44
- "@aztec/l1-artifacts": "4.0.0-nightly.20250907",
45
- "@aztec/merkle-tree": "4.0.0-nightly.20250907",
46
- "@aztec/node-keystore": "4.0.0-nightly.20250907",
47
- "@aztec/noir-contracts.js": "4.0.0-nightly.20250907",
48
- "@aztec/noir-noirc_abi": "4.0.0-nightly.20250907",
49
- "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20250907",
50
- "@aztec/noir-test-contracts.js": "4.0.0-nightly.20250907",
51
- "@aztec/p2p": "4.0.0-nightly.20250907",
52
- "@aztec/protocol-contracts": "4.0.0-nightly.20250907",
53
- "@aztec/prover-client": "4.0.0-nightly.20250907",
54
- "@aztec/prover-node": "4.0.0-nightly.20250907",
55
- "@aztec/pxe": "4.0.0-nightly.20250907",
56
- "@aztec/sequencer-client": "4.0.0-nightly.20250907",
57
- "@aztec/simulator": "4.0.0-nightly.20250907",
58
- "@aztec/slasher": "4.0.0-nightly.20250907",
59
- "@aztec/stdlib": "4.0.0-nightly.20250907",
60
- "@aztec/telemetry-client": "4.0.0-nightly.20250907",
61
- "@aztec/validator-client": "4.0.0-nightly.20250907",
62
- "@aztec/world-state": "4.0.0-nightly.20250907",
28
+ "@aztec/accounts": "4.0.0-nightly.20260108",
29
+ "@aztec/archiver": "4.0.0-nightly.20260108",
30
+ "@aztec/aztec": "4.0.0-nightly.20260108",
31
+ "@aztec/aztec-node": "4.0.0-nightly.20260108",
32
+ "@aztec/aztec.js": "4.0.0-nightly.20260108",
33
+ "@aztec/bb-prover": "4.0.0-nightly.20260108",
34
+ "@aztec/bb.js": "4.0.0-nightly.20260108",
35
+ "@aztec/blob-client": "4.0.0-nightly.20260108",
36
+ "@aztec/blob-lib": "4.0.0-nightly.20260108",
37
+ "@aztec/bot": "4.0.0-nightly.20260108",
38
+ "@aztec/cli": "4.0.0-nightly.20260108",
39
+ "@aztec/constants": "4.0.0-nightly.20260108",
40
+ "@aztec/entrypoints": "4.0.0-nightly.20260108",
41
+ "@aztec/epoch-cache": "4.0.0-nightly.20260108",
42
+ "@aztec/ethereum": "4.0.0-nightly.20260108",
43
+ "@aztec/foundation": "4.0.0-nightly.20260108",
44
+ "@aztec/kv-store": "4.0.0-nightly.20260108",
45
+ "@aztec/l1-artifacts": "4.0.0-nightly.20260108",
46
+ "@aztec/merkle-tree": "4.0.0-nightly.20260108",
47
+ "@aztec/node-keystore": "4.0.0-nightly.20260108",
48
+ "@aztec/noir-contracts.js": "4.0.0-nightly.20260108",
49
+ "@aztec/noir-noirc_abi": "4.0.0-nightly.20260108",
50
+ "@aztec/noir-protocol-circuits-types": "4.0.0-nightly.20260108",
51
+ "@aztec/noir-test-contracts.js": "4.0.0-nightly.20260108",
52
+ "@aztec/p2p": "4.0.0-nightly.20260108",
53
+ "@aztec/protocol-contracts": "4.0.0-nightly.20260108",
54
+ "@aztec/prover-client": "4.0.0-nightly.20260108",
55
+ "@aztec/prover-node": "4.0.0-nightly.20260108",
56
+ "@aztec/pxe": "4.0.0-nightly.20260108",
57
+ "@aztec/sequencer-client": "4.0.0-nightly.20260108",
58
+ "@aztec/simulator": "4.0.0-nightly.20260108",
59
+ "@aztec/slasher": "4.0.0-nightly.20260108",
60
+ "@aztec/stdlib": "4.0.0-nightly.20260108",
61
+ "@aztec/telemetry-client": "4.0.0-nightly.20260108",
62
+ "@aztec/test-wallet": "4.0.0-nightly.20260108",
63
+ "@aztec/validator-client": "4.0.0-nightly.20260108",
64
+ "@aztec/world-state": "4.0.0-nightly.20260108",
63
65
  "@iarna/toml": "^2.2.5",
64
66
  "@jest/globals": "^30.0.0",
65
67
  "@noble/curves": "=1.0.0",
@@ -91,12 +93,12 @@
91
93
  "snappy": "^7.2.2",
92
94
  "stream-browserify": "^3.0.0",
93
95
  "string-argv": "^0.3.2",
94
- "ts-loader": "^9.4.4",
96
+ "ts-loader": "^9.5.4",
95
97
  "ts-node": "^10.9.1",
96
98
  "tslib": "^2.4.0",
97
99
  "typescript": "^5.3.3",
98
100
  "util": "^0.12.5",
99
- "viem": "2.23.7",
101
+ "viem": "npm:@aztec/viem@2.38.2",
100
102
  "zod": "^3.23.8"
101
103
  },
102
104
  "devDependencies": {
@@ -105,6 +107,7 @@
105
107
  "@types/jest": "^30.0.0",
106
108
  "@types/js-yaml": "^4.0.9",
107
109
  "@types/lodash.chunk": "^4.2.9",
110
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
108
111
  "concurrently": "^7.6.0",
109
112
  "jest": "^30.0.0",
110
113
  "jest-extended": "^6.0.0",
@@ -1,10 +1,10 @@
1
- import type {
1
+ import {
2
2
  ContractFunctionInteraction,
3
3
  DeployMethod,
4
- DeployOptions,
5
- Logger,
6
- ProfileMethodOptions,
7
- } from '@aztec/aztec.js';
4
+ type DeployOptions,
5
+ type ProfileInteractionOptions,
6
+ } from '@aztec/aztec.js/contracts';
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
10
  import type { ProvingStats, ProvingTimings, SimulationStats, SimulationTimings } from '@aztec/stdlib/tx';
@@ -301,7 +301,7 @@ export function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): Git
301
301
  export async function captureProfile(
302
302
  label: string,
303
303
  interaction: ContractFunctionInteraction | DeployMethod,
304
- opts: Omit<ProfileMethodOptions & DeployOptions, 'profileMode'>,
304
+ opts: Omit<ProfileInteractionOptions & DeployOptions, 'profileMode'>,
305
305
  expectedSteps?: number,
306
306
  ) {
307
307
  // Make sure the proxy logger starts from a clean slate
@@ -315,12 +315,12 @@ export async function captureProfile(
315
315
 
316
316
  const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
317
317
  if (ivcFolder) {
318
- logger.info(`Capturing client ivc execution profile for ${label}`);
318
+ logger.info(`Capturing chonk execution profile for ${label}`);
319
319
 
320
320
  const resultsDirectory = join(ivcFolder, label);
321
321
  logger.info(`Writing private execution steps to ${resultsDirectory}`);
322
322
  await mkdir(resultsDirectory, { recursive: true });
323
- // Write the client IVC files read by the prover.
323
+ // Write the chonk files read by the prover.
324
324
  const ivcInputsPath = join(resultsDirectory, 'ivc-inputs.msgpack');
325
325
  await writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
326
326
  await writeFile(join(resultsDirectory, 'logs.json'), JSON.stringify(logs, null, 2));
@@ -1,26 +1,18 @@
1
- import { EcdsaRAccountContractArtifact, getEcdsaRAccount } from '@aztec/accounts/ecdsa';
2
- import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWallet } from '@aztec/accounts/schnorr';
3
- import {
4
- type AccountWallet,
5
- AccountWalletWithSecretKey,
6
- AztecAddress,
7
- type AztecNode,
8
- FeeJuicePaymentMethod,
9
- FeeJuicePaymentMethodWithClaim,
10
- type FeePaymentMethod,
11
- type Logger,
12
- type PXE,
13
- PrivateFeePaymentMethod,
14
- SponsoredFeePaymentMethod,
15
- type Wallet,
16
- createLogger,
17
- } from '@aztec/aztec.js';
1
+ import { AztecAddress } from '@aztec/aztec.js/addresses';
2
+ import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
3
+ import { type FeePaymentMethod, PrivateFeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
4
+ import { type Logger, createLogger } from '@aztec/aztec.js/log';
5
+ import type { AztecNode } from '@aztec/aztec.js/node';
6
+ import type { Wallet } from '@aztec/aztec.js/wallet';
18
7
  import { CheatCodes } from '@aztec/aztec/testing';
19
- 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';
20
12
  import { ChainMonitor } from '@aztec/ethereum/test';
21
- import { randomBytes } from '@aztec/foundation/crypto';
13
+ import { randomBytes } from '@aztec/foundation/crypto/random';
14
+ import { Fr } from '@aztec/foundation/curves/bn254';
22
15
  import { EthAddress } from '@aztec/foundation/eth-address';
23
- import { Fr } from '@aztec/foundation/fields';
24
16
  import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
25
17
  import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
26
18
  import { AMMContract } from '@aztec/noir-contracts.js/AMM';
@@ -30,8 +22,11 @@ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
30
22
  import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contracts.js/Token';
31
23
  import { ProtocolContractAddress } from '@aztec/protocol-contracts';
32
24
  import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
33
- import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
25
+ import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
26
+ import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
27
+ import { GasSettings } from '@aztec/stdlib/gas';
34
28
  import { deriveSigningKey } from '@aztec/stdlib/keys';
29
+ import { TestWallet } from '@aztec/test-wallet/server';
35
30
 
36
31
  import { MNEMONIC } from '../../fixtures/fixtures.js';
37
32
  import {
@@ -53,22 +48,21 @@ import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './c
53
48
  const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
54
49
 
55
50
  export type AccountType = 'ecdsar1' | 'schnorr';
56
- export type FeePaymentMethodGetter = (wallet: Wallet) => Promise<FeePaymentMethod>;
51
+ export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
57
52
  export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
58
53
 
59
54
  export class ClientFlowsBenchmark {
60
55
  private snapshotManager: ISnapshotManager;
61
56
 
62
57
  public logger: Logger;
63
- public pxe!: PXE;
64
58
  public aztecNode!: AztecNode;
65
59
  public cheatCodes!: CheatCodes;
66
60
  public context!: SubsystemsContext;
67
61
  public chainMonitor!: ChainMonitor;
68
62
  public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
63
+ public adminWallet!: TestWallet;
69
64
 
70
65
  // The admin that aids in the setup of the test
71
- public adminWallet!: AccountWallet;
72
66
  public adminAddress!: AztecAddress;
73
67
 
74
68
  // Aztec Node config
@@ -79,18 +73,24 @@ export class ClientFlowsBenchmark {
79
73
  public feeJuiceContract!: FeeJuiceContract;
80
74
  // Asset in which fees are paid via FPC
81
75
  public bananaCoin!: BananaCoin;
76
+ public bananaCoinInstance!: ContractInstanceWithAddress;
82
77
  public bananaFPC!: FPCContract;
78
+ public bananaFPCInstance!: ContractInstanceWithAddress;
83
79
  // Random asset we want to trade
84
80
  public candyBarCoin!: TokenContract;
81
+ public candyBarCoinInstance!: ContractInstanceWithAddress;
85
82
  // AMM contract
86
83
  public amm!: AMMContract;
84
+ public ammInstance!: ContractInstanceWithAddress;
87
85
  // Liquidity token for AMM
88
86
  public liquidityToken!: TokenContract;
87
+ public liquidityTokenInstance!: ContractInstanceWithAddress;
89
88
  // Sponsored FPC contract
90
89
  public sponsoredFPC!: SponsoredFPCContract;
90
+ public sponsoredFPCInstance!: ContractInstanceWithAddress;
91
91
 
92
- // PXE used by the benchmarking user. It can be set up with client-side proving enabled
93
- public userPXE!: PXE;
92
+ // PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
93
+ public userWallet!: TestWallet;
94
94
 
95
95
  public realProofs = ['true', '1'].includes(process.env.REAL_PROOFS ?? '');
96
96
 
@@ -117,7 +117,7 @@ export class ClientFlowsBenchmark {
117
117
  },
118
118
  // eslint-disable-next-line camelcase
119
119
  fee_juice: {
120
- forWallet: this.getFeeJuicePaymentMethodForWallet.bind(this),
120
+ forWallet: () => Promise.resolve(undefined),
121
121
  circuits: 0,
122
122
  },
123
123
  };
@@ -126,7 +126,7 @@ export class ClientFlowsBenchmark {
126
126
 
127
127
  private proxyLogger: ProxyLogger;
128
128
 
129
- constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployL1ContractsArgs> = {}) {
129
+ constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
130
130
  this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
131
131
  this.snapshotManager = createSnapshotManager(
132
132
  `bench_client_flows${testName ? `/${testName}` : ''}`,
@@ -169,7 +169,7 @@ export class ClientFlowsBenchmark {
169
169
  .balance_of_private(address)
170
170
  .simulate({ from: this.adminAddress });
171
171
 
172
- await mintTokensToPrivate(this.bananaCoin, this.adminAddress, this.adminWallet, address, amount);
172
+ await mintTokensToPrivate(this.bananaCoin, this.adminAddress, address, amount);
173
173
 
174
174
  const balanceAfter = await this.bananaCoin.methods
175
175
  .balance_of_private(address)
@@ -177,23 +177,20 @@ export class ClientFlowsBenchmark {
177
177
  expect(balanceAfter).toEqual(balanceBefore + amount);
178
178
  }
179
179
 
180
- async createBenchmarkingAccountManager(pxe: PXE, type: 'ecdsar1' | 'schnorr') {
181
- const benchysSecretKey = Fr.random();
180
+ createBenchmarkingAccountManager(wallet: TestWallet, type: 'ecdsar1' | 'schnorr') {
181
+ const benchysSecret = Fr.random();
182
182
  const salt = Fr.random();
183
183
 
184
184
  let benchysPrivateSigningKey;
185
- let benchysAccountManager;
186
185
  if (type === 'schnorr') {
187
- benchysPrivateSigningKey = deriveSigningKey(benchysSecretKey);
188
- benchysAccountManager = await getSchnorrAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
186
+ benchysPrivateSigningKey = deriveSigningKey(benchysSecret);
187
+ return wallet.createSchnorrAccount(benchysSecret, salt, benchysPrivateSigningKey);
189
188
  } else if (type === 'ecdsar1') {
190
189
  benchysPrivateSigningKey = randomBytes(32);
191
- benchysAccountManager = await getEcdsaRAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
190
+ return wallet.createECDSARAccount(benchysSecret, salt, benchysPrivateSigningKey);
192
191
  } else {
193
192
  throw new Error(`Unknown account type: ${type}`);
194
193
  }
195
- await benchysAccountManager.register();
196
- return benchysAccountManager;
197
194
  }
198
195
 
199
196
  public async applyBaseSnapshots() {
@@ -205,32 +202,28 @@ export class ClientFlowsBenchmark {
205
202
  await this.snapshotManager.snapshot(
206
203
  'initial_accounts',
207
204
  deployAccounts(2, this.logger),
208
- async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig }) => {
209
- this.pxe = pxe;
210
-
205
+ async (
206
+ { deployedAccounts: [{ address: adminAddress }, { address: sequencerAddress }] },
207
+ { wallet, aztecNode, cheatCodes },
208
+ ) => {
209
+ this.adminWallet = wallet;
211
210
  this.aztecNode = aztecNode;
212
- this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
211
+ this.cheatCodes = cheatCodes;
213
212
 
214
- const deployedWallets = await Promise.all(
215
- deployedAccounts.map(a => getSchnorrWallet(pxe, a.address, a.signingKey)),
216
- );
217
- [this.adminWallet] = deployedWallets;
218
- this.adminAddress = this.adminWallet.getAddress();
219
- this.sequencerAddress = deployedWallets[1].getAddress();
213
+ this.adminAddress = adminAddress;
214
+ this.sequencerAddress = sequencerAddress;
220
215
 
221
216
  const canonicalFeeJuice = await getCanonicalFeeJuice();
222
- this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
217
+ this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
223
218
  this.coinbase = EthAddress.random();
224
219
 
225
- const userPXEConfig = getPXEServiceConfig();
226
- const l1Contracts = await aztecNode.getL1ContractAddresses();
220
+ const userPXEConfig = getPXEConfig();
227
221
  const userPXEConfigWithContracts = {
228
222
  ...userPXEConfig,
229
223
  proverEnabled: this.realProofs,
230
- l1Contracts,
231
- } as PXEServiceConfig;
224
+ } as PXEConfig;
232
225
 
233
- this.userPXE = await createPXEService(this.aztecNode, userPXEConfigWithContracts, {
226
+ this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
234
227
  loggers: {
235
228
  prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
236
229
  },
@@ -246,12 +239,11 @@ export class ClientFlowsBenchmark {
246
239
  async (_data, context) => {
247
240
  this.context = context;
248
241
 
249
- this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
242
+ this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
250
243
 
251
244
  this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
252
245
  aztecNode: context.aztecNode,
253
246
  aztecNodeAdmin: context.aztecNode,
254
- pxeService: context.pxe,
255
247
  l1Client: context.deployL1ContractsValues.l1Client,
256
248
  wallet: this.adminWallet,
257
249
  logger: this.logger,
@@ -264,14 +256,22 @@ export class ClientFlowsBenchmark {
264
256
  await this.snapshotManager.snapshot(
265
257
  'deploy_banana_token',
266
258
  async () => {
267
- const bananaCoin = await BananaCoin.deploy(this.adminWallet, this.adminAddress, 'BC', 'BC', 18n)
259
+ const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
260
+ this.adminWallet,
261
+ this.adminAddress,
262
+ 'BC',
263
+ 'BC',
264
+ 18n,
265
+ )
268
266
  .send({ from: this.adminAddress })
269
- .deployed();
267
+ .wait();
270
268
  this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
271
- return { bananaCoinAddress: bananaCoin.address };
269
+ return { bananaCoinAddress: bananaCoin.address, bananaCoinInstance };
272
270
  },
273
- async ({ bananaCoinAddress }) => {
274
- this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.adminWallet);
271
+ ({ bananaCoinAddress, bananaCoinInstance }) => {
272
+ this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.adminWallet);
273
+ this.bananaCoinInstance = bananaCoinInstance;
274
+ return Promise.resolve();
275
275
  },
276
276
  );
277
277
  }
@@ -280,14 +280,22 @@ export class ClientFlowsBenchmark {
280
280
  await this.snapshotManager.snapshot(
281
281
  'deploy_candy_bar_token',
282
282
  async () => {
283
- const candyBarCoin = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'CBC', 'CBC', 18n)
283
+ const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
284
+ this.adminWallet,
285
+ this.adminAddress,
286
+ 'CBC',
287
+ 'CBC',
288
+ 18n,
289
+ )
284
290
  .send({ from: this.adminAddress })
285
- .deployed();
291
+ .wait();
286
292
  this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
287
- return { candyBarCoinAddress: candyBarCoin.address };
293
+ return { candyBarCoinAddress: candyBarCoin.address, candyBarCoinInstance };
288
294
  },
289
- async ({ candyBarCoinAddress }) => {
290
- this.candyBarCoin = await TokenContract.at(candyBarCoinAddress, this.adminWallet);
295
+ ({ candyBarCoinAddress, candyBarCoinInstance }) => {
296
+ this.candyBarCoin = TokenContract.at(candyBarCoinAddress, this.adminWallet);
297
+ this.candyBarCoinInstance = candyBarCoinInstance;
298
+ return Promise.resolve();
291
299
  },
292
300
  );
293
301
  }
@@ -297,21 +305,27 @@ export class ClientFlowsBenchmark {
297
305
  'fpc_setup',
298
306
  async context => {
299
307
  const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
300
- expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
308
+ expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
301
309
 
302
310
  const bananaCoin = this.bananaCoin;
303
- const bananaFPC = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress)
311
+ const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
312
+ this.adminWallet,
313
+ bananaCoin.address,
314
+ this.adminAddress,
315
+ )
304
316
  .send({ from: this.adminAddress })
305
- .deployed();
317
+ .wait();
306
318
 
307
319
  this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
308
320
 
309
321
  await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
310
322
 
311
- return { bananaFPCAddress: bananaFPC.address };
323
+ return { bananaFPCAddress: bananaFPC.address, bananaFPCInstance };
312
324
  },
313
- async data => {
314
- this.bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.adminWallet);
325
+ data => {
326
+ this.bananaFPC = FPCContract.at(data.bananaFPCAddress, this.adminWallet);
327
+ this.bananaFPCInstance = data.bananaFPCInstance;
328
+ return Promise.resolve();
315
329
  },
316
330
  );
317
331
  }
@@ -320,17 +334,19 @@ export class ClientFlowsBenchmark {
320
334
  await this.snapshotManager.snapshot(
321
335
  'deploy_sponsored_fpc',
322
336
  async () => {
323
- const sponsoredFPC = await setupSponsoredFPC(this.pxe);
324
- this.logger.info(`SponsoredFPC at ${sponsoredFPC.address}`);
325
- return { sponsoredFPCAddress: sponsoredFPC.address };
337
+ const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
338
+ this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
339
+ return { sponsoredFPCAddress: sponsoredFPCInstance.address, sponsoredFPCInstance };
326
340
  },
327
- async ({ sponsoredFPCAddress }) => {
328
- this.sponsoredFPC = await SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
341
+ ({ sponsoredFPCAddress, sponsoredFPCInstance }) => {
342
+ this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
343
+ this.sponsoredFPCInstance = sponsoredFPCInstance;
344
+ return Promise.resolve();
329
345
  },
330
346
  );
331
347
  }
332
348
 
333
- public async createCrossChainTestHarness(owner: AccountWallet) {
349
+ public async createCrossChainTestHarness(owner: AztecAddress) {
334
350
  const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
335
351
 
336
352
  const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
@@ -342,10 +358,9 @@ export class ClientFlowsBenchmark {
342
358
  this.logger.verbose(`Setting up cross chain harness...`);
343
359
  const crossChainTestHarness = await CrossChainTestHarness.new(
344
360
  this.aztecNode,
345
- this.pxe,
346
361
  l1Client,
362
+ this.adminWallet,
347
363
  owner,
348
- owner.getAddress(),
349
364
  this.logger,
350
365
  underlyingERC20Address,
351
366
  );
@@ -355,68 +370,81 @@ export class ClientFlowsBenchmark {
355
370
  return crossChainTestHarness;
356
371
  }
357
372
 
358
- public async createAndFundBenchmarkingWallet(accountType: AccountType) {
359
- const benchysAccountManager = await this.createBenchmarkingAccountManager(this.pxe, accountType);
360
- const benchysWallet = await benchysAccountManager.getWallet();
361
- const benchysAddress = benchysAccountManager.getAddress();
373
+ public async createAndFundBenchmarkingAccountOnUserWallet(accountType: AccountType) {
374
+ const benchysAccountManager = await this.createBenchmarkingAccountManager(this.adminWallet, accountType);
375
+ const benchysAccount = await benchysAccountManager.getAccount();
376
+ const benchysAddress = benchysAccountManager.address;
362
377
  const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
363
- const paymentMethod = new FeeJuicePaymentMethodWithClaim(benchysWallet, claim);
364
- await benchysAccountManager.deploy({ fee: { paymentMethod } }).wait();
365
- // Register benchy on the user's PXE, where we're going to be interacting from
366
- await this.userPXE.registerContract({
367
- instance: benchysAccountManager.getInstance(),
368
- artifact: accountType === 'ecdsar1' ? EcdsaRAccountContractArtifact : SchnorrAccountContractArtifact,
378
+ const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
379
+ await behchysDeployMethod
380
+ .send({
381
+ from: AztecAddress.ZERO,
382
+ fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
383
+ })
384
+ .wait();
385
+ // Register benchy on the user's Wallet, where we're going to be interacting from
386
+ const accountManager = await this.userWallet.createAccount({
387
+ secret: benchysAccount.getSecretKey(),
388
+ salt: new Fr(benchysAccount.salt),
389
+ contract: benchysAccountManager.getAccountContract(),
369
390
  });
370
- await this.userPXE.registerAccount(benchysWallet.getSecretKey(), benchysWallet.getCompleteAddress().partialAddress);
371
- const entrypoint = await benchysAccountManager.getAccount();
372
- return new AccountWalletWithSecretKey(
373
- this.userPXE,
374
- entrypoint,
375
- benchysWallet.getSecretKey(),
376
- benchysAccountManager.salt,
377
- );
391
+ return accountManager.address;
378
392
  }
379
393
 
380
394
  public async applyDeployAmmSnapshot() {
381
395
  await this.snapshotManager.snapshot(
382
396
  'deploy_amm',
383
397
  async () => {
384
- const liquidityToken = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'LPT', 'LPT', 18n)
398
+ const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
399
+ this.adminWallet,
400
+ this.adminAddress,
401
+ 'LPT',
402
+ 'LPT',
403
+ 18n,
404
+ )
385
405
  .send({ from: this.adminAddress })
386
- .deployed();
387
- const amm = await AMMContract.deploy(
406
+ .wait();
407
+ const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
388
408
  this.adminWallet,
389
409
  this.bananaCoin.address,
390
410
  this.candyBarCoin.address,
391
411
  liquidityToken.address,
392
412
  )
393
413
  .send({ from: this.adminAddress })
394
- .deployed();
414
+ .wait();
395
415
  this.logger.info(`AMM deployed at ${amm.address}`);
396
416
  await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
397
- return { ammAddress: amm.address, liquidityTokenAddress: liquidityToken.address };
417
+ return {
418
+ ammAddress: amm.address,
419
+ ammInstance,
420
+ liquidityTokenAddress: liquidityToken.address,
421
+ liquidityTokenInstance,
422
+ };
398
423
  },
399
- async ({ ammAddress, liquidityTokenAddress }) => {
400
- this.liquidityToken = await TokenContract.at(liquidityTokenAddress, this.adminWallet);
401
- this.amm = await AMMContract.at(ammAddress, this.adminWallet);
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();
402
430
  },
403
431
  );
404
432
  }
405
433
 
406
- public async getBridgedFeeJuicePaymentMethodForWallet(wallet: Wallet) {
407
- const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(wallet.getAddress());
408
- return new FeeJuicePaymentMethodWithClaim(wallet, claim);
434
+ public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
435
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(sender);
436
+ return new FeeJuicePaymentMethodWithClaim(sender, claim);
409
437
  }
410
438
 
411
- public getPrivateFPCPaymentMethodForWallet(wallet: Wallet) {
412
- return Promise.resolve(new PrivateFeePaymentMethod(this.bananaFPC.address, wallet));
439
+ public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
440
+ // The private fee paying method assembled on the app side requires knowledge of the maximum
441
+ // fee the user is willing to pay
442
+ const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1.5);
443
+ const gasSettings = GasSettings.default({ maxFeesPerGas });
444
+ return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
413
445
  }
414
446
 
415
- public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet) {
447
+ public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet, _sender: AztecAddress) {
416
448
  return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
417
449
  }
418
-
419
- public getFeeJuicePaymentMethodForWallet(wallet: Wallet) {
420
- return Promise.resolve(new FeeJuicePaymentMethod(wallet.getAddress()));
421
- }
422
450
  }