@aztec/end-to-end 3.0.0-nightly.20250910 → 3.0.0-nightly.20250911
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 +14 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +35 -39
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -4
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -6
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +38 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +4 -5
- 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 +16 -20
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +4 -7
- package/dest/e2e_fees/bridging_race.notest.js +10 -8
- package/dest/e2e_fees/fees_test.d.ts +3 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +26 -21
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +3 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +6 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +7 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +13 -16
- package/dest/fixtures/e2e_prover_test.d.ts +4 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +22 -29
- package/dest/fixtures/snapshot_manager.d.ts +6 -4
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +22 -12
- package/dest/fixtures/token_utils.d.ts +3 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +8 -10
- package/dest/fixtures/utils.d.ts +7 -7
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +29 -25
- package/dest/shared/cross_chain_test_harness.d.ts +6 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +5 -6
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +4 -5
- package/dest/shared/uniswap_l1_l2.d.ts +6 -4
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -21
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +12 -10
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +54 -50
- package/package.json +37 -36
- package/src/bench/client_flows/client_flows_benchmark.ts +41 -52
- package/src/bench/utils.ts +6 -6
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +39 -50
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +15 -33
- package/src/e2e_deploy_contract/deploy_test.ts +6 -14
- package/src/e2e_fees/bridging_race.notest.ts +12 -9
- package/src/e2e_fees/fees_test.ts +30 -30
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -8
- package/src/e2e_p2p/p2p_network.ts +10 -10
- package/src/e2e_p2p/shared.ts +7 -16
- package/src/e2e_token_contract/token_contract_test.ts +14 -17
- package/src/fixtures/e2e_prover_test.ts +26 -60
- package/src/fixtures/snapshot_manager.ts +32 -24
- package/src/fixtures/token_utils.ts +7 -15
- package/src/fixtures/utils.ts +37 -41
- package/src/shared/cross_chain_test_harness.ts +5 -7
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +7 -8
- package/src/shared/uniswap_l1_l2.ts +40 -36
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +82 -73
package/dest/fixtures/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import {
|
|
2
|
+
import { generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
5
|
import { BatchCall, createAztecNodeClient, createLogger, createPXEClient, makeFetch, sleep, waitForPXE } from '@aztec/aztec.js';
|
|
@@ -30,6 +30,7 @@ import { getContractClassFromArtifact, getContractInstanceFromInstantiationParam
|
|
|
30
30
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
31
31
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
32
32
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
33
|
+
import { TestWallet, deployFundedSchnorrAccounts } from '@aztec/test-wallet';
|
|
33
34
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
34
35
|
import fs from 'fs/promises';
|
|
35
36
|
import getPort from 'get-port';
|
|
@@ -146,13 +147,17 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
146
147
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
147
148
|
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, pxeClient);
|
|
148
149
|
const teardown = ()=>Promise.resolve();
|
|
149
|
-
logger.verbose('
|
|
150
|
+
logger.verbose('Populating wallet from already registered accounts...');
|
|
150
151
|
const initialFundedAccounts = await getDeployedTestAccounts(pxeClient);
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${
|
|
152
|
+
const wallet = new TestWallet(pxeClient);
|
|
153
|
+
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
154
|
+
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
154
155
|
// Deploy new accounts if there's a test that requires more funded accounts in the remote environment.
|
|
155
156
|
}
|
|
157
|
+
const testAccounts = await Promise.all(initialFundedAccounts.slice(0, numberOfAccounts).map(async (account)=>{
|
|
158
|
+
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
159
|
+
return accountManager.getAddress();
|
|
160
|
+
}));
|
|
156
161
|
return {
|
|
157
162
|
aztecNode,
|
|
158
163
|
aztecNodeAdmin: undefined,
|
|
@@ -162,9 +167,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
162
167
|
deployL1ContractsValues,
|
|
163
168
|
config,
|
|
164
169
|
initialFundedAccounts,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
accounts: wallets.slice(0, numberOfAccounts).map((w)=>w.getAddress()),
|
|
170
|
+
wallet,
|
|
171
|
+
accounts: testAccounts,
|
|
168
172
|
logger,
|
|
169
173
|
cheatCodes,
|
|
170
174
|
ethCheatCodes,
|
|
@@ -416,8 +420,9 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
416
420
|
await cheatCodes.rollup.setupEpoch();
|
|
417
421
|
await cheatCodes.rollup.debugRollup();
|
|
418
422
|
}
|
|
423
|
+
const wallet = new TestWallet(pxe);
|
|
424
|
+
let accounts = [];
|
|
419
425
|
// Below we continue with what we described in the long comment on line 571.
|
|
420
|
-
let accountManagers = [];
|
|
421
426
|
if (numberOfAccounts === 0) {
|
|
422
427
|
logger.info('No accounts are being deployed, waiting for an empty block 1 to be mined');
|
|
423
428
|
while(await pxe.getBlockNumber() === 0){
|
|
@@ -425,13 +430,14 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
425
430
|
}
|
|
426
431
|
} else {
|
|
427
432
|
logger.info(`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`);
|
|
428
|
-
|
|
433
|
+
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
434
|
+
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
435
|
+
accounts = accountManagers.map((accountManager)=>accountManager.getAddress());
|
|
429
436
|
}
|
|
430
437
|
// Now we restore the original minTxsPerBlock setting.
|
|
431
438
|
sequencerClient.getSequencer().updateConfig({
|
|
432
439
|
minTxsPerBlock: originalMinTxsPerBlock
|
|
433
440
|
});
|
|
434
|
-
const wallets = await Promise.all(accountManagers.map((account)=>account.getWallet()));
|
|
435
441
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
436
442
|
// TODO: Create (numberOfAccounts - initialFundedAccounts.length) wallets without funds.
|
|
437
443
|
throw new Error(`Unable to deploy ${numberOfAccounts} accounts. Only ${initialFundedAccounts.length} accounts were funded.`);
|
|
@@ -473,9 +479,8 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
473
479
|
sequencer: sequencerClient,
|
|
474
480
|
teardown,
|
|
475
481
|
telemetryClient: telemetry,
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
accounts: wallets.map((w)=>w.getAddress()),
|
|
482
|
+
wallet,
|
|
483
|
+
accounts,
|
|
479
484
|
watcher
|
|
480
485
|
};
|
|
481
486
|
} catch (err) {
|
|
@@ -490,27 +495,26 @@ export const setupL1Contracts = async (l1RpcUrls, account, logger, args = {}, ch
|
|
|
490
495
|
* @param sender - Wallet to send the deployment tx.
|
|
491
496
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
492
497
|
*/ // docs:start:public_deploy_accounts
|
|
493
|
-
export async function ensureAccountContractsPublished(
|
|
498
|
+
export async function ensureAccountContractsPublished(wallet, accountsToDeploy) {
|
|
494
499
|
// We have to check whether the accounts are already deployed. This can happen if the test runs against
|
|
495
500
|
// the sandbox and the test accounts exist
|
|
496
|
-
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (
|
|
497
|
-
const address = account.getAddress();
|
|
501
|
+
const accountsAndAddresses = await Promise.all(accountsToDeploy.map(async (address)=>{
|
|
498
502
|
return {
|
|
499
503
|
address,
|
|
500
|
-
deployed: (await
|
|
504
|
+
deployed: (await wallet.getContractMetadata(address)).isContractPublished
|
|
501
505
|
};
|
|
502
506
|
}));
|
|
503
|
-
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>
|
|
507
|
+
const instances = (await Promise.all(accountsAndAddresses.filter(({ deployed })=>!deployed).map(({ address })=>wallet.getContractMetadata(address)))).map((contractMetadata)=>contractMetadata.contractInstance);
|
|
504
508
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
505
|
-
if (!(await
|
|
506
|
-
await (await publishContractClass(
|
|
507
|
-
from: accountsToDeploy[0]
|
|
509
|
+
if (!(await wallet.getContractClassMetadata(contractClass.id, true)).isContractClassPubliclyRegistered) {
|
|
510
|
+
await (await publishContractClass(wallet, SchnorrAccountContractArtifact)).send({
|
|
511
|
+
from: accountsToDeploy[0]
|
|
508
512
|
}).wait();
|
|
509
513
|
}
|
|
510
|
-
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(
|
|
511
|
-
const batch = new BatchCall(
|
|
514
|
+
const requests = await Promise.all(instances.map(async (instance)=>await publishInstance(wallet, instance)));
|
|
515
|
+
const batch = new BatchCall(wallet, requests);
|
|
512
516
|
await batch.send({
|
|
513
|
-
from: accountsToDeploy[0]
|
|
517
|
+
from: accountsToDeploy[0]
|
|
514
518
|
}).wait();
|
|
515
519
|
}
|
|
516
520
|
// docs:end:public_deploy_accounts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { 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
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';
|
|
@@ -70,11 +70,11 @@ export declare class CrossChainTestHarness {
|
|
|
70
70
|
l1Client: ExtendedViemWalletClient;
|
|
71
71
|
/** Deployment addresses for all L1 contracts */
|
|
72
72
|
readonly l1ContractAddresses: L1ContractAddresses;
|
|
73
|
-
/** Wallet
|
|
74
|
-
readonly
|
|
73
|
+
/** Wallet to simulate and send txs from. */
|
|
74
|
+
readonly wallet: Wallet;
|
|
75
75
|
/** Owner of the l2 token and bridge */
|
|
76
76
|
readonly ownerAddress: AztecAddress;
|
|
77
|
-
static new(aztecNode: AztecNode, pxeService: PXE, l1Client: ExtendedViemWalletClient, wallet:
|
|
77
|
+
static new(aztecNode: AztecNode, pxeService: PXE, l1Client: ExtendedViemWalletClient, wallet: Wallet, ownerAddress: AztecAddress, logger: Logger, underlyingERC20Address: EthAddress): Promise<CrossChainTestHarness>;
|
|
78
78
|
private readonly l1TokenManager;
|
|
79
79
|
private readonly l1TokenPortalManager;
|
|
80
80
|
constructor(
|
|
@@ -98,8 +98,8 @@ export declare class CrossChainTestHarness {
|
|
|
98
98
|
l1Client: ExtendedViemWalletClient,
|
|
99
99
|
/** Deployment addresses for all L1 contracts */
|
|
100
100
|
l1ContractAddresses: L1ContractAddresses,
|
|
101
|
-
/** Wallet
|
|
102
|
-
|
|
101
|
+
/** Wallet to simulate and send txs from. */
|
|
102
|
+
wallet: Wallet,
|
|
103
103
|
/** Owner of the l2 token and bridge */
|
|
104
104
|
ownerAddress: AztecAddress);
|
|
105
105
|
mintTokensOnL1(amount: bigint): Promise<void>;
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"cross_chain_test_harness.d.ts","sourceRoot":"","sources":["../../src/shared/cross_chain_test_harness.ts"],"names":[],"mappings":"AACA,OAAO,EACL,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;AAE3E,OAAO,EAAE,KAAK,GAAG,EAAe,MAAM,MAAM,CAAC;AAK7C;;;;;;;;;GASG;AACH,wBAAsB,0CAA0C,CAC9D,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,wBAAwB,EAClC,qBAAqB,EAAE,UAAU,EACjC,KAAK,EAAE,YAAY,EACnB,sBAAsB,EAAE,UAAU,GACjC,OAAO,CAAC;IACT;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB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AC,SAAS,CAAC,CAAC;IASzB,2BAA2B,CAAC,cAAc,EAAE,MAAM,EAAE,YAAY,GAAE,EAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAS7G,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;IAQ1C,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,KAAU;IAQjE;;;;;;OAMG;IACG,qBAAqB,CAAC,OAAO,EAAE,EAAE,GAAG,GAAG;IAS7C,mBAAmB,IAAI,iBAAiB;CAYzC"}
|
|
@@ -84,20 +84,20 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
84
84
|
underlyingERC20Address;
|
|
85
85
|
l1Client;
|
|
86
86
|
l1ContractAddresses;
|
|
87
|
-
|
|
87
|
+
wallet;
|
|
88
88
|
ownerAddress;
|
|
89
89
|
static async new(aztecNode, pxeService, l1Client, wallet, ownerAddress, logger, underlyingERC20Address) {
|
|
90
90
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
91
91
|
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
92
92
|
// Deploy and initialize all required contracts
|
|
93
93
|
logger.info('Deploying and initializing token, portal and its bridge...');
|
|
94
|
-
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress,
|
|
94
|
+
const { token, bridge, tokenPortalAddress, underlyingERC20 } = await deployAndInitializeTokenAndBridgeContracts(wallet, l1Client, l1ContractAddresses.registryAddress, ownerAddress, underlyingERC20Address);
|
|
95
95
|
logger.info('Deployed and initialized token, portal and its bridge.');
|
|
96
96
|
return new CrossChainTestHarness(aztecNode, pxeService, logger, token, bridge, ethAccount, tokenPortalAddress, underlyingERC20.address, l1Client, l1ContractAddresses, wallet, ownerAddress);
|
|
97
97
|
}
|
|
98
98
|
l1TokenManager;
|
|
99
99
|
l1TokenPortalManager;
|
|
100
|
-
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
|
|
100
|
+
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 to simulate and send txs from. */ wallet, /** Owner of the l2 token and bridge */ ownerAddress){
|
|
101
101
|
this.aztecNode = aztecNode;
|
|
102
102
|
this.pxeService = pxeService;
|
|
103
103
|
this.logger = logger;
|
|
@@ -108,11 +108,10 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
108
108
|
this.underlyingERC20Address = underlyingERC20Address;
|
|
109
109
|
this.l1Client = l1Client;
|
|
110
110
|
this.l1ContractAddresses = l1ContractAddresses;
|
|
111
|
-
this.
|
|
111
|
+
this.wallet = wallet;
|
|
112
112
|
this.ownerAddress = ownerAddress;
|
|
113
113
|
this.l1TokenPortalManager = new L1TokenPortalManager(this.tokenPortalAddress, this.underlyingERC20Address, this.l1ContractAddresses.feeAssetHandlerAddress, this.l1ContractAddresses.outboxAddress, this.l1Client, this.logger);
|
|
114
114
|
this.l1TokenManager = this.l1TokenPortalManager.getTokenManager();
|
|
115
|
-
this.ownerAddress = this.ownerWallet.getAddress();
|
|
116
115
|
}
|
|
117
116
|
async mintTokensOnL1(amount) {
|
|
118
117
|
const contract = getContract({
|
|
@@ -146,7 +145,7 @@ import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
|
146
145
|
}).wait();
|
|
147
146
|
}
|
|
148
147
|
async mintTokensPrivateOnL2(amount) {
|
|
149
|
-
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.
|
|
148
|
+
await mintTokensToPrivate(this.l2Token, this.ownerAddress, this.ownerAddress, amount);
|
|
150
149
|
}
|
|
151
150
|
async sendL2PublicTransfer(transferAmount, receiverAddress) {
|
|
152
151
|
// send a transfer tx to force through rollup with the message included
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress, type AztecNode, EthAddress, L1FeeJuicePortalManager, type L1TokenManager, type L2AmountClaim, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
2
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';
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"gas_portal_test_harness.d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,EAAE,MAAM;IAKpE,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAerC,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY;YAQnD,cAAc;CAe7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Logger, type SentTx
|
|
2
|
-
import type {
|
|
3
|
-
export declare const submitTxsTo: (
|
|
1
|
+
import { AztecAddress, type Logger, type SentTx } from '@aztec/aztec.js';
|
|
2
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
3
|
+
export declare const submitTxsTo: (wallet: TestWallet, submitter: AztecAddress, numTxs: number, logger: Logger) => Promise<SentTx[]>;
|
|
4
4
|
//# sourceMappingURL=submit-transactions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"submit-transactions.d.ts","sourceRoot":"","sources":["../../src/shared/submit-transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAsB,KAAK,MAAM,EAAE,KAAK,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAEvG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,eAAO,MAAM,WAAW,GACtB,QAAQ,UAAU,EAClB,WAAW,YAAY,EACvB,QAAQ,MAAM,EACd,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,EAAE,CAqBlB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { Fr, GrumpkinScalar, TxStatus } from '@aztec/aztec.js';
|
|
3
2
|
import { times } from '@aztec/foundation/collection';
|
|
4
|
-
// submits a set of transactions to the provided
|
|
5
|
-
export const submitTxsTo = async (
|
|
3
|
+
// submits a set of transactions to the provided Wallet
|
|
4
|
+
export const submitTxsTo = async (wallet, submitter, numTxs, logger)=>{
|
|
6
5
|
const txs = [];
|
|
7
6
|
await Promise.all(times(numTxs, async ()=>{
|
|
8
|
-
const accountManager = await
|
|
7
|
+
const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
|
|
9
8
|
const tx = accountManager.deploy({
|
|
10
|
-
|
|
9
|
+
deployAccount: submitter
|
|
11
10
|
});
|
|
12
11
|
const txHash = await tx.getTxHash();
|
|
13
12
|
logger.info(`Tx sent with hash ${txHash}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type PXE, type Wallet } from '@aztec/aztec.js';
|
|
2
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
3
3
|
import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
4
4
|
/** Objects to be returned by the uniswap setup function */
|
|
@@ -11,10 +11,12 @@ export type UniswapSetupContext = {
|
|
|
11
11
|
logger: Logger;
|
|
12
12
|
/** The L1 wallet client, extended with public actions. */
|
|
13
13
|
l1Client: ExtendedViemWalletClient;
|
|
14
|
-
/** The
|
|
15
|
-
|
|
14
|
+
/** The wallet. */
|
|
15
|
+
wallet: Wallet;
|
|
16
|
+
/** The owner address. */
|
|
17
|
+
ownerAddress: AztecAddress;
|
|
16
18
|
/** The sponsor wallet. */
|
|
17
|
-
|
|
19
|
+
sponsorAddress: AztecAddress;
|
|
18
20
|
/** */
|
|
19
21
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
20
22
|
/** Cheat codes instance. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"uniswap_l1_l2.d.ts","sourceRoot":"","sources":["../../src/shared/uniswap_l1_l2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EAGd,KAAK,MAAM,EACX,KAAK,GAAG,EACR,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAI9B,MAAM,iBAAiB,CAAC;AAuBzB,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,kBAAkB;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,0BAA0B;IAC1B,cAAc,EAAE,YAAY,CAAC;IAC7B,OAAO;IACP,uBAAuB,EAAE,2BAA2B,CAAC;IACrD,4BAA4B;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,OAAO,CAAC,mBAAmB,CAAC,EACzC,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,gCAAkC,SAk+BnC,CAAC"}
|
|
@@ -28,11 +28,10 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
28
28
|
let pxe;
|
|
29
29
|
let logger;
|
|
30
30
|
let l1Client;
|
|
31
|
-
let
|
|
31
|
+
let wallet;
|
|
32
32
|
let ownerAddress;
|
|
33
33
|
let ownerEthAddress;
|
|
34
34
|
// does transactions on behalf of owner on Aztec:
|
|
35
|
-
let sponsorWallet;
|
|
36
35
|
let sponsorAddress;
|
|
37
36
|
let daiCrossChainHarness;
|
|
38
37
|
let wethCrossChainHarness;
|
|
@@ -47,23 +46,21 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
47
46
|
let cheatCodes;
|
|
48
47
|
let version;
|
|
49
48
|
beforeAll(async ()=>{
|
|
50
|
-
({ aztecNode, pxe, logger, l1Client,
|
|
49
|
+
({ aztecNode, pxe, logger, l1Client, wallet, ownerAddress, sponsorAddress, deployL1ContractsValues, cheatCodes } = await setup());
|
|
51
50
|
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
52
51
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
53
52
|
}
|
|
54
53
|
rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
55
54
|
version = Number(await rollup.getVersion());
|
|
56
|
-
ownerAddress = ownerWallet.getAddress();
|
|
57
|
-
sponsorAddress = sponsorWallet.getAddress();
|
|
58
55
|
ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
59
|
-
await ensureAccountContractsPublished(
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
await ensureAccountContractsPublished(wallet, [
|
|
57
|
+
ownerAddress,
|
|
58
|
+
sponsorAddress
|
|
62
59
|
]);
|
|
63
60
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
64
|
-
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client,
|
|
61
|
+
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, wallet, ownerAddress, logger, DAI_ADDRESS);
|
|
65
62
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
66
|
-
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client,
|
|
63
|
+
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, wallet, ownerAddress, logger, WETH9_ADDRESS);
|
|
67
64
|
logger.info('Deploy Uniswap portal on L1 and L2...');
|
|
68
65
|
uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
|
|
69
66
|
uniswapPortal = getContract({
|
|
@@ -72,7 +69,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
72
69
|
client: l1Client
|
|
73
70
|
});
|
|
74
71
|
// deploy l2 uniswap contract and attach to portal
|
|
75
|
-
uniswapL2Contract = await UniswapContract.deploy(
|
|
72
|
+
uniswapL2Contract = await UniswapContract.deploy(wallet, uniswapPortalAddress).send({
|
|
76
73
|
from: ownerAddress
|
|
77
74
|
}).deployed();
|
|
78
75
|
const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
@@ -115,7 +112,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
115
112
|
// 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
116
113
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
117
114
|
const nonceForWETHTransferToPublicApproval = new Fr(1n);
|
|
118
|
-
const transferToPublicAuhtwit = await
|
|
115
|
+
const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
|
|
119
116
|
caller: uniswapL2Contract.address,
|
|
120
117
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
121
118
|
});
|
|
@@ -444,8 +441,8 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
444
441
|
caller: uniswapL2Contract.address,
|
|
445
442
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
446
443
|
}, {
|
|
447
|
-
chainId:
|
|
448
|
-
version:
|
|
444
|
+
chainId: new Fr(await aztecNode.getChainId()),
|
|
445
|
+
version: new Fr(await aztecNode.getVersion())
|
|
449
446
|
});
|
|
450
447
|
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
|
|
451
448
|
from: ownerAddress
|
|
@@ -458,7 +455,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
458
455
|
// 2. owner gives uniswap approval to transfer the funds to public:
|
|
459
456
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
460
457
|
const nonceForWETHTransferToPublicApproval = new Fr(3n);
|
|
461
|
-
const transferToPublicAuthwith = await
|
|
458
|
+
const transferToPublicAuthwith = await wallet.createAuthWit(ownerAddress, {
|
|
462
459
|
caller: uniswapL2Contract.address,
|
|
463
460
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
464
461
|
});
|
|
@@ -477,7 +474,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
477
474
|
await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
|
|
478
475
|
// 2. Give approval to uniswap to transfer funds to itself
|
|
479
476
|
const nonceForWETHTransferApproval = new Fr(2n);
|
|
480
|
-
const validateActionInteraction = await
|
|
477
|
+
const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
|
|
481
478
|
caller: uniswapL2Contract.address,
|
|
482
479
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
483
480
|
}, true);
|
|
@@ -498,8 +495,8 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
498
495
|
const nonceForWETHTransferApproval = new Fr(3n);
|
|
499
496
|
const nonceForSwap = new Fr(3n);
|
|
500
497
|
const secretHashForDepositingSwappedDai = new Fr(4n);
|
|
501
|
-
const action = uniswapL2Contract.
|
|
502
|
-
const validateActionInteraction = await
|
|
498
|
+
const action = uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, nonceForSwap);
|
|
499
|
+
const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
|
|
503
500
|
caller: approvedUser,
|
|
504
501
|
action
|
|
505
502
|
}, true);
|
|
@@ -513,7 +510,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
513
510
|
it("uniswap can't pull funds without transfer approval", async ()=>{
|
|
514
511
|
// swap should fail since no transfer approval to uniswap:
|
|
515
512
|
const nonceForWETHTransferApproval = new Fr(4n);
|
|
516
|
-
const validateActionInteraction = await
|
|
513
|
+
const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
|
|
517
514
|
caller: uniswapL2Contract.address,
|
|
518
515
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
519
516
|
}, true);
|
|
@@ -532,7 +529,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
532
529
|
// Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
533
530
|
logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
|
|
534
531
|
const nonceForWETHTransferToPublicApproval = new Fr(4n);
|
|
535
|
-
const transferToPublicAuhtwit = await
|
|
532
|
+
const transferToPublicAuhtwit = await wallet.createAuthWit(ownerAddress, {
|
|
536
533
|
caller: uniswapL2Contract.address,
|
|
537
534
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
538
535
|
});
|
|
@@ -621,7 +618,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
621
618
|
await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
|
|
622
619
|
// Owner gives uniswap approval to transfer funds on its behalf
|
|
623
620
|
const nonceForWETHTransferApproval = new Fr(5n);
|
|
624
|
-
const validateActionInteraction = await
|
|
621
|
+
const validateActionInteraction = await wallet.setPublicAuthWit(ownerAddress, {
|
|
625
622
|
caller: uniswapL2Contract.address,
|
|
626
623
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
627
624
|
}, true);
|
|
@@ -160,7 +160,7 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
160
160
|
AztecAddress.fromField(await this.account.key())
|
|
161
161
|
]){
|
|
162
162
|
const privatePos = await this.lendingContract.methods.get_position(key).simulate({
|
|
163
|
-
from:
|
|
163
|
+
from: this.account.address
|
|
164
164
|
});
|
|
165
165
|
expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
|
|
166
166
|
expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type AztecAddress, type FeePaymentMethod, type PXE } from '@aztec/aztec.js';
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
|
-
|
|
4
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
5
|
+
export interface TestAccounts {
|
|
5
6
|
pxe: PXE;
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
wallet: TestWallet;
|
|
8
|
+
accounts: AztecAddress[];
|
|
9
|
+
tokenContract: TokenContract;
|
|
8
10
|
tokenAdminAddress: AztecAddress;
|
|
9
11
|
tokenName: string;
|
|
10
|
-
recipientWallet: AccountWalletWithSecretKey;
|
|
11
12
|
recipientAddress: AztecAddress;
|
|
12
13
|
tokenAddress: AztecAddress;
|
|
13
14
|
}
|
|
14
|
-
export declare function
|
|
15
|
-
export declare function
|
|
16
|
-
export declare function
|
|
17
|
-
export declare function performTransfers({
|
|
18
|
-
|
|
15
|
+
export declare function setupTestAccountsWithTokens(pxeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestAccounts>;
|
|
16
|
+
export declare function deploySponsoredTestAccounts(pxe: PXE, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestAccounts>;
|
|
17
|
+
export declare function deployTestAccountsWithTokens(pxeUrl: string, nodeUrl: string, l1RpcUrls: string[], mnemonicOrPrivateKey: string, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestAccounts>;
|
|
18
|
+
export declare function performTransfers({ testAccounts, rounds, transferAmount, logger, feePaymentMethod, }: {
|
|
19
|
+
testAccounts: TestAccounts;
|
|
19
20
|
rounds: number;
|
|
20
21
|
transferAmount: bigint;
|
|
21
22
|
logger: Logger;
|
|
23
|
+
feePaymentMethod?: FeePaymentMethod;
|
|
22
24
|
}): Promise<void>;
|
|
23
25
|
export declare function startCompatiblePXE(nodeUrl: string, proverEnabled: boolean, logger: Logger): Promise<{
|
|
24
26
|
pxe: PXE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup_test_wallets.d.ts","sourceRoot":"","sources":["../../src/spartan/setup_test_wallets.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,gBAAgB,EAGrB,KAAK,GAAG,EAMT,MAAM,i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