@aztec/end-to-end 1.0.0-nightly.20250608 → 1.0.0-nightly.20250611

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.
@@ -20,6 +20,7 @@ import {
20
20
  import { sha256ToField } from '@aztec/foundation/crypto';
21
21
  import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
22
22
  import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
23
+ import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
23
24
  import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
24
25
 
25
26
  import { jest } from '@jest/globals';
@@ -242,13 +243,13 @@ export const uniswapL1L2TestSuite = (
242
243
  ownerEthAddress.toBuffer32(),
243
244
  ]);
244
245
 
245
- const swapPrivateLeaf = sha256ToField([
246
- uniswapL2Contract.address,
247
- new Fr(version), // aztec version
248
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
249
- new Fr(l1Client.chain.id), // chain id
250
- swapPrivateContent,
251
- ]);
246
+ const swapPrivateLeaf = computeL2ToL1MessageHash({
247
+ l2Sender: uniswapL2Contract.address,
248
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
249
+ content: swapPrivateContent,
250
+ rollupVersion: new Fr(version),
251
+ chainId: new Fr(l1Client.chain.id),
252
+ });
252
253
 
253
254
  const withdrawContent = sha256ToField([
254
255
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
@@ -257,13 +258,13 @@ export const uniswapL1L2TestSuite = (
257
258
  uniswapPortalAddress.toBuffer32(),
258
259
  ]);
259
260
 
260
- const withdrawLeaf = sha256ToField([
261
- wethCrossChainHarness.l2Bridge.address,
262
- new Fr(version), // aztec version
263
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
264
- new Fr(l1Client.chain.id), // chain id
265
- withdrawContent,
266
- ]);
261
+ const withdrawLeaf = computeL2ToL1MessageHash({
262
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
263
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
264
+ content: withdrawContent,
265
+ rollupVersion: new Fr(version),
266
+ chainId: new Fr(l1Client.chain.id),
267
+ });
267
268
 
268
269
  // ensure that user's funds were burnt
269
270
  await wethCrossChainHarness.expectPrivateBalanceOnL2(ownerAddress, wethL2BalanceBeforeSwap - wethAmountToBridge);
@@ -837,13 +838,13 @@ export const uniswapL1L2TestSuite = (
837
838
  ownerEthAddress.toBuffer32(),
838
839
  ]);
839
840
 
840
- const swapPrivateLeaf = sha256ToField([
841
- uniswapL2Contract.address,
842
- new Fr(version), // aztec version
843
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
844
- new Fr(l1Client.chain.id), // chain id
845
- swapPrivateContent,
846
- ]);
841
+ const swapPrivateLeaf = computeL2ToL1MessageHash({
842
+ l2Sender: uniswapL2Contract.address,
843
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
844
+ content: swapPrivateContent,
845
+ rollupVersion: new Fr(version),
846
+ chainId: new Fr(l1Client.chain.id),
847
+ });
847
848
 
848
849
  const withdrawContent = sha256ToField([
849
850
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
@@ -852,13 +853,13 @@ export const uniswapL1L2TestSuite = (
852
853
  uniswapPortalAddress.toBuffer32(),
853
854
  ]);
854
855
 
855
- const withdrawLeaf = sha256ToField([
856
- wethCrossChainHarness.l2Bridge.address,
857
- new Fr(version), // aztec version
858
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
859
- new Fr(l1Client.chain.id), // chain id
860
- withdrawContent,
861
- ]);
856
+ const withdrawLeaf = computeL2ToL1MessageHash({
857
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
858
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
859
+ content: withdrawContent,
860
+ rollupVersion: new Fr(version),
861
+ chainId: new Fr(l1Client.chain.id),
862
+ });
862
863
 
863
864
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPrivateLeaf);
864
865
  const withdrawResult = await computeL2ToL1MembershipWitness(
@@ -971,13 +972,13 @@ export const uniswapL1L2TestSuite = (
971
972
  ownerEthAddress.toBuffer32(),
972
973
  ]);
973
974
 
974
- const swapPublicLeaf = sha256ToField([
975
- uniswapL2Contract.address,
976
- new Fr(version), // aztec version
977
- EthAddress.fromString(uniswapPortal.address).toBuffer32(),
978
- new Fr(l1Client.chain.id), // chain id
979
- swapPublicContent,
980
- ]);
975
+ const swapPublicLeaf = computeL2ToL1MessageHash({
976
+ l2Sender: uniswapL2Contract.address,
977
+ l1Recipient: EthAddress.fromString(uniswapPortal.address),
978
+ content: swapPublicContent,
979
+ rollupVersion: new Fr(version),
980
+ chainId: new Fr(l1Client.chain.id),
981
+ });
981
982
 
982
983
  const withdrawContent = sha256ToField([
983
984
  Buffer.from(toFunctionSelector('withdraw(address,uint256,address)').substring(2), 'hex'),
@@ -986,13 +987,13 @@ export const uniswapL1L2TestSuite = (
986
987
  uniswapPortalAddress.toBuffer32(),
987
988
  ]);
988
989
 
989
- const withdrawLeaf = sha256ToField([
990
- wethCrossChainHarness.l2Bridge.address,
991
- new Fr(version), // aztec version
992
- wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
993
- new Fr(l1Client.chain.id), // chain id
994
- withdrawContent,
995
- ]);
990
+ const withdrawLeaf = computeL2ToL1MessageHash({
991
+ l2Sender: wethCrossChainHarness.l2Bridge.address,
992
+ l1Recipient: wethCrossChainHarness.tokenPortalAddress,
993
+ content: withdrawContent,
994
+ rollupVersion: new Fr(version),
995
+ chainId: new Fr(l1Client.chain.id),
996
+ });
996
997
 
997
998
  const swapResult = await computeL2ToL1MembershipWitness(aztecNode, withdrawReceipt.blockNumber!, swapPublicLeaf);
998
999
  const withdrawResult = await computeL2ToL1MembershipWitness(