@aztec/end-to-end 0.0.1-fake-c83136db25 → 0.0.1-fake-ceab37513c
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/benchmark.d.ts +2 -3
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +12 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +58 -54
- package/dest/bench/client_flows/data_extractor.js +3 -3
- package/dest/bench/utils.d.ts +11 -2
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +34 -10
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +7 -7
- 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 +42 -42
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +8 -10
- 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 +33 -31
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -9
- package/dest/e2e_epochs/epochs_test.d.ts +1 -3
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +9 -10
- package/dest/e2e_fees/bridging_race.notest.js +9 -12
- package/dest/e2e_fees/fees_test.d.ts +5 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +31 -23
- package/dest/e2e_l1_publisher/write_json.d.ts +1 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +5 -5
- package/dest/e2e_multi_validator/utils.d.ts +1 -1
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +3 -6
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +9 -7
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +2 -2
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +2 -5
- package/dest/e2e_p2p/p2p_network.d.ts +2 -14
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +10 -32
- package/dest/e2e_p2p/shared.d.ts +13 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +45 -49
- package/dest/e2e_token_contract/token_contract_test.d.ts +4 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +17 -14
- package/dest/fixtures/e2e_prover_test.d.ts +6 -8
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +50 -40
- package/dest/fixtures/get_acvm_config.d.ts +1 -1
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +2 -2
- package/dest/fixtures/setup_l1_contracts.d.ts +1 -1
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +2 -2
- package/dest/fixtures/setup_p2p_test.d.ts +7 -0
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +7 -10
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +32 -42
- package/dest/fixtures/token_utils.d.ts +4 -6
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +15 -11
- package/dest/fixtures/utils.d.ts +27 -23
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +100 -75
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +5 -16
- package/dest/quality_of_service/alert_checker.d.ts +1 -1
- package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.d.ts +10 -16
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +15 -13
- package/dest/shared/gas_portal_test_harness.d.ts +6 -9
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +7 -10
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -5
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +7 -8
- package/dest/shared/uniswap_l1_l2.d.ts +6 -9
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +45 -29
- package/dest/simulators/lending_simulator.d.ts +1 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +2 -3
- package/dest/simulators/token_simulator.d.ts +1 -3
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +2 -2
- package/dest/spartan/setup_test_wallets.d.ts +13 -19
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +84 -107
- package/dest/spartan/utils.d.ts +0 -44
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +20 -212
- package/package.json +36 -37
- package/src/bench/client_flows/benchmark.ts +8 -8
- package/src/bench/client_flows/client_flows_benchmark.ts +82 -62
- package/src/bench/client_flows/data_extractor.ts +4 -4
- package/src/bench/utils.ts +37 -9
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +63 -46
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -33
- package/src/e2e_deploy_contract/deploy_test.ts +35 -17
- package/src/e2e_epochs/epochs_test.ts +14 -12
- package/src/e2e_fees/bridging_race.notest.ts +9 -14
- package/src/e2e_fees/fees_test.ts +38 -26
- package/src/e2e_l1_publisher/write_json.ts +6 -8
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +10 -11
- package/src/e2e_p2p/inactivity_slash_test.ts +3 -7
- package/src/e2e_p2p/p2p_network.ts +67 -105
- package/src/e2e_p2p/shared.ts +55 -50
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +88 -51
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +2 -3
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +8 -0
- package/src/fixtures/snapshot_manager.ts +59 -59
- package/src/fixtures/token_utils.ts +21 -13
- package/src/fixtures/utils.ts +137 -86
- package/src/fixtures/web3signer.ts +5 -22
- package/src/guides/up_quick_start.sh +10 -2
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +29 -18
- package/src/shared/gas_portal_test_harness.ts +19 -12
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +8 -12
- package/src/shared/uniswap_l1_l2.ts +67 -61
- package/src/simulators/lending_simulator.ts +2 -3
- package/src/simulators/token_simulator.ts +2 -5
- package/src/spartan/DEVELOP.md +3 -8
- package/src/spartan/setup_test_wallets.ts +125 -132
- package/src/spartan/utils.ts +18 -268
|
@@ -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,
|
|
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;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,MAAM,WAAW,uBAAuB;IACtC,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/D,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5E,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,iBAAiB,EAAE,UAAU,CAAC;CAC/B;AAED,MAAM,WAAW,yCAAyC;IACxD,SAAS,EAAE,SAAS,CAAC;IACrB,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,UAAU,EAAE,GAAG,CAAC;IAChB,QAAQ,EAAE,wBAAwB,CAAC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,mCAAmC;IAC1B,OAAO,CAAC,MAAM;IAAlC,OAAO;YAEO,UAAU;IA6BxB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,yCAAyC,GAAG,OAAO,CAAC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AC,KAAK,EAAE,YAAY;IAIxC,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM;IAKpE,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAerC,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY;YAQnD,cAAc;CAe7B"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/aztec.js
|
|
2
|
-
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
3
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
4
|
-
import { retryUntil } from '@aztec/foundation/retry';
|
|
1
|
+
import { EthAddress, Fr, L1FeeJuicePortalManager, retryUntil } from '@aztec/aztec.js';
|
|
5
2
|
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
6
3
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
7
4
|
export class FeeJuicePortalTestingHarnessFactory {
|
|
@@ -10,16 +7,16 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
10
7
|
this.config = config;
|
|
11
8
|
}
|
|
12
9
|
async createReal() {
|
|
13
|
-
const { aztecNode, aztecNodeAdmin, l1Client, wallet, logger } = this.config;
|
|
10
|
+
const { aztecNode, aztecNodeAdmin, pxeService, l1Client, wallet, logger } = this.config;
|
|
14
11
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
15
|
-
const l1ContractAddresses = (await
|
|
12
|
+
const l1ContractAddresses = (await pxeService.getNodeInfo()).l1ContractAddresses;
|
|
16
13
|
const feeJuiceAddress = l1ContractAddresses.feeJuiceAddress;
|
|
17
14
|
const feeJuicePortalAddress = l1ContractAddresses.feeJuicePortalAddress;
|
|
18
15
|
if (feeJuiceAddress.isZero() || feeJuicePortalAddress.isZero()) {
|
|
19
16
|
throw new Error('Fee Juice portal not deployed on L1');
|
|
20
17
|
}
|
|
21
18
|
const gasL2 = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, wallet);
|
|
22
|
-
return new GasBridgingTestHarness(aztecNode, aztecNodeAdmin,
|
|
19
|
+
return new GasBridgingTestHarness(aztecNode, aztecNodeAdmin, pxeService, logger, gasL2, ethAccount, feeJuicePortalAddress, feeJuiceAddress, l1ContractAddresses.feeAssetHandlerAddress, l1Client);
|
|
23
20
|
}
|
|
24
21
|
static create(config) {
|
|
25
22
|
const factory = new FeeJuicePortalTestingHarnessFactory(config);
|
|
@@ -32,7 +29,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
32
29
|
*/ export class GasBridgingTestHarness {
|
|
33
30
|
aztecNode;
|
|
34
31
|
aztecNodeAdmin;
|
|
35
|
-
|
|
32
|
+
pxeService;
|
|
36
33
|
logger;
|
|
37
34
|
feeJuice;
|
|
38
35
|
ethAccount;
|
|
@@ -42,10 +39,10 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
42
39
|
l1Client;
|
|
43
40
|
l1TokenManager;
|
|
44
41
|
feeJuicePortalManager;
|
|
45
|
-
constructor(/** Aztec node */ aztecNode, /** Aztec node admin interface */ aztecNodeAdmin, /**
|
|
42
|
+
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
43
|
this.aztecNode = aztecNode;
|
|
47
44
|
this.aztecNodeAdmin = aztecNodeAdmin;
|
|
48
|
-
this.
|
|
45
|
+
this.pxeService = pxeService;
|
|
49
46
|
this.logger = logger;
|
|
50
47
|
this.feeJuice = feeJuice;
|
|
51
48
|
this.ethAccount = ethAccount;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
5
|
-
export declare const submitTxsTo: (wallet: TestWallet, submitter: AztecAddress, numTxs: number, logger: Logger) => Promise<SentTx[]>;
|
|
1
|
+
import { type Logger, type SentTx, type Wallet } from '@aztec/aztec.js';
|
|
2
|
+
import type { PXEService } from '@aztec/pxe/server';
|
|
3
|
+
export declare const submitTxsTo: (pxe: PXEService, numTxs: number, wallet: Wallet, logger: Logger) => Promise<SentTx[]>;
|
|
6
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":"AACA,OAAO,EAAsB,KAAK,MAAM,EAAE,KAAK,MAAM,EAAY,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,WAAW,GACtB,KAAK,UAAU,EACf,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,QAAQ,MAAM,KACb,OAAO,CAAC,MAAM,EAAE,CAqBlB,CAAC"}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { TxStatus } from '@aztec/aztec.js
|
|
1
|
+
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
|
+
import { Fr, GrumpkinScalar, TxStatus } from '@aztec/aztec.js';
|
|
3
3
|
import { times } from '@aztec/foundation/collection';
|
|
4
|
-
// submits a set of transactions to the provided
|
|
5
|
-
export const submitTxsTo = async (
|
|
4
|
+
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
5
|
+
export const submitTxsTo = async (pxe, numTxs, wallet, logger)=>{
|
|
6
6
|
const txs = [];
|
|
7
7
|
await Promise.all(times(numTxs, async ()=>{
|
|
8
|
-
const accountManager = await
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
from: submitter
|
|
8
|
+
const accountManager = await getSchnorrAccount(pxe, Fr.random(), GrumpkinScalar.random(), Fr.random());
|
|
9
|
+
const tx = accountManager.deploy({
|
|
10
|
+
deployWallet: wallet
|
|
12
11
|
});
|
|
13
12
|
const txHash = await tx.getTxHash();
|
|
14
13
|
logger.info(`Tx sent with hash ${txHash}`);
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
3
|
-
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
1
|
+
import { type AccountWallet, type AztecNode, type Logger, type PXE } from '@aztec/aztec.js';
|
|
4
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
5
3
|
import { type DeployL1ContractsReturnType, type ExtendedViemWalletClient } from '@aztec/ethereum';
|
|
6
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
7
4
|
/** Objects to be returned by the uniswap setup function */
|
|
8
5
|
export type UniswapSetupContext = {
|
|
9
6
|
/** Aztec Node instance */
|
|
10
7
|
aztecNode: AztecNode;
|
|
8
|
+
/** The Private eXecution Environment (PXE). */
|
|
9
|
+
pxe: PXE;
|
|
11
10
|
/** Logger instance named as the current test. */
|
|
12
11
|
logger: Logger;
|
|
13
12
|
/** The L1 wallet client, extended with public actions. */
|
|
14
13
|
l1Client: ExtendedViemWalletClient;
|
|
15
|
-
/** The wallet. */
|
|
16
|
-
|
|
17
|
-
/** The owner address. */
|
|
18
|
-
ownerAddress: AztecAddress;
|
|
14
|
+
/** The owner wallet. */
|
|
15
|
+
ownerWallet: AccountWallet;
|
|
19
16
|
/** The sponsor wallet. */
|
|
20
|
-
|
|
17
|
+
sponsorWallet: AccountWallet;
|
|
21
18
|
/** */
|
|
22
19
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
23
20
|
/** 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,
|
|
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,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,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,GAC/B,OAAO,MAAM,OAAO,CAAC,mBAAmB,CAAC,EACzC,SAAS,MAAM,OAAO,CAAC,IAAI,CAAC,EAC5B,gCAAkC,SAg+BnC,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, EthAddress } from '@aztec/aztec.js
|
|
2
|
-
import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization';
|
|
3
|
-
import { generateClaimSecret } from '@aztec/aztec.js/ethereum';
|
|
4
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
1
|
+
import { AztecAddress, EthAddress, Fr, computeAuthWitMessageHash, generateClaimSecret } from '@aztec/aztec.js';
|
|
5
2
|
import { RollupContract, deployL1Contract, extractEvent } from '@aztec/ethereum';
|
|
6
3
|
import { sha256ToField } from '@aztec/foundation/crypto';
|
|
7
4
|
import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-artifacts';
|
|
@@ -18,19 +15,24 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
|
|
|
18
15
|
// To start an actual fork, use the command:
|
|
19
16
|
// anvil --fork-url https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c --fork-block-number 17514288 --chain-id 31337
|
|
20
17
|
// For CI, this is configured in `run_tests.sh` and `docker-compose-images.yml`
|
|
18
|
+
// docs:start:uniswap_l1_l2_test_setup_const
|
|
21
19
|
const TIMEOUT = 360_000;
|
|
20
|
+
// docs:end:uniswap_l1_l2_test_setup_const
|
|
22
21
|
export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 17514288)=>{
|
|
22
|
+
// docs:start:uniswap_l1_l2_test_beforeAll
|
|
23
23
|
describe('uniswap_trade_on_l1_from_l2', ()=>{
|
|
24
24
|
jest.setTimeout(TIMEOUT);
|
|
25
25
|
const WETH9_ADDRESS = EthAddress.fromString('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2');
|
|
26
26
|
const DAI_ADDRESS = EthAddress.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F');
|
|
27
27
|
let aztecNode;
|
|
28
|
+
let pxe;
|
|
28
29
|
let logger;
|
|
29
30
|
let l1Client;
|
|
30
|
-
let
|
|
31
|
+
let ownerWallet;
|
|
31
32
|
let ownerAddress;
|
|
32
33
|
let ownerEthAddress;
|
|
33
34
|
// does transactions on behalf of owner on Aztec:
|
|
35
|
+
let sponsorWallet;
|
|
34
36
|
let sponsorAddress;
|
|
35
37
|
let daiCrossChainHarness;
|
|
36
38
|
let wethCrossChainHarness;
|
|
@@ -45,21 +47,23 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
45
47
|
let cheatCodes;
|
|
46
48
|
let version;
|
|
47
49
|
beforeAll(async ()=>{
|
|
48
|
-
({ aztecNode, logger, l1Client,
|
|
50
|
+
({ aztecNode, pxe, logger, l1Client, ownerWallet, sponsorWallet, deployL1ContractsValues, cheatCodes } = await setup());
|
|
49
51
|
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
50
52
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
51
53
|
}
|
|
52
54
|
rollup = new RollupContract(deployL1ContractsValues.l1Client, deployL1ContractsValues.l1ContractAddresses.rollupAddress);
|
|
53
55
|
version = Number(await rollup.getVersion());
|
|
56
|
+
ownerAddress = ownerWallet.getAddress();
|
|
57
|
+
sponsorAddress = sponsorWallet.getAddress();
|
|
54
58
|
ownerEthAddress = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
55
|
-
await ensureAccountContractsPublished(
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
await ensureAccountContractsPublished(ownerWallet, [
|
|
60
|
+
ownerWallet,
|
|
61
|
+
sponsorWallet
|
|
58
62
|
]);
|
|
59
63
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
60
|
-
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, deployL1ContractsValues.l1Client,
|
|
64
|
+
daiCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, deployL1ContractsValues.l1Client, ownerWallet, ownerAddress, logger, DAI_ADDRESS);
|
|
61
65
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
62
|
-
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, l1Client,
|
|
66
|
+
wethCrossChainHarness = await CrossChainTestHarness.new(aztecNode, pxe, l1Client, ownerWallet, ownerAddress, logger, WETH9_ADDRESS);
|
|
63
67
|
logger.info('Deploy Uniswap portal on L1 and L2...');
|
|
64
68
|
uniswapPortalAddress = await deployL1Contract(l1Client, UniswapPortalAbi, UniswapPortalBytecode).then(({ address })=>address);
|
|
65
69
|
uniswapPortal = getContract({
|
|
@@ -68,10 +72,10 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
68
72
|
client: l1Client
|
|
69
73
|
});
|
|
70
74
|
// deploy l2 uniswap contract and attach to portal
|
|
71
|
-
uniswapL2Contract = await UniswapContract.deploy(
|
|
75
|
+
uniswapL2Contract = await UniswapContract.deploy(ownerWallet, uniswapPortalAddress).send({
|
|
72
76
|
from: ownerAddress
|
|
73
77
|
}).deployed();
|
|
74
|
-
const registryAddress = (await
|
|
78
|
+
const registryAddress = (await pxe.getNodeInfo()).l1ContractAddresses.registryAddress;
|
|
75
79
|
await uniswapPortal.write.initialize([
|
|
76
80
|
registryAddress.toString(),
|
|
77
81
|
uniswapL2Contract.address.toString()
|
|
@@ -88,6 +92,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
88
92
|
const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
89
93
|
expect(wethBalance).toBe(parseEther('1000'));
|
|
90
94
|
});
|
|
95
|
+
// docs:end:uniswap_l1_l2_test_beforeAll
|
|
91
96
|
afterAll(async ()=>{
|
|
92
97
|
await cleanup();
|
|
93
98
|
});
|
|
@@ -110,7 +115,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
110
115
|
// 3. Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
111
116
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
112
117
|
const nonceForWETHTransferToPublicApproval = new Fr(1n);
|
|
113
|
-
const transferToPublicAuhtwit = await
|
|
118
|
+
const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
|
|
114
119
|
caller: uniswapL2Contract.address,
|
|
115
120
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
116
121
|
});
|
|
@@ -437,8 +442,11 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
437
442
|
const nonceForWETHTransferToPublicApproval = new Fr(2n);
|
|
438
443
|
const expectedMessageHash = await computeAuthWitMessageHash({
|
|
439
444
|
caller: uniswapL2Contract.address,
|
|
440
|
-
|
|
441
|
-
},
|
|
445
|
+
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
446
|
+
}, {
|
|
447
|
+
chainId: ownerWallet.getChainId(),
|
|
448
|
+
version: ownerWallet.getVersion()
|
|
449
|
+
});
|
|
442
450
|
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).simulate({
|
|
443
451
|
from: ownerAddress
|
|
444
452
|
})).rejects.toThrow(`Unknown auth witness for message hash ${expectedMessageHash.toString()}`);
|
|
@@ -450,18 +458,18 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
450
458
|
// 2. owner gives uniswap approval to transfer the funds to public:
|
|
451
459
|
logger.info('Approving uniswap to transfer funds to public to self on my behalf');
|
|
452
460
|
const nonceForWETHTransferToPublicApproval = new Fr(3n);
|
|
453
|
-
const transferToPublicAuthwith = await
|
|
461
|
+
const transferToPublicAuthwith = await ownerWallet.createAuthWit({
|
|
454
462
|
caller: uniswapL2Contract.address,
|
|
455
463
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
456
464
|
});
|
|
457
465
|
// 3. Swap but send the wrong token address
|
|
458
466
|
logger.info('Swap but send the wrong token address');
|
|
459
|
-
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).
|
|
467
|
+
await expect(uniswapL2Contract.methods.swap_private(wethCrossChainHarness.l2Token.address, daiCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferToPublicApproval, uniswapFeeTier, minimumOutputAmount, Fr.random(), ownerEthAddress).prove({
|
|
460
468
|
from: ownerAddress,
|
|
461
469
|
authWitnesses: [
|
|
462
470
|
transferToPublicAuthwith
|
|
463
471
|
]
|
|
464
|
-
})
|
|
472
|
+
})).rejects.toThrow('Assertion failed: input_asset address is not the same as seen in the bridge contract');
|
|
465
473
|
});
|
|
466
474
|
// edge cases for public flow:
|
|
467
475
|
it("I don't need approval to call swap_public if I'm swapping on my own behalf", async ()=>{
|
|
@@ -469,11 +477,13 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
469
477
|
await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
|
|
470
478
|
// 2. Give approval to uniswap to transfer funds to itself
|
|
471
479
|
const nonceForWETHTransferApproval = new Fr(2n);
|
|
472
|
-
const validateActionInteraction = await
|
|
480
|
+
const validateActionInteraction = await ownerWallet.setPublicAuthWit({
|
|
473
481
|
caller: uniswapL2Contract.address,
|
|
474
482
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
475
483
|
}, true);
|
|
476
|
-
await validateActionInteraction.send(
|
|
484
|
+
await validateActionInteraction.send({
|
|
485
|
+
from: ownerAddress
|
|
486
|
+
}).wait();
|
|
477
487
|
// No approval to call `swap` but should work even without it:
|
|
478
488
|
const [_, secretHashForDepositingSwappedDai] = await generateClaimSecret();
|
|
479
489
|
await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -488,12 +498,14 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
488
498
|
const nonceForWETHTransferApproval = new Fr(3n);
|
|
489
499
|
const nonceForSwap = new Fr(3n);
|
|
490
500
|
const secretHashForDepositingSwappedDai = new Fr(4n);
|
|
491
|
-
const action = uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, nonceForSwap);
|
|
492
|
-
const validateActionInteraction = await
|
|
501
|
+
const action = uniswapL2Contract.withWallet(sponsorWallet).methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, nonceForSwap);
|
|
502
|
+
const validateActionInteraction = await ownerWallet.setPublicAuthWit({
|
|
493
503
|
caller: approvedUser,
|
|
494
504
|
action
|
|
495
505
|
}, true);
|
|
496
|
-
await validateActionInteraction.send(
|
|
506
|
+
await validateActionInteraction.send({
|
|
507
|
+
from: ownerAddress
|
|
508
|
+
}).wait();
|
|
497
509
|
await expect(action.simulate({
|
|
498
510
|
from: sponsorAddress
|
|
499
511
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -501,11 +513,13 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
501
513
|
it("uniswap can't pull funds without transfer approval", async ()=>{
|
|
502
514
|
// swap should fail since no transfer approval to uniswap:
|
|
503
515
|
const nonceForWETHTransferApproval = new Fr(4n);
|
|
504
|
-
const validateActionInteraction = await
|
|
516
|
+
const validateActionInteraction = await ownerWallet.setPublicAuthWit({
|
|
505
517
|
caller: uniswapL2Contract.address,
|
|
506
518
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
507
519
|
}, true);
|
|
508
|
-
await validateActionInteraction.send(
|
|
520
|
+
await validateActionInteraction.send({
|
|
521
|
+
from: ownerAddress
|
|
522
|
+
}).wait();
|
|
509
523
|
await expect(uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, new Fr(420), uniswapFeeTier, minimumOutputAmount, ownerAddress, Fr.random(), ownerEthAddress, Fr.ZERO).simulate({
|
|
510
524
|
from: ownerAddress
|
|
511
525
|
})).rejects.toThrow(/unauthorized/);
|
|
@@ -518,7 +532,7 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
518
532
|
// Owner gives uniswap approval to transfer the funds to public to self on its behalf
|
|
519
533
|
logger.info('Approving uniswap to transfer the funds to public to self on my behalf');
|
|
520
534
|
const nonceForWETHTransferToPublicApproval = new Fr(4n);
|
|
521
|
-
const transferToPublicAuhtwit = await
|
|
535
|
+
const transferToPublicAuhtwit = await ownerWallet.createAuthWit({
|
|
522
536
|
caller: uniswapL2Contract.address,
|
|
523
537
|
action: wethCrossChainHarness.l2Token.methods.transfer_to_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferToPublicApproval)
|
|
524
538
|
});
|
|
@@ -607,11 +621,13 @@ export const uniswapL1L2TestSuite = (setup, cleanup, expectedForkBlockNumber = 1
|
|
|
607
621
|
await wethCrossChainHarness.mintTokensPublicOnL2(wethAmountToBridge);
|
|
608
622
|
// Owner gives uniswap approval to transfer funds on its behalf
|
|
609
623
|
const nonceForWETHTransferApproval = new Fr(5n);
|
|
610
|
-
const validateActionInteraction = await
|
|
624
|
+
const validateActionInteraction = await ownerWallet.setPublicAuthWit({
|
|
611
625
|
caller: uniswapL2Contract.address,
|
|
612
626
|
action: wethCrossChainHarness.l2Token.methods.transfer_in_public(ownerAddress, uniswapL2Contract.address, wethAmountToBridge, nonceForWETHTransferApproval)
|
|
613
627
|
}, true);
|
|
614
|
-
await validateActionInteraction.send(
|
|
628
|
+
await validateActionInteraction.send({
|
|
629
|
+
from: ownerAddress
|
|
630
|
+
}).wait();
|
|
615
631
|
// Call swap_public on L2
|
|
616
632
|
const secretHashForDepositingSwappedDai = Fr.random();
|
|
617
633
|
const withdrawReceipt = await uniswapL2Contract.methods.swap_public(ownerAddress, wethCrossChainHarness.l2Bridge.address, wethAmountToBridge, daiCrossChainHarness.l2Bridge.address, nonceForWETHTransferApproval, uniswapFeeTier, minimumOutputAmount, ownerAddress, secretHashForDepositingSwappedDai, ownerEthAddress, Fr.ZERO).send({
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js
|
|
2
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
1
|
+
import { AztecAddress, Fr } from '@aztec/aztec.js';
|
|
3
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
3
|
import type { RollupContract } from '@aztec/ethereum';
|
|
5
4
|
import type { TestDateProvider } from '@aztec/foundation/timer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lending_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/lending_simulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"lending_simulator.d.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BAA0B;IACnB,MAAM,EAAE,cAAc;IAC7B,2BAA2B;IACpB,eAAe,EAAE,eAAe;IACvC,wDAAwD;IACjD,eAAe,EAAE,cAAc;IACtC,uDAAuD;IAChD,UAAU,EAAE,cAAc;IAG7B,OAAO;IAMP,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,gBAAgB;IAmBjE,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAKjE,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAKhE,OAAO,CAAC,OAAO;IAKf,QAAQ,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAM3D,MAAM,CAAC,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASzD,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAK/D,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM;IAK9D,OAAO,CAAC,KAAK;IAQb,yBAAyB,CAAC,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,UAAQ;IASzE,KAAK;CA0BZ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Convenience struct to hold an account's address and secret that can easily be passed around.
|
|
2
|
-
import { AztecAddress } from '@aztec/aztec.js
|
|
3
|
-
import { Fr } from '@aztec/aztec.js/fields';
|
|
2
|
+
import { AztecAddress, Fr } from '@aztec/aztec.js';
|
|
4
3
|
import { pedersenHash } from '@aztec/foundation/crypto';
|
|
5
4
|
/**
|
|
6
5
|
* Contains utilities to compute the "key" for private holdings in the public state.
|
|
@@ -161,7 +160,7 @@ const computeMultiplier = (rate, dt)=>{
|
|
|
161
160
|
AztecAddress.fromField(await this.account.key())
|
|
162
161
|
]){
|
|
163
162
|
const privatePos = await this.lendingContract.methods.get_position(key).simulate({
|
|
164
|
-
from:
|
|
163
|
+
from: key
|
|
165
164
|
});
|
|
166
165
|
expect(new Fr(privatePos['collateral'])).toEqual(this.collateral[key.toString()] ?? Fr.ZERO);
|
|
167
166
|
expect(new Fr(privatePos['static_debt'])).toEqual(this.staticDebt[key.toString()] ?? Fr.ZERO);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { Logger } from '@aztec/aztec.js/log';
|
|
3
|
-
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
1
|
+
import { type AztecAddress, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
4
2
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
3
|
export declare class TokenSimulator {
|
|
6
4
|
protected token: TokenContract;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/token_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"token_simulator.d.ts","sourceRoot":"","sources":["../../src/simulators/token_simulator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAIpE,qBAAa,cAAc;IAQvB,SAAS,CAAC,KAAK,EAAE,aAAa;IAC9B,SAAS,CAAC,aAAa,EAAE,MAAM;IAC/B,SAAS,CAAC,cAAc,EAAE,YAAY;IACtC,SAAS,CAAC,MAAM,EAAE,MAAM;IACxB,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE;IAXpC,OAAO,CAAC,eAAe,CAAkC;IACzD,OAAO,CAAC,aAAa,CAAkC;IAChD,WAAW,EAAE,MAAM,CAAM;IAEhC,OAAO,CAAC,cAAc,CAAkC;gBAG5C,KAAK,EAAE,aAAa,EACpB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,YAAY,EAC5B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EAAE;IAG7B,UAAU,CAAC,OAAO,EAAE,YAAY;IAIhC,iBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAIvD,WAAW,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAK5C,UAAU,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAM3C,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASnE,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IASpE,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQtE,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQrE,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQ9C,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM;IAQ7C,eAAe,CAAC,OAAO,EAAE,YAAY;IAIrC,gBAAgB,CAAC,OAAO,EAAE,YAAY;IAIvC,WAAW;IAoBX,YAAY;IAsCL,KAAK;CAInB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchCall } from '@aztec/aztec.js
|
|
1
|
+
import { BatchCall } from '@aztec/aztec.js';
|
|
2
2
|
import chunk from 'lodash.chunk';
|
|
3
3
|
export class TokenSimulator {
|
|
4
4
|
token;
|
|
@@ -88,7 +88,7 @@ export class TokenSimulator {
|
|
|
88
88
|
this.token.methods.total_supply(),
|
|
89
89
|
...this.accounts.map((address)=>this.token.methods.balance_of_public(address))
|
|
90
90
|
];
|
|
91
|
-
const results = (await Promise.all(chunk(calls,
|
|
91
|
+
const results = (await Promise.all(chunk(calls, 4).map((batch)=>new BatchCall(this.defaultWallet, batch).simulate({
|
|
92
92
|
from: this.defaultAddress
|
|
93
93
|
})))).flat();
|
|
94
94
|
expect(results[0]).toEqual(this.totalSupply);
|
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import { AztecAddress } from '@aztec/aztec.js
|
|
2
|
-
import { type FeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
3
|
-
import { type AztecNode } from '@aztec/aztec.js/node';
|
|
1
|
+
import { type AccountWalletWithSecretKey, type AztecAddress, type PXE } from '@aztec/aztec.js';
|
|
4
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
5
3
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
accounts: AztecAddress[];
|
|
11
|
-
tokenContract: TokenContract;
|
|
4
|
+
export interface TestWallets {
|
|
5
|
+
pxe: PXE;
|
|
6
|
+
wallets: AccountWalletWithSecretKey[];
|
|
7
|
+
tokenAdminWallet: TokenContract;
|
|
12
8
|
tokenAdminAddress: AztecAddress;
|
|
13
9
|
tokenName: string;
|
|
10
|
+
recipientWallet: AccountWalletWithSecretKey;
|
|
14
11
|
recipientAddress: AztecAddress;
|
|
15
12
|
tokenAddress: AztecAddress;
|
|
16
13
|
}
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function performTransfers({
|
|
21
|
-
|
|
22
|
-
testAccounts: TestAccounts;
|
|
14
|
+
export declare function setupTestWalletsWithTokens(pxeUrl: string, mintAmount: bigint, logger: Logger): Promise<TestWallets>;
|
|
15
|
+
export declare function deploySponsoredTestWallets(pxe: PXE, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestWallets>;
|
|
16
|
+
export declare function deployTestWalletWithTokens(pxeUrl: string, nodeUrl: string, l1RpcUrls: string[], mnemonicOrPrivateKey: string, mintAmount: bigint, logger: Logger, numberOfFundedWallets?: number): Promise<TestWallets>;
|
|
17
|
+
export declare function performTransfers({ testWallets, rounds, transferAmount, logger, }: {
|
|
18
|
+
testWallets: TestWallets;
|
|
23
19
|
rounds: number;
|
|
24
20
|
transferAmount: bigint;
|
|
25
21
|
logger: Logger;
|
|
26
|
-
feePaymentMethod?: FeePaymentMethod;
|
|
27
22
|
}): Promise<void>;
|
|
28
|
-
export declare function
|
|
29
|
-
|
|
30
|
-
aztecNode: AztecNode;
|
|
23
|
+
export declare function startCompatiblePXE(nodeUrl: string, proverEnabled: boolean, logger: Logger): Promise<{
|
|
24
|
+
pxe: PXE;
|
|
31
25
|
cleanup: () => Promise<void>;
|
|
32
26
|
}>;
|
|
33
27
|
//# sourceMappingURL=setup_test_wallets.d.ts.map
|
|
@@ -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":"AAEA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAMjB,KAAK,GAAG,EAKT,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAQ/D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,0BAA0B,EAAE,CAAC;IACtC,gBAAgB,EAAE,aAAa,CAAC;IAChC,iBAAiB,EAAE,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,0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