@aztec/end-to-end 0.0.1-commit.0b941701 → 0.0.1-commit.10bd49492

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 (193) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +2 -2
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +19 -11
  4. package/dest/bench/client_flows/config.d.ts +2 -2
  5. package/dest/bench/client_flows/config.d.ts.map +1 -1
  6. package/dest/bench/client_flows/config.js +18 -0
  7. package/dest/bench/utils.d.ts +1 -1
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +6 -3
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +4 -2
  11. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +22 -12
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +3 -2
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +15 -7
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +86 -41
  21. package/dest/e2e_fees/fees_test.d.ts +2 -2
  22. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  23. package/dest/e2e_fees/fees_test.js +18 -11
  24. package/dest/e2e_l1_publisher/write_json.d.ts +3 -2
  25. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  26. package/dest/e2e_l1_publisher/write_json.js +1 -7
  27. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  28. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  29. package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
  30. package/dest/e2e_p2p/p2p_network.d.ts +5 -4
  31. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  32. package/dest/e2e_p2p/p2p_network.js +24 -7
  33. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  34. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  35. package/dest/e2e_p2p/reqresp/utils.js +190 -0
  36. package/dest/e2e_p2p/shared.d.ts +22 -2
  37. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  38. package/dest/e2e_p2p/shared.js +40 -5
  39. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  44. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  45. package/dest/e2e_token_contract/token_contract_test.d.ts +4 -2
  46. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  47. package/dest/e2e_token_contract/token_contract_test.js +19 -9
  48. package/dest/fixtures/authwit_proxy.d.ts +15 -0
  49. package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
  50. package/dest/fixtures/authwit_proxy.js +30 -0
  51. package/dest/fixtures/e2e_prover_test.d.ts +4 -4
  52. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  53. package/dest/fixtures/e2e_prover_test.js +34 -41
  54. package/dest/fixtures/elu_monitor.d.ts +21 -0
  55. package/dest/fixtures/elu_monitor.d.ts.map +1 -0
  56. package/dest/fixtures/elu_monitor.js +102 -0
  57. package/dest/fixtures/fixtures.d.ts +5 -1
  58. package/dest/fixtures/fixtures.d.ts.map +1 -1
  59. package/dest/fixtures/fixtures.js +6 -0
  60. package/dest/fixtures/ha_setup.d.ts +71 -0
  61. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  62. package/dest/fixtures/ha_setup.js +116 -0
  63. package/dest/fixtures/index.d.ts +2 -1
  64. package/dest/fixtures/index.d.ts.map +1 -1
  65. package/dest/fixtures/index.js +1 -0
  66. package/dest/fixtures/setup.d.ts +46 -25
  67. package/dest/fixtures/setup.d.ts.map +1 -1
  68. package/dest/fixtures/setup.js +83 -167
  69. package/dest/fixtures/setup_p2p_test.d.ts +16 -9
  70. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  71. package/dest/fixtures/setup_p2p_test.js +40 -29
  72. package/dest/fixtures/token_utils.d.ts +2 -2
  73. package/dest/fixtures/token_utils.d.ts.map +1 -1
  74. package/dest/fixtures/token_utils.js +5 -4
  75. package/dest/shared/cross_chain_test_harness.d.ts +1 -1
  76. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  77. package/dest/shared/cross_chain_test_harness.js +13 -13
  78. package/dest/shared/gas_portal_test_harness.js +2 -2
  79. package/dest/shared/index.d.ts +2 -1
  80. package/dest/shared/index.d.ts.map +1 -1
  81. package/dest/shared/index.js +1 -0
  82. package/dest/shared/jest_setup.js +41 -1
  83. package/dest/shared/mock_state_view.d.ts +86 -0
  84. package/dest/shared/mock_state_view.d.ts.map +1 -0
  85. package/dest/shared/mock_state_view.js +186 -0
  86. package/dest/shared/submit-transactions.d.ts +2 -2
  87. package/dest/shared/submit-transactions.d.ts.map +1 -1
  88. package/dest/shared/submit-transactions.js +1 -1
  89. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  90. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  91. package/dest/shared/uniswap_l1_l2.js +16 -17
  92. package/dest/simulators/lending_simulator.d.ts +1 -1
  93. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  94. package/dest/simulators/lending_simulator.js +2 -2
  95. package/dest/simulators/token_simulator.d.ts +1 -1
  96. package/dest/simulators/token_simulator.d.ts.map +1 -1
  97. package/dest/simulators/token_simulator.js +3 -24
  98. package/dest/spartan/setup_test_wallets.d.ts +12 -3
  99. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  100. package/dest/spartan/setup_test_wallets.js +54 -11
  101. package/dest/spartan/tx_metrics.d.ts +35 -1
  102. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  103. package/dest/spartan/tx_metrics.js +151 -1
  104. package/dest/spartan/utils/bot.d.ts +3 -2
  105. package/dest/spartan/utils/bot.d.ts.map +1 -1
  106. package/dest/spartan/utils/bot.js +2 -1
  107. package/dest/spartan/utils/config.d.ts +10 -1
  108. package/dest/spartan/utils/config.d.ts.map +1 -1
  109. package/dest/spartan/utils/config.js +4 -1
  110. package/dest/spartan/utils/index.d.ts +6 -4
  111. package/dest/spartan/utils/index.d.ts.map +1 -1
  112. package/dest/spartan/utils/index.js +6 -2
  113. package/dest/spartan/utils/k8s.d.ts +31 -1
  114. package/dest/spartan/utils/k8s.d.ts.map +1 -1
  115. package/dest/spartan/utils/k8s.js +124 -0
  116. package/dest/spartan/utils/nodes.d.ts +14 -5
  117. package/dest/spartan/utils/nodes.d.ts.map +1 -1
  118. package/dest/spartan/utils/nodes.js +204 -33
  119. package/dest/spartan/utils/pod_logs.d.ts +25 -0
  120. package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
  121. package/dest/spartan/utils/pod_logs.js +74 -0
  122. package/dest/spartan/utils/scripts.d.ts +18 -4
  123. package/dest/spartan/utils/scripts.d.ts.map +1 -1
  124. package/dest/spartan/utils/scripts.js +19 -4
  125. package/dest/test-wallet/test_wallet.d.ts +83 -0
  126. package/dest/test-wallet/test_wallet.d.ts.map +1 -0
  127. package/dest/test-wallet/test_wallet.js +214 -0
  128. package/dest/test-wallet/utils.d.ts +41 -0
  129. package/dest/test-wallet/utils.d.ts.map +1 -0
  130. package/dest/test-wallet/utils.js +71 -0
  131. package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
  132. package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
  133. package/dest/test-wallet/wallet_worker_script.js +48 -0
  134. package/dest/test-wallet/worker_wallet.d.ts +52 -0
  135. package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
  136. package/dest/test-wallet/worker_wallet.js +151 -0
  137. package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
  138. package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
  139. package/dest/test-wallet/worker_wallet_schema.js +10 -0
  140. package/package.json +46 -43
  141. package/src/bench/client_flows/client_flows_benchmark.ts +42 -38
  142. package/src/bench/client_flows/config.ts +9 -1
  143. package/src/bench/utils.ts +8 -3
  144. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +28 -15
  145. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +7 -8
  146. package/src/e2e_deploy_contract/deploy_test.ts +3 -3
  147. package/src/e2e_epochs/epochs_test.ts +104 -72
  148. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  149. package/src/e2e_fees/fees_test.ts +20 -28
  150. package/src/e2e_l1_publisher/write_json.ts +1 -6
  151. package/src/e2e_nested_contract/nested_contract_test.ts +7 -5
  152. package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
  153. package/src/e2e_p2p/p2p_network.ts +36 -10
  154. package/src/e2e_p2p/reqresp/utils.ts +256 -0
  155. package/src/e2e_p2p/shared.ts +68 -5
  156. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  157. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  158. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  159. package/src/e2e_token_contract/token_contract_test.ts +26 -9
  160. package/src/fixtures/authwit_proxy.ts +50 -0
  161. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  162. package/src/fixtures/e2e_prover_test.ts +40 -44
  163. package/src/fixtures/elu_monitor.ts +126 -0
  164. package/src/fixtures/fixtures.ts +10 -0
  165. package/src/fixtures/ha_setup.ts +186 -0
  166. package/src/fixtures/index.ts +1 -0
  167. package/src/fixtures/setup.ts +113 -227
  168. package/src/fixtures/setup_p2p_test.ts +40 -44
  169. package/src/fixtures/token_utils.ts +6 -3
  170. package/src/guides/up_quick_start.sh +3 -3
  171. package/src/shared/cross_chain_test_harness.ts +13 -9
  172. package/src/shared/gas_portal_test_harness.ts +1 -1
  173. package/src/shared/index.ts +1 -0
  174. package/src/shared/jest_setup.ts +51 -1
  175. package/src/shared/mock_state_view.ts +188 -0
  176. package/src/shared/submit-transactions.ts +3 -2
  177. package/src/shared/uniswap_l1_l2.ts +38 -33
  178. package/src/simulators/lending_simulator.ts +4 -2
  179. package/src/simulators/token_simulator.ts +6 -30
  180. package/src/spartan/setup_test_wallets.ts +102 -17
  181. package/src/spartan/tx_metrics.ts +127 -1
  182. package/src/spartan/utils/bot.ts +4 -1
  183. package/src/spartan/utils/config.ts +3 -0
  184. package/src/spartan/utils/index.ts +10 -1
  185. package/src/spartan/utils/k8s.ts +160 -0
  186. package/src/spartan/utils/nodes.ts +251 -31
  187. package/src/spartan/utils/pod_logs.ts +99 -0
  188. package/src/spartan/utils/scripts.ts +43 -7
  189. package/src/test-wallet/test_wallet.ts +306 -0
  190. package/src/test-wallet/utils.ts +112 -0
  191. package/src/test-wallet/wallet_worker_script.ts +60 -0
  192. package/src/test-wallet/worker_wallet.ts +213 -0
  193. package/src/test-wallet/worker_wallet_schema.ts +13 -0
@@ -11,18 +11,18 @@ import type { DeployAztecL1ContractsReturnType } from '@aztec/ethereum/deploy-az
11
11
  import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
12
12
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
13
13
  import { extractEvent } from '@aztec/ethereum/utils';
14
- import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
14
+ import { EpochNumber } from '@aztec/foundation/branded-types';
15
15
  import { sha256ToField } from '@aztec/foundation/crypto/sha256';
16
16
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
17
17
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
18
18
  import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
19
19
  import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
20
- import type { TestWallet } from '@aztec/test-wallet/server';
21
20
 
22
21
  import { jest } from '@jest/globals';
23
22
  import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
24
23
 
25
24
  import { type EndToEndContext, ensureAccountContractsPublished } from '../fixtures/utils.js';
25
+ import type { TestWallet } from '../test-wallet/test_wallet.js';
26
26
  import { CrossChainTestHarness } from './cross_chain_test_harness.js';
27
27
 
28
28
  // PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
@@ -84,7 +84,7 @@ export const uniswapL1L2TestSuite = (
84
84
 
85
85
  l1Client = deployL1ContractsValues.l1Client;
86
86
 
87
- t.watcher?.setIsMarkingAsProven(false);
87
+ t.watcher.setIsMarkingAsProven(false);
88
88
 
89
89
  if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
90
90
  throw new Error('This test must be run on a fork of mainnet with the expected fork block');
@@ -130,7 +130,9 @@ export const uniswapL1L2TestSuite = (
130
130
  client: l1Client,
131
131
  });
132
132
  // deploy l2 uniswap contract and attach to portal
133
- uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({ from: ownerAddress });
133
+ ({ contract: uniswapL2Contract } = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
134
+ from: ownerAddress,
135
+ }));
134
136
 
135
137
  const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
136
138
 
@@ -195,7 +197,7 @@ export const uniswapL1L2TestSuite = (
195
197
  logger.info('Withdrawing weth to L1 and sending message to swap to dai');
196
198
  const [secretForDepositingSwappedDai, secretHashForDepositingSwappedDai] = await generateClaimSecret();
197
199
 
198
- const l2UniswapInteractionReceipt = await uniswapL2Contract.methods
200
+ const { receipt: l2UniswapInteractionReceipt } = await uniswapL2Contract.methods
199
201
  .swap_private(
200
202
  wethCrossChainHarness.l2Token.address,
201
203
  wethCrossChainHarness.l2Bridge.address,
@@ -250,8 +252,12 @@ export const uniswapL1L2TestSuite = (
250
252
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
251
253
 
252
254
  // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
253
- const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber!);
254
- const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
255
+ const swapResult = (await computeL2ToL1MembershipWitness(
256
+ aztecNode,
257
+ swapPrivateLeaf,
258
+ l2UniswapInteractionReceipt.txHash,
259
+ ))!;
260
+ const { epochNumber: epoch } = swapResult;
255
261
  await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
256
262
  await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
257
263
 
@@ -260,14 +266,17 @@ export const uniswapL1L2TestSuite = (
260
266
  const daiL1BalanceOfPortalBeforeSwap = await daiCrossChainHarness.getL1BalanceOf(
261
267
  daiCrossChainHarness.tokenPortalAddress,
262
268
  );
263
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
264
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
269
+ const withdrawResult = (await computeL2ToL1MembershipWitness(
270
+ aztecNode,
271
+ withdrawLeaf,
272
+ l2UniswapInteractionReceipt.txHash,
273
+ ))!;
265
274
 
266
- const swapPrivateL2MessageIndex = swapResult!.leafIndex;
267
- const swapPrivateSiblingPath = swapResult!.siblingPath;
275
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
276
+ const swapPrivateSiblingPath = swapResult.siblingPath;
268
277
 
269
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
270
- const withdrawSiblingPath = withdrawResult!.siblingPath;
278
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
279
+ const withdrawSiblingPath = withdrawResult.siblingPath;
271
280
 
272
281
  const withdrawMessageMetadata = {
273
282
  _epoch: BigInt(epoch),
@@ -787,7 +796,7 @@ export const uniswapL1L2TestSuite = (
787
796
  logger.info('Withdrawing weth to L1 and sending message to swap to dai');
788
797
 
789
798
  const [, secretHashForDepositingSwappedDai] = await generateClaimSecret();
790
- const withdrawReceipt = await uniswapL2Contract.methods
799
+ const { receipt: withdrawReceipt } = await uniswapL2Contract.methods
791
800
  .swap_private(
792
801
  wethCrossChainHarness.l2Token.address,
793
802
  wethCrossChainHarness.l2Bridge.address,
@@ -838,17 +847,15 @@ export const uniswapL1L2TestSuite = (
838
847
  chainId: new Fr(l1Client.chain.id),
839
848
  });
840
849
 
841
- const epoch = await rollup.getEpochNumberForCheckpoint(
842
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
843
- );
844
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
845
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
850
+ const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPrivateLeaf, withdrawReceipt.txHash))!;
851
+ const { epochNumber: epoch } = swapResult;
852
+ const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
846
853
 
847
- const swapPrivateL2MessageIndex = swapResult!.leafIndex;
848
- const swapPrivateSiblingPath = swapResult!.siblingPath;
854
+ const swapPrivateL2MessageIndex = swapResult.leafIndex;
855
+ const swapPrivateSiblingPath = swapResult.siblingPath;
849
856
 
850
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
851
- const withdrawSiblingPath = withdrawResult!.siblingPath;
857
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
858
+ const withdrawSiblingPath = withdrawResult.siblingPath;
852
859
 
853
860
  const withdrawMessageMetadata = {
854
861
  _epoch: BigInt(epoch),
@@ -916,7 +923,7 @@ export const uniswapL1L2TestSuite = (
916
923
 
917
924
  // Call swap_public on L2
918
925
  const secretHashForDepositingSwappedDai = Fr.random();
919
- const withdrawReceipt = await uniswapL2Contract.methods
926
+ const { receipt: withdrawReceipt } = await uniswapL2Contract.methods
920
927
  .swap_public(
921
928
  ownerAddress,
922
929
  wethCrossChainHarness.l2Bridge.address,
@@ -972,17 +979,15 @@ export const uniswapL1L2TestSuite = (
972
979
  chainId: new Fr(l1Client.chain.id),
973
980
  });
974
981
 
975
- const epoch = await rollup.getEpochNumberForCheckpoint(
976
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
977
- );
978
- const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
979
- const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
982
+ const swapResult = (await computeL2ToL1MembershipWitness(aztecNode, swapPublicLeaf, withdrawReceipt.txHash))!;
983
+ const { epochNumber: epoch } = swapResult;
984
+ const withdrawResult = (await computeL2ToL1MembershipWitness(aztecNode, withdrawLeaf, withdrawReceipt.txHash))!;
980
985
 
981
- const swapPublicL2MessageIndex = swapResult!.leafIndex;
982
- const swapPublicSiblingPath = swapResult!.siblingPath;
986
+ const swapPublicL2MessageIndex = swapResult.leafIndex;
987
+ const swapPublicSiblingPath = swapResult.siblingPath;
983
988
 
984
- const withdrawL2MessageIndex = withdrawResult!.leafIndex;
985
- const withdrawSiblingPath = withdrawResult!.siblingPath;
989
+ const withdrawL2MessageIndex = withdrawResult.leafIndex;
990
+ const withdrawSiblingPath = withdrawResult.siblingPath;
986
991
 
987
992
  const withdrawMessageMetadata = {
988
993
  _epoch: BigInt(epoch),
@@ -186,14 +186,16 @@ export class LendingSimulator {
186
186
 
187
187
  expect(this.borrowed).toEqual(this.stableCoin.totalSupply - this.mintedOutside);
188
188
 
189
- const asset = await this.lendingContract.methods.get_asset(0).simulate({ from: this.account.address });
189
+ const { result: asset } = await this.lendingContract.methods.get_asset(0).simulate({ from: this.account.address });
190
190
 
191
191
  const interestAccumulator = asset['interest_accumulator'];
192
192
  expect(interestAccumulator).toEqual(this.accumulator);
193
193
  expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
194
194
 
195
195
  for (const key of [this.account.address, AztecAddress.fromField(await this.account.key())]) {
196
- const privatePos = await this.lendingContract.methods.get_position(key).simulate({ from: this.account.address });
196
+ const { result: privatePos } = await this.lendingContract.methods
197
+ .get_position(key)
198
+ .simulate({ from: this.account.address });
197
199
  expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
198
200
  expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
199
201
  expect(privatePos['debt']).toEqual(
@@ -109,7 +109,9 @@ export class TokenSimulator {
109
109
  await Promise.all(
110
110
  chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
111
111
  )
112
- ).flat();
112
+ )
113
+ .flat()
114
+ .map(r => r.result);
113
115
  expect(results[0]).toEqual(this.totalSupply);
114
116
 
115
117
  // Check that all our balances match
@@ -119,39 +121,13 @@ export class TokenSimulator {
119
121
  }
120
122
 
121
123
  async checkPrivate() {
122
- // Private calls
123
- const defaultLookups = [];
124
- const nonDefaultLookups = [];
125
-
126
124
  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
125
  const wallet = this.lookupProvider.get(address.toString());
150
126
  const asset = wallet ? this.token.withWallet(wallet) : this.token;
151
127
 
152
- const actualPrivateBalance = await asset.methods
153
- .balance_of_private({ address })
154
- .simulate({ from: this.defaultAddress });
128
+ const { result: actualPrivateBalance } = await asset.methods
129
+ .balance_of_private(address)
130
+ .simulate({ from: address });
155
131
  expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
156
132
  }
157
133
  }
@@ -13,11 +13,14 @@ import type { Logger } from '@aztec/foundation/log';
13
13
  import { retryUntil } from '@aztec/foundation/retry';
14
14
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
15
15
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
16
- import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
16
+ import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
17
17
 
18
18
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
19
19
  import { getBBConfig } from '../fixtures/get_bb_config.js';
20
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';
21
24
 
22
25
  export interface TestAccounts {
23
26
  aztecNode: AztecNode;
@@ -85,11 +88,19 @@ export async function deploySponsoredTestAccountsWithTokens(
85
88
 
86
89
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
87
90
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
88
- 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
+ });
89
96
  await Promise.all(
90
97
  fundedAccounts.map(async a => {
91
98
  const deployMethod = await a.getDeployMethod();
92
- 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
93
104
  logger.info(`Account deployed at ${a.address}`);
94
105
  }),
95
106
  );
@@ -118,16 +129,28 @@ export async function deploySponsoredTestAccountsWithTokens(
118
129
  }
119
130
 
120
131
  async function deployAccountWithDiagnostics(
121
- account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
132
+ account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
122
133
  paymentMethod: SponsoredFeePaymentMethod,
123
134
  aztecNode: AztecNode,
124
135
  logger: Logger,
125
136
  accountLabel: string,
137
+ estimateGas?: boolean,
126
138
  ): Promise<void> {
127
139
  const deployMethod = await account.getDeployMethod();
128
140
  let txHash;
129
141
  try {
130
- txHash = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
142
+ let gasSettings;
143
+ if (estimateGas) {
144
+ const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
145
+ gasSettings = sim.estimatedGas;
146
+ logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
147
+ }
148
+ const deployResult = await deployMethod.send({
149
+ from: AztecAddress.ZERO,
150
+ fee: { paymentMethod, gasSettings },
151
+ wait: NO_WAIT,
152
+ });
153
+ txHash = deployResult.txHash;
131
154
  await waitForTx(aztecNode, txHash, { timeout: 2400 });
132
155
  logger.info(`${accountLabel} deployed at ${account.address}`);
133
156
  } catch (error) {
@@ -149,18 +172,29 @@ async function deployAccountWithDiagnostics(
149
172
  }
150
173
 
151
174
  async function deployAccountsInBatches(
152
- accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
175
+ accounts: {
176
+ getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
177
+ address: any;
178
+ }[],
153
179
  paymentMethod: SponsoredFeePaymentMethod,
154
180
  aztecNode: AztecNode,
155
181
  logger: Logger,
156
182
  labelPrefix: string,
157
183
  batchSize = 2,
184
+ estimateGas?: boolean,
158
185
  ): Promise<void> {
159
186
  for (let i = 0; i < accounts.length; i += batchSize) {
160
187
  const batch = accounts.slice(i, i + batchSize);
161
188
  await Promise.all(
162
189
  batch.map((account, idx) =>
163
- deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
190
+ deployAccountWithDiagnostics(
191
+ account,
192
+ paymentMethod,
193
+ aztecNode,
194
+ logger,
195
+ `${labelPrefix}${i + idx + 1}`,
196
+ estimateGas,
197
+ ),
164
198
  ),
165
199
  );
166
200
  }
@@ -171,6 +205,7 @@ export async function deploySponsoredTestAccounts(
171
205
  aztecNode: AztecNode,
172
206
  logger: Logger,
173
207
  numberOfFundedWallets = 1,
208
+ opts?: { estimateGas?: boolean },
174
209
  ): Promise<TestAccountsWithoutTokens> {
175
210
  const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
176
211
  const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
@@ -180,8 +215,23 @@ export async function deploySponsoredTestAccounts(
180
215
 
181
216
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
182
217
 
183
- await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
184
- await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
218
+ await deployAccountWithDiagnostics(
219
+ recipientAccount,
220
+ paymentMethod,
221
+ aztecNode,
222
+ logger,
223
+ 'Recipient account',
224
+ opts?.estimateGas,
225
+ );
226
+ await deployAccountsInBatches(
227
+ fundedAccounts,
228
+ paymentMethod,
229
+ aztecNode,
230
+ logger,
231
+ 'Funded account ',
232
+ 2,
233
+ opts?.estimateGas,
234
+ );
185
235
 
186
236
  return {
187
237
  aztecNode,
@@ -263,7 +313,7 @@ async function bridgeL1FeeJuice(
263
313
  const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
264
314
 
265
315
  const isSynced = async () =>
266
- (await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
316
+ (await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
267
317
  await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
268
318
 
269
319
  log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
@@ -295,13 +345,9 @@ async function deployTokenAndMint(
295
345
  logger: Logger,
296
346
  ) {
297
347
  logger.verbose(`Deploying TokenContract...`);
298
- const { contract: tokenContract } = await TokenContract.deploy(
299
- wallet,
300
- admin,
301
- TOKEN_NAME,
302
- TOKEN_SYMBOL,
303
- TOKEN_DECIMALS,
304
- ).send({
348
+ const {
349
+ receipt: { contract: tokenContract },
350
+ } = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
305
351
  from: admin,
306
352
  fee: {
307
353
  paymentMethod,
@@ -395,3 +441,42 @@ export async function createWalletAndAztecNodeClient(
395
441
  },
396
442
  };
397
443
  }
444
+
445
+ export type WorkerWalletWrapper = {
446
+ wallet: WorkerWallet;
447
+ aztecNode: AztecNode;
448
+ cleanup: () => Promise<void>;
449
+ };
450
+
451
+ export async function createWorkerWalletClient(
452
+ nodeUrl: string,
453
+ proverEnabled: boolean,
454
+ logger: Logger,
455
+ ): Promise<WorkerWalletWrapper> {
456
+ const aztecNode = createAztecNodeClient(nodeUrl);
457
+ const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
458
+
459
+ // Strip cleanup functions — they can't be structured-cloned for worker transfer
460
+ const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
461
+ const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
462
+
463
+ const pxeConfig = {
464
+ dataDirectory: undefined,
465
+ dataStoreMapSizeKb: 1024 * 1024,
466
+ ...bbPaths,
467
+ ...acvmPaths,
468
+ proverEnabled,
469
+ };
470
+
471
+ const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
472
+
473
+ return {
474
+ wallet,
475
+ aztecNode,
476
+ async cleanup() {
477
+ await wallet.stop();
478
+ await bbCleanup?.();
479
+ await acvmCleanup?.();
480
+ },
481
+ };
482
+ }
@@ -6,6 +6,132 @@ import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
6
6
 
7
7
  import { createHistogram } from 'perf_hooks';
8
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
+
9
135
  export type TxInclusionData = {
10
136
  txHash: string;
11
137
  sentAt: number;
@@ -170,7 +296,7 @@ export class TxInclusionMetrics {
170
296
  value: stats.mean,
171
297
  },
172
298
  {
173
- name: `${group}/median_inclusion`,
299
+ name: `${group}/p50_inclusion`,
174
300
  unit: 's',
175
301
  value: stats.median,
176
302
  },
@@ -34,7 +34,8 @@ export async function installTransferBot({
34
34
  logger: log,
35
35
  replicas = 1,
36
36
  txIntervalSeconds = 10,
37
- followChain = 'PENDING',
37
+ followChain = 'CHECKPOINTED',
38
+ pxeSyncChainTip = 'proposed',
38
39
  mnemonic = process.env.LABS_INFRA_MNEMONIC ?? 'test test test test test test test test test test test junk',
39
40
  mnemonicStartIndex,
40
41
  botPrivateKey = process.env.BOT_TRANSFERS_L2_PRIVATE_KEY ?? '0xcafe01',
@@ -49,6 +50,7 @@ export async function installTransferBot({
49
50
  replicas?: number;
50
51
  txIntervalSeconds?: number;
51
52
  followChain?: string;
53
+ pxeSyncChainTip?: string;
52
54
  mnemonic?: string;
53
55
  mnemonicStartIndex?: number | string;
54
56
  botPrivateKey?: string;
@@ -67,6 +69,7 @@ export async function installTransferBot({
67
69
  'bot.replicaCount': replicas,
68
70
  'bot.txIntervalSeconds': txIntervalSeconds,
69
71
  'bot.followChain': followChain,
72
+ 'bot.pxeSyncChainTip': pxeSyncChainTip,
70
73
  'bot.botPrivateKey': botPrivateKey,
71
74
  'bot.nodeUrl': resolvedNodeUrl,
72
75
  'bot.mnemonic': mnemonic,
@@ -8,6 +8,7 @@ const logger = createLogger('e2e:k8s-utils');
8
8
  const testConfigSchema = z.object({
9
9
  NAMESPACE: z.string().default('scenario'),
10
10
  REAL_VERIFIER: schemas.Boolean.optional().default(true),
11
+ DEBUG_FORCE_TX_PROOF_VERIFICATION: schemas.Boolean.optional().default(true),
11
12
  CREATE_ETH_DEVNET: schemas.Boolean.optional().default(false),
12
13
  L1_RPC_URLS_JSON: z.string().optional(),
13
14
  L1_ACCOUNT_MNEMONIC: z.string().optional(),
@@ -15,6 +16,8 @@ const testConfigSchema = z.object({
15
16
  AZTEC_EPOCH_DURATION: z.coerce.number().optional().default(32),
16
17
  AZTEC_PROOF_SUBMISSION_WINDOW: z.coerce.number().optional().default(5),
17
18
  AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET: z.coerce.number().optional().default(2),
19
+ FUNDING_PRIVATE_KEY: z.string().optional(),
20
+ AZTEC_ADMIN_API_KEY: z.string().optional(),
18
21
  });
19
22
 
20
23
  export type TestConfig = z.infer<typeof testConfigSchema>;
@@ -5,7 +5,7 @@
5
5
  export { type TestConfig, setupEnvironment } from './config.js';
6
6
 
7
7
  // Scripts
8
- export { getGitProjectRoot, getAztecBin, runAztecBin, runProjectScript } from './scripts.js';
8
+ export { type ScriptResult, getGitProjectRoot, getAztecBin, runAztecBin, runProjectScript } from './scripts.js';
9
9
 
10
10
  // K8s operations
11
11
  export {
@@ -24,6 +24,8 @@ export {
24
24
  getServiceEndpoint,
25
25
  getRPCEndpoint,
26
26
  getEthereumEndpoint,
27
+ createResilientPrometheusConnection,
28
+ scaleProverAgents,
27
29
  } from './k8s.js';
28
30
 
29
31
  // Chaos Mesh
@@ -39,12 +41,16 @@ export {
39
41
  applyNetworkShaping,
40
42
  } from './chaos.js';
41
43
 
44
+ // Helm
45
+ export { hasDeployedHelmRelease } from './helm.js';
46
+
42
47
  // Bot management
43
48
  export { restartBot, installTransferBot, uninstallTransferBot } from './bot.js';
44
49
 
45
50
  // Node operations (sequencers, validators, pods)
46
51
  export {
47
52
  awaitCheckpointNumber,
53
+ waitForProvenToAdvance,
48
54
  getSequencers,
49
55
  updateSequencersConfig,
50
56
  getSequencersConfig,
@@ -60,3 +66,6 @@ export { getPublicViemClient, getL1DeploymentAddresses, getNodeClient } from './
60
66
 
61
67
  // Health checks
62
68
  export { ChainHealth, type ChainHealthSnapshot } from './health.js';
69
+
70
+ // Pod log extraction
71
+ export { type BlockBuiltLogEntry, fetchBlockBuiltLogs } from './pod_logs.js';