@aztec/end-to-end 0.0.1-commit.3469e52 → 0.0.1-commit.59e663cd

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 +28 -13
  4. package/dest/bench/utils.d.ts +5 -4
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +9 -7
  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 +7 -8
  10. package/dest/e2e_epochs/epochs_test.d.ts +6 -1
  11. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  12. package/dest/e2e_epochs/epochs_test.js +17 -0
  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 +6 -2
  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 +7 -14
  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 +7 -4
  34. package/dest/fixtures/setup.d.ts +3 -1
  35. package/dest/fixtures/setup.d.ts.map +1 -1
  36. package/dest/fixtures/setup.js +12 -6
  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 +7 -4
  40. package/dest/shared/cross_chain_test_harness.d.ts +3 -4
  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 +9 -11
  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 +61 -34
  54. package/dest/spartan/tx_metrics.d.ts +4 -2
  55. package/dest/spartan/tx_metrics.d.ts.map +1 -1
  56. package/dest/spartan/tx_metrics.js +28 -4
  57. package/dest/spartan/utils/bot.d.ts +27 -0
  58. package/dest/spartan/utils/bot.d.ts.map +1 -0
  59. package/dest/spartan/utils/bot.js +141 -0
  60. package/dest/spartan/utils/chaos.d.ts +79 -0
  61. package/dest/spartan/utils/chaos.d.ts.map +1 -0
  62. package/dest/spartan/utils/chaos.js +142 -0
  63. package/dest/spartan/utils/clients.d.ts +39 -0
  64. package/dest/spartan/utils/clients.d.ts.map +1 -0
  65. package/dest/spartan/utils/clients.js +90 -0
  66. package/dest/spartan/utils/config.d.ts +36 -0
  67. package/dest/spartan/utils/config.d.ts.map +1 -0
  68. package/dest/spartan/utils/config.js +20 -0
  69. package/dest/spartan/utils/health.d.ts +63 -0
  70. package/dest/spartan/utils/health.d.ts.map +1 -0
  71. package/dest/spartan/utils/health.js +202 -0
  72. package/dest/spartan/utils/helm.d.ts +15 -0
  73. package/dest/spartan/utils/helm.d.ts.map +1 -0
  74. package/dest/spartan/utils/helm.js +47 -0
  75. package/dest/spartan/utils/index.d.ts +9 -0
  76. package/dest/spartan/utils/index.d.ts.map +1 -0
  77. package/dest/spartan/utils/index.js +18 -0
  78. package/dest/spartan/utils/k8s.d.ts +98 -0
  79. package/dest/spartan/utils/k8s.d.ts.map +1 -0
  80. package/dest/spartan/utils/k8s.js +257 -0
  81. package/dest/spartan/utils/nodes.d.ts +31 -0
  82. package/dest/spartan/utils/nodes.d.ts.map +1 -0
  83. package/dest/spartan/utils/nodes.js +290 -0
  84. package/dest/spartan/utils/scripts.d.ts +16 -0
  85. package/dest/spartan/utils/scripts.d.ts.map +1 -0
  86. package/dest/spartan/utils/scripts.js +66 -0
  87. package/dest/spartan/utils.d.ts +2 -260
  88. package/dest/spartan/utils.d.ts.map +1 -1
  89. package/dest/spartan/utils.js +1 -942
  90. package/package.json +39 -39
  91. package/src/bench/client_flows/client_flows_benchmark.ts +11 -24
  92. package/src/bench/utils.ts +9 -7
  93. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +9 -12
  94. package/src/e2e_epochs/epochs_test.ts +46 -25
  95. package/src/e2e_fees/bridging_race.notest.ts +1 -4
  96. package/src/e2e_fees/fees_test.ts +10 -14
  97. package/src/e2e_l1_publisher/write_json.ts +2 -2
  98. package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
  99. package/src/e2e_p2p/p2p_network.ts +15 -9
  100. package/src/e2e_p2p/shared.ts +10 -20
  101. package/src/e2e_token_contract/token_contract_test.ts +3 -5
  102. package/src/fixtures/e2e_prover_test.ts +3 -8
  103. package/src/fixtures/setup.ts +21 -14
  104. package/src/fixtures/token_utils.ts +6 -5
  105. package/src/shared/cross_chain_test_harness.ts +13 -27
  106. package/src/shared/gas_portal_test_harness.ts +1 -1
  107. package/src/shared/submit-transactions.ts +9 -15
  108. package/src/shared/uniswap_l1_l2.ts +12 -19
  109. package/src/simulators/lending_simulator.ts +2 -2
  110. package/src/spartan/setup_test_wallets.ts +72 -24
  111. package/src/spartan/tx_metrics.ts +26 -7
  112. package/src/spartan/utils/bot.ts +185 -0
  113. package/src/spartan/utils/chaos.ts +253 -0
  114. package/src/spartan/utils/clients.ts +100 -0
  115. package/src/spartan/utils/config.ts +26 -0
  116. package/src/spartan/utils/health.ts +255 -0
  117. package/src/spartan/utils/helm.ts +84 -0
  118. package/src/spartan/utils/index.ts +62 -0
  119. package/src/spartan/utils/k8s.ts +375 -0
  120. package/src/spartan/utils/nodes.ts +323 -0
  121. package/src/spartan/utils/scripts.ts +63 -0
  122. package/src/spartan/utils.ts +1 -1246
@@ -114,9 +114,7 @@ export class FullProverTest {
114
114
  FullProverTest.TOKEN_NAME,
115
115
  FullProverTest.TOKEN_SYMBOL,
116
116
  FullProverTest.TOKEN_DECIMALS,
117
- )
118
- .send({ from: this.accounts[0] })
119
- .wait();
117
+ ).send({ from: this.accounts[0], wait: { returnReceipt: true } });
120
118
  this.logger.verbose(`Token deployed to ${asset.address}`);
121
119
 
122
120
  this.fakeProofsAsset = asset;
@@ -308,13 +306,10 @@ export class FullProverTest {
308
306
  const publicAmount = 10000n;
309
307
 
310
308
  this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
311
- await asset.methods
312
- .mint_to_public(accounts[0], privateAmount + publicAmount)
313
- .send({ from: accounts[0] })
314
- .wait();
309
+ await asset.methods.mint_to_public(accounts[0], privateAmount + publicAmount).send({ from: accounts[0] });
315
310
 
316
311
  this.logger.verbose(`Transferring ${privateAmount} to private...`);
317
- await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
312
+ await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] });
318
313
 
319
314
  this.logger.info(`Minting complete`);
320
315
 
@@ -209,6 +209,8 @@ 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;
212
214
  } & Partial<AztecNodeConfig>;
213
215
 
214
216
  /** Context for an end-to-end test as returned by the `setup` function */
@@ -268,7 +270,7 @@ export type EndToEndContext = {
268
270
  */
269
271
  async function setupWithRemoteEnvironment(
270
272
  account: HDAccount | PrivateKeyAccount,
271
- config: AztecNodeConfig,
273
+ config: AztecNodeConfig & SetupOptions,
272
274
  logger: Logger,
273
275
  numberOfAccounts: number,
274
276
  ): Promise<EndToEndContext> {
@@ -289,6 +291,11 @@ async function setupWithRemoteEnvironment(
289
291
  };
290
292
  const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
291
293
  const wallet = await TestWallet.create(aztecNode);
294
+
295
+ if (config.walletMinFeePadding !== undefined) {
296
+ wallet.setMinFeePadding(config.walletMinFeePadding);
297
+ }
298
+
292
299
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
293
300
  const teardown = () => Promise.resolve();
294
301
 
@@ -385,7 +392,7 @@ export async function setup(
385
392
  const res = await startAnvil({
386
393
  l1BlockTime: opts.ethereumSlotDuration,
387
394
  accounts: opts.anvilAccounts,
388
- port: opts.anvilPort,
395
+ port: opts.anvilPort ?? (process.env.ANVIL_PORT ? parseInt(process.env.ANVIL_PORT) : undefined),
389
396
  });
390
397
  anvil = res.anvil;
391
398
  config.l1RpcUrls = [res.rpcUrl];
@@ -606,6 +613,10 @@ export async function setup(
606
613
  pxeConfig.proverEnabled = !!pxeOpts.proverEnabled;
607
614
  const wallet = await TestWallet.create(aztecNodeService, pxeConfig);
608
615
 
616
+ if (opts.walletMinFeePadding !== undefined) {
617
+ wallet.setMinFeePadding(opts.walletMinFeePadding);
618
+ }
619
+
609
620
  const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNodeService, dateProvider);
610
621
 
611
622
  if (
@@ -629,7 +640,7 @@ export async function setup(
629
640
  `${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
630
641
  );
631
642
  const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
632
- const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNodeService, accountsData);
643
+ const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
633
644
  accounts = accountManagers.map(accountManager => accountManager.address);
634
645
  } else if (needsEmptyBlock) {
635
646
  logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
@@ -921,13 +932,11 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
921
932
  ).map(contractMetadata => contractMetadata.instance);
922
933
  const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
923
934
  if (!(await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered) {
924
- await (await publishContractClass(wallet, SchnorrAccountContractArtifact))
925
- .send({ from: accountsToDeploy[0] })
926
- .wait();
935
+ await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({ from: accountsToDeploy[0] });
927
936
  }
928
937
  const requests = instances.map(instance => publishInstance(wallet, instance!));
929
938
  const batch = new BatchCall(wallet, requests);
930
- await batch.send({ from: accountsToDeploy[0] }).wait();
939
+ await batch.send({ from: accountsToDeploy[0] });
931
940
  }
932
941
 
933
942
  /**
@@ -951,12 +960,10 @@ export const deployAccounts =
951
960
  deployedAccounts[i].signingKey,
952
961
  );
953
962
  const deployMethod = await accountManager.getDeployMethod();
954
- await deployMethod
955
- .send({
956
- from: AztecAddress.ZERO,
957
- skipClassPublication: i !== 0, // Publish the contract class at most once.
958
- })
959
- .wait();
963
+ await deployMethod.send({
964
+ from: AztecAddress.ZERO,
965
+ skipClassPublication: i !== 0, // Publish the contract class at most once.
966
+ });
960
967
  }
961
968
 
962
969
  return { deployedAccounts };
@@ -986,7 +993,7 @@ export async function publicDeployAccounts(
986
993
 
987
994
  const batch = new BatchCall(wallet, calls);
988
995
 
989
- const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
996
+ const txReceipt = await batch.send({ from: accountsToDeploy[0] });
990
997
  if (waitUntilProven) {
991
998
  if (!node) {
992
999
  throw new Error('Need to provide an AztecNode to wait for proven.');
@@ -6,9 +6,10 @@ 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)
10
- .send({ from: admin })
11
- .wait();
9
+ const { contract, instance } = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18).send({
10
+ from: admin,
11
+ wait: { returnReceipt: true },
12
+ });
12
13
 
13
14
  if (initialAdminBalance > 0n) {
14
15
  await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
@@ -25,7 +26,7 @@ export async function mintTokensToPrivate(
25
26
  recipient: AztecAddress,
26
27
  amount: bigint,
27
28
  ) {
28
- await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
29
+ await token.methods.mint_to_private(recipient, amount).send({ from: minter });
29
30
  }
30
31
 
31
32
  export async function expectTokenBalance(
@@ -55,7 +56,7 @@ export async function mintNotes(
55
56
  for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
56
57
  const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
57
58
  const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
58
- await new BatchCall(wallet, actions).send({ from: minter }).wait();
59
+ await new BatchCall(wallet, actions).send({ from: minter });
59
60
  }
60
61
 
61
62
  return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
@@ -18,7 +18,6 @@ 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';
22
21
  import { TestERC20Abi, TokenPortalAbi, TokenPortalBytecode } from '@aztec/l1-artifacts';
23
22
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
24
23
  import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
@@ -74,14 +73,10 @@ export async function deployAndInitializeTokenAndBridgeContracts(
74
73
  });
75
74
 
76
75
  // deploy l2 token
77
- const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18)
78
- .send({ from: owner })
79
- .deployed();
76
+ const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send({ from: owner });
80
77
 
81
78
  // deploy l2 token bridge and attach to the portal
82
- const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress)
83
- .send({ from: owner })
84
- .deployed();
79
+ const bridge = await TokenBridgeContract.deploy(wallet, token.address, tokenPortalAddress).send({ from: owner });
85
80
 
86
81
  if ((await token.methods.get_admin().simulate({ from: owner })) !== owner.toBigInt()) {
87
82
  throw new Error(`Token admin is not ${owner}`);
@@ -92,7 +87,7 @@ export async function deployAndInitializeTokenAndBridgeContracts(
92
87
  }
93
88
 
94
89
  // make the bridge a minter on the token:
95
- await token.methods.set_minter(bridge.address, true).send({ from: owner }).wait();
90
+ await token.methods.set_minter(bridge.address, true).send({ from: owner });
96
91
  if ((await token.methods.is_minter(bridge.address).simulate({ from: owner })) === 1n) {
97
92
  throw new Error(`Bridge is not a minter`);
98
93
  }
@@ -235,7 +230,7 @@ export class CrossChainTestHarness {
235
230
 
236
231
  async mintTokensPublicOnL2(amount: bigint) {
237
232
  this.logger.info('Minting tokens on L2 publicly');
238
- await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress }).wait();
233
+ await this.l2Token.methods.mint_to_public(this.ownerAddress, amount).send({ from: this.ownerAddress });
239
234
  }
240
235
 
241
236
  async mintTokensPrivateOnL2(amount: bigint) {
@@ -246,8 +241,7 @@ export class CrossChainTestHarness {
246
241
  // send a transfer tx to force through rollup with the message included
247
242
  await this.l2Token.methods
248
243
  .transfer_in_public(this.ownerAddress, receiverAddress, transferAmount, 0)
249
- .send({ from: this.ownerAddress })
250
- .wait();
244
+ .send({ from: this.ownerAddress });
251
245
  }
252
246
 
253
247
  async consumeMessageOnAztecAndMintPrivately(
@@ -257,8 +251,7 @@ export class CrossChainTestHarness {
257
251
  const { recipient, claimAmount, claimSecret: secretForL2MessageConsumption, messageLeafIndex } = claim;
258
252
  await this.l2Bridge.methods
259
253
  .claim_private(recipient, claimAmount, secretForL2MessageConsumption, messageLeafIndex)
260
- .send({ from: this.ownerAddress })
261
- .wait();
254
+ .send({ from: this.ownerAddress });
262
255
  }
263
256
 
264
257
  async consumeMessageOnAztecAndMintPublicly(
@@ -268,28 +261,25 @@ export class CrossChainTestHarness {
268
261
  const { claimAmount, claimSecret, messageLeafIndex } = claim;
269
262
  await this.l2Bridge.methods
270
263
  .claim_public(this.ownerAddress, claimAmount, claimSecret, messageLeafIndex)
271
- .send({ from: this.ownerAddress })
272
- .wait();
264
+ .send({ from: this.ownerAddress });
273
265
  }
274
266
 
275
267
  async withdrawPrivateFromAztecToL1(
276
268
  withdrawAmount: bigint,
277
269
  authwitNonce: Fr = Fr.ZERO,
278
270
  authWitness: AuthWitness,
279
- ): Promise<FieldsOf<TxReceipt>> {
271
+ ): Promise<TxReceipt> {
280
272
  const withdrawReceipt = await this.l2Bridge.methods
281
273
  .exit_to_l1_private(this.l2Token.address, this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
282
- .send({ authWitnesses: [authWitness], from: this.ownerAddress })
283
- .wait();
274
+ .send({ authWitnesses: [authWitness], from: this.ownerAddress });
284
275
 
285
276
  return withdrawReceipt;
286
277
  }
287
278
 
288
- async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<FieldsOf<TxReceipt>> {
279
+ async withdrawPublicFromAztecToL1(withdrawAmount: bigint, authwitNonce: Fr = Fr.ZERO): Promise<TxReceipt> {
289
280
  const withdrawReceipt = await this.l2Bridge.methods
290
281
  .exit_to_l1_public(this.ethAccount, withdrawAmount, EthAddress.ZERO, authwitNonce)
291
- .send({ from: this.ownerAddress })
292
- .wait();
282
+ .send({ from: this.ownerAddress });
293
283
 
294
284
  return withdrawReceipt;
295
285
  }
@@ -333,18 +323,14 @@ export class CrossChainTestHarness {
333
323
 
334
324
  async transferToPrivateOnL2(shieldAmount: bigint) {
335
325
  this.logger.info('Transferring to private on L2');
336
- await this.l2Token.methods
337
- .transfer_to_private(this.ownerAddress, shieldAmount)
338
- .send({ from: this.ownerAddress })
339
- .wait();
326
+ await this.l2Token.methods.transfer_to_private(this.ownerAddress, shieldAmount).send({ from: this.ownerAddress });
340
327
  }
341
328
 
342
329
  async transferToPublicOnL2(amount: bigint, authwitNonce = Fr.ZERO) {
343
330
  this.logger.info('Transferring tokens to public');
344
331
  await this.l2Token.methods
345
332
  .transfer_to_public(this.ownerAddress, this.ownerAddress, amount, authwitNonce)
346
- .send({ from: this.ownerAddress })
347
- .wait();
333
+ .send({ from: this.ownerAddress });
348
334
  }
349
335
 
350
336
  /**
@@ -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 }).wait();
130
+ await this.feeJuice.methods.claim(owner, claimAmount, claimSecret, messageLeafIndex).send({ from: claimer });
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 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
  };
@@ -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([
@@ -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(
@@ -918,7 +912,7 @@ export const uniswapL1L2TestSuite = (
918
912
  },
919
913
  true,
920
914
  );
921
- await validateActionInteraction.send().wait();
915
+ await validateActionInteraction.send();
922
916
 
923
917
  // Call swap_public on L2
924
918
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -936,8 +930,7 @@ export const uniswapL1L2TestSuite = (
936
930
  ownerEthAddress,
937
931
  Fr.ZERO,
938
932
  )
939
- .send({ from: ownerAddress })
940
- .wait();
933
+ .send({ from: ownerAddress });
941
934
 
942
935
  const swapPublicContent = sha256ToField([
943
936
  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 { 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
  }