@aztec/end-to-end 1.0.0-nightly.20250810 → 1.0.0-nightly.20250812

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 (94) 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.map +1 -1
  4. package/dest/bench/client_flows/client_flows_benchmark.js +30 -12
  5. package/dest/bench/utils.d.ts.map +1 -1
  6. package/dest/bench/utils.js +6 -2
  7. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -0
  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 +47 -15
  10. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -1
  11. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  12. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +12 -9
  13. package/dest/e2e_deploy_contract/deploy_test.d.ts +1 -1
  14. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  15. package/dest/e2e_deploy_contract/deploy_test.js +5 -4
  16. package/dest/e2e_fees/bridging_race.notest.js +3 -1
  17. package/dest/e2e_fees/fees_test.d.ts +2 -2
  18. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  19. package/dest/e2e_fees/fees_test.js +29 -33
  20. package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -3
  21. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  22. package/dest/e2e_nested_contract/nested_contract_test.js +17 -12
  23. package/dest/e2e_p2p/p2p_network.d.ts +2 -1
  24. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  25. package/dest/e2e_p2p/p2p_network.js +5 -1
  26. package/dest/e2e_p2p/shared.d.ts +2 -2
  27. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  28. package/dest/e2e_p2p/shared.js +7 -3
  29. package/dest/e2e_token_contract/token_contract_test.d.ts +8 -4
  30. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  31. package/dest/e2e_token_contract/token_contract_test.js +48 -23
  32. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  33. package/dest/fixtures/e2e_prover_test.js +22 -8
  34. package/dest/fixtures/snapshot_manager.js +3 -1
  35. package/dest/fixtures/token_utils.d.ts +3 -3
  36. package/dest/fixtures/token_utils.d.ts.map +1 -1
  37. package/dest/fixtures/token_utils.js +13 -7
  38. package/dest/fixtures/utils.d.ts +4 -3
  39. package/dest/fixtures/utils.d.ts.map +1 -1
  40. package/dest/fixtures/utils.js +14 -6
  41. package/dest/sample-dapp/connect.d.mts +2 -0
  42. package/dest/sample-dapp/connect.d.mts.map +1 -0
  43. package/dest/sample-dapp/connect.js +1 -1
  44. package/dest/sample-dapp/contracts.d.mts +3 -0
  45. package/dest/sample-dapp/contracts.d.mts.map +1 -0
  46. package/dest/sample-dapp/contracts.js +1 -1
  47. package/dest/sample-dapp/deploy.d.mts +3 -0
  48. package/dest/sample-dapp/deploy.d.mts.map +1 -0
  49. package/dest/sample-dapp/deploy.js +4 -1
  50. package/dest/sample-dapp/index.d.mts +2 -0
  51. package/dest/sample-dapp/index.d.mts.map +1 -0
  52. package/dest/sample-dapp/index.js +18 -7
  53. package/dest/shared/cross_chain_test_harness.d.ts +6 -3
  54. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  55. package/dest/shared/cross_chain_test_harness.js +50 -20
  56. package/dest/shared/gas_portal_test_harness.d.ts +3 -3
  57. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  58. package/dest/shared/gas_portal_test_harness.js +9 -5
  59. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  60. package/dest/shared/uniswap_l1_l2.js +37 -14
  61. package/dest/simulators/lending_simulator.js +6 -2
  62. package/dest/simulators/token_simulator.d.ts +2 -1
  63. package/dest/simulators/token_simulator.d.ts.map +1 -1
  64. package/dest/simulators/token_simulator.js +12 -4
  65. package/dest/spartan/setup_test_wallets.d.ts +2 -0
  66. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  67. package/dest/spartan/setup_test_wallets.js +15 -5
  68. package/package.json +35 -35
  69. package/src/bench/client_flows/benchmark.ts +1 -1
  70. package/src/bench/client_flows/client_flows_benchmark.ts +20 -11
  71. package/src/bench/utils.ts +4 -2
  72. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +28 -17
  73. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +13 -8
  74. package/src/e2e_deploy_contract/deploy_test.ts +5 -5
  75. package/src/e2e_fees/bridging_race.notest.ts +1 -1
  76. package/src/e2e_fees/fees_test.ts +37 -46
  77. package/src/e2e_nested_contract/nested_contract_test.ts +16 -11
  78. package/src/e2e_p2p/p2p_network.ts +6 -2
  79. package/src/e2e_p2p/shared.ts +4 -2
  80. package/src/e2e_token_contract/token_contract_test.ts +38 -36
  81. package/src/fixtures/e2e_prover_test.ts +13 -7
  82. package/src/fixtures/snapshot_manager.ts +1 -1
  83. package/src/fixtures/token_utils.ts +13 -6
  84. package/src/fixtures/utils.ts +14 -7
  85. package/src/sample-dapp/connect.mjs +1 -1
  86. package/src/sample-dapp/contracts.mjs +1 -1
  87. package/src/sample-dapp/deploy.mjs +3 -3
  88. package/src/sample-dapp/index.mjs +11 -7
  89. package/src/shared/cross_chain_test_harness.ts +31 -18
  90. package/src/shared/gas_portal_test_harness.ts +6 -6
  91. package/src/shared/uniswap_l1_l2.ts +19 -15
  92. package/src/simulators/lending_simulator.ts +2 -2
  93. package/src/simulators/token_simulator.ts +12 -3
  94. package/src/spartan/setup_test_wallets.ts +40 -16
@@ -83,7 +83,7 @@ export const uniswapL1L2TestSuite = (
83
83
  let ownerEthAddress: EthAddress;
84
84
  // does transactions on behalf of owner on Aztec:
85
85
  let sponsorWallet: AccountWallet;
86
- // let sponsorAddress: AztecAddress;
86
+ let sponsorAddress: AztecAddress;
87
87
 
88
88
  let daiCrossChainHarness: CrossChainTestHarness;
89
89
  let wethCrossChainHarness: CrossChainTestHarness;
@@ -114,7 +114,7 @@ export const uniswapL1L2TestSuite = (
114
114
  );
115
115
  version = Number(await rollup.getVersion());
116
116
  ownerAddress = ownerWallet.getAddress();
117
- // sponsorAddress = sponsorWallet.getAddress();
117
+ sponsorAddress = sponsorWallet.getAddress();
118
118
  ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
119
119
 
120
120
  await ensureAccountContractsPublished(ownerWallet, [ownerWallet, sponsorWallet]);
@@ -125,6 +125,7 @@ export const uniswapL1L2TestSuite = (
125
125
  pxe,
126
126
  deployL1ContractsValues.l1Client,
127
127
  ownerWallet,
128
+ ownerAddress,
128
129
  logger,
129
130
  DAI_ADDRESS,
130
131
  );
@@ -135,6 +136,7 @@ export const uniswapL1L2TestSuite = (
135
136
  pxe,
136
137
  l1Client,
137
138
  ownerWallet,
139
+ ownerAddress,
138
140
  logger,
139
141
  WETH9_ADDRESS,
140
142
  );
@@ -150,7 +152,9 @@ export const uniswapL1L2TestSuite = (
150
152
  client: l1Client,
151
153
  });
152
154
  // deploy l2 uniswap contract and attach to portal
153
- uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send().deployed();
155
+ uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress)
156
+ .send({ from: ownerAddress })
157
+ .deployed();
154
158
 
155
159
  const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
156
160
 
@@ -228,7 +232,7 @@ export const uniswapL1L2TestSuite = (
228
232
  secretHashForDepositingSwappedDai,
229
233
  ownerEthAddress,
230
234
  )
231
- .send({ authWitnesses: [transferToPublicAuhtwit] })
235
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
232
236
  .wait();
233
237
 
234
238
  const swapPrivateFunction = 'swap_private(address,uint256,uint24,address,uint256,bytes32,address)';
@@ -634,7 +638,7 @@ export const uniswapL1L2TestSuite = (
634
638
  Fr.random(),
635
639
  ownerEthAddress,
636
640
  )
637
- .simulate(),
641
+ .simulate({ from: ownerAddress }),
638
642
  ).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
639
643
  });
640
644
 
@@ -671,7 +675,7 @@ export const uniswapL1L2TestSuite = (
671
675
  Fr.random(),
672
676
  ownerEthAddress,
673
677
  )
674
- .prove({ authWitnesses: [transferToPublicAuthwith] }),
678
+ .prove({ from: ownerAddress, authWitnesses: [transferToPublicAuthwith] }),
675
679
  ).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
676
680
  });
677
681
 
@@ -695,7 +699,7 @@ export const uniswapL1L2TestSuite = (
695
699
  },
696
700
  true,
697
701
  );
698
- await validateActionInteraction.send().wait();
702
+ await validateActionInteraction.send({ from: ownerAddress }).wait();
699
703
 
700
704
  // No approval to call `swap` but should work even without it:
701
705
  const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
@@ -714,7 +718,7 @@ export const uniswapL1L2TestSuite = (
714
718
  ownerEthAddress,
715
719
  Fr.ZERO, // nonce for swap -> doesn't matter
716
720
  )
717
- .send()
721
+ .send({ from: ownerAddress })
718
722
  .wait();
719
723
  // check weth balance of owner on L2 (we first bridged `wethAmountToBridge` into L2 and now withdrew it!)
720
724
  await wethCrossChainHarness.expectPublicBalanceOnL2(ownerAddress, 0n);
@@ -743,9 +747,9 @@ export const uniswapL1L2TestSuite = (
743
747
  nonceForSwap,
744
748
  );
745
749
  const validateActionInteraction = await ownerWallet.setPublicAuthWit({ caller: approvedUser, action }, true);
746
- await validateActionInteraction.send().wait();
750
+ await validateActionInteraction.send({ from: sponsorAddress }).wait();
747
751
 
748
- await expect(action.simulate()).rejects.toThrow(/unauthorized/);
752
+ await expect(action.simulate({ from: sponsorAddress })).rejects.toThrow(/unauthorized/);
749
753
  });
750
754
 
751
755
  it("uniswap can't pull funds without transfer approval", async () => {
@@ -764,7 +768,7 @@ export const uniswapL1L2TestSuite = (
764
768
  },
765
769
  true,
766
770
  );
767
- await validateActionInteraction.send().wait();
771
+ await validateActionInteraction.send({ from: ownerAddress }).wait();
768
772
 
769
773
  await expect(
770
774
  uniswapL2Contract.methods
@@ -781,7 +785,7 @@ export const uniswapL1L2TestSuite = (
781
785
  ownerEthAddress,
782
786
  Fr.ZERO,
783
787
  )
784
- .simulate(),
788
+ .simulate({ from: ownerAddress }),
785
789
  ).rejects.toThrow(/unauthorized/);
786
790
  });
787
791
 
@@ -821,7 +825,7 @@ export const uniswapL1L2TestSuite = (
821
825
  secretHashForDepositingSwappedDai,
822
826
  ownerEthAddress,
823
827
  )
824
- .send({ authWitnesses: [transferToPublicAuhtwit] })
828
+ .send({ from: ownerAddress, authWitnesses: [transferToPublicAuhtwit] })
825
829
  .wait();
826
830
 
827
831
  const swapPrivateContent = sha256ToField([
@@ -934,7 +938,7 @@ export const uniswapL1L2TestSuite = (
934
938
  },
935
939
  true,
936
940
  );
937
- await validateActionInteraction.send().wait();
941
+ await validateActionInteraction.send({ from: ownerAddress }).wait();
938
942
 
939
943
  // Call swap_public on L2
940
944
  const secretHashForDepositingSwappedDai = Fr.random();
@@ -952,7 +956,7 @@ export const uniswapL1L2TestSuite = (
952
956
  ownerEthAddress,
953
957
  Fr.ZERO,
954
958
  )
955
- .send()
959
+ .send({ from: ownerAddress })
956
960
  .wait();
957
961
 
958
962
  const swapPublicContent = sha256ToField([
@@ -183,14 +183,14 @@ export class LendingSimulator {
183
183
 
184
184
  expect(this.borrowed).toEqual(this.stableCoin.totalSupply - this.mintedOutside);
185
185
 
186
- const asset = await this.lendingContract.methods.get_asset(0).simulate();
186
+ const asset = await this.lendingContract.methods.get_asset(0).simulate({ from: this.account.address });
187
187
 
188
188
  const interestAccumulator = asset['interest_accumulator'];
189
189
  expect(interestAccumulator).toEqual(this.accumulator);
190
190
  expect(asset['last_updated_ts']).toEqual(BigInt(this.time));
191
191
 
192
192
  for (const key of [this.account.address, AztecAddress.fromField(await this.account.key())]) {
193
- const privatePos = await this.lendingContract.methods.get_position(key).simulate();
193
+ const privatePos = await this.lendingContract.methods.get_position(key).simulate({ from: key });
194
194
  expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
195
195
  expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
196
196
  expect(privatePos['debt']).toEqual(
@@ -13,6 +13,7 @@ export class TokenSimulator {
13
13
  constructor(
14
14
  protected token: TokenContract,
15
15
  protected defaultWallet: Wallet,
16
+ protected defaultAddress: AztecAddress,
16
17
  protected logger: Logger,
17
18
  protected accounts: AztecAddress[],
18
19
  ) {}
@@ -102,7 +103,9 @@ export class TokenSimulator {
102
103
  ];
103
104
 
104
105
  const results = (
105
- await Promise.all(chunk(calls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate()))
106
+ await Promise.all(
107
+ chunk(calls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
108
+ )
106
109
  ).flat();
107
110
  expect(results[0]).toEqual(this.totalSupply);
108
111
 
@@ -127,7 +130,11 @@ export class TokenSimulator {
127
130
 
128
131
  const defaultCalls = defaultLookups.map(address => this.token.methods.balance_of_private(address));
129
132
  const results = (
130
- await Promise.all(chunk(defaultCalls, 4).map(batch => new BatchCall(this.defaultWallet, batch).simulate()))
133
+ await Promise.all(
134
+ chunk(defaultCalls, 4).map(batch =>
135
+ new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress }),
136
+ ),
137
+ )
131
138
  ).flat();
132
139
  for (let i = 0; i < defaultLookups.length; i++) {
133
140
  expect(results[i]).toEqual(this.balanceOfPrivate(defaultLookups[i]));
@@ -139,7 +146,9 @@ export class TokenSimulator {
139
146
  const wallet = this.lookupProvider.get(address.toString());
140
147
  const asset = wallet ? this.token.withWallet(wallet) : this.token;
141
148
 
142
- const actualPrivateBalance = await asset.methods.balance_of_private({ address }).simulate();
149
+ const actualPrivateBalance = await asset.methods
150
+ .balance_of_private({ address })
151
+ .simulate({ from: this.defaultAddress });
143
152
  expect(actualPrivateBalance).toEqual(this.balanceOfPrivate(address));
144
153
  }
145
154
  }
@@ -28,8 +28,10 @@ export interface TestWallets {
28
28
  pxe: PXE;
29
29
  wallets: AccountWalletWithSecretKey[];
30
30
  tokenAdminWallet: TokenContract;
31
+ tokenAdminAddress: AztecAddress;
31
32
  tokenName: string;
32
33
  recipientWallet: AccountWalletWithSecretKey;
34
+ recipientAddress: AztecAddress;
33
35
  tokenAddress: AztecAddress;
34
36
  }
35
37
 
@@ -52,7 +54,16 @@ export async function setupTestWalletsWithTokens(
52
54
  const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
53
55
  const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
54
56
 
55
- return { pxe, wallets, tokenAdminWallet, tokenName: TOKEN_NAME, tokenAddress, recipientWallet };
57
+ return {
58
+ pxe,
59
+ wallets,
60
+ tokenAdminWallet,
61
+ tokenAdminAddress: tokenAdmin.getAddress(),
62
+ tokenName: TOKEN_NAME,
63
+ tokenAddress,
64
+ recipientAddress: recipientWallet.getAddress(),
65
+ recipientWallet,
66
+ };
56
67
  }
57
68
 
58
69
  export async function deploySponsoredTestWallets(
@@ -92,7 +103,16 @@ export async function deploySponsoredTestWallets(
92
103
  );
93
104
  const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
94
105
 
95
- return { pxe, wallets, tokenAdminWallet, tokenName: TOKEN_NAME, tokenAddress, recipientWallet };
106
+ return {
107
+ pxe,
108
+ wallets,
109
+ tokenAdminAddress: tokenAdmin.getAddress(),
110
+ tokenAdminWallet,
111
+ tokenName: TOKEN_NAME,
112
+ tokenAddress,
113
+ recipientWallet,
114
+ recipientAddress: recipientWallet.getAddress(),
115
+ };
96
116
  }
97
117
 
98
118
  export async function deployTestWalletWithTokens(
@@ -139,7 +159,16 @@ export async function deployTestWalletWithTokens(
139
159
  const tokenAddress = await deployTokenAndMint(wallets, tokenAdmin.getAddress(), mintAmount, undefined, logger);
140
160
  const tokenAdminWallet = await TokenContract.at(tokenAddress, tokenAdmin);
141
161
 
142
- return { pxe, wallets, tokenAdminWallet, tokenName: TOKEN_NAME, tokenAddress, recipientWallet };
162
+ return {
163
+ pxe,
164
+ wallets,
165
+ tokenAdminAddress: tokenAdmin.getAddress(),
166
+ tokenAdminWallet,
167
+ tokenName: TOKEN_NAME,
168
+ tokenAddress,
169
+ recipientWallet,
170
+ recipientAddress: recipientWallet.getAddress(),
171
+ };
143
172
  }
144
173
 
145
174
  async function bridgeL1FeeJuice(
@@ -192,6 +221,7 @@ async function deployTokenAndMint(
192
221
  logger.verbose(`Deploying TokenContract...`);
193
222
  const tokenContract = await TokenContract.deploy(wallets[0], admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS)
194
223
  .send({
224
+ from: admin,
195
225
  fee: {
196
226
  paymentMethod,
197
227
  },
@@ -206,7 +236,7 @@ async function deployTokenAndMint(
206
236
  wallets.map(async w =>
207
237
  (await TokenContract.at(tokenAddress, w)).methods
208
238
  .mint_to_public(w.getAddress(), mintAmount)
209
- .send({ fee: { paymentMethod } })
239
+ .send({ from: admin, fee: { paymentMethod } })
210
240
  .wait({ timeout: 600 }),
211
241
  ),
212
242
  );
@@ -228,22 +258,16 @@ export async function performTransfers({
228
258
  logger: Logger;
229
259
  }) {
230
260
  const recipient = testWallets.recipientWallet.getAddress();
231
-
232
261
  for (let i = 0; i < rounds; i++) {
233
- const interactions = await Promise.all(
234
- testWallets.wallets.map(async w =>
235
- (await TokenContract.at(testWallets.tokenAddress, w)).methods.transfer_in_public(
236
- w.getAddress(),
237
- recipient,
238
- transferAmount,
239
- 0,
240
- ),
241
- ),
262
+ const txs = testWallets.wallets.map(async w =>
263
+ (await TokenContract.at(testWallets.tokenAddress, w)).methods
264
+ .transfer_in_public(w.getAddress(), recipient, transferAmount, 0)
265
+ .prove({ from: w.getAddress() }),
242
266
  );
243
267
 
244
- const txs = await Promise.all(interactions.map(async i => await i.prove()));
268
+ const provenTxs = await Promise.all(txs);
245
269
 
246
- await Promise.all(txs.map(t => t.send().wait({ timeout: 600 })));
270
+ await Promise.all(provenTxs.map(t => t.send().wait({ timeout: 600 })));
247
271
 
248
272
  logger.info(`Completed round ${i + 1} / ${rounds}`);
249
273
  }