@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.fce3e4f

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 (121) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +8 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +53 -30
  6. package/dest/bench/client_flows/config.d.ts +1 -1
  7. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.js +5 -27
  9. package/dest/bench/utils.d.ts +2 -2
  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 +2 -2
  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 +4 -3
  16. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  17. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  18. package/dest/e2e_epochs/epochs_test.d.ts +1 -1
  19. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.js +6 -5
  21. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  22. package/dest/e2e_fees/bridging_race.notest.js +1 -1
  23. package/dest/e2e_fees/fees_test.d.ts +1 -1
  24. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  25. package/dest/e2e_fees/fees_test.js +12 -9
  26. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  27. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  28. package/dest/e2e_l1_publisher/write_json.js +5 -4
  29. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  30. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  31. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  32. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  33. package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
  34. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  35. package/dest/e2e_p2p/inactivity_slash_test.js +6 -2
  36. package/dest/e2e_p2p/p2p_network.d.ts +214 -9
  37. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  38. package/dest/e2e_p2p/p2p_network.js +5 -3
  39. package/dest/e2e_p2p/shared.d.ts +5 -5
  40. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  41. package/dest/e2e_p2p/shared.js +6 -5
  42. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  43. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  44. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  45. package/dest/fixtures/e2e_prover_test.d.ts +3 -1
  46. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  47. package/dest/fixtures/e2e_prover_test.js +18 -14
  48. package/dest/fixtures/fixtures.d.ts +1 -1
  49. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  50. package/dest/fixtures/get_bb_config.d.ts +1 -1
  51. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  52. package/dest/fixtures/index.d.ts +1 -1
  53. package/dest/fixtures/l1_to_l2_messaging.d.ts +1 -1
  54. package/dest/fixtures/logging.d.ts +1 -1
  55. package/dest/fixtures/setup_l1_contracts.d.ts +475 -4
  56. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  57. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  58. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  59. package/dest/fixtures/setup_p2p_test.js +15 -7
  60. package/dest/fixtures/snapshot_manager.d.ts +2 -2
  61. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  62. package/dest/fixtures/token_utils.d.ts +5 -2
  63. package/dest/fixtures/token_utils.d.ts.map +1 -1
  64. package/dest/fixtures/token_utils.js +7 -4
  65. package/dest/fixtures/utils.d.ts +449 -4
  66. package/dest/fixtures/utils.d.ts.map +1 -1
  67. package/dest/fixtures/utils.js +11 -12
  68. package/dest/fixtures/web3signer.d.ts +1 -1
  69. package/dest/fixtures/with_telemetry_utils.d.ts +1 -1
  70. package/dest/index.d.ts +1 -1
  71. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  72. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  73. package/dest/shared/cross_chain_test_harness.d.ts +1 -12
  74. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  75. package/dest/shared/gas_portal_test_harness.d.ts +1 -11
  76. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  77. package/dest/shared/gas_portal_test_harness.js +1 -1
  78. package/dest/shared/index.d.ts +1 -1
  79. package/dest/shared/jest_setup.d.ts +1 -1
  80. package/dest/shared/submit-transactions.d.ts +1 -1
  81. package/dest/shared/submit-transactions.d.ts.map +1 -1
  82. package/dest/shared/uniswap_l1_l2.d.ts +1 -1
  83. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  84. package/dest/shared/uniswap_l1_l2.js +11 -11
  85. package/dest/simulators/index.d.ts +1 -1
  86. package/dest/simulators/lending_simulator.d.ts +1 -5
  87. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  88. package/dest/simulators/lending_simulator.js +4 -2
  89. package/dest/simulators/token_simulator.d.ts +1 -1
  90. package/dest/simulators/token_simulator.d.ts.map +1 -1
  91. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  92. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  93. package/dest/spartan/setup_test_wallets.js +43 -9
  94. package/dest/spartan/utils.d.ts +18 -18
  95. package/dest/spartan/utils.d.ts.map +1 -1
  96. package/dest/spartan/utils.js +2 -2
  97. package/package.json +42 -40
  98. package/src/bench/client_flows/client_flows_benchmark.ts +75 -30
  99. package/src/bench/client_flows/data_extractor.ts +6 -28
  100. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  101. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -3
  102. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  103. package/src/e2e_epochs/epochs_test.ts +6 -5
  104. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  105. package/src/e2e_fees/fees_test.ts +12 -9
  106. package/src/e2e_l1_publisher/write_json.ts +5 -4
  107. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  108. package/src/e2e_p2p/inactivity_slash_test.ts +6 -2
  109. package/src/e2e_p2p/p2p_network.ts +7 -3
  110. package/src/e2e_p2p/shared.ts +8 -5
  111. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  112. package/src/fixtures/e2e_prover_test.ts +15 -16
  113. package/src/fixtures/setup_p2p_test.ts +20 -6
  114. package/src/fixtures/token_utils.ts +4 -4
  115. package/src/fixtures/utils.ts +35 -16
  116. package/src/guides/up_quick_start.sh +1 -1
  117. package/src/shared/gas_portal_test_harness.ts +1 -1
  118. package/src/shared/uniswap_l1_l2.ts +11 -11
  119. package/src/simulators/lending_simulator.ts +4 -2
  120. package/src/spartan/setup_test_wallets.ts +47 -11
  121. package/src/spartan/utils.ts +2 -2
@@ -262,7 +262,7 @@ export const uniswapL1L2TestSuite = (
262
262
  await wethCrossChainHarness.expectPublicBalanceOnL2(uniswapL2Contract.address, 0n);
263
263
 
264
264
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
265
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
265
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
266
266
 
267
267
  // 5. Consume L2 to L1 message by calling uniswapPortal.swap_private()
268
268
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -287,7 +287,7 @@ export const uniswapL1L2TestSuite = (
287
287
  const withdrawSiblingPath = withdrawResult!.siblingPath;
288
288
 
289
289
  const withdrawMessageMetadata = {
290
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
290
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
291
291
  _leafIndex: BigInt(withdrawL2MessageIndex),
292
292
  _path: withdrawSiblingPath
293
293
  .toBufferArray()
@@ -295,7 +295,7 @@ export const uniswapL1L2TestSuite = (
295
295
  };
296
296
 
297
297
  const swapPrivateMessageMetadata = {
298
- _l2BlockNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
298
+ _checkpointNumber: BigInt(l2UniswapInteractionReceipt.blockNumber!),
299
299
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
300
300
  _path: swapPrivateSiblingPath
301
301
  .toBufferArray()
@@ -506,7 +506,7 @@ export const uniswapL1L2TestSuite = (
506
506
  // );
507
507
 
508
508
  // const withdrawMessageMetadata = {
509
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
509
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
510
510
  // _leafIndex: BigInt(withdrawL2MessageIndex),
511
511
  // _path: withdrawSiblingPath
512
512
  // .toBufferArray()
@@ -514,7 +514,7 @@ export const uniswapL1L2TestSuite = (
514
514
  // };
515
515
 
516
516
  // const swapPrivateMessageMetadata = {
517
- // _l2BlockNumber: BigInt(uniswapL2Interaction.blockNumber!),
517
+ // _checkpointNumber: BigInt(uniswapL2Interaction.blockNumber!),
518
518
  // _leafIndex: BigInt(swapPrivateL2MessageIndex),
519
519
  // _path: swapPrivateSiblingPath
520
520
  // .toBufferArray()
@@ -872,7 +872,7 @@ export const uniswapL1L2TestSuite = (
872
872
  const withdrawSiblingPath = withdrawResult!.siblingPath;
873
873
 
874
874
  const withdrawMessageMetadata = {
875
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
875
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
876
876
  _leafIndex: BigInt(withdrawL2MessageIndex),
877
877
  _path: withdrawSiblingPath
878
878
  .toBufferArray()
@@ -880,7 +880,7 @@ export const uniswapL1L2TestSuite = (
880
880
  };
881
881
 
882
882
  const swapPrivateMessageMetadata = {
883
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
883
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
884
884
  _leafIndex: BigInt(swapPrivateL2MessageIndex),
885
885
  _path: swapPrivateSiblingPath
886
886
  .toBufferArray()
@@ -891,7 +891,7 @@ export const uniswapL1L2TestSuite = (
891
891
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
892
892
 
893
893
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
894
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
894
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
895
895
 
896
896
  // On L1 call swap_public!
897
897
  logger.info('call swap_public on L1');
@@ -1007,7 +1007,7 @@ export const uniswapL1L2TestSuite = (
1007
1007
  const withdrawSiblingPath = withdrawResult!.siblingPath;
1008
1008
 
1009
1009
  const withdrawMessageMetadata = {
1010
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1010
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1011
1011
  _leafIndex: BigInt(withdrawL2MessageIndex),
1012
1012
  _path: withdrawSiblingPath
1013
1013
  .toBufferArray()
@@ -1015,7 +1015,7 @@ export const uniswapL1L2TestSuite = (
1015
1015
  };
1016
1016
 
1017
1017
  const swapPublicMessageMetadata = {
1018
- _l2BlockNumber: BigInt(withdrawReceipt.blockNumber!),
1018
+ _checkpointNumber: BigInt(withdrawReceipt.blockNumber!),
1019
1019
  _leafIndex: BigInt(swapPublicL2MessageIndex),
1020
1020
  _path: swapPublicSiblingPath
1021
1021
  .toBufferArray()
@@ -1026,7 +1026,7 @@ export const uniswapL1L2TestSuite = (
1026
1026
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
1027
1027
 
1028
1028
  // Since the outbox is only consumable when the block is proven, we need to set the block to be proven
1029
- await cheatCodes.rollup.markAsProven(await rollup.getBlockNumber());
1029
+ await cheatCodes.rollup.markAsProven(await rollup.getCheckpointNumber());
1030
1030
 
1031
1031
  // Call swap_private on L1
1032
1032
  logger.info('Execute withdraw and swap on the uniswapPortal!');
@@ -3,6 +3,7 @@ import { AztecAddress } from '@aztec/aztec.js/addresses';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
5
  import type { RollupContract } from '@aztec/ethereum';
6
+ import { SlotNumber } from '@aztec/foundation/branded-types';
6
7
  import { pedersenHash } from '@aztec/foundation/crypto';
7
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
8
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
@@ -103,7 +104,8 @@ export class LendingSimulator {
103
104
  }
104
105
 
105
106
  const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
106
- const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
107
+ const targetSlot = SlotNumber(slot + diff);
108
+ const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
107
109
  const timeDiff = ts - this.time;
108
110
  this.time = ts;
109
111
 
@@ -112,7 +114,7 @@ export class LendingSimulator {
112
114
  if (dateProvider) {
113
115
  dateProvider.setTime(this.time * 1000);
114
116
  }
115
- await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
117
+ await this.cc.rollup.markAsProven(await this.rollup.getCheckpointNumber());
116
118
  this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
117
119
  }
118
120
 
@@ -11,7 +11,7 @@ import type { Logger } from '@aztec/foundation/log';
11
11
  import { retryUntil } from '@aztec/foundation/retry';
12
12
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
13
13
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
14
- import { TestWallet, proveInteraction, registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet/server';
14
+ import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
15
15
 
16
16
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
17
17
  import { getBBConfig } from '../fixtures/get_bb_config.js';
@@ -28,6 +28,11 @@ export interface TestAccounts {
28
28
  tokenAddress: AztecAddress;
29
29
  }
30
30
 
31
+ export type TestAccountsWithoutTokens = Omit<
32
+ TestAccounts,
33
+ 'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
34
+ >;
35
+
31
36
  const TOKEN_NAME = 'USDC';
32
37
  const TOKEN_SYMBOL = 'USD';
33
38
  const TOKEN_DECIMALS = 18n;
@@ -42,14 +47,14 @@ export async function setupTestAccountsWithTokens(
42
47
  const aztecNode = createAztecNodeClient(nodeUrl);
43
48
  const wallet = await TestWallet.create(aztecNode);
44
49
 
45
- const [recipientAccount, ...accounts] = (await registerInitialSandboxAccountsInWallet(wallet)).slice(
50
+ const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
46
51
  0,
47
52
  ACCOUNT_COUNT + 1,
48
53
  );
49
54
 
50
55
  const tokenAdmin = accounts[0];
51
56
  const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
52
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
57
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
53
58
 
54
59
  return {
55
60
  aztecNode,
@@ -63,7 +68,7 @@ export async function setupTestAccountsWithTokens(
63
68
  };
64
69
  }
65
70
 
66
- export async function deploySponsoredTestAccounts(
71
+ export async function deploySponsoredTestAccountsWithTokens(
67
72
  wallet: TestWallet,
68
73
  aztecNode: AztecNode,
69
74
  mintAmount: bigint,
@@ -96,7 +101,7 @@ export async function deploySponsoredTestAccounts(
96
101
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
97
102
  logger,
98
103
  );
99
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
104
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
100
105
 
101
106
  return {
102
107
  aztecNode,
@@ -110,6 +115,37 @@ export async function deploySponsoredTestAccounts(
110
115
  };
111
116
  }
112
117
 
118
+ export async function deploySponsoredTestAccounts(
119
+ wallet: TestWallet,
120
+ aztecNode: AztecNode,
121
+ logger: Logger,
122
+ numberOfFundedWallets = 1,
123
+ ): Promise<TestAccountsWithoutTokens> {
124
+ const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
125
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
126
+ const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
127
+
128
+ await registerSponsoredFPC(wallet);
129
+
130
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
131
+ const recipientDeployMethod = await recipientAccount.getDeployMethod();
132
+ await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
133
+ await Promise.all(
134
+ fundedAccounts.map(async a => {
135
+ const deployMethod = await a.getDeployMethod();
136
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
137
+ logger.info(`Account deployed at ${a.address}`);
138
+ }),
139
+ );
140
+
141
+ return {
142
+ aztecNode,
143
+ wallet,
144
+ accounts: fundedAccounts.map(acc => acc.address),
145
+ recipientAddress: recipientAccount.address,
146
+ };
147
+ }
148
+
113
149
  export async function deployTestAccountsWithTokens(
114
150
  nodeUrl: string,
115
151
  l1RpcUrls: string[],
@@ -152,7 +188,7 @@ export async function deployTestAccountsWithTokens(
152
188
  undefined,
153
189
  logger,
154
190
  );
155
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
191
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
156
192
 
157
193
  return {
158
194
  aztecNode,
@@ -228,9 +264,9 @@ async function deployTokenAndMint(
228
264
  logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
229
265
 
230
266
  await Promise.all(
231
- accounts.map(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
233
- .mint_to_public(acc, mintAmount)
267
+ accounts.map(acc =>
268
+ TokenContract.at(tokenAddress, wallet)
269
+ .methods.mint_to_public(acc, mintAmount)
234
270
  .send({ from: admin, fee: { paymentMethod } })
235
271
  .wait({ timeout: 600 }),
236
272
  ),
@@ -260,8 +296,8 @@ export async function performTransfers({
260
296
  // Default to sponsored fee payment if no fee method is provided
261
297
  const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
262
298
  for (let i = 0; i < rounds; i++) {
263
- const txs = testAccounts.accounts.map(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
299
+ const txs = testAccounts.accounts.map(acc => {
300
+ const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
265
301
  return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
266
302
  from: acc,
267
303
  fee: {
@@ -160,9 +160,9 @@ export async function startPortForward({
160
160
  return { process, port };
161
161
  }
162
162
 
163
- export function startPortForwardForRPC(namespace: string) {
163
+ export function startPortForwardForRPC(namespace: string, resourceType = 'services', index = 0) {
164
164
  return startPortForward({
165
- resource: `services/${namespace}-rpc-aztec-node`,
165
+ resource: `${resourceType}/${namespace}-rpc-aztec-node-${index}`,
166
166
  namespace,
167
167
  containerPort: 8080,
168
168
  });