@aztec/end-to-end 0.85.0 → 0.86.0
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.
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +6 -7
- package/dest/bench/client_flows/data_extractor.js +12 -7
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +11 -11
- package/dest/e2e_epochs/epochs_test.d.ts +2 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts +4 -0
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +22 -10
- package/dest/e2e_p2p/p2p_network.d.ts +67 -72
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +20 -61
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +1 -1
- package/dest/e2e_prover/e2e_prover_test.js +9 -9
- package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -11
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +24 -23
- package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
- package/dest/shared/capture_private_execution_steps.js +3 -17
- package/dest/shared/cross_chain_test_harness.d.ts +7 -11
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +14 -16
- package/dest/shared/gas_portal_test_harness.d.ts +6 -11
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +8 -10
- package/dest/shared/uniswap_l1_l2.d.ts +3 -5
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -19
- package/dest/spartan/setup_test_wallets.js +3 -3
- package/package.json +34 -35
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -8
- package/src/bench/client_flows/data_extractor.ts +10 -6
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +14 -18
- package/src/e2e_epochs/epochs_test.ts +4 -3
- package/src/e2e_fees/fees_test.ts +32 -10
- package/src/e2e_p2p/p2p_network.ts +28 -74
- package/src/e2e_prover/e2e_prover_test.ts +9 -14
- package/src/fixtures/l1_to_l2_messaging.ts +5 -14
- package/src/fixtures/setup_l1_contracts.ts +1 -2
- package/src/fixtures/snapshot_manager.ts +9 -11
- package/src/fixtures/utils.ts +24 -25
- package/src/shared/capture_private_execution_steps.ts +3 -19
- package/src/shared/cross_chain_test_harness.ts +14 -31
- package/src/shared/gas_portal_test_harness.ts +9 -14
- package/src/shared/uniswap_l1_l2.ts +25 -43
- package/src/spartan/setup_test_wallets.ts +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AccountWallet, AuthWitness, type AztecAddress, type AztecNode, EthAddress, type FieldsOf, Fr, type L2AmountClaim, type L2AmountClaimWithRecipient, type Logger, type PXE, type SiblingPath, type TxReceipt, type Wallet } from '@aztec/aztec.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type ExtendedViemWalletClient, type L1ContractAddresses } from '@aztec/ethereum';
|
|
3
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
4
|
import { TokenBridgeContract } from '@aztec/noir-contracts.js/TokenBridge';
|
|
5
5
|
import { type Hex } from 'viem';
|
|
@@ -13,7 +13,7 @@ import { type Hex } from 'viem';
|
|
|
13
13
|
* @param underlyingERC20Address - address of the underlying ERC20 contract to use (if none supplied, it deploys one)
|
|
14
14
|
* @returns l2 contract instance, bridge contract instance, token portal instance, token portal address and the underlying ERC20 instance
|
|
15
15
|
*/
|
|
16
|
-
export declare function deployAndInitializeTokenAndBridgeContracts(wallet: Wallet,
|
|
16
|
+
export declare function deployAndInitializeTokenAndBridgeContracts(wallet: Wallet, l1Client: ExtendedViemWalletClient, rollupRegistryAddress: EthAddress, owner: AztecAddress, underlyingERC20Address: EthAddress): Promise<{
|
|
17
17
|
/**
|
|
18
18
|
* The L2 token contract instance.
|
|
19
19
|
*/
|
|
@@ -66,15 +66,13 @@ export declare class CrossChainTestHarness {
|
|
|
66
66
|
tokenPortalAddress: EthAddress;
|
|
67
67
|
/** Underlying token for portal tests. */
|
|
68
68
|
underlyingERC20Address: EthAddress;
|
|
69
|
-
/** Viem
|
|
70
|
-
|
|
71
|
-
/** Viem Wallet Client instance. */
|
|
72
|
-
walletClient: ViemWalletClient;
|
|
69
|
+
/** Viem Extended client instance. */
|
|
70
|
+
l1Client: ExtendedViemWalletClient;
|
|
73
71
|
/** Deployment addresses for all L1 contracts */
|
|
74
72
|
readonly l1ContractAddresses: L1ContractAddresses;
|
|
75
73
|
/** Wallet of the owner. */
|
|
76
74
|
readonly ownerWallet: AccountWallet;
|
|
77
|
-
static new(aztecNode: AztecNode, pxeService: PXE,
|
|
75
|
+
static new(aztecNode: AztecNode, pxeService: PXE, l1Client: ExtendedViemWalletClient, wallet: AccountWallet, logger: Logger, underlyingERC20Address: EthAddress): Promise<CrossChainTestHarness>;
|
|
78
76
|
private readonly l1TokenManager;
|
|
79
77
|
private readonly l1TokenPortalManager;
|
|
80
78
|
readonly ownerAddress: AztecAddress;
|
|
@@ -95,10 +93,8 @@ export declare class CrossChainTestHarness {
|
|
|
95
93
|
tokenPortalAddress: EthAddress,
|
|
96
94
|
/** Underlying token for portal tests. */
|
|
97
95
|
underlyingERC20Address: EthAddress,
|
|
98
|
-
/** Viem
|
|
99
|
-
|
|
100
|
-
/** Viem Wallet Client instance. */
|
|
101
|
-
walletClient: ViemWalletClient,
|
|
96
|
+
/** Viem Extended client instance. */
|
|
97
|
+
l1Client: ExtendedViemWalletClient,
|
|
102
98
|
/** Deployment addresses for all L1 contracts */
|
|
103
99
|
l1ContractAddresses: L1ContractAddresses,
|
|
104
100
|
/** Wallet of the owner. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EACV,KAAK,QAAQ,EACb,EAAE,EAGF,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,
|
|
1
|
+
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EACV,KAAK,QAAQ,EACb,EAAE,EAGF,KAAK,aAAa,EAClB,KAAK,0BAA0B,EAC/B,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,mBAAmB,EAAoB,MAAM,iBAAiB,CAAC;AAE5G,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE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G,oCAAoC,CACxC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAU1E,4BAA4B,CAChC,cAAc,EAAE,MAAM,EACtB,KAAK,gBAAc,EACnB,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IASzB,2BAA2B,CAAC,cAAc,EAAE,MAAM,EAAE,KAAK,GAAE,EAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAStG,qBAAqB,CAAC,KAAK,EAAE,YAAY;IAIzC,wBAAwB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAMrE,oBAAoB,CAAC,KAAK,EAAE,YAAY;IAIxC,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAKpE,oBAAoB,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,GAAE,UAA4B,GAAG,OAAO,CAAC,EAAE,CAAC;IASzG,2BAA2B,CACzB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC;IAW5B,qBAAqB,CAAC,YAAY,EAAE,MAAM;IAK1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,KAAU;IAK1D;;;;;;OAMG;IACG,qBAAqB,CAAC,OAAO,EAAE,EAAE,GAAG,GAAG;IAS7C,mBAAmB,IAAI,iBAAiB;CAYzC"}
|
|
@@ -16,13 +16,13 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
16
16
|
* @param owner - owner of the L2 contract
|
|
17
17
|
* @param underlyingERC20Address - address of the underlying ERC20 contract to use (if none supplied, it deploys one)
|
|
18
18
|
* @returns l2 contract instance, bridge contract instance, token portal instance, token portal address and the underlying ERC20 instance
|
|
19
|
-
*/ export async function deployAndInitializeTokenAndBridgeContracts(wallet,
|
|
19
|
+
*/ export async function deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, rollupRegistryAddress, owner, underlyingERC20Address) {
|
|
20
20
|
// deploy the token portal
|
|
21
|
-
const { address: tokenPortalAddress } = await deployL1Contract(
|
|
21
|
+
const { address: tokenPortalAddress } = await deployL1Contract(l1Client, TokenPortalAbi, TokenPortalBytecode);
|
|
22
22
|
const tokenPortal = getContract({
|
|
23
23
|
address: tokenPortalAddress.toString(),
|
|
24
24
|
abi: TokenPortalAbi,
|
|
25
|
-
client:
|
|
25
|
+
client: l1Client
|
|
26
26
|
});
|
|
27
27
|
// deploy l2 token
|
|
28
28
|
const token = await TokenContract.deploy(wallet, owner, 'TokenName', 'TokenSymbol', 18).send().deployed();
|
|
@@ -48,7 +48,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
48
48
|
const underlyingERC20 = getContract({
|
|
49
49
|
address: underlyingERC20Address.toString(),
|
|
50
50
|
abi: TestERC20Abi,
|
|
51
|
-
client:
|
|
51
|
+
client: l1Client
|
|
52
52
|
});
|
|
53
53
|
return {
|
|
54
54
|
token,
|
|
@@ -70,23 +70,22 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
70
70
|
ethAccount;
|
|
71
71
|
tokenPortalAddress;
|
|
72
72
|
underlyingERC20Address;
|
|
73
|
-
|
|
74
|
-
walletClient;
|
|
73
|
+
l1Client;
|
|
75
74
|
l1ContractAddresses;
|
|
76
75
|
ownerWallet;
|
|
77
|
-
static async new(aztecNode, pxeService,
|
|
78
|
-
const ethAccount = EthAddress.fromString((await
|
|
76
|
+
static async new(aztecNode, pxeService, l1Client, wallet, logger, underlyingERC20Address) {
|
|
77
|
+
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
79
78
|
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
80
79
|
// Deploy and initialize all required contracts
|
|
81
80
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
82
|
-
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet,
|
|
81
|
+
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, wallet.getAddress(), underlyingERC20Address);
|
|
83
82
|
logger.info('Deployed and initialized token, portal and its bridge.');
|
|
84
|
-
return new CrossChainTestHarness(aztecNode, pxeService, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address,
|
|
83
|
+
return new CrossChainTestHarness(aztecNode, pxeService, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet);
|
|
85
84
|
}
|
|
86
85
|
l1TokenManager;
|
|
87
86
|
l1TokenPortalManager;
|
|
88
87
|
ownerAddress;
|
|
89
|
-
constructor(/** Aztec node instance. */ aztecNode, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem
|
|
88
|
+
constructor(/** Aztec node instance. */ aztecNode, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token contract. */ l2Token, /** L2 Token bridge contract. */ l2Bridge, /** Eth account to interact with. */ ethAccount, /** Portal address. */ tokenPortalAddress, /** Underlying token for portal tests. */ underlyingERC20Address, /** Viem Extended client instance. */ l1Client, /** Deployment addresses for all L1 contracts */ l1ContractAddresses, /** Wallet of the owner. */ ownerWallet){
|
|
90
89
|
this.aztecNode = aztecNode;
|
|
91
90
|
this.pxeService = pxeService;
|
|
92
91
|
this.logger = logger;
|
|
@@ -95,11 +94,10 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
95
94
|
this.ethAccount = ethAccount;
|
|
96
95
|
this.tokenPortalAddress = tokenPortalAddress;
|
|
97
96
|
this.underlyingERC20Address = underlyingERC20Address;
|
|
98
|
-
this.
|
|
99
|
-
this.walletClient = walletClient;
|
|
97
|
+
this.l1Client = l1Client;
|
|
100
98
|
this.l1ContractAddresses = l1ContractAddresses;
|
|
101
99
|
this.ownerWallet = ownerWallet;
|
|
102
|
-
this.l1TokenPortalManager = new L1TokenPortalManager(this.tokenPortalAddress, this.underlyingERC20Address, this.l1ContractAddresses.feeAssetHandlerAddress, this.l1ContractAddresses.outboxAddress, this.
|
|
100
|
+
this.l1TokenPortalManager = new L1TokenPortalManager(this.tokenPortalAddress, this.underlyingERC20Address, this.l1ContractAddresses.feeAssetHandlerAddress, this.l1ContractAddresses.outboxAddress, this.l1Client, this.logger);
|
|
103
101
|
this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
|
|
104
102
|
this.ownerAddress = this.ownerWallet.getAddress();
|
|
105
103
|
}
|
|
@@ -107,14 +105,14 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
107
105
|
const contract = getContract({
|
|
108
106
|
abi: TestERC20Abi,
|
|
109
107
|
address: this.l1TokenManager.tokenAddress.toString(),
|
|
110
|
-
client: this.
|
|
108
|
+
client: this.l1Client
|
|
111
109
|
});
|
|
112
110
|
const balanceBefore = await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString());
|
|
113
111
|
const hash = await contract.write.mint([
|
|
114
112
|
this.ethAccount.toString(),
|
|
115
113
|
amount
|
|
116
114
|
]);
|
|
117
|
-
await this.
|
|
115
|
+
await this.l1Client.waitForTransactionReceipt({
|
|
118
116
|
hash
|
|
119
117
|
});
|
|
120
118
|
expect(await this.l1TokenManager.getL1TokenBalance(this.ethAccount.toString())).toEqual(balanceBefore + amount);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AztecAddress, type AztecNode, EthAddress, L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
3
3
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
4
4
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
5
5
|
export interface IGasBridgingTestHarness {
|
|
@@ -13,8 +13,7 @@ export interface FeeJuicePortalTestingHarnessFactoryConfig {
|
|
|
13
13
|
aztecNode: AztecNode;
|
|
14
14
|
aztecNodeAdmin?: AztecNodeAdmin;
|
|
15
15
|
pxeService: PXE;
|
|
16
|
-
|
|
17
|
-
walletClient: ViemWalletClient;
|
|
16
|
+
l1Client: ExtendedViemWalletClient;
|
|
18
17
|
wallet: Wallet;
|
|
19
18
|
logger: Logger;
|
|
20
19
|
mockL1?: boolean;
|
|
@@ -48,10 +47,8 @@ export declare class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
48
47
|
l1FeeJuiceAddress: EthAddress;
|
|
49
48
|
/** Fee asset handler address. */
|
|
50
49
|
feeAssetHandlerAddress: EthAddress;
|
|
51
|
-
/** Viem
|
|
52
|
-
|
|
53
|
-
/** Viem Wallet Client instance. */
|
|
54
|
-
walletClient: ViemWalletClient;
|
|
50
|
+
/** Viem Extended client instance. */
|
|
51
|
+
l1Client: ExtendedViemWalletClient;
|
|
55
52
|
readonly l1TokenManager: L1TokenManager;
|
|
56
53
|
readonly feeJuicePortalManager: L1FeeJuicePortalManager;
|
|
57
54
|
constructor(
|
|
@@ -73,10 +70,8 @@ export declare class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
73
70
|
l1FeeJuiceAddress: EthAddress,
|
|
74
71
|
/** Fee asset handler address. */
|
|
75
72
|
feeAssetHandlerAddress: EthAddress,
|
|
76
|
-
/** Viem
|
|
77
|
-
|
|
78
|
-
/** Viem Wallet Client instance. */
|
|
79
|
-
walletClient: ViemWalletClient);
|
|
73
|
+
/** Viem Extended client instance. */
|
|
74
|
+
l1Client: ExtendedViemWalletClient);
|
|
80
75
|
mintTokensOnL1(amount: bigint, to?: EthAddress): Promise<void>;
|
|
81
76
|
getL1FeeJuiceBalance(address: EthAddress): Promise<bigint>;
|
|
82
77
|
sendTokensToPortalPublic(bridgeAmount: bigint, l2Address: AztecAddress): Promise<L2AmountClaim>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gas_portal_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/gas_portal_test_harness.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EAEV,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"gas_portal_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/gas_portal_test_harness.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,UAAU,EAEV,uBAAuB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAEhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAItE,MAAM,WAAW,uBAAuB;IACtC,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACrF,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EA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P,MAAM,EAAE,MAAM;IAErB,gCAAgC;IACzB,QAAQ,EAAE,gBAAgB;IAEjC,oCAAoC;IAC7B,UAAU,EAAE,UAAU;IAE7B,sBAAsB;IACf,qBAAqB,EAAE,UAAU;IACxC,yCAAyC;IAClC,iBAAiB,EAAE,UAAU;IACpC,iCAAiC;IAC1B,sBAAsB,EAAE,UAAU;IACzC,qCAAqC;IAC9B,QAAQ,EAAE,wBAAwB;IAarC,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,GAAE,UAA4B;IAc/D,oBAAoB,CAAC,OAAO,EAAE,UAAU;IAI9C,wBAAwB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY;IAIhE,sCAAsC,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa;IAMhF,oBAAoB,CAAC,KAAK,EAAE,YAAY;IAIxC,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAKpE,iBAAiB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;IAc3D,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY;YAQlD,cAAc;CAK7B"}
|
|
@@ -9,8 +9,8 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
9
9
|
this.config = config;
|
|
10
10
|
}
|
|
11
11
|
async createReal() {
|
|
12
|
-
const { aztecNode, aztecNodeAdmin, pxeService,
|
|
13
|
-
const ethAccount = EthAddress.fromString((await
|
|
12
|
+
const { aztecNode, aztecNodeAdmin, pxeService, l1Client, wallet, logger } = this.config;
|
|
13
|
+
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
14
14
|
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
15
15
|
const feeJuiceAddress = l1ContractAddresses.feeJuiceAddress;
|
|
16
16
|
const feeJuicePortalAddress = l1ContractAddresses.feeJuicePortalAddress;
|
|
@@ -18,7 +18,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
18
18
|
throw new Error('Fee Juice portal not deployed on L1');
|
|
19
19
|
}
|
|
20
20
|
const gasL2 = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
21
|
-
return new GasBridgingTestHarness(aztecNode, aztecNodeAdmin, pxeService, logger, gasL2, ethAccount, feeJuicePortalAddress, feeJuiceAddress, l1ContractAddresses.feeAssetHandlerAddress,
|
|
21
|
+
return new GasBridgingTestHarness(aztecNode, aztecNodeAdmin, pxeService, logger, gasL2, ethAccount, feeJuicePortalAddress, feeJuiceAddress, l1ContractAddresses.feeAssetHandlerAddress, l1Client);
|
|
22
22
|
}
|
|
23
23
|
static create(config) {
|
|
24
24
|
const factory = new FeeJuicePortalTestingHarnessFactory(config);
|
|
@@ -38,11 +38,10 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
38
38
|
feeJuicePortalAddress;
|
|
39
39
|
l1FeeJuiceAddress;
|
|
40
40
|
feeAssetHandlerAddress;
|
|
41
|
-
|
|
42
|
-
walletClient;
|
|
41
|
+
l1Client;
|
|
43
42
|
l1TokenManager;
|
|
44
43
|
feeJuicePortalManager;
|
|
45
|
-
constructor(/** Aztec node */ aztecNode, /** Aztec node admin interface */ aztecNodeAdmin, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token/Bridge contract. */ feeJuice, /** Eth account to interact with. */ ethAccount, /** Portal address. */ feeJuicePortalAddress, /** Underlying token for portal tests. */ l1FeeJuiceAddress, /** Fee asset handler address. */ feeAssetHandlerAddress, /** Viem
|
|
44
|
+
constructor(/** Aztec node */ aztecNode, /** Aztec node admin interface */ aztecNodeAdmin, /** Private eXecution Environment (PXE). */ pxeService, /** Logger. */ logger, /** L2 Token/Bridge contract. */ feeJuice, /** Eth account to interact with. */ ethAccount, /** Portal address. */ feeJuicePortalAddress, /** Underlying token for portal tests. */ l1FeeJuiceAddress, /** Fee asset handler address. */ feeAssetHandlerAddress, /** Viem Extended client instance. */ l1Client){
|
|
46
45
|
this.aztecNode = aztecNode;
|
|
47
46
|
this.aztecNodeAdmin = aztecNodeAdmin;
|
|
48
47
|
this.pxeService = pxeService;
|
|
@@ -52,9 +51,8 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
52
51
|
this.feeJuicePortalAddress = feeJuicePortalAddress;
|
|
53
52
|
this.l1FeeJuiceAddress = l1FeeJuiceAddress;
|
|
54
53
|
this.feeAssetHandlerAddress = feeAssetHandlerAddress;
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.feeJuicePortalManager = new L1FeeJuicePortalManager(this.feeJuicePortalAddress, this.l1FeeJuiceAddress, this.feeAssetHandlerAddress, this.publicClient, this.walletClient, this.logger);
|
|
54
|
+
this.l1Client = l1Client;
|
|
55
|
+
this.feeJuicePortalManager = new L1FeeJuicePortalManager(this.feeJuicePortalAddress, this.l1FeeJuiceAddress, this.feeAssetHandlerAddress, this.l1Client, this.logger);
|
|
58
56
|
this.l1TokenManager = this.feeJuicePortalManager.getTokenManager();
|
|
59
57
|
}
|
|
60
58
|
async mintTokensOnL1(amount, to = this.ethAccount) {
|
|
@@ -63,7 +61,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
63
61
|
const feeAssetL1 = getContract({
|
|
64
62
|
address: this.l1FeeJuiceAddress.toString(),
|
|
65
63
|
abi: TestERC20Abi,
|
|
66
|
-
client: this.
|
|
64
|
+
client: this.l1Client
|
|
67
65
|
});
|
|
68
66
|
await feeAssetL1.write.mint([
|
|
69
67
|
to.toString(),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AccountWallet, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
3
|
-
import { type DeployL1ContractsReturnType, type
|
|
3
|
+
import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
4
4
|
/** Objects to be returned by the uniswap setup function */
|
|
5
5
|
export type UniswapSetupContext = {
|
|
6
6
|
/** Aztec Node instance */
|
|
@@ -9,10 +9,8 @@ export type UniswapSetupContext = {
|
|
|
9
9
|
pxe: PXE;
|
|
10
10
|
/** Logger instance named as the current test. */
|
|
11
11
|
logger: Logger;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/** Viem Wallet Client instance. */
|
|
15
|
-
walletClient: ViemWalletClient;
|
|
12
|
+
/** The L1 wallet client, extended with public actions. */
|
|
13
|
+
l1Client: ExtendedViemWalletClient;
|
|
16
14
|
/** The owner wallet. */
|
|
17
15
|
ownerWallet: AccountWallet;
|
|
18
16
|
/** The sponsor wallet. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,2BAA2B,
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EAGT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAqBzB,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,0BAA0B;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,+CAA+C;IAC/C,GAAG,EAAE,GAAG,CAAC;IACT,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,QAAQ,EAAE,wBAAwB,CAAC;IACnC,wBAAwB;IACxB,WAAW,EAAE,aAAa,CAAC;IAC3B,0BAA0B;IAC1B,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,UACxB,MAAM,QAAQ,mBAAmB,CAAC,WAChC,MAAM,QAAQ,IAAI,CAAC,2CA88B7B,CAAC"}
|
|
@@ -25,8 +25,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
25
25
|
let aztecNode;
|
|
26
26
|
let pxe;
|
|
27
27
|
let logger;
|
|
28
|
-
let
|
|
29
|
-
let publicClient;
|
|
28
|
+
let l1Client;
|
|
30
29
|
let ownerWallet;
|
|
31
30
|
let ownerAddress;
|
|
32
31
|
let ownerEthAddress;
|
|
@@ -46,29 +45,29 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
46
45
|
let cheatCodes;
|
|
47
46
|
let version;
|
|
48
47
|
beforeAll(async ()=>{
|
|
49
|
-
({ aztecNode, pxe, logger,
|
|
50
|
-
if (Number(await
|
|
48
|
+
({ aztecNode, pxe, logger, l1Client, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } = await setup());
|
|
49
|
+
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
51
50
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
52
51
|
}
|
|
53
|
-
rollup = new RollupContract(deployL1ContractsValues.
|
|
52
|
+
rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
54
53
|
version = Number(await rollup.getVersion());
|
|
55
54
|
ownerAddress = ownerWallet.getAddress();
|
|
56
55
|
// sponsorAddress = sponsorWallet.getAddress();
|
|
57
|
-
ownerEthAddress = EthAddress.fromString((await
|
|
56
|
+
ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
58
57
|
await ensureAccountsPubliclyDeployed(ownerWallet, [
|
|
59
58
|
ownerWallet,
|
|
60
59
|
sponsorWallet
|
|
61
60
|
]);
|
|
62
61
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
63
|
-
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe,
|
|
62
|
+
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, ownerWallet, logger, DAI_ADDRESS);
|
|
64
63
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
65
|
-
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe,
|
|
64
|
+
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, ownerWallet, logger, WETH9_ADDRESS);
|
|
66
65
|
logger.info('Deploy Uniswap portal on L1 and L2...');
|
|
67
|
-
uniswapPortalAddress = await deployL1Contract(
|
|
66
|
+
uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
|
|
68
67
|
uniswapPortal = getContract({
|
|
69
68
|
address: uniswapPortalAddress.toString(),
|
|
70
69
|
abi: UniswapPortalAbi,
|
|
71
|
-
client:
|
|
70
|
+
client: l1Client
|
|
72
71
|
});
|
|
73
72
|
// deploy l2 uniswap contract and attach to portal
|
|
74
73
|
uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send().deployed();
|
|
@@ -79,11 +78,11 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
79
78
|
], {});
|
|
80
79
|
// Give me some WETH so I can deposit to L2 and do the swap...
|
|
81
80
|
logger.info('Getting some weth');
|
|
82
|
-
const hash = await
|
|
81
|
+
const hash = await l1Client.sendTransaction({
|
|
83
82
|
to: WETH9_ADDRESS.toString(),
|
|
84
83
|
value: parseEther('1000')
|
|
85
84
|
});
|
|
86
|
-
await
|
|
85
|
+
await l1Client.waitForTransactionReceipt({
|
|
87
86
|
hash
|
|
88
87
|
});
|
|
89
88
|
const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
@@ -139,7 +138,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
139
138
|
uniswapL2Contract.address,
|
|
140
139
|
new Fr(version),
|
|
141
140
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
142
|
-
new Fr(
|
|
141
|
+
new Fr(l1Client.chain.id),
|
|
143
142
|
swapPrivateContent
|
|
144
143
|
]);
|
|
145
144
|
const withdrawContent = sha256ToField([
|
|
@@ -152,7 +151,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
152
151
|
wethCrossChainHarness.l2Bridge.address,
|
|
153
152
|
new Fr(version),
|
|
154
153
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
155
|
-
new Fr(
|
|
154
|
+
new Fr(l1Client.chain.id),
|
|
156
155
|
withdrawContent
|
|
157
156
|
]);
|
|
158
157
|
// ensure that user's funds were burnt
|
|
@@ -190,7 +189,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
190
189
|
]
|
|
191
190
|
];
|
|
192
191
|
// this should also insert a message into the inbox.
|
|
193
|
-
const txReceipt = await daiCrossChainHarness.
|
|
192
|
+
const txReceipt = await daiCrossChainHarness.l1Client.waitForTransactionReceipt({
|
|
194
193
|
hash: await uniswapPortal.write.swapPrivate(swapArgs)
|
|
195
194
|
});
|
|
196
195
|
// We get the msg leaf from event so that we can later wait for it to be available for consumption
|
|
@@ -536,7 +535,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
536
535
|
uniswapL2Contract.address,
|
|
537
536
|
new Fr(version),
|
|
538
537
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
539
|
-
new Fr(
|
|
538
|
+
new Fr(l1Client.chain.id),
|
|
540
539
|
swapPrivateContent
|
|
541
540
|
]);
|
|
542
541
|
const withdrawContent = sha256ToField([
|
|
@@ -549,7 +548,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
549
548
|
wethCrossChainHarness.l2Bridge.address,
|
|
550
549
|
new Fr(version),
|
|
551
550
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
552
|
-
new Fr(
|
|
551
|
+
new Fr(l1Client.chain.id),
|
|
553
552
|
withdrawContent
|
|
554
553
|
]);
|
|
555
554
|
const [swapPrivateL2MessageIndex, swapPrivateSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPrivateLeaf);
|
|
@@ -616,7 +615,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
616
615
|
uniswapL2Contract.address,
|
|
617
616
|
new Fr(version),
|
|
618
617
|
EthAddress.fromString(uniswapPortal.address).toBuffer32(),
|
|
619
|
-
new Fr(
|
|
618
|
+
new Fr(l1Client.chain.id),
|
|
620
619
|
swapPublicContent
|
|
621
620
|
]);
|
|
622
621
|
const withdrawContent = sha256ToField([
|
|
@@ -629,7 +628,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
629
628
|
wethCrossChainHarness.l2Bridge.address,
|
|
630
629
|
new Fr(version),
|
|
631
630
|
wethCrossChainHarness.tokenPortalAddress.toBuffer32(),
|
|
632
|
-
new Fr(
|
|
631
|
+
new Fr(l1Client.chain.id),
|
|
633
632
|
withdrawContent
|
|
634
633
|
]);
|
|
635
634
|
const [swapPublicL2MessageIndex, swapPublicSiblingPath] = await aztecNode.getL2ToL1MessageMembershipWitness(withdrawReceipt.blockNumber, swapPublicLeaf);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSchnorrAccount, getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { generateSchnorrAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
3
3
|
import { FeeJuicePaymentMethodWithClaim, Fr, L1FeeJuicePortalManager, createAztecNodeClient, createCompatibleClient, retryUntil } from '@aztec/aztec.js';
|
|
4
|
-
import { createEthereumChain,
|
|
4
|
+
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
6
|
const TOKEN_NAME = 'USDC';
|
|
7
7
|
const TOKEN_SYMBOL = 'USD';
|
|
@@ -59,9 +59,9 @@ export async function deployTestWalletWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mne
|
|
|
59
59
|
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
60
60
|
const { l1ChainId } = await pxe.getNodeInfo();
|
|
61
61
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
62
|
-
const
|
|
62
|
+
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
63
63
|
// docs:start:bridge_fee_juice
|
|
64
|
-
const portal = await L1FeeJuicePortalManager.new(pxe,
|
|
64
|
+
const portal = await L1FeeJuicePortalManager.new(pxe, l1Client, log);
|
|
65
65
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true);
|
|
66
66
|
// docs:end:bridge_fee_juice
|
|
67
67
|
const isSynced = async ()=>await pxe.isL1ToL2MessageSynced(Fr.fromHexString(claim.messageHash));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"build": "yarn clean && tsc -b",
|
|
12
12
|
"build:dev": "tsc -b --watch",
|
|
13
13
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
14
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
15
14
|
"test:with-alerts": "./scripts/test-with-alerts.sh",
|
|
16
15
|
"test:e2e": "LOG_LEVEL=${LOG_LEVEL:-verbose} NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=300000 --forceExit",
|
|
17
16
|
"test:e2e-docker": "./scripts/run_test.sh simple",
|
|
@@ -26,41 +25,40 @@
|
|
|
26
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@aztec/accounts": "0.
|
|
30
|
-
"@aztec/archiver": "0.
|
|
31
|
-
"@aztec/aztec": "0.
|
|
32
|
-
"@aztec/aztec-node": "0.
|
|
33
|
-
"@aztec/aztec.js": "0.
|
|
34
|
-
"@aztec/bb-prover": "0.
|
|
35
|
-
"@aztec/blob-lib": "0.
|
|
36
|
-
"@aztec/blob-sink": "0.
|
|
37
|
-
"@aztec/bot": "0.
|
|
38
|
-
"@aztec/cli": "0.
|
|
39
|
-
"@aztec/constants": "0.
|
|
40
|
-
"@aztec/entrypoints": "0.
|
|
41
|
-
"@aztec/epoch-cache": "0.
|
|
42
|
-
"@aztec/ethereum": "0.
|
|
43
|
-
"@aztec/foundation": "0.
|
|
44
|
-
"@aztec/kv-store": "0.
|
|
45
|
-
"@aztec/l1-artifacts": "0.
|
|
46
|
-
"@aztec/merkle-tree": "0.
|
|
47
|
-
"@aztec/noir-contracts.js": "0.
|
|
48
|
-
"@aztec/noir-noirc_abi": "0.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
50
|
-
"@aztec/p2p": "0.
|
|
51
|
-
"@aztec/protocol-contracts": "0.
|
|
52
|
-
"@aztec/prover-client": "0.
|
|
53
|
-
"@aztec/prover-node": "0.
|
|
54
|
-
"@aztec/pxe": "0.
|
|
55
|
-
"@aztec/sequencer-client": "0.
|
|
56
|
-
"@aztec/simulator": "0.
|
|
57
|
-
"@aztec/stdlib": "0.
|
|
58
|
-
"@aztec/telemetry-client": "0.
|
|
59
|
-
"@aztec/validator-client": "0.
|
|
60
|
-
"@aztec/world-state": "0.
|
|
28
|
+
"@aztec/accounts": "0.86.0",
|
|
29
|
+
"@aztec/archiver": "0.86.0",
|
|
30
|
+
"@aztec/aztec": "0.86.0",
|
|
31
|
+
"@aztec/aztec-node": "0.86.0",
|
|
32
|
+
"@aztec/aztec.js": "0.86.0",
|
|
33
|
+
"@aztec/bb-prover": "0.86.0",
|
|
34
|
+
"@aztec/blob-lib": "0.86.0",
|
|
35
|
+
"@aztec/blob-sink": "0.86.0",
|
|
36
|
+
"@aztec/bot": "0.86.0",
|
|
37
|
+
"@aztec/cli": "0.86.0",
|
|
38
|
+
"@aztec/constants": "0.86.0",
|
|
39
|
+
"@aztec/entrypoints": "0.86.0",
|
|
40
|
+
"@aztec/epoch-cache": "0.86.0",
|
|
41
|
+
"@aztec/ethereum": "0.86.0",
|
|
42
|
+
"@aztec/foundation": "0.86.0",
|
|
43
|
+
"@aztec/kv-store": "0.86.0",
|
|
44
|
+
"@aztec/l1-artifacts": "0.86.0",
|
|
45
|
+
"@aztec/merkle-tree": "0.86.0",
|
|
46
|
+
"@aztec/noir-contracts.js": "0.86.0",
|
|
47
|
+
"@aztec/noir-noirc_abi": "0.86.0",
|
|
48
|
+
"@aztec/noir-protocol-circuits-types": "0.86.0",
|
|
49
|
+
"@aztec/p2p": "0.86.0",
|
|
50
|
+
"@aztec/protocol-contracts": "0.86.0",
|
|
51
|
+
"@aztec/prover-client": "0.86.0",
|
|
52
|
+
"@aztec/prover-node": "0.86.0",
|
|
53
|
+
"@aztec/pxe": "0.86.0",
|
|
54
|
+
"@aztec/sequencer-client": "0.86.0",
|
|
55
|
+
"@aztec/simulator": "0.86.0",
|
|
56
|
+
"@aztec/stdlib": "0.86.0",
|
|
57
|
+
"@aztec/telemetry-client": "0.86.0",
|
|
58
|
+
"@aztec/validator-client": "0.86.0",
|
|
59
|
+
"@aztec/world-state": "0.86.0",
|
|
61
60
|
"@iarna/toml": "^2.2.5",
|
|
62
61
|
"@jest/globals": "^29.5.0",
|
|
63
|
-
"@msgpack/msgpack": "^3.0.0-beta2",
|
|
64
62
|
"@noble/curves": "^1.0.0",
|
|
65
63
|
"@swc/core": "^1.4.11",
|
|
66
64
|
"@swc/jest": "^0.2.36",
|
|
@@ -85,6 +83,7 @@
|
|
|
85
83
|
"lodash.compact": "^3.0.1",
|
|
86
84
|
"lodash.every": "^4.6.0",
|
|
87
85
|
"lodash.omit": "^4.5.0",
|
|
86
|
+
"msgpackr": "^1.11.2",
|
|
88
87
|
"process": "^0.11.10",
|
|
89
88
|
"stream-browserify": "^3.0.0",
|
|
90
89
|
"string-argv": "^0.3.2",
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from '@aztec/aztec.js';
|
|
17
17
|
import { CheatCodes } from '@aztec/aztec.js/testing';
|
|
18
18
|
import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
|
|
19
|
-
import { type DeployL1ContractsArgs, RollupContract,
|
|
19
|
+
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
|
|
20
20
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
21
21
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
22
22
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
@@ -234,8 +234,7 @@ export class ClientFlowsBenchmark {
|
|
|
234
234
|
aztecNode: context.aztecNode,
|
|
235
235
|
aztecNodeAdmin: context.aztecNode,
|
|
236
236
|
pxeService: context.pxe,
|
|
237
|
-
|
|
238
|
-
walletClient: context.deployL1ContractsValues.walletClient,
|
|
237
|
+
l1Client: context.deployL1ContractsValues.l1Client,
|
|
239
238
|
wallet: this.adminWallet,
|
|
240
239
|
logger: this.logger,
|
|
241
240
|
});
|
|
@@ -314,20 +313,19 @@ export class ClientFlowsBenchmark {
|
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
public async createCrossChainTestHarness(owner: AccountWallet) {
|
|
317
|
-
const
|
|
316
|
+
const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
318
317
|
|
|
319
|
-
const underlyingERC20Address = await deployL1Contract(
|
|
318
|
+
const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
320
319
|
'Underlying',
|
|
321
320
|
'UND',
|
|
322
|
-
|
|
321
|
+
l1Client.account.address,
|
|
323
322
|
]).then(({ address }) => address);
|
|
324
323
|
|
|
325
324
|
this.logger.verbose(`Setting up cross chain harness...`);
|
|
326
325
|
const crossChainTestHarness = await CrossChainTestHarness.new(
|
|
327
326
|
this.aztecNode,
|
|
328
327
|
this.pxe,
|
|
329
|
-
|
|
330
|
-
walletClient,
|
|
328
|
+
l1Client,
|
|
331
329
|
owner,
|
|
332
330
|
this.logger,
|
|
333
331
|
underlyingERC20Address,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Logger } from '@aztec/aztec.js';
|
|
2
|
-
import { BBNativePrivateKernelProver } from '@aztec/bb-prover';
|
|
3
|
-
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/wasm/bundle';
|
|
2
|
+
import { BBNativePrivateKernelProver } from '@aztec/bb-prover/client/native';
|
|
3
|
+
import { BBWASMBundlePrivateKernelProver } from '@aztec/bb-prover/client/wasm/bundle';
|
|
4
4
|
import { createLogger, logger } from '@aztec/foundation/log';
|
|
5
5
|
import { WASMSimulator } from '@aztec/simulator/client';
|
|
6
6
|
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Decoder } from 'msgpackr';
|
|
9
9
|
import assert from 'node:assert';
|
|
10
10
|
import { readFile, readdir, writeFile } from 'node:fs/promises';
|
|
11
11
|
import { join } from 'node:path';
|
|
@@ -149,9 +149,10 @@ async function main() {
|
|
|
149
149
|
|
|
150
150
|
for (const flow of flows) {
|
|
151
151
|
userLog.info(`Processing flow ${flow}`);
|
|
152
|
-
const
|
|
153
|
-
const
|
|
152
|
+
const ivcInputs = await readFile(join(ivcFolder, flow, 'ivc-inputs.msgpack'));
|
|
153
|
+
const stepsFromFile: PrivateExecutionStep[] = new Decoder({ useRecords: false }).unpack(ivcInputs);
|
|
154
154
|
const witnesses = await readFile(join(ivcFolder, flow, 'witnesses.json'));
|
|
155
|
+
|
|
155
156
|
const witnessStack = JSON.parse(witnesses.toString()).map((witnessMap: Record<string, string>) => {
|
|
156
157
|
return new Map<number, string>(Object.entries(witnessMap).map(([k, v]) => [Number(k), v]));
|
|
157
158
|
});
|
|
@@ -160,8 +161,11 @@ async function main() {
|
|
|
160
161
|
const privateExecutionSteps: PrivateExecutionStep[] = executionSteps.map((step, i) => ({
|
|
161
162
|
functionName: step.fnName,
|
|
162
163
|
gateCount: step.gateCount,
|
|
163
|
-
bytecode:
|
|
164
|
+
bytecode: stepsFromFile[i].bytecode,
|
|
165
|
+
// TODO(AD) do we still want to take this from witness.json?
|
|
164
166
|
witness: witnessStack[i],
|
|
167
|
+
// This can be left empty. If so, the prover will generate a vk on the fly (~25% slower).
|
|
168
|
+
vk: Buffer.from([]),
|
|
165
169
|
}));
|
|
166
170
|
let stats: { duration: number; eventName: string; proofSize: number } | undefined;
|
|
167
171
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|