@aztec/end-to-end 0.0.1-commit.f295ac2 → 0.0.1-commit.f2ce05ee

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 (157) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.js +28 -13
  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 +5 -4
  8. package/dest/bench/utils.d.ts.map +1 -1
  9. package/dest/bench/utils.js +9 -7
  10. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  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 +7 -8
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -1
  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_epochs/epochs_test.d.ts +7 -1
  17. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.js +31 -8
  19. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  20. package/dest/e2e_fees/fees_test.d.ts +1 -1
  21. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  22. package/dest/e2e_fees/fees_test.js +6 -6
  23. package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
  24. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  25. package/dest/e2e_l1_publisher/write_json.js +1 -7
  26. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  27. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  28. package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
  29. package/dest/e2e_p2p/p2p_network.d.ts +1 -1
  30. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  31. package/dest/e2e_p2p/p2p_network.js +6 -2
  32. package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
  33. package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
  34. package/dest/e2e_p2p/reqresp/utils.js +153 -0
  35. package/dest/e2e_p2p/shared.d.ts +6 -6
  36. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  37. package/dest/e2e_p2p/shared.js +12 -16
  38. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
  39. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
  40. package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
  41. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
  42. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
  43. package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
  44. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  45. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.js +3 -3
  47. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  48. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  49. package/dest/fixtures/e2e_prover_test.js +8 -5
  50. package/dest/fixtures/ha_setup.d.ts +71 -0
  51. package/dest/fixtures/ha_setup.d.ts.map +1 -0
  52. package/dest/fixtures/ha_setup.js +114 -0
  53. package/dest/fixtures/index.d.ts +2 -1
  54. package/dest/fixtures/index.d.ts.map +1 -1
  55. package/dest/fixtures/index.js +1 -0
  56. package/dest/fixtures/setup.d.ts +5 -3
  57. package/dest/fixtures/setup.d.ts.map +1 -1
  58. package/dest/fixtures/setup.js +31 -20
  59. package/dest/fixtures/setup_p2p_test.d.ts +12 -8
  60. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  61. package/dest/fixtures/setup_p2p_test.js +29 -21
  62. package/dest/fixtures/token_utils.d.ts +1 -1
  63. package/dest/fixtures/token_utils.d.ts.map +1 -1
  64. package/dest/fixtures/token_utils.js +7 -4
  65. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  66. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  67. package/dest/shared/cross_chain_test_harness.js +11 -11
  68. package/dest/shared/gas_portal_test_harness.js +1 -1
  69. package/dest/shared/submit-transactions.d.ts +3 -3
  70. package/dest/shared/submit-transactions.d.ts.map +1 -1
  71. package/dest/shared/submit-transactions.js +9 -11
  72. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  73. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  74. package/dest/shared/uniswap_l1_l2.js +19 -17
  75. package/dest/simulators/lending_simulator.js +2 -2
  76. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  77. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  78. package/dest/spartan/setup_test_wallets.js +61 -34
  79. package/dest/spartan/tx_metrics.d.ts +48 -2
  80. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  81. package/dest/spartan/tx_metrics.js +309 -5
  82. package/dest/spartan/utils/bot.d.ts +27 -0
  83. package/dest/spartan/utils/bot.d.ts.map +1 -0
  84. package/dest/spartan/utils/bot.js +141 -0
  85. package/dest/spartan/utils/chaos.d.ts +79 -0
  86. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  87. package/dest/spartan/utils/chaos.js +142 -0
  88. package/dest/spartan/utils/clients.d.ts +39 -0
  89. package/dest/spartan/utils/clients.d.ts.map +1 -0
  90. package/dest/spartan/utils/clients.js +90 -0
  91. package/dest/spartan/utils/config.d.ts +39 -0
  92. package/dest/spartan/utils/config.d.ts.map +1 -0
  93. package/dest/spartan/utils/config.js +21 -0
  94. package/dest/spartan/utils/health.d.ts +63 -0
  95. package/dest/spartan/utils/health.d.ts.map +1 -0
  96. package/dest/spartan/utils/health.js +202 -0
  97. package/dest/spartan/utils/helm.d.ts +15 -0
  98. package/dest/spartan/utils/helm.d.ts.map +1 -0
  99. package/dest/spartan/utils/helm.js +47 -0
  100. package/dest/spartan/utils/index.d.ts +9 -0
  101. package/dest/spartan/utils/index.d.ts.map +1 -0
  102. package/dest/spartan/utils/index.js +18 -0
  103. package/dest/spartan/utils/k8s.d.ts +126 -0
  104. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  105. package/dest/spartan/utils/k8s.js +375 -0
  106. package/dest/spartan/utils/nodes.d.ts +41 -0
  107. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  108. package/dest/spartan/utils/nodes.js +461 -0
  109. package/dest/spartan/utils/scripts.d.ts +30 -0
  110. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  111. package/dest/spartan/utils/scripts.js +81 -0
  112. package/dest/spartan/utils.d.ts +2 -260
  113. package/dest/spartan/utils.d.ts.map +1 -1
  114. package/dest/spartan/utils.js +1 -942
  115. package/package.json +42 -39
  116. package/src/bench/client_flows/client_flows_benchmark.ts +11 -24
  117. package/src/bench/client_flows/config.ts +9 -1
  118. package/src/bench/utils.ts +9 -7
  119. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -12
  120. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +3 -4
  121. package/src/e2e_epochs/epochs_test.ts +59 -32
  122. package/src/e2e_fees/bridging_race.notest.ts +1 -4
  123. package/src/e2e_fees/fees_test.ts +10 -14
  124. package/src/e2e_l1_publisher/write_json.ts +3 -8
  125. package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
  126. package/src/e2e_p2p/p2p_network.ts +15 -9
  127. package/src/e2e_p2p/reqresp/utils.ts +207 -0
  128. package/src/e2e_p2p/shared.ts +21 -22
  129. package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
  130. package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
  131. package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
  132. package/src/e2e_token_contract/token_contract_test.ts +3 -5
  133. package/src/fixtures/dumps/epoch_proof_result.json +1 -1
  134. package/src/fixtures/e2e_prover_test.ts +4 -9
  135. package/src/fixtures/ha_setup.ts +184 -0
  136. package/src/fixtures/index.ts +1 -0
  137. package/src/fixtures/setup.ts +33 -26
  138. package/src/fixtures/setup_p2p_test.ts +31 -27
  139. package/src/fixtures/token_utils.ts +6 -5
  140. package/src/shared/cross_chain_test_harness.ts +13 -27
  141. package/src/shared/gas_portal_test_harness.ts +1 -1
  142. package/src/shared/submit-transactions.ts +9 -15
  143. package/src/shared/uniswap_l1_l2.ts +19 -28
  144. package/src/simulators/lending_simulator.ts +2 -2
  145. package/src/spartan/setup_test_wallets.ts +72 -24
  146. package/src/spartan/tx_metrics.ts +231 -8
  147. package/src/spartan/utils/bot.ts +185 -0
  148. package/src/spartan/utils/chaos.ts +253 -0
  149. package/src/spartan/utils/clients.ts +100 -0
  150. package/src/spartan/utils/config.ts +27 -0
  151. package/src/spartan/utils/health.ts +255 -0
  152. package/src/spartan/utils/helm.ts +84 -0
  153. package/src/spartan/utils/index.ts +64 -0
  154. package/src/spartan/utils/k8s.ts +527 -0
  155. package/src/spartan/utils/nodes.ts +538 -0
  156. package/src/spartan/utils/scripts.ts +99 -0
  157. package/src/spartan/utils.ts +1 -1246
@@ -1,8 +1,8 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import type { SentTx } from '@aztec/aztec.js/contracts';
2
+ import { NO_WAIT } from '@aztec/aztec.js/contracts';
3
3
  import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
4
4
  import type { Logger } from '@aztec/aztec.js/log';
5
- import { TxStatus } from '@aztec/aztec.js/tx';
5
+ import { TxHash, type TxReceipt, TxStatus } from '@aztec/aztec.js/tx';
6
6
  import { times } from '@aztec/foundation/collection';
7
7
  import type { TestWallet } from '@aztec/test-wallet/server';
8
8
 
@@ -12,26 +12,20 @@ export const submitTxsTo = async (
12
12
  submitter: AztecAddress,
13
13
  numTxs: number,
14
14
  logger: Logger,
15
- ): Promise<SentTx[]> => {
16
- const txs: SentTx[] = [];
15
+ ): Promise<TxHash[]> => {
16
+ const txHashes: TxHash[] = [];
17
17
  await Promise.all(
18
18
  times(numTxs, async () => {
19
19
  const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
20
20
  const deployMethod = await accountManager.getDeployMethod();
21
- const tx = deployMethod.send({ from: submitter });
22
- const txHash = await tx.getTxHash();
21
+ const txHash = await deployMethod.send({ from: submitter, wait: NO_WAIT });
23
22
 
24
23
  logger.info(`Tx sent with hash ${txHash}`);
25
- const receipt = await tx.getReceipt();
26
- expect(receipt).toEqual(
27
- expect.objectContaining({
28
- status: TxStatus.PENDING,
29
- error: '',
30
- }),
31
- );
24
+ const receipt: TxReceipt = await wallet.getTxReceipt(txHash);
25
+ expect(receipt.status).toBe(TxStatus.PENDING);
32
26
  logger.info(`Receipt received for ${txHash}`);
33
- txs.push(tx);
27
+ txHashes.push(txHash);
34
28
  }),
35
29
  );
36
- return txs;
30
+ return txHashes;
37
31
  };
@@ -11,7 +11,7 @@ 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';
@@ -130,9 +130,7 @@ 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)
134
- .send({ from: ownerAddress })
135
- .deployed();
133
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({ from: ownerAddress });
136
134
 
137
135
  const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
138
136
 
@@ -209,8 +207,7 @@ export const uniswapL1L2TestSuite = (
209
207
  secretHashForDepositingSwappedDai,
210
208
  ownerEthAddress,
211
209
  )
212
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
213
- .wait();
210
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
214
211
 
215
212
  const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
216
213
  const swapPrivateContent = sha256ToField([
@@ -253,8 +250,8 @@ export const uniswapL1L2TestSuite = (
253
250
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
254
251
 
255
252
  // Since the outbox is only consumable when the epoch is proven, we need to advance to the next epoch.
256
- const checkpointNumber = CheckpointNumber.fromBlockNumber(l2UniswapInteractionReceipt.blockNumber!);
257
- const epoch = await rollup.getEpochNumberForCheckpoint(checkpointNumber);
253
+ const block = await aztecNode.getBlock(l2UniswapInteractionReceipt.blockNumber!);
254
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
258
255
  await cheatCodes.rollup.advanceToEpoch(EpochNumber(epoch + 1));
259
256
  await waitForProven(aztecNode, l2UniswapInteractionReceipt, { provenTimeout: 300 });
260
257
 
@@ -428,10 +425,10 @@ export const uniswapL1L2TestSuite = (
428
425
  // ownerEthAddress,
429
426
  // nonceForSwap,
430
427
  // );
431
- // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send().wait();
428
+ // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send();
432
429
 
433
430
  // // 4.2 Call swap_public from user2 on behalf of owner
434
- // const uniswapL2Interaction = await action.send().wait();
431
+ // const uniswapL2Interaction = await action.send();
435
432
 
436
433
  // const swapPublicContent = sha256ToField([
437
434
  // Buffer.from(
@@ -649,8 +646,7 @@ export const uniswapL1L2TestSuite = (
649
646
  Fr.random(),
650
647
  ownerEthAddress,
651
648
  )
652
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
653
- .wait(),
649
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] }),
654
650
  ).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
655
651
  });
656
652
 
@@ -675,7 +671,7 @@ export const uniswapL1L2TestSuite = (
675
671
  },
676
672
  true,
677
673
  );
678
- await validateActionInteraction.send().wait();
674
+ await validateActionInteraction.send();
679
675
 
680
676
  // No approval to call `swap` but should work even without it:
681
677
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
@@ -694,8 +690,7 @@ export const uniswapL1L2TestSuite = (
694
690
  ownerEthAddress,
695
691
  Fr.ZERO, // nonce for swap -> doesn't matter
696
692
  )
697
- .send({ from: ownerAddress })
698
- .wait();
693
+ .send({ from: ownerAddress });
699
694
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
700
695
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
701
696
  });
@@ -725,7 +720,7 @@ export const uniswapL1L2TestSuite = (
725
720
  { caller: approvedUser, action },
726
721
  true,
727
722
  );
728
- await validateActionInteraction.send().wait();
723
+ await validateActionInteraction.send();
729
724
 
730
725
  await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
731
726
  });
@@ -747,7 +742,7 @@ export const uniswapL1L2TestSuite = (
747
742
  },
748
743
  true,
749
744
  );
750
- await validateActionInteraction.send().wait();
745
+ await validateActionInteraction.send();
751
746
 
752
747
  await expect(
753
748
  uniswapL2Contract.methods
@@ -804,8 +799,7 @@ export const uniswapL1L2TestSuite = (
804
799
  secretHashForDepositingSwappedDai,
805
800
  ownerEthAddress,
806
801
  )
807
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
808
- .wait();
802
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
809
803
 
810
804
  const swapPrivateContent = sha256ToField([
811
805
  Buffer.from(
@@ -844,9 +838,8 @@ export const uniswapL1L2TestSuite = (
844
838
  chainId: new Fr(l1Client.chain.id),
845
839
  });
846
840
 
847
- const epoch = await rollup.getEpochNumberForCheckpoint(
848
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
849
- );
841
+ const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
842
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
850
843
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPrivateLeaf);
851
844
  const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
852
845
 
@@ -918,7 +911,7 @@ export const uniswapL1L2TestSuite = (
918
911
  },
919
912
  true,
920
913
  );
921
- await validateActionInteraction.send().wait();
914
+ await validateActionInteraction.send();
922
915
 
923
916
  // Call swap_public on L2
924
917
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -936,8 +929,7 @@ export const uniswapL1L2TestSuite = (
936
929
  ownerEthAddress,
937
930
  Fr.ZERO,
938
931
  )
939
- .send({ from: ownerAddress })
940
- .wait();
932
+ .send({ from: ownerAddress });
941
933
 
942
934
  const swapPublicContent = sha256ToField([
943
935
  Buffer.from(
@@ -979,9 +971,8 @@ export const uniswapL1L2TestSuite = (
979
971
  chainId: new Fr(l1Client.chain.id),
980
972
  });
981
973
 
982
- const epoch = await rollup.getEpochNumberForCheckpoint(
983
- CheckpointNumber.fromBlockNumber(withdrawReceipt.blockNumber!),
984
- );
974
+ const block = await aztecNode.getBlock(withdrawReceipt.blockNumber!);
975
+ const epoch = await rollup.getEpochNumberForCheckpoint(block!.checkpointNumber);
985
976
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, swapPublicLeaf);
986
977
  const withdrawResult = await computeL2ToL1MembershipWitness(aztecNode, epoch, withdrawLeaf);
987
978
 
@@ -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
 
@@ -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';
@@ -84,11 +85,11 @@ export async function deploySponsoredTestAccountsWithTokens(
84
85
 
85
86
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
86
87
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
87
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
88
+ await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: 2400 } });
88
89
  await Promise.all(
89
90
  fundedAccounts.map(async a => {
90
91
  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
92
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: 2400 } }); // increase timeout on purpose in order to account for two empty epochs
92
93
  logger.info(`Account deployed at ${a.address}`);
93
94
  }),
94
95
  );
@@ -116,6 +117,55 @@ export async function deploySponsoredTestAccountsWithTokens(
116
117
  };
117
118
  }
118
119
 
120
+ async function deployAccountWithDiagnostics(
121
+ account: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any },
122
+ paymentMethod: SponsoredFeePaymentMethod,
123
+ aztecNode: AztecNode,
124
+ logger: Logger,
125
+ accountLabel: string,
126
+ ): Promise<void> {
127
+ const deployMethod = await account.getDeployMethod();
128
+ let txHash;
129
+ try {
130
+ txHash = await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: NO_WAIT });
131
+ await waitForTx(aztecNode, txHash, { timeout: 2400 });
132
+ logger.info(`${accountLabel} deployed at ${account.address}`);
133
+ } catch (error) {
134
+ const blockNumber = await aztecNode.getBlockNumber();
135
+ let receipt;
136
+ try {
137
+ receipt = await aztecNode.getTxReceipt(txHash);
138
+ } catch {
139
+ receipt = 'unavailable';
140
+ }
141
+ logger.error(`${accountLabel} deployment failed`, {
142
+ txHash: txHash.toString(),
143
+ receipt: JSON.stringify(receipt),
144
+ currentBlockNumber: blockNumber,
145
+ error: String(error),
146
+ });
147
+ throw error;
148
+ }
149
+ }
150
+
151
+ async function deployAccountsInBatches(
152
+ accounts: { getDeployMethod: () => Promise<{ send: (opts: any) => any }>; address: any }[],
153
+ paymentMethod: SponsoredFeePaymentMethod,
154
+ aztecNode: AztecNode,
155
+ logger: Logger,
156
+ labelPrefix: string,
157
+ batchSize = 2,
158
+ ): Promise<void> {
159
+ for (let i = 0; i < accounts.length; i += batchSize) {
160
+ const batch = accounts.slice(i, i + batchSize);
161
+ await Promise.all(
162
+ batch.map((account, idx) =>
163
+ deployAccountWithDiagnostics(account, paymentMethod, aztecNode, logger, `${labelPrefix}${i + idx + 1}`),
164
+ ),
165
+ );
166
+ }
167
+ }
168
+
119
169
  export async function deploySponsoredTestAccounts(
120
170
  wallet: TestWallet,
121
171
  aztecNode: AztecNode,
@@ -129,15 +179,9 @@ export async function deploySponsoredTestAccounts(
129
179
  await registerSponsoredFPC(wallet);
130
180
 
131
181
  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
- );
182
+
183
+ await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
184
+ await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
141
185
 
142
186
  return {
143
187
  aztecNode,
@@ -175,7 +219,7 @@ export async function deployTestAccountsWithTokens(
175
219
  fundedAccounts.map(async (a, i) => {
176
220
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
177
221
  const deployMethod = await a.getDeployMethod();
178
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
222
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
179
223
  logger.info(`Account deployed at ${a.address}`);
180
224
  }),
181
225
  );
@@ -251,14 +295,19 @@ async function deployTokenAndMint(
251
295
  logger: Logger,
252
296
  ) {
253
297
  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 });
298
+ const { contract: tokenContract } = await TokenContract.deploy(
299
+ wallet,
300
+ admin,
301
+ TOKEN_NAME,
302
+ TOKEN_SYMBOL,
303
+ TOKEN_DECIMALS,
304
+ ).send({
305
+ from: admin,
306
+ fee: {
307
+ paymentMethod,
308
+ },
309
+ wait: { timeout: 600, returnReceipt: true },
310
+ });
262
311
 
263
312
  const tokenAddress = tokenContract.address;
264
313
 
@@ -268,8 +317,7 @@ async function deployTokenAndMint(
268
317
  accounts.map(acc =>
269
318
  TokenContract.at(tokenAddress, wallet)
270
319
  .methods.mint_to_public(acc, mintAmount)
271
- .send({ from: admin, fee: { paymentMethod } })
272
- .wait({ timeout: 600 }),
320
+ .send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
273
321
  ),
274
322
  );
275
323
 
@@ -309,7 +357,7 @@ export async function performTransfers({
309
357
 
310
358
  const provenTxs = await Promise.all(txs);
311
359
 
312
- await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
360
+ await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
313
361
 
314
362
  logger.info(`Completed round ${i + 1} / ${rounds}`);
315
363
  }
@@ -1,10 +1,137 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
- import type { L2BlockNew } from '@aztec/stdlib/block';
2
+ import type { Logger } from '@aztec/foundation/log';
3
+ import type { L2Block } from '@aztec/stdlib/block';
3
4
  import type { TopicType } from '@aztec/stdlib/p2p';
4
- import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
5
+ import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
5
6
 
6
7
  import { createHistogram } from 'perf_hooks';
7
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
+
8
135
  export type TxInclusionData = {
9
136
  txHash: string;
10
137
  sentAt: number;
@@ -20,16 +147,31 @@ export type TxInclusionData = {
20
147
  export class TxInclusionMetrics {
21
148
  private data = new Map<string, TxInclusionData>();
22
149
  private groups = new Set<string>();
23
- private blocks = new Map<number, Promise<L2BlockNew | undefined>>();
150
+ private blocks = new Map<number, Promise<L2Block | undefined>>();
24
151
 
25
152
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
26
153
 
27
- 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
+ ) {}
28
166
 
29
167
  recordSentTx(tx: Tx, group: string): void {
30
168
  const txHash = tx.getTxHash().toString();
31
169
  const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
32
170
 
171
+ if (this.data.has(txHash)) {
172
+ this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
173
+ }
174
+
33
175
  this.data.set(txHash, {
34
176
  txHash,
35
177
  sentAt: Math.trunc(Date.now() / 1000),
@@ -45,8 +187,13 @@ export class TxInclusionMetrics {
45
187
  }
46
188
 
47
189
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
48
- const { status, txHash, blockNumber } = txReceipt;
49
- 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
+ });
50
197
  return;
51
198
  }
52
199
 
@@ -56,9 +203,15 @@ export class TxInclusionMetrics {
56
203
 
57
204
  const block = await this.blocks.get(blockNumber)!;
58
205
  if (!block) {
206
+ this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
59
207
  return;
60
208
  }
61
- const data = this.data.get(txHash.toString())!;
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
+ }
62
215
  data.blocknumber = blockNumber;
63
216
  data.minedAt = Number(block.header.globalVariables.timestamp);
64
217
  data.attestedAt = -1;
@@ -111,6 +264,26 @@ export class TxInclusionMetrics {
111
264
  this.p2pGossipLatencyByTopic[topicName] = { p50, p95 };
112
265
  }
113
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
+
114
287
  toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
115
288
  const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
116
289
  for (const group of this.groups) {
@@ -148,6 +321,56 @@ export class TxInclusionMetrics {
148
321
  });
149
322
  }
150
323
 
151
- return data;
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}` }));
152
375
  }
153
376
  }