@aztec/end-to-end 0.0.1-commit.7d4e6cd → 0.0.1-commit.808bf7f90

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 (226) 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 +13 -14
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +120 -135
  7. package/dest/bench/client_flows/config.d.ts +2 -2
  8. package/dest/bench/client_flows/config.d.ts.map +1 -1
  9. package/dest/bench/client_flows/config.js +18 -0
  10. package/dest/bench/utils.d.ts +6 -5
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +9 -7
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +9 -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 +106 -112
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +7 -8
  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 +68 -64
  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 +15 -7
  23. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  24. package/dest/e2e_epochs/epochs_test.js +86 -39
  25. package/dest/e2e_fees/bridging_race.notest.js +3 -5
  26. package/dest/e2e_fees/fees_test.d.ts +14 -14
  27. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  28. package/dest/e2e_fees/fees_test.js +124 -142
  29. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  30. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  31. package/dest/e2e_l1_publisher/write_json.js +14 -13
  32. package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.js +31 -39
  35. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  37. package/dest/e2e_p2p/inactivity_slash_test.js +3 -3
  38. package/dest/e2e_p2p/p2p_network.d.ts +8 -7
  39. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  40. package/dest/e2e_p2p/p2p_network.js +126 -105
  41. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  42. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  43. package/dest/e2e_p2p/reqresp/utils.js +177 -0
  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 +14 -17
  47. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  48. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  49. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  50. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  51. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  52. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  53. package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
  54. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  55. package/dest/e2e_token_contract/token_contract_test.js +99 -91
  56. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  57. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  58. package/dest/fixtures/authwit_proxy.js +30 -0
  59. package/dest/fixtures/e2e_prover_test.d.ts +11 -17
  60. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  61. package/dest/fixtures/e2e_prover_test.js +112 -127
  62. package/dest/fixtures/fixtures.d.ts +5 -1
  63. package/dest/fixtures/fixtures.d.ts.map +1 -1
  64. package/dest/fixtures/fixtures.js +6 -0
  65. package/dest/fixtures/ha_setup.d.ts +71 -0
  66. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  67. package/dest/fixtures/ha_setup.js +116 -0
  68. package/dest/fixtures/index.d.ts +2 -1
  69. package/dest/fixtures/index.d.ts.map +1 -1
  70. package/dest/fixtures/index.js +1 -0
  71. package/dest/fixtures/setup.d.ts +235 -0
  72. package/dest/fixtures/setup.d.ts.map +1 -0
  73. package/dest/fixtures/setup.js +605 -0
  74. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  75. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  76. package/dest/fixtures/setup_p2p_test.js +40 -29
  77. package/dest/fixtures/token_utils.d.ts +2 -2
  78. package/dest/fixtures/token_utils.d.ts.map +1 -1
  79. package/dest/fixtures/token_utils.js +10 -6
  80. package/dest/fixtures/utils.d.ts +5 -191
  81. package/dest/fixtures/utils.d.ts.map +1 -1
  82. package/dest/fixtures/utils.js +4 -615
  83. package/dest/quality_of_service/prometheus_client.d.ts +38 -0
  84. package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
  85. package/dest/quality_of_service/prometheus_client.js +67 -0
  86. package/dest/shared/cross_chain_test_harness.d.ts +14 -4
  87. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  88. package/dest/shared/cross_chain_test_harness.js +11 -11
  89. package/dest/shared/gas_portal_test_harness.d.ts +11 -1
  90. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  91. package/dest/shared/gas_portal_test_harness.js +1 -1
  92. package/dest/shared/index.d.ts +2 -1
  93. package/dest/shared/index.d.ts.map +1 -1
  94. package/dest/shared/index.js +1 -0
  95. package/dest/shared/mock_state_view.d.ts +86 -0
  96. package/dest/shared/mock_state_view.d.ts.map +1 -0
  97. package/dest/shared/mock_state_view.js +186 -0
  98. package/dest/shared/submit-transactions.d.ts +4 -4
  99. package/dest/shared/submit-transactions.d.ts.map +1 -1
  100. package/dest/shared/submit-transactions.js +9 -11
  101. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  102. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  103. package/dest/shared/uniswap_l1_l2.js +20 -18
  104. package/dest/simulators/lending_simulator.d.ts +5 -1
  105. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  106. package/dest/simulators/lending_simulator.js +2 -2
  107. package/dest/simulators/token_simulator.d.ts +1 -1
  108. package/dest/simulators/token_simulator.d.ts.map +1 -1
  109. package/dest/simulators/token_simulator.js +2 -23
  110. package/dest/spartan/setup_test_wallets.d.ts +9 -2
  111. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  112. package/dest/spartan/setup_test_wallets.js +92 -35
  113. package/dest/spartan/tx_metrics.d.ts +51 -2
  114. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  115. package/dest/spartan/tx_metrics.js +333 -6
  116. package/dest/spartan/utils/bot.d.ts +28 -0
  117. package/dest/spartan/utils/bot.d.ts.map +1 -0
  118. package/dest/spartan/utils/bot.js +142 -0
  119. package/dest/spartan/utils/chaos.d.ts +79 -0
  120. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  121. package/dest/spartan/utils/chaos.js +142 -0
  122. package/dest/spartan/utils/clients.d.ts +39 -0
  123. package/dest/spartan/utils/clients.d.ts.map +1 -0
  124. package/dest/spartan/utils/clients.js +90 -0
  125. package/dest/spartan/utils/config.d.ts +39 -0
  126. package/dest/spartan/utils/config.d.ts.map +1 -0
  127. package/dest/spartan/utils/config.js +21 -0
  128. package/dest/spartan/utils/health.d.ts +63 -0
  129. package/dest/spartan/utils/health.d.ts.map +1 -0
  130. package/dest/spartan/utils/health.js +202 -0
  131. package/dest/spartan/utils/helm.d.ts +15 -0
  132. package/dest/spartan/utils/helm.d.ts.map +1 -0
  133. package/dest/spartan/utils/helm.js +47 -0
  134. package/dest/spartan/utils/index.d.ts +9 -0
  135. package/dest/spartan/utils/index.d.ts.map +1 -0
  136. package/dest/spartan/utils/index.js +18 -0
  137. package/dest/spartan/utils/k8s.d.ts +128 -0
  138. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  139. package/dest/spartan/utils/k8s.js +381 -0
  140. package/dest/spartan/utils/nodes.d.ts +40 -0
  141. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  142. package/dest/spartan/utils/nodes.js +461 -0
  143. package/dest/spartan/utils/scripts.d.ts +30 -0
  144. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  145. package/dest/spartan/utils/scripts.js +81 -0
  146. package/dest/spartan/utils.d.ts +2 -253
  147. package/dest/spartan/utils.d.ts.map +1 -1
  148. package/dest/spartan/utils.js +1 -892
  149. package/dest/test-wallet/test_wallet.d.ts +83 -0
  150. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  151. package/dest/test-wallet/test_wallet.js +214 -0
  152. package/dest/test-wallet/utils.d.ts +41 -0
  153. package/dest/test-wallet/utils.d.ts.map +1 -0
  154. package/dest/test-wallet/utils.js +71 -0
  155. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  156. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  157. package/dest/test-wallet/wallet_worker_script.js +48 -0
  158. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  159. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  160. package/dest/test-wallet/worker_wallet.js +151 -0
  161. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  162. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  163. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  164. package/package.json +44 -39
  165. package/src/bench/client_flows/benchmark.ts +24 -2
  166. package/src/bench/client_flows/client_flows_benchmark.ts +140 -210
  167. package/src/bench/client_flows/config.ts +9 -1
  168. package/src/bench/utils.ts +10 -8
  169. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +114 -143
  170. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +103 -111
  171. package/src/e2e_deploy_contract/deploy_test.ts +22 -15
  172. package/src/e2e_epochs/epochs_test.ts +129 -93
  173. package/src/e2e_fees/bridging_race.notest.ts +4 -10
  174. package/src/e2e_fees/fees_test.ts +163 -224
  175. package/src/e2e_l1_publisher/write_json.ts +16 -13
  176. package/src/e2e_nested_contract/nested_contract_test.ts +33 -56
  177. package/src/e2e_p2p/inactivity_slash_test.ts +3 -3
  178. package/src/e2e_p2p/p2p_network.ts +196 -170
  179. package/src/e2e_p2p/reqresp/utils.ts +235 -0
  180. package/src/e2e_p2p/shared.ts +22 -22
  181. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  182. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  183. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  184. package/src/e2e_token_contract/token_contract_test.ts +113 -119
  185. package/src/fixtures/authwit_proxy.ts +50 -0
  186. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  187. package/src/fixtures/e2e_prover_test.ts +127 -171
  188. package/src/fixtures/fixtures.ts +10 -0
  189. package/src/fixtures/ha_setup.ts +186 -0
  190. package/src/fixtures/index.ts +1 -0
  191. package/src/fixtures/setup.ts +896 -0
  192. package/src/fixtures/setup_p2p_test.ts +40 -44
  193. package/src/fixtures/token_utils.ts +7 -5
  194. package/src/fixtures/utils.ts +27 -901
  195. package/src/guides/up_quick_start.sh +3 -3
  196. package/src/quality_of_service/prometheus_client.ts +113 -0
  197. package/src/shared/cross_chain_test_harness.ts +13 -27
  198. package/src/shared/gas_portal_test_harness.ts +1 -1
  199. package/src/shared/index.ts +1 -0
  200. package/src/shared/mock_state_view.ts +188 -0
  201. package/src/shared/submit-transactions.ts +14 -16
  202. package/src/shared/uniswap_l1_l2.ts +21 -30
  203. package/src/simulators/lending_simulator.ts +2 -2
  204. package/src/simulators/token_simulator.ts +1 -29
  205. package/src/spartan/setup_test_wallets.ts +127 -25
  206. package/src/spartan/tx_metrics.ts +255 -9
  207. package/src/spartan/utils/bot.ts +188 -0
  208. package/src/spartan/utils/chaos.ts +253 -0
  209. package/src/spartan/utils/clients.ts +100 -0
  210. package/src/spartan/utils/config.ts +27 -0
  211. package/src/spartan/utils/health.ts +255 -0
  212. package/src/spartan/utils/helm.ts +84 -0
  213. package/src/spartan/utils/index.ts +65 -0
  214. package/src/spartan/utils/k8s.ts +535 -0
  215. package/src/spartan/utils/nodes.ts +543 -0
  216. package/src/spartan/utils/scripts.ts +99 -0
  217. package/src/spartan/utils.ts +1 -1158
  218. package/src/test-wallet/test_wallet.ts +306 -0
  219. package/src/test-wallet/utils.ts +112 -0
  220. package/src/test-wallet/wallet_worker_script.ts +60 -0
  221. package/src/test-wallet/worker_wallet.ts +213 -0
  222. package/src/test-wallet/worker_wallet_schema.ts +13 -0
  223. package/dest/fixtures/snapshot_manager.d.ts +0 -93
  224. package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
  225. package/dest/fixtures/snapshot_manager.js +0 -488
  226. package/src/fixtures/snapshot_manager.ts +0 -646
@@ -4,7 +4,7 @@ import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import type { RollupContract } from '@aztec/ethereum/contracts';
6
6
  import { SlotNumber } from '@aztec/foundation/branded-types';
7
- import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
7
+ import { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
8
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
9
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
10
10
 
@@ -29,7 +29,7 @@ export class LendingAccount {
29
29
  * @returns Key in public space
30
30
  */
31
31
  public key() {
32
- return pedersenHash([this.address, this.secret]);
32
+ return poseidon2Hash([this.address, this.secret]);
33
33
  }
34
34
  }
35
35
 
@@ -119,39 +119,11 @@ export class TokenSimulator {
119
119
  }
120
120
 
121
121
  async checkPrivate() {
122
- // Private calls
123
- const defaultLookups = [];
124
- const nonDefaultLookups = [];
125
-
126
122
  for (const address of this.accounts) {
127
- if (this.lookupProvider.has(address.toString())) {
128
- nonDefaultLookups.push(address);
129
- } else {
130
- defaultLookups.push(address);
131
- }
132
- }
133
-
134
- const defaultCalls = defaultLookups.map(address => this.token.methods.balance_of_private(address));
135
- const results = (
136
- await Promise.all(
137
- chunk(defaultCalls, 4).map(batch =>
138
- new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress }),
139
- ),
140
- )
141
- ).flat();
142
- for (let i = 0; i < defaultLookups.length; i++) {
143
- expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
144
- }
145
-
146
- // We are just running individual calls for the non-default lookups
147
- // @todo We should also batch these
148
- for (const address of nonDefaultLookups) {
149
123
  const wallet = this.lookupProvider.get(address.toString());
150
124
  const asset = wallet ? this.token.withWallet(wallet) : this.token;
151
125
 
152
- const actualPrivateBalance = await asset.methods
153
- .balance_of_private({ address })
154
- .simulate({ from: this.defaultAddress });
126
+ const actualPrivateBalance = await asset.methods.balance_of_private(address).simulate({ from: address });
155
127
  expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
156
128
  }
157
129
  }
@@ -1,10 +1,11 @@
1
1
  import { generateSchnorrAccounts } from '@aztec/accounts/testing';
2
2
  import { AztecAddress } from '@aztec/aztec.js/addresses';
3
+ import { NO_WAIT } from '@aztec/aztec.js/contracts';
3
4
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
4
5
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
5
6
  import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
6
7
  import { Fr } from '@aztec/aztec.js/fields';
7
- import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
8
+ import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
8
9
  import type { Wallet } from '@aztec/aztec.js/wallet';
9
10
  import { createEthereumChain } from '@aztec/ethereum/chain';
10
11
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -12,11 +13,14 @@ import type { Logger } from '@aztec/foundation/log';
12
13
  import { retryUntil } from '@aztec/foundation/retry';
13
14
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
14
15
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
15
- import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
16
+ import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
16
17
 
17
18
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
18
19
  import { getBBConfig } from '../fixtures/get_bb_config.js';
19
20
  import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
21
+ import { TestWallet } from '../test-wallet/test_wallet.js';
22
+ import { proveInteraction } from '../test-wallet/utils.js';
23
+ import { WorkerWallet } from '../test-wallet/worker_wallet.js';
20
24
 
21
25
  export interface TestAccounts {
22
26
  aztecNode: AztecNode;
@@ -84,11 +88,19 @@ export async function deploySponsoredTestAccountsWithTokens(
84
88
 
85
89
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
86
90
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
87
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
91
+ await recipientDeployMethod.send({
92
+ from: AztecAddress.ZERO,
93
+ fee: { paymentMethod },
94
+ wait: { timeout: 2400 },
95
+ });
88
96
  await Promise.all(
89
97
  fundedAccounts.map(async a => {
90
98
  const deployMethod = await a.getDeployMethod();
91
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
99
+ await deployMethod.send({
100
+ from: AztecAddress.ZERO,
101
+ fee: { paymentMethod },
102
+ wait: { timeout: 2400 },
103
+ }); // increase timeout on purpose in order to account for two empty epochs
92
104
  logger.info(`Account deployed at ${a.address}`);
93
105
  }),
94
106
  );
@@ -116,6 +128,59 @@ export async function deploySponsoredTestAccountsWithTokens(
116
128
  };
117
129
  }
118
130
 
131
+ async function deployAccountWithDiagnostics(
132
+ account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
133
+ paymentMethod: SponsoredFeePaymentMethod,
134
+ aztecNode: AztecNode,
135
+ logger: Logger,
136
+ accountLabel: string,
137
+ ): Promise<void> {
138
+ const deployMethod = await account.getDeployMethod();
139
+ let txHash;
140
+ try {
141
+ txHash = await deployMethod.send({
142
+ from: AztecAddress.ZERO,
143
+ fee: { paymentMethod },
144
+ wait: NO_WAIT,
145
+ });
146
+ await waitForTx(aztecNode, txHash, { timeout: 2400 });
147
+ logger.info(`${accountLabel} deployed at ${account.address}`);
148
+ } catch (error) {
149
+ const blockNumber = await aztecNode.getBlockNumber();
150
+ let receipt;
151
+ try {
152
+ receipt = await aztecNode.getTxReceipt(txHash);
153
+ } catch {
154
+ receipt = 'unavailable';
155
+ }
156
+ logger.error(`${accountLabel} deployment failed`, {
157
+ txHash: txHash.toString(),
158
+ receipt: JSON.stringify(receipt),
159
+ currentBlockNumber: blockNumber,
160
+ error: String(error),
161
+ });
162
+ throw error;
163
+ }
164
+ }
165
+
166
+ async function deployAccountsInBatches(
167
+ accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
168
+ paymentMethod: SponsoredFeePaymentMethod,
169
+ aztecNode: AztecNode,
170
+ logger: Logger,
171
+ labelPrefix: string,
172
+ batchSize = 2,
173
+ ): Promise<void> {
174
+ for (let i = 0; i < accounts.length; i += batchSize) {
175
+ const batch = accounts.slice(i, i + batchSize);
176
+ await Promise.all(
177
+ batch.map((account, idx) =>
178
+ deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
179
+ ),
180
+ );
181
+ }
182
+ }
183
+
119
184
  export async function deploySponsoredTestAccounts(
120
185
  wallet: TestWallet,
121
186
  aztecNode: AztecNode,
@@ -129,15 +194,9 @@ export async function deploySponsoredTestAccounts(
129
194
  await registerSponsoredFPC(wallet);
130
195
 
131
196
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
132
- const recipientDeployMethod = await recipientAccount.getDeployMethod();
133
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
134
- await Promise.all(
135
- fundedAccounts.map(async a => {
136
- const deployMethod = await a.getDeployMethod();
137
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
138
- logger.info(`Account deployed at ${a.address}`);
139
- }),
140
- );
197
+
198
+ await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
199
+ await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
141
200
 
142
201
  return {
143
202
  aztecNode,
@@ -175,7 +234,7 @@ export async function deployTestAccountsWithTokens(
175
234
  fundedAccounts.map(async (a, i) => {
176
235
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
177
236
  const deployMethod = await a.getDeployMethod();
178
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
237
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
179
238
  logger.info(`Account deployed at ${a.address}`);
180
239
  }),
181
240
  );
@@ -251,14 +310,19 @@ async function deployTokenAndMint(
251
310
  logger: Logger,
252
311
  ) {
253
312
  logger.verbose(`Deploying TokenContract...`);
254
- const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
255
- .send({
256
- from: admin,
257
- fee: {
258
- paymentMethod,
259
- },
260
- })
261
- .deployed({ timeout: 600 });
313
+ const { contract: tokenContract } = await TokenContract.deploy(
314
+ wallet,
315
+ admin,
316
+ TOKEN_NAME,
317
+ TOKEN_SYMBOL,
318
+ TOKEN_DECIMALS,
319
+ ).send({
320
+ from: admin,
321
+ fee: {
322
+ paymentMethod,
323
+ },
324
+ wait: { timeout: 600, returnReceipt: true },
325
+ });
262
326
 
263
327
  const tokenAddress = tokenContract.address;
264
328
 
@@ -268,8 +332,7 @@ async function deployTokenAndMint(
268
332
  accounts.map(acc =>
269
333
  TokenContract.at(tokenAddress, wallet)
270
334
  .methods.mint_to_public(acc, mintAmount)
271
- .send({ from: admin, fee: { paymentMethod } })
272
- .wait({ timeout: 600 }),
335
+ .send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
273
336
  ),
274
337
  );
275
338
 
@@ -309,7 +372,7 @@ export async function performTransfers({
309
372
 
310
373
  const provenTxs = await Promise.all(txs);
311
374
 
312
- await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
375
+ await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
313
376
 
314
377
  logger.info(`Completed round ${i + 1} / ${rounds}`);
315
378
  }
@@ -347,3 +410,42 @@ export async function createWalletAndAztecNodeClient(
347
410
  },
348
411
  };
349
412
  }
413
+
414
+ export type WorkerWalletWrapper = {
415
+ wallet: WorkerWallet;
416
+ aztecNode: AztecNode;
417
+ cleanup: () => Promise<void>;
418
+ };
419
+
420
+ export async function createWorkerWalletClient(
421
+ nodeUrl: string,
422
+ proverEnabled: boolean,
423
+ logger: Logger,
424
+ ): Promise<WorkerWalletWrapper> {
425
+ const aztecNode = createAztecNodeClient(nodeUrl);
426
+ const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
427
+
428
+ // Strip cleanup functions — they can't be structured-cloned for worker transfer
429
+ const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
430
+ const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
431
+
432
+ const pxeConfig = {
433
+ dataDirectory: undefined,
434
+ dataStoreMapSizeKb: 1024 * 1024,
435
+ ...bbPaths,
436
+ ...acvmPaths,
437
+ proverEnabled,
438
+ };
439
+
440
+ const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
441
+
442
+ return {
443
+ wallet,
444
+ aztecNode,
445
+ async cleanup() {
446
+ await wallet.stop();
447
+ await bbCleanup?.();
448
+ await acvmCleanup?.();
449
+ },
450
+ };
451
+ }
@@ -1,9 +1,137 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import type { Logger } from '@aztec/foundation/log';
2
3
  import type { L2Block } from '@aztec/stdlib/block';
3
- import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
4
+ import type { TopicType } from '@aztec/stdlib/p2p';
5
+ import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
4
6
 
5
7
  import { createHistogram } from 'perf_hooks';
6
8
 
9
+ /** Metrics class for proving-related benchmarks. */
10
+ export class ProvingMetrics {
11
+ private successfulTxs: number | undefined;
12
+ private proofDuration: number | undefined;
13
+ private activeAgents: number | undefined;
14
+ private avgQueueTime: number | undefined;
15
+ private jobRetries: number | undefined;
16
+ private jobDuration: number | undefined;
17
+ private timedOutJobs: number | undefined;
18
+ private resolvedJobs: number | undefined;
19
+ private rejectedJobs: number | undefined;
20
+ private epochProvingDuration: number | undefined;
21
+ private provenTransactions: number | undefined;
22
+ private provenBlocks: number | undefined;
23
+
24
+ constructor(private prefix: string) {}
25
+
26
+ recordSuccessfulTxs(count: number): void {
27
+ this.successfulTxs = count;
28
+ }
29
+
30
+ recordProofDuration(seconds: number): void {
31
+ this.proofDuration = seconds;
32
+ }
33
+
34
+ recordActiveAgents(count: number): void {
35
+ this.activeAgents = count;
36
+ }
37
+
38
+ recordAvgQueueTime(ms: number): void {
39
+ this.avgQueueTime = ms;
40
+ }
41
+
42
+ recordJobRetries(count: number): void {
43
+ this.jobRetries = count;
44
+ }
45
+
46
+ recordJobDuration(ms: number): void {
47
+ this.jobDuration = ms;
48
+ }
49
+
50
+ recordTimedOutJobs(count: number): void {
51
+ this.timedOutJobs = count;
52
+ }
53
+
54
+ recordResolvedJobs(count: number): void {
55
+ this.resolvedJobs = count;
56
+ }
57
+
58
+ recordRejectedJobs(count: number): void {
59
+ this.rejectedJobs = count;
60
+ }
61
+
62
+ recordEpochProvingDuration(seconds: number): void {
63
+ this.epochProvingDuration = seconds;
64
+ }
65
+
66
+ recordProvenTransactions(count: number): void {
67
+ this.provenTransactions = count;
68
+ }
69
+
70
+ recordProvenBlocks(count: number): void {
71
+ this.provenBlocks = count;
72
+ }
73
+
74
+ toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number }> {
75
+ const data: Array<{ name: string; unit: string; value: number }> = [];
76
+
77
+ if (this.successfulTxs !== undefined) {
78
+ data.push({ name: `${this.prefix}/successful_txs`, unit: 'count', value: this.successfulTxs });
79
+ }
80
+
81
+ if (this.proofDuration !== undefined) {
82
+ data.push({ name: `${this.prefix}/proof_duration`, unit: 's', value: this.proofDuration });
83
+ }
84
+
85
+ if (this.activeAgents !== undefined) {
86
+ data.push({ name: `${this.prefix}/active_agents`, unit: 'count', value: this.activeAgents });
87
+ }
88
+
89
+ if (this.avgQueueTime !== undefined) {
90
+ data.push({ name: `${this.prefix}/avg_queue_time`, unit: 'ms', value: this.avgQueueTime });
91
+ }
92
+
93
+ if (this.jobRetries !== undefined) {
94
+ data.push({ name: `${this.prefix}/job_retries`, unit: 'count', value: this.jobRetries });
95
+ }
96
+
97
+ if (this.jobDuration !== undefined) {
98
+ data.push({ name: `${this.prefix}/job_duration`, unit: 'ms', value: this.jobDuration });
99
+ }
100
+
101
+ if (this.timedOutJobs !== undefined) {
102
+ data.push({ name: `${this.prefix}/timed_out_jobs`, unit: 'count', value: this.timedOutJobs });
103
+ }
104
+
105
+ if (this.resolvedJobs !== undefined) {
106
+ data.push({ name: `${this.prefix}/resolved_jobs`, unit: 'count', value: this.resolvedJobs });
107
+ }
108
+
109
+ if (this.rejectedJobs !== undefined) {
110
+ data.push({ name: `${this.prefix}/rejected_jobs`, unit: 'count', value: this.rejectedJobs });
111
+ }
112
+
113
+ if (this.epochProvingDuration !== undefined) {
114
+ data.push({ name: `${this.prefix}/epoch_proving_duration`, unit: 's', value: this.epochProvingDuration });
115
+ }
116
+
117
+ if (this.provenTransactions !== undefined) {
118
+ data.push({ name: `${this.prefix}/proven_transactions`, unit: 'count', value: this.provenTransactions });
119
+ }
120
+
121
+ if (this.provenBlocks !== undefined) {
122
+ data.push({ name: `${this.prefix}/proven_blocks`, unit: 'count', value: this.provenBlocks });
123
+ }
124
+
125
+ const scenario = process.env.BENCH_SCENARIO?.trim();
126
+ if (!scenario) {
127
+ return data;
128
+ }
129
+
130
+ const scenarioPrefix = `scenario/${scenario}/`;
131
+ return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
132
+ }
133
+ }
134
+
7
135
  export type TxInclusionData = {
8
136
  txHash: string;
9
137
  sentAt: number;
@@ -19,14 +147,31 @@ export type TxInclusionData = {
19
147
  export class TxInclusionMetrics {
20
148
  private data = new Map<string, TxInclusionData>();
21
149
  private groups = new Set<string>();
22
- private blocks = new Map<number, Promise<L2Block>>();
150
+ private blocks = new Map<number, Promise<L2Block | undefined>>();
151
+
152
+ private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
23
153
 
24
- constructor(private aztecNode: AztecNode) {}
154
+ private attestationLatency: { p50: number; p95: number } | undefined;
155
+ private attestationCounts: { success: number; failedBad: number; failedNode: number } | undefined;
156
+ private reqRespStats: { fraction: number; delayP50: number; delayP95: number } | undefined;
157
+ private peerStats: { avgCount: number; connectionDurationP50: number; connectionDurationP95: number } | undefined;
158
+ private mempoolMinedDelay:
159
+ | { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
160
+ | undefined;
161
+
162
+ constructor(
163
+ private aztecNode: AztecNode,
164
+ private logger?: Logger,
165
+ ) {}
25
166
 
26
167
  recordSentTx(tx: Tx, group: string): void {
27
168
  const txHash = tx.getTxHash().toString();
28
169
  const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
29
170
 
171
+ if (this.data.has(txHash)) {
172
+ this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
173
+ }
174
+
30
175
  this.data.set(txHash, {
31
176
  txHash,
32
177
  sentAt: Math.trunc(Date.now() / 1000),
@@ -42,17 +187,31 @@ export class TxInclusionMetrics {
42
187
  }
43
188
 
44
189
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
45
- const { status, txHash, blockNumber } = txReceipt;
46
- if (status !== TxStatus.SUCCESS || !blockNumber) {
190
+ const { txHash, blockNumber } = txReceipt;
191
+ if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
192
+ this.logger?.debug('Skipping mined tx record due to receipt status', {
193
+ txHash: txHash.toString(),
194
+ status: txReceipt.status,
195
+ blockNumber,
196
+ });
47
197
  return;
48
198
  }
49
199
 
50
200
  if (!this.blocks.has(blockNumber)) {
51
- this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber) as Promise<L2Block>);
201
+ this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
52
202
  }
53
203
 
54
204
  const block = await this.blocks.get(blockNumber)!;
55
- const data = this.data.get(txHash.toString())!;
205
+ if (!block) {
206
+ this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
207
+ return;
208
+ }
209
+ const data = this.data.get(txHash.toString());
210
+ if (!data) {
211
+ const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
212
+ this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
213
+ throw new Error(message);
214
+ }
56
215
  data.blocknumber = blockNumber;
57
216
  data.minedAt = Number(block.header.globalVariables.timestamp);
58
217
  data.attestedAt = -1;
@@ -71,7 +230,7 @@ export class TxInclusionMetrics {
71
230
  } {
72
231
  const histogram = createHistogram({});
73
232
  for (const tx of this.data.values()) {
74
- if (!tx.blocknumber || tx.group !== group) {
233
+ if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
75
234
  continue;
76
235
  }
77
236
 
@@ -101,6 +260,30 @@ export class TxInclusionMetrics {
101
260
  };
102
261
  }
103
262
 
263
+ public recordP2PGossipLatency(topicName: TopicType, p50: number, p95: number): void {
264
+ this.p2pGossipLatencyByTopic[topicName] = { p50, p95 };
265
+ }
266
+
267
+ public recordAttestationLatency(p50: number, p95: number): void {
268
+ this.attestationLatency = { p50, p95 };
269
+ }
270
+
271
+ public recordAttestationCounts(success: number, failedBad: number, failedNode: number): void {
272
+ this.attestationCounts = { success, failedBad, failedNode };
273
+ }
274
+
275
+ public recordReqRespStats(fraction: number, delayP50: number, delayP95: number): void {
276
+ this.reqRespStats = { fraction, delayP50, delayP95 };
277
+ }
278
+
279
+ public recordPeerStats(avgCount: number, connectionDurationP50: number, connectionDurationP95: number): void {
280
+ this.peerStats = { avgCount, connectionDurationP50, connectionDurationP95 };
281
+ }
282
+
283
+ public recordMempoolMinedDelay(txP50: number, txP95: number, attestationP50: number, attestationP95: number): void {
284
+ this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
285
+ }
286
+
104
287
  toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
105
288
  const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
106
289
  for (const group of this.groups) {
@@ -125,6 +308,69 @@ export class TxInclusionMetrics {
125
308
  );
126
309
  }
127
310
 
128
- return data;
311
+ for (const [topic, { p50, p95 }] of Object.entries(this.p2pGossipLatencyByTopic)) {
312
+ data.push({
313
+ name: `p2p_gossip_latency/${topic}/p50`,
314
+ unit: 'ms',
315
+ value: p50,
316
+ });
317
+ data.push({
318
+ name: `p2p_gossip_latency/${topic}/p95`,
319
+ unit: 'ms',
320
+ value: p95,
321
+ });
322
+ }
323
+
324
+ if (this.attestationLatency) {
325
+ data.push(
326
+ { name: 'attestation_latency/p50', unit: 'ms', value: this.attestationLatency.p50 },
327
+ { name: 'attestation_latency/p95', unit: 'ms', value: this.attestationLatency.p95 },
328
+ );
329
+ }
330
+
331
+ if (this.attestationCounts) {
332
+ const { success, failedBad, failedNode } = this.attestationCounts;
333
+ const total = success + failedBad + failedNode;
334
+ const ratio = total > 0 ? success / total : 0;
335
+ data.push(
336
+ { name: 'attestation/success_count', unit: 'count', value: success },
337
+ { name: 'attestation/failed_bad_proposal_count', unit: 'count', value: failedBad },
338
+ { name: 'attestation/failed_node_issue_count', unit: 'count', value: failedNode },
339
+ { name: 'attestation/success_ratio', unit: 'ratio', value: ratio },
340
+ );
341
+ }
342
+
343
+ if (this.reqRespStats) {
344
+ data.push(
345
+ { name: 'req_resp/txs_requested_fraction', unit: 'ratio', value: this.reqRespStats.fraction },
346
+ { name: 'req_resp/delay_p50', unit: 'ms', value: this.reqRespStats.delayP50 },
347
+ { name: 'req_resp/delay_p95', unit: 'ms', value: this.reqRespStats.delayP95 },
348
+ );
349
+ }
350
+
351
+ if (this.peerStats) {
352
+ data.push(
353
+ { name: 'peers/avg_count', unit: 'peers', value: this.peerStats.avgCount },
354
+ { name: 'peers/connection_duration_p50', unit: 'ms', value: this.peerStats.connectionDurationP50 },
355
+ { name: 'peers/connection_duration_p95', unit: 'ms', value: this.peerStats.connectionDurationP95 },
356
+ );
357
+ }
358
+
359
+ if (this.mempoolMinedDelay) {
360
+ data.push(
361
+ { name: 'mempool/tx_mined_delay_p50', unit: 'ms', value: this.mempoolMinedDelay.txP50 },
362
+ { name: 'mempool/tx_mined_delay_p95', unit: 'ms', value: this.mempoolMinedDelay.txP95 },
363
+ { name: 'mempool/attestation_mined_delay_p50', unit: 'ms', value: this.mempoolMinedDelay.attestationP50 },
364
+ { name: 'mempool/attestation_mined_delay_p95', unit: 'ms', value: this.mempoolMinedDelay.attestationP95 },
365
+ );
366
+ }
367
+
368
+ const scenario = process.env.BENCH_SCENARIO?.trim();
369
+ if (!scenario) {
370
+ return data;
371
+ }
372
+
373
+ const scenarioPrefix = `scenario/${scenario}/`;
374
+ return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
129
375
  }
130
376
  }