@aztec/end-to-end 0.0.1-commit.2ed92850 → 0.0.1-commit.3469e52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) 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 +13 -28
  4. package/dest/bench/utils.d.ts +4 -5
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +7 -9
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  8. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  9. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +8 -7
  10. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +0 -3
  13. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  14. package/dest/e2e_fees/fees_test.d.ts +1 -1
  15. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  16. package/dest/e2e_fees/fees_test.js +6 -6
  17. package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
  18. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  19. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  20. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  21. package/dest/e2e_nested_contract/nested_contract_test.js +2 -2
  22. package/dest/e2e_p2p/p2p_network.d.ts +1 -1
  23. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  24. package/dest/e2e_p2p/p2p_network.js +2 -6
  25. package/dest/e2e_p2p/shared.d.ts +6 -6
  26. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  27. package/dest/e2e_p2p/shared.js +14 -7
  28. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  29. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  30. package/dest/e2e_token_contract/token_contract_test.js +3 -3
  31. package/dest/fixtures/e2e_prover_test.d.ts +1 -1
  32. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  33. package/dest/fixtures/e2e_prover_test.js +4 -7
  34. package/dest/fixtures/setup.d.ts +1 -3
  35. package/dest/fixtures/setup.d.ts.map +1 -1
  36. package/dest/fixtures/setup.js +5 -11
  37. package/dest/fixtures/token_utils.d.ts +1 -1
  38. package/dest/fixtures/token_utils.d.ts.map +1 -1
  39. package/dest/fixtures/token_utils.js +4 -7
  40. package/dest/shared/cross_chain_test_harness.d.ts +4 -3
  41. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  42. package/dest/shared/cross_chain_test_harness.js +11 -11
  43. package/dest/shared/gas_portal_test_harness.js +1 -1
  44. package/dest/shared/submit-transactions.d.ts +3 -3
  45. package/dest/shared/submit-transactions.d.ts.map +1 -1
  46. package/dest/shared/submit-transactions.js +11 -9
  47. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  48. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  49. package/dest/shared/uniswap_l1_l2.js +12 -12
  50. package/dest/simulators/lending_simulator.js +2 -2
  51. package/dest/spartan/setup_test_wallets.d.ts +1 -1
  52. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  53. package/dest/spartan/setup_test_wallets.js +34 -61
  54. package/dest/spartan/tx_metrics.d.ts +2 -4
  55. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  56. package/dest/spartan/tx_metrics.js +4 -28
  57. package/dest/spartan/utils.d.ts +260 -2
  58. package/dest/spartan/utils.d.ts.map +1 -1
  59. package/dest/spartan/utils.js +942 -1
  60. package/package.json +39 -39
  61. package/src/bench/client_flows/client_flows_benchmark.ts +24 -11
  62. package/src/bench/utils.ts +7 -9
  63. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +12 -9
  64. package/src/e2e_epochs/epochs_test.ts +24 -29
  65. package/src/e2e_fees/bridging_race.notest.ts +4 -1
  66. package/src/e2e_fees/fees_test.ts +14 -10
  67. package/src/e2e_l1_publisher/write_json.ts +2 -2
  68. package/src/e2e_nested_contract/nested_contract_test.ts +4 -2
  69. package/src/e2e_p2p/p2p_network.ts +9 -15
  70. package/src/e2e_p2p/shared.ts +20 -10
  71. package/src/e2e_token_contract/token_contract_test.ts +5 -3
  72. package/src/fixtures/e2e_prover_test.ts +8 -3
  73. package/src/fixtures/setup.ts +13 -20
  74. package/src/fixtures/token_utils.ts +5 -6
  75. package/src/shared/cross_chain_test_harness.ts +27 -13
  76. package/src/shared/gas_portal_test_harness.ts +1 -1
  77. package/src/shared/submit-transactions.ts +15 -9
  78. package/src/shared/uniswap_l1_l2.ts +19 -12
  79. package/src/simulators/lending_simulator.ts +2 -2
  80. package/src/spartan/setup_test_wallets.ts +24 -72
  81. package/src/spartan/tx_metrics.ts +7 -26
  82. package/src/spartan/utils.ts +1246 -1
  83. package/dest/spartan/utils/bot.d.ts +0 -27
  84. package/dest/spartan/utils/bot.d.ts.map +0 -1
  85. package/dest/spartan/utils/bot.js +0 -141
  86. package/dest/spartan/utils/chaos.d.ts +0 -79
  87. package/dest/spartan/utils/chaos.d.ts.map +0 -1
  88. package/dest/spartan/utils/chaos.js +0 -142
  89. package/dest/spartan/utils/clients.d.ts +0 -39
  90. package/dest/spartan/utils/clients.d.ts.map +0 -1
  91. package/dest/spartan/utils/clients.js +0 -90
  92. package/dest/spartan/utils/config.d.ts +0 -36
  93. package/dest/spartan/utils/config.d.ts.map +0 -1
  94. package/dest/spartan/utils/config.js +0 -20
  95. package/dest/spartan/utils/health.d.ts +0 -63
  96. package/dest/spartan/utils/health.d.ts.map +0 -1
  97. package/dest/spartan/utils/health.js +0 -202
  98. package/dest/spartan/utils/helm.d.ts +0 -15
  99. package/dest/spartan/utils/helm.d.ts.map +0 -1
  100. package/dest/spartan/utils/helm.js +0 -47
  101. package/dest/spartan/utils/index.d.ts +0 -9
  102. package/dest/spartan/utils/index.d.ts.map +0 -1
  103. package/dest/spartan/utils/index.js +0 -18
  104. package/dest/spartan/utils/k8s.d.ts +0 -98
  105. package/dest/spartan/utils/k8s.d.ts.map +0 -1
  106. package/dest/spartan/utils/k8s.js +0 -257
  107. package/dest/spartan/utils/nodes.d.ts +0 -31
  108. package/dest/spartan/utils/nodes.d.ts.map +0 -1
  109. package/dest/spartan/utils/nodes.js +0 -290
  110. package/dest/spartan/utils/scripts.d.ts +0 -16
  111. package/dest/spartan/utils/scripts.d.ts.map +0 -1
  112. package/dest/spartan/utils/scripts.js +0 -66
  113. package/src/spartan/utils/bot.ts +0 -185
  114. package/src/spartan/utils/chaos.ts +0 -253
  115. package/src/spartan/utils/clients.ts +0 -100
  116. package/src/spartan/utils/config.ts +0 -26
  117. package/src/spartan/utils/health.ts +0 -255
  118. package/src/spartan/utils/helm.ts +0 -84
  119. package/src/spartan/utils/index.ts +0 -62
  120. package/src/spartan/utils/k8s.ts +0 -375
  121. package/src/spartan/utils/nodes.ts +0 -323
  122. package/src/spartan/utils/scripts.ts +0 -63
@@ -209,8 +209,6 @@ export type SetupOptions = {
209
209
  skipAccountDeployment?: boolean;
210
210
  /** L1 contracts deployment arguments. */
211
211
  l1ContractsArgs?: Partial<DeployAztecL1ContractsArgs>;
212
- /** Wallet minimum fee padding multiplier (defaults to 0.5, which is 50% padding). */
213
- walletMinFeePadding?: number;
214
212
  } & Partial<AztecNodeConfig>;
215
213
 
216
214
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -270,7 +268,7 @@ export type EndToEndContext = {
270
268
  */
271
269
  async function setupWithRemoteEnvironment(
272
270
  account: HDAccount | PrivateKeyAccount,
273
- config: AztecNodeConfig & SetupOptions,
271
+ config: AztecNodeConfig,
274
272
  logger: Logger,
275
273
  numberOfAccounts: number,
276
274
  ): Promise<EndToEndContext> {
@@ -291,11 +289,6 @@ async function setupWithRemoteEnvironment(
291
289
  };
292
290
  const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
293
291
  const wallet = await TestWallet.create(aztecNode);
294
-
295
- if (config.walletMinFeePadding !== undefined) {
296
- wallet.setMinFeePadding(config.walletMinFeePadding);
297
- }
298
-
299
292
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
300
293
  const teardown = () => Promise.resolve();
301
294
 
@@ -613,10 +606,6 @@ export async function setup(
613
606
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
614
607
  const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
615
608
 
616
- if (opts.walletMinFeePadding !== undefined) {
617
- wallet.setMinFeePadding(opts.walletMinFeePadding);
618
- }
619
-
620
609
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
621
610
 
622
611
  if (
@@ -640,7 +629,7 @@ export async function setup(
640
629
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
641
630
  );
642
631
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
643
- const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
632
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
644
633
  accounts = accountManagers.map(accountManager => accountManager.address);
645
634
  } else if (needsEmptyBlock) {
646
635
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
@@ -932,11 +921,13 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
932
921
  ).map(contractMetadata => contractMetadata.instance);
933
922
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
934
923
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
935
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
924
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
925
+ .send({ from: accountsToDeploy[0] })
926
+ .wait();
936
927
  }
937
928
  const requests = instances.map(instance => publishInstance(wallet, instance!));
938
929
  const batch = new BatchCall(wallet, requests);
939
- await batch.send({ from: accountsToDeploy[0] });
930
+ await batch.send({ from: accountsToDeploy[0] }).wait();
940
931
  }
941
932
 
942
933
  /**
@@ -960,10 +951,12 @@ export const deployAccounts =
960
951
  deployedAccounts[i].signingKey,
961
952
  );
962
953
  const deployMethod = await accountManager.getDeployMethod();
963
- await deployMethod.send({
964
- from: AztecAddress.ZERO,
965
- skipClassPublication: i !== 0, // Publish the contract class at most once.
966
- });
954
+ await deployMethod
955
+ .send({
956
+ from: AztecAddress.ZERO,
957
+ skipClassPublication: i !== 0, // Publish the contract class at most once.
958
+ })
959
+ .wait();
967
960
  }
968
961
 
969
962
  return { deployedAccounts };
@@ -993,7 +986,7 @@ export async function publicDeployAccounts(
993
986
 
994
987
  const batch = new BatchCall(wallet, calls);
995
988
 
996
- const txReceipt = await batch.send({ from: accountsToDeploy[0] });
989
+ const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
997
990
  if (waitUntilProven) {
998
991
  if (!node) {
999
992
  throw new Error('Need to provide an AztecNode to wait for proven.');
@@ -6,10 +6,9 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
6
6
 
7
7
  export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
8
8
  logger.info(`Deploying Token contract...`);
9
- const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
10
- from: admin,
11
- wait: { returnReceipt: true },
12
- });
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
10
+ .send({ from: admin })
11
+ .wait();
13
12
 
14
13
  if (initialAdminBalance > 0n) {
15
14
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -26,7 +25,7 @@ export async function mintTokensToPrivate(
26
25
  recipient: AztecAddress,
27
26
  amount: bigint,
28
27
  ) {
29
- await token.methods.mint_to_private(recipient, amount).send({ from: minter });
28
+ await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
30
29
  }
31
30
 
32
31
  export async function expectTokenBalance(
@@ -56,7 +55,7 @@ export async function mintNotes(
56
55
  for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
57
56
  const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
58
57
  const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
59
- await new BatchCall(wallet, actions).send({ from: minter });
58
+ await new BatchCall(wallet, actions).send({ from: minter }).wait();
60
59
  }
61
60
 
62
61
  return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
@@ -18,6 +18,7 @@ import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses'
18
18
  import type { ExtendedViemWalletClient } from '@aztec/ethereum/types';
19
19
  import { EpochNumber } from '@aztec/foundation/branded-types';
20
20
  import { retryUntil } from '@aztec/foundation/retry';
21
+ import type { FieldsOf } from '@aztec/foundation/types';
21
22
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
22
23
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
23
24
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
@@ -73,10 +74,14 @@ export async function deployAndInitializeTokenAndBridgeContracts(
73
74
  });
74
75
 
75
76
  // deploy l2 token
76
- const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({ from: owner });
77
+ const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
78
+ .send({ from: owner })
79
+ .deployed();
77
80
 
78
81
  // deploy l2 token bridge and attach to the portal
79
- const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({ from: owner });
82
+ const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
83
+ .send({ from: owner })
84
+ .deployed();
80
85
 
81
86
  if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
82
87
  throw new Error(`Token admin is not ${owner}`);
@@ -87,7 +92,7 @@ export async function deployAndInitializeTokenAndBridgeContracts(
87
92
  }
88
93
 
89
94
  // make the bridge a minter on the token:
90
- await token.methods.set_minter(bridge.address, true).send({ from: owner });
95
+ await token.methods.set_minter(bridge.address, true).send({ from: owner }).wait();
91
96
  if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
92
97
  throw new Error(`Bridge is not a minter`);
93
98
  }
@@ -230,7 +235,7 @@ export class CrossChainTestHarness {
230
235
 
231
236
  async mintTokensPublicOnL2(amount: bigint) {
232
237
  this.logger.info('Minting tokens on L2 publicly');
233
- await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress });
238
+ await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress }).wait();
234
239
  }
235
240
 
236
241
  async mintTokensPrivateOnL2(amount: bigint) {
@@ -241,7 +246,8 @@ export class CrossChainTestHarness {
241
246
  // send a transfer tx to force through rollup with the message included
242
247
  await this.l2Token.methods
243
248
  .transfer_in_public(this.ownerAddress, receiverAddress, transferAmount, 0)
244
- .send({ from: this.ownerAddress });
249
+ .send({ from: this.ownerAddress })
250
+ .wait();
245
251
  }
246
252
 
247
253
  async consumeMessageOnAztecAndMintPrivately(
@@ -251,7 +257,8 @@ export class CrossChainTestHarness {
251
257
  const { recipient, claimAmount, claimSecret: secretForL2MessageConsumption, messageLeafIndex } = claim;
252
258
  await this.l2Bridge.methods
253
259
  .claim_private(recipient, claimAmount, secretForL2MessageConsumption, messageLeafIndex)
254
- .send({ from: this.ownerAddress });
260
+ .send({ from: this.ownerAddress })
261
+ .wait();
255
262
  }
256
263
 
257
264
  async consumeMessageOnAztecAndMintPublicly(
@@ -261,25 +268,28 @@ export class CrossChainTestHarness {
261
268
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
262
269
  await this.l2Bridge.methods
263
270
  .claim_public(this.ownerAddress, claimAmount, claimSecret, messageLeafIndex)
264
- .send({ from: this.ownerAddress });
271
+ .send({ from: this.ownerAddress })
272
+ .wait();
265
273
  }
266
274
 
267
275
  async withdrawPrivateFromAztecToL1(
268
276
  withdrawAmount: bigint,
269
277
  authwitNonce: Fr = Fr.ZERO,
270
278
  authWitness: AuthWitness,
271
- ): Promise<TxReceipt> {
279
+ ): Promise<FieldsOf<TxReceipt>> {
272
280
  const withdrawReceipt = await this.l2Bridge.methods
273
281
  .exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
274
- .send({ authWitnesses: [authWitness], from: this.ownerAddress });
282
+ .send({ authWitnesses: [authWitness], from: this.ownerAddress })
283
+ .wait();
275
284
 
276
285
  return withdrawReceipt;
277
286
  }
278
287
 
279
- async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
288
+ async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<FieldsOf<TxReceipt>> {
280
289
  const withdrawReceipt = await this.l2Bridge.methods
281
290
  .exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
282
- .send({ from: this.ownerAddress });
291
+ .send({ from: this.ownerAddress })
292
+ .wait();
283
293
 
284
294
  return withdrawReceipt;
285
295
  }
@@ -323,14 +333,18 @@ export class CrossChainTestHarness {
323
333
 
324
334
  async transferToPrivateOnL2(shieldAmount: bigint) {
325
335
  this.logger.info('Transferring to private on L2');
326
- await this.l2Token.methods.transfer_to_private(this.ownerAddress, shieldAmount).send({ from: this.ownerAddress });
336
+ await this.l2Token.methods
337
+ .transfer_to_private(this.ownerAddress, shieldAmount)
338
+ .send({ from: this.ownerAddress })
339
+ .wait();
327
340
  }
328
341
 
329
342
  async transferToPublicOnL2(amount: bigint, authwitNonce = Fr.ZERO) {
330
343
  this.logger.info('Transferring tokens to public');
331
344
  await this.l2Token.methods
332
345
  .transfer_to_public(this.ownerAddress, this.ownerAddress, amount, authwitNonce)
333
- .send({ from: this.ownerAddress });
346
+ .send({ from: this.ownerAddress })
347
+ .wait();
334
348
  }
335
349
 
336
350
  /**
@@ -127,7 +127,7 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
127
127
  async consumeMessageOnAztecAndClaimPrivately(owner: AztecAddress, claimer: AztecAddress, claim: L2AmountClaim) {
128
128
  this.logger.info('Consuming messages on L2 Privately');
129
129
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
130
- await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer });
130
+ await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer }).wait();
131
131
  }
132
132
 
133
133
  async getL2PublicBalanceOf(owner: AztecAddress) {
@@ -1,8 +1,8 @@
1
1
  import { AztecAddress } from '@aztec/aztec.js/addresses';
2
- import { NO_WAIT } from '@aztec/aztec.js/contracts';
2
+ import type { SentTx } 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 { TxHash, type TxReceipt, TxStatus } from '@aztec/aztec.js/tx';
5
+ import { 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,20 +12,26 @@ export const submitTxsTo = async (
12
12
  submitter: AztecAddress,
13
13
  numTxs: number,
14
14
  logger: Logger,
15
- ): Promise<TxHash[]> => {
16
- const txHashes: TxHash[] = [];
15
+ ): Promise<SentTx[]> => {
16
+ const txs: SentTx[] = [];
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 txHash = await deployMethod.send({ from: submitter, wait: NO_WAIT });
21
+ const tx = deployMethod.send({ from: submitter });
22
+ const txHash = await tx.getTxHash();
22
23
 
23
24
  logger.info(`Tx sent with hash ${txHash}`);
24
- const receipt: TxReceipt = await wallet.getTxReceipt(txHash);
25
- expect(receipt.status).toBe(TxStatus.PENDING);
25
+ const receipt = await tx.getReceipt();
26
+ expect(receipt).toEqual(
27
+ expect.objectContaining({
28
+ status: TxStatus.PENDING,
29
+ error: '',
30
+ }),
31
+ );
26
32
  logger.info(`Receipt received for ${txHash}`);
27
- txHashes.push(txHash);
33
+ txs.push(tx);
28
34
  }),
29
35
  );
30
- return txHashes;
36
+ return txs;
31
37
  };
@@ -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
+ uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress)
134
+ .send({ from: ownerAddress })
135
+ .deployed();
134
136
 
135
137
  const registryAddress = (await aztecNode.getNodeInfo()).l1ContractAddresses.registryAddress;
136
138
 
@@ -207,7 +209,8 @@ export const uniswapL1L2TestSuite = (
207
209
  secretHashForDepositingSwappedDai,
208
210
  ownerEthAddress,
209
211
  )
210
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
212
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
213
+ .wait();
211
214
 
212
215
  const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
213
216
  const swapPrivateContent = sha256ToField([
@@ -425,10 +428,10 @@ export const uniswapL1L2TestSuite = (
425
428
  // ownerEthAddress,
426
429
  // nonceForSwap,
427
430
  // );
428
- // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send();
431
+ // await ownerWallet.setPublicAuthWit({ caller: sponsorAddress, action }, true).send().wait();
429
432
 
430
433
  // // 4.2 Call swap_public from user2 on behalf of owner
431
- // const uniswapL2Interaction = await action.send();
434
+ // const uniswapL2Interaction = await action.send().wait();
432
435
 
433
436
  // const swapPublicContent = sha256ToField([
434
437
  // Buffer.from(
@@ -646,7 +649,8 @@ export const uniswapL1L2TestSuite = (
646
649
  Fr.random(),
647
650
  ownerEthAddress,
648
651
  )
649
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] }),
652
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] })
653
+ .wait(),
650
654
  ).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
651
655
  });
652
656
 
@@ -671,7 +675,7 @@ export const uniswapL1L2TestSuite = (
671
675
  },
672
676
  true,
673
677
  );
674
- await validateActionInteraction.send();
678
+ await validateActionInteraction.send().wait();
675
679
 
676
680
  // No approval to call `swap` but should work even without it:
677
681
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
@@ -690,7 +694,8 @@ export const uniswapL1L2TestSuite = (
690
694
  ownerEthAddress,
691
695
  Fr.ZERO, // nonce for swap -> doesn't matter
692
696
  )
693
- .send({ from: ownerAddress });
697
+ .send({ from: ownerAddress })
698
+ .wait();
694
699
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
695
700
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
696
701
  });
@@ -720,7 +725,7 @@ export const uniswapL1L2TestSuite = (
720
725
  { caller: approvedUser, action },
721
726
  true,
722
727
  );
723
- await validateActionInteraction.send();
728
+ await validateActionInteraction.send().wait();
724
729
 
725
730
  await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
726
731
  });
@@ -742,7 +747,7 @@ export const uniswapL1L2TestSuite = (
742
747
  },
743
748
  true,
744
749
  );
745
- await validateActionInteraction.send();
750
+ await validateActionInteraction.send().wait();
746
751
 
747
752
  await expect(
748
753
  uniswapL2Contract.methods
@@ -799,7 +804,8 @@ export const uniswapL1L2TestSuite = (
799
804
  secretHashForDepositingSwappedDai,
800
805
  ownerEthAddress,
801
806
  )
802
- .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] });
807
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
808
+ .wait();
803
809
 
804
810
  const swapPrivateContent = sha256ToField([
805
811
  Buffer.from(
@@ -912,7 +918,7 @@ export const uniswapL1L2TestSuite = (
912
918
  },
913
919
  true,
914
920
  );
915
- await validateActionInteraction.send();
921
+ await validateActionInteraction.send().wait();
916
922
 
917
923
  // Call swap_public on L2
918
924
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -930,7 +936,8 @@ export const uniswapL1L2TestSuite = (
930
936
  ownerEthAddress,
931
937
  Fr.ZERO,
932
938
  )
933
- .send({ from: ownerAddress });
939
+ .send({ from: ownerAddress })
940
+ .wait();
934
941
 
935
942
  const swapPublicContent = sha256ToField([
936
943
  Buffer.from(
@@ -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 { poseidon2Hash } from '@aztec/foundation/crypto/poseidon';
7
+ import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
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 poseidon2Hash([this.address, this.secret]);
32
+ return pedersenHash([this.address, this.secret]);
33
33
  }
34
34
  }
35
35
 
@@ -1,11 +1,10 @@
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';
4
3
  import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
5
4
  import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
6
5
  import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
7
6
  import { Fr } from '@aztec/aztec.js/fields';
8
- import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
7
+ import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
9
8
  import type { Wallet } from '@aztec/aztec.js/wallet';
10
9
  import { createEthereumChain } from '@aztec/ethereum/chain';
11
10
  import { createExtendedL1Client } from '@aztec/ethereum/client';
@@ -85,11 +84,11 @@ export async function deploySponsoredTestAccountsWithTokens(
85
84
 
86
85
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
87
86
  const recipientDeployMethod = await recipientAccount.getDeployMethod();
88
- await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod }, wait: { timeout: 2400 } });
87
+ await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
89
88
  await Promise.all(
90
89
  fundedAccounts.map(async a => {
91
90
  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
91
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
93
92
  logger.info(`Account deployed at ${a.address}`);
94
93
  }),
95
94
  );
@@ -117,55 +116,6 @@ export async function deploySponsoredTestAccountsWithTokens(
117
116
  };
118
117
  }
119
118
 
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
-
169
119
  export async function deploySponsoredTestAccounts(
170
120
  wallet: TestWallet,
171
121
  aztecNode: AztecNode,
@@ -179,9 +129,15 @@ export async function deploySponsoredTestAccounts(
179
129
  await registerSponsoredFPC(wallet);
180
130
 
181
131
  const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
182
-
183
- await deployAccountWithDiagnostics(recipientAccount, paymentMethod, aztecNode, logger, 'Recipient account');
184
- await deployAccountsInBatches(fundedAccounts, paymentMethod, aztecNode, logger, 'Funded account ', 2);
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
+ );
185
141
 
186
142
  return {
187
143
  aztecNode,
@@ -219,7 +175,7 @@ export async function deployTestAccountsWithTokens(
219
175
  fundedAccounts.map(async (a, i) => {
220
176
  const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
221
177
  const deployMethod = await a.getDeployMethod();
222
- await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
178
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
223
179
  logger.info(`Account deployed at ${a.address}`);
224
180
  }),
225
181
  );
@@ -295,19 +251,14 @@ async function deployTokenAndMint(
295
251
  logger: Logger,
296
252
  ) {
297
253
  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({
305
- from: admin,
306
- fee: {
307
- paymentMethod,
308
- },
309
- wait: { timeout: 600, returnReceipt: true },
310
- });
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 });
311
262
 
312
263
  const tokenAddress = tokenContract.address;
313
264
 
@@ -317,7 +268,8 @@ async function deployTokenAndMint(
317
268
  accounts.map(acc =>
318
269
  TokenContract.at(tokenAddress, wallet)
319
270
  .methods.mint_to_public(acc, mintAmount)
320
- .send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
271
+ .send({ from: admin, fee: { paymentMethod } })
272
+ .wait({ timeout: 600 }),
321
273
  ),
322
274
  );
323
275
 
@@ -357,7 +309,7 @@ export async function performTransfers({
357
309
 
358
310
  const provenTxs = await Promise.all(txs);
359
311
 
360
- await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
312
+ await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
361
313
 
362
314
  logger.info(`Completed round ${i + 1} / ${rounds}`);
363
315
  }
@@ -1,8 +1,7 @@
1
1
  import type { AztecNode } from '@aztec/aztec.js/node';
2
- import type { Logger } from '@aztec/foundation/log';
3
- import type { L2Block } from '@aztec/stdlib/block';
2
+ import type { L2BlockNew } from '@aztec/stdlib/block';
4
3
  import type { TopicType } from '@aztec/stdlib/p2p';
5
- import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
4
+ import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
6
5
 
7
6
  import { createHistogram } from 'perf_hooks';
8
7
 
@@ -21,7 +20,7 @@ export type TxInclusionData = {
21
20
  export class TxInclusionMetrics {
22
21
  private data = new Map<string, TxInclusionData>();
23
22
  private groups = new Set<string>();
24
- private blocks = new Map<number, Promise<L2Block | undefined>>();
23
+ private blocks = new Map<number, Promise<L2BlockNew | undefined>>();
25
24
 
26
25
  private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
27
26
 
@@ -33,19 +32,12 @@ export class TxInclusionMetrics {
33
32
  | { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
34
33
  | undefined;
35
34
 
36
- constructor(
37
- private aztecNode: AztecNode,
38
- private logger?: Logger,
39
- ) {}
35
+ constructor(private aztecNode: AztecNode) {}
40
36
 
41
37
  recordSentTx(tx: Tx, group: string): void {
42
38
  const txHash = tx.getTxHash().toString();
43
39
  const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
44
40
 
45
- if (this.data.has(txHash)) {
46
- this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
47
- }
48
-
49
41
  this.data.set(txHash, {
50
42
  txHash,
51
43
  sentAt: Math.trunc(Date.now() / 1000),
@@ -61,13 +53,8 @@ export class TxInclusionMetrics {
61
53
  }
62
54
 
63
55
  async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
64
- const { txHash, blockNumber } = txReceipt;
65
- if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
66
- this.logger?.debug('Skipping mined tx record due to receipt status', {
67
- txHash: txHash.toString(),
68
- status: txReceipt.status,
69
- blockNumber,
70
- });
56
+ const { status, txHash, blockNumber } = txReceipt;
57
+ if (status !== TxStatus.SUCCESS || !blockNumber) {
71
58
  return;
72
59
  }
73
60
 
@@ -77,15 +64,9 @@ export class TxInclusionMetrics {
77
64
 
78
65
  const block = await this.blocks.get(blockNumber)!;
79
66
  if (!block) {
80
- this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
81
67
  return;
82
68
  }
83
- const data = this.data.get(txHash.toString());
84
- if (!data) {
85
- const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
86
- this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
87
- throw new Error(message);
88
- }
69
+ const data = this.data.get(txHash.toString())!;
89
70
  data.blocknumber = blockNumber;
90
71
  data.minedAt = Number(block.header.globalVariables.timestamp);
91
72
  data.attestedAt = -1;