@aztec/end-to-end 3.0.0-nightly.20250922 → 3.0.0-nightly.20250924
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 +0 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +5 -9
- package/dest/bench/utils.d.ts +1 -10
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +0 -25
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -2
- 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 +1 -3
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +1 -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 +6 -9
- package/dest/e2e_deploy_contract/deploy_test.d.ts +3 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +2 -3
- package/dest/e2e_fees/fees_test.d.ts +1 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +5 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +1 -3
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +2 -4
- package/dest/e2e_p2p/shared.d.ts +5 -4
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +26 -14
- package/dest/fixtures/e2e_prover_test.d.ts +0 -2
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +6 -9
- package/dest/fixtures/snapshot_manager.d.ts +0 -2
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +9 -11
- package/dest/fixtures/utils.d.ts +12 -20
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +24 -42
- package/dest/shared/cross_chain_test_harness.d.ts +2 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -5
- package/dest/shared/gas_portal_test_harness.d.ts +5 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +5 -5
- package/dest/shared/uniswap_l1_l2.d.ts +1 -3
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +3 -4
- package/dest/spartan/setup_test_wallets.d.ts +5 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +19 -14
- package/package.json +37 -37
- package/src/bench/client_flows/client_flows_benchmark.ts +4 -8
- package/src/bench/utils.ts +1 -28
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +1 -4
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +5 -9
- package/src/e2e_deploy_contract/deploy_test.ts +4 -5
- package/src/e2e_fees/fees_test.ts +6 -9
- package/src/e2e_nested_contract/nested_contract_test.ts +2 -4
- package/src/e2e_p2p/p2p_network.ts +54 -60
- package/src/e2e_p2p/shared.ts +27 -15
- package/src/fixtures/e2e_prover_test.ts +7 -12
- package/src/fixtures/snapshot_manager.ts +12 -14
- package/src/fixtures/utils.ts +27 -53
- package/src/shared/cross_chain_test_harness.ts +0 -5
- package/src/shared/gas_portal_test_harness.ts +4 -6
- package/src/shared/uniswap_l1_l2.ts +1 -7
- package/src/spartan/setup_test_wallets.ts +13 -17
package/src/fixtures/utils.ts
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
BatchCall,
|
|
9
9
|
type ContractMethod,
|
|
10
10
|
type Logger,
|
|
11
|
-
type PXE,
|
|
12
11
|
type Wallet,
|
|
13
12
|
createAztecNodeClient,
|
|
14
13
|
createLogger,
|
|
@@ -57,12 +56,7 @@ import type { P2PClientDeps } from '@aztec/p2p';
|
|
|
57
56
|
import { MockGossipSubNetwork, getMockPubSubP2PServiceFactory } from '@aztec/p2p/test-helpers';
|
|
58
57
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
59
58
|
import { type ProverNode, type ProverNodeConfig, type ProverNodeDeps, createProverNode } from '@aztec/prover-node';
|
|
60
|
-
import {
|
|
61
|
-
type PXEService,
|
|
62
|
-
type PXEServiceConfig,
|
|
63
|
-
createPXEServiceWithSimulator,
|
|
64
|
-
getPXEServiceConfig,
|
|
65
|
-
} from '@aztec/pxe/server';
|
|
59
|
+
import { type PXEServiceConfig, createPXEServiceWithSimulator, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
66
60
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
67
61
|
import type { TestSequencerClient } from '@aztec/sequencer-client/test';
|
|
68
62
|
import { MemoryCircuitRecorder, SimulatorRecorderWrapper, WASMSimulator } from '@aztec/simulator/client';
|
|
@@ -148,23 +142,23 @@ export const setupL1Contracts = async (
|
|
|
148
142
|
};
|
|
149
143
|
|
|
150
144
|
/**
|
|
151
|
-
* Sets up Private eXecution Environment (PXE).
|
|
145
|
+
* Sets up Private eXecution Environment (PXE) and returns the corresponding test wallet.
|
|
152
146
|
* @param aztecNode - An instance of Aztec Node.
|
|
153
147
|
* @param opts - Partial configuration for the PXE service.
|
|
154
148
|
* @param logger - The logger to be used.
|
|
155
149
|
* @param useLogSuffix - Whether to add a randomly generated suffix to the PXE debug logs.
|
|
156
|
-
* @returns
|
|
150
|
+
* @returns A test wallet, logger and teardown function.
|
|
157
151
|
*/
|
|
158
|
-
export async function
|
|
152
|
+
export async function setupPXEServiceAndGetWallet(
|
|
159
153
|
aztecNode: AztecNode,
|
|
160
154
|
opts: Partial<PXEServiceConfig> = {},
|
|
161
155
|
logger = getLogger(),
|
|
162
156
|
useLogSuffix = false,
|
|
163
157
|
): Promise<{
|
|
164
158
|
/**
|
|
165
|
-
* The
|
|
159
|
+
* The wallet instance.
|
|
166
160
|
*/
|
|
167
|
-
|
|
161
|
+
wallet: TestWallet;
|
|
168
162
|
/**
|
|
169
163
|
* Logger instance named as the current test.
|
|
170
164
|
*/
|
|
@@ -195,8 +189,10 @@ export async function setupPXEService(
|
|
|
195
189
|
|
|
196
190
|
const teardown = configuredDataDirectory ? () => Promise.resolve() : () => tryRmDir(pxeServiceConfig.dataDirectory!);
|
|
197
191
|
|
|
192
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
193
|
+
|
|
198
194
|
return {
|
|
199
|
-
|
|
195
|
+
wallet,
|
|
200
196
|
logger,
|
|
201
197
|
teardown,
|
|
202
198
|
};
|
|
@@ -235,13 +231,13 @@ async function setupWithRemoteEnvironment(
|
|
|
235
231
|
l1Client,
|
|
236
232
|
rollupVersion,
|
|
237
233
|
};
|
|
238
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls);
|
|
239
|
-
const
|
|
234
|
+
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
235
|
+
const wallet = new TestWallet(pxeClient, aztecNode);
|
|
236
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode, new DateProvider());
|
|
240
237
|
const teardown = () => Promise.resolve();
|
|
241
238
|
|
|
242
239
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
243
|
-
const initialFundedAccounts = await getDeployedTestAccounts(
|
|
244
|
-
const wallet = new TestWallet(pxeClient, aztecNode);
|
|
240
|
+
const initialFundedAccounts = await getDeployedTestAccounts(wallet);
|
|
245
241
|
|
|
246
242
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
247
243
|
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
@@ -260,7 +256,6 @@ async function setupWithRemoteEnvironment(
|
|
|
260
256
|
aztecNodeAdmin: undefined,
|
|
261
257
|
sequencer: undefined,
|
|
262
258
|
proverNode: undefined,
|
|
263
|
-
pxe: pxeClient,
|
|
264
259
|
deployL1ContractsValues,
|
|
265
260
|
config,
|
|
266
261
|
initialFundedAccounts,
|
|
@@ -337,8 +332,6 @@ export type EndToEndContext = {
|
|
|
337
332
|
proverNode: ProverNode | undefined;
|
|
338
333
|
/** A client to the sequencer service (undefined if connected to remote environment) */
|
|
339
334
|
sequencer: SequencerClient | undefined;
|
|
340
|
-
/** The Private eXecution Environment (PXE). */
|
|
341
|
-
pxe: PXE;
|
|
342
335
|
/** Return values from deployL1Contracts function. */
|
|
343
336
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
344
337
|
/** The Aztec Node configuration. */
|
|
@@ -433,7 +426,8 @@ export async function setup(
|
|
|
433
426
|
setupMetricsLogger(filename);
|
|
434
427
|
}
|
|
435
428
|
|
|
436
|
-
const
|
|
429
|
+
const dateProvider = new TestDateProvider();
|
|
430
|
+
const ethCheatCodes = new EthCheatCodesWithState(config.l1RpcUrls, dateProvider);
|
|
437
431
|
|
|
438
432
|
if (opts.stateLoad) {
|
|
439
433
|
await ethCheatCodes.loadChainState(opts.stateLoad);
|
|
@@ -534,6 +528,7 @@ export async function setup(
|
|
|
534
528
|
if (enableAutomine) {
|
|
535
529
|
await ethCheatCodes.setAutomine(false);
|
|
536
530
|
await ethCheatCodes.setIntervalMining(config.ethereumSlotDuration);
|
|
531
|
+
dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
|
|
537
532
|
}
|
|
538
533
|
|
|
539
534
|
if (opts.l2StartTime) {
|
|
@@ -542,11 +537,8 @@ export async function setup(
|
|
|
542
537
|
await ethCheatCodes.warp(opts.l2StartTime, { resetBlockInterval: true });
|
|
543
538
|
}
|
|
544
539
|
|
|
545
|
-
const dateProvider = new TestDateProvider();
|
|
546
|
-
dateProvider.setTime((await ethCheatCodes.timestamp()) * 1000);
|
|
547
|
-
|
|
548
540
|
const watcher = new AnvilTestWatcher(
|
|
549
|
-
new EthCheatCodesWithState(config.l1RpcUrls),
|
|
541
|
+
new EthCheatCodesWithState(config.l1RpcUrls, dateProvider),
|
|
550
542
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
551
543
|
deployL1ContractsValues.l1Client,
|
|
552
544
|
dateProvider,
|
|
@@ -655,22 +647,19 @@ export async function setup(
|
|
|
655
647
|
}
|
|
656
648
|
|
|
657
649
|
logger.verbose('Creating a pxe...');
|
|
658
|
-
const {
|
|
650
|
+
const { wallet, teardown: pxeTeardown } = await setupPXEServiceAndGetWallet(aztecNode!, pxeOpts, logger);
|
|
659
651
|
|
|
660
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls,
|
|
652
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, wallet, aztecNode, dateProvider);
|
|
661
653
|
|
|
662
654
|
if (
|
|
663
655
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
664
656
|
(opts.initialValidators && opts.initialValidators.length > 0)
|
|
665
657
|
) {
|
|
666
658
|
// We need to advance such that the committee is set up.
|
|
667
|
-
await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1)
|
|
668
|
-
updateDateProvider: dateProvider,
|
|
669
|
-
});
|
|
659
|
+
await cheatCodes.rollup.advanceToEpoch((await cheatCodes.rollup.getEpoch()) + BigInt(config.lagInEpochs + 1));
|
|
670
660
|
await cheatCodes.rollup.setupEpoch();
|
|
671
661
|
await cheatCodes.rollup.debugRollup();
|
|
672
662
|
}
|
|
673
|
-
const wallet = new TestWallet(pxe, aztecNode);
|
|
674
663
|
let accounts: AztecAddress[] = [];
|
|
675
664
|
// Below we continue with what we described in the long comment on line 571.
|
|
676
665
|
if (numberOfAccounts === 0) {
|
|
@@ -736,7 +725,6 @@ export async function setup(
|
|
|
736
725
|
mockGossipSubNetwork,
|
|
737
726
|
prefilledPublicData,
|
|
738
727
|
proverNode,
|
|
739
|
-
pxe,
|
|
740
728
|
sequencer: sequencerClient,
|
|
741
729
|
teardown,
|
|
742
730
|
telemetryClient: telemetry,
|
|
@@ -789,20 +777,6 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
789
777
|
}
|
|
790
778
|
// docs:end:public_deploy_accounts
|
|
791
779
|
|
|
792
|
-
/**
|
|
793
|
-
* Sets the timestamp of the next block.
|
|
794
|
-
* @param rpcUrl - rpc url of the blockchain instance to connect to
|
|
795
|
-
* @param timestamp - the timestamp for the next block
|
|
796
|
-
*/
|
|
797
|
-
export async function setNextBlockTimestamp(rpcUrl: string, timestamp: number) {
|
|
798
|
-
const params = `[${timestamp}]`;
|
|
799
|
-
await fetch(rpcUrl, {
|
|
800
|
-
body: `{"jsonrpc":"2.0", "method": "evm_setNextBlockTimestamp", "params": ${params}, "id": 1}`,
|
|
801
|
-
method: 'POST',
|
|
802
|
-
headers: { 'Content-Type': 'application/json' },
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
|
|
806
780
|
/** Returns the job name for the current test. */
|
|
807
781
|
function getJobName() {
|
|
808
782
|
return process.env.JOB_NAME ?? expect.getState().currentTestName?.split(' ')[0].replaceAll('/', '_') ?? 'unknown';
|
|
@@ -866,7 +840,7 @@ export async function expectMappingDelta<K, V extends number | bigint>(
|
|
|
866
840
|
}
|
|
867
841
|
|
|
868
842
|
/**
|
|
869
|
-
* Computes the address of the "canonical"
|
|
843
|
+
* Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
|
|
870
844
|
* but by conventions its address is computed with a salt of 0.
|
|
871
845
|
* @returns The address of the sponsored FPC contract
|
|
872
846
|
*/
|
|
@@ -879,7 +853,7 @@ export function getSponsoredFPCInstance(): Promise<ContractInstanceWithAddress>
|
|
|
879
853
|
}
|
|
880
854
|
|
|
881
855
|
/**
|
|
882
|
-
* Computes the address of the "canonical"
|
|
856
|
+
* Computes the address of the "canonical" SponsoredFPCContract. This is not a protocol contract
|
|
883
857
|
* but by conventions its address is computed with a salt of 0.
|
|
884
858
|
* @returns The address of the sponsored FPC contract
|
|
885
859
|
*/
|
|
@@ -891,22 +865,22 @@ export async function getSponsoredFPCAddress() {
|
|
|
891
865
|
/**
|
|
892
866
|
* Deploy a sponsored FPC contract to a running instance.
|
|
893
867
|
*/
|
|
894
|
-
export async function setupSponsoredFPC(
|
|
868
|
+
export async function setupSponsoredFPC(wallet: Wallet) {
|
|
895
869
|
const instance = await getContractInstanceFromInstantiationParams(SponsoredFPCContract.artifact, {
|
|
896
870
|
salt: new Fr(SPONSORED_FPC_SALT),
|
|
897
871
|
});
|
|
898
872
|
|
|
899
|
-
await
|
|
873
|
+
await wallet.registerContract({ instance, artifact: SponsoredFPCContract.artifact });
|
|
900
874
|
getLogger().info(`SponsoredFPC: ${instance.address}`);
|
|
901
875
|
return instance;
|
|
902
876
|
}
|
|
903
877
|
|
|
904
878
|
/**
|
|
905
879
|
* Registers the SponsoredFPC in this PXE instance
|
|
906
|
-
* @param
|
|
880
|
+
* @param wallet - The wallet
|
|
907
881
|
*/
|
|
908
|
-
export async function registerSponsoredFPC(
|
|
909
|
-
await
|
|
882
|
+
export async function registerSponsoredFPC(wallet: Wallet): Promise<void> {
|
|
883
|
+
await wallet.registerContract({ instance: await getSponsoredFPCInstance(), artifact: SponsoredFPCContract.artifact });
|
|
910
884
|
}
|
|
911
885
|
|
|
912
886
|
export async function waitForProvenChain(node: AztecNode, targetBlock?: number, timeoutSec = 60, intervalSec = 1) {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
type L2AmountClaim,
|
|
12
12
|
type L2AmountClaimWithRecipient,
|
|
13
13
|
type Logger,
|
|
14
|
-
type PXE,
|
|
15
14
|
type SiblingPath,
|
|
16
15
|
type TxReceipt,
|
|
17
16
|
type Wallet,
|
|
@@ -131,7 +130,6 @@ export type CrossChainContext = {
|
|
|
131
130
|
export class CrossChainTestHarness {
|
|
132
131
|
static async new(
|
|
133
132
|
aztecNode: AztecNode,
|
|
134
|
-
pxeService: PXE,
|
|
135
133
|
l1Client: ExtendedViemWalletClient,
|
|
136
134
|
wallet: Wallet,
|
|
137
135
|
ownerAddress: AztecAddress,
|
|
@@ -154,7 +152,6 @@ export class CrossChainTestHarness {
|
|
|
154
152
|
|
|
155
153
|
return new CrossChainTestHarness(
|
|
156
154
|
aztecNode,
|
|
157
|
-
pxeService,
|
|
158
155
|
logger,
|
|
159
156
|
token,
|
|
160
157
|
bridge,
|
|
@@ -174,8 +171,6 @@ export class CrossChainTestHarness {
|
|
|
174
171
|
constructor(
|
|
175
172
|
/** Aztec node instance. */
|
|
176
173
|
public aztecNode: AztecNode,
|
|
177
|
-
/** Private eXecution Environment (PXE). */
|
|
178
|
-
public pxeService: PXE,
|
|
179
174
|
/** Logger. */
|
|
180
175
|
public logger: Logger,
|
|
181
176
|
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
type L1TokenManager,
|
|
8
8
|
type L2AmountClaim,
|
|
9
9
|
type Logger,
|
|
10
|
-
type PXE,
|
|
11
10
|
type Wallet,
|
|
12
11
|
retryUntil,
|
|
13
12
|
} from '@aztec/aztec.js';
|
|
@@ -27,7 +26,6 @@ export interface IGasBridgingTestHarness {
|
|
|
27
26
|
export interface FeeJuicePortalTestingHarnessFactoryConfig {
|
|
28
27
|
aztecNode: AztecNode;
|
|
29
28
|
aztecNodeAdmin?: AztecNodeAdmin;
|
|
30
|
-
pxeService: PXE;
|
|
31
29
|
l1Client: ExtendedViemWalletClient;
|
|
32
30
|
wallet: Wallet;
|
|
33
31
|
logger: Logger;
|
|
@@ -38,7 +36,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
38
36
|
private constructor(private config: FeeJuicePortalTestingHarnessFactoryConfig) {}
|
|
39
37
|
|
|
40
38
|
private async createReal() {
|
|
41
|
-
const { aztecNode, aztecNodeAdmin,
|
|
39
|
+
const { aztecNode, aztecNodeAdmin, l1Client, wallet, logger } = this.config;
|
|
42
40
|
|
|
43
41
|
const ethAccount = EthAddress.fromString((await l1Client.getAddresses())[0]);
|
|
44
42
|
const l1ContractAddresses = (await aztecNode.getNodeInfo()).l1ContractAddresses;
|
|
@@ -55,7 +53,7 @@ export class FeeJuicePortalTestingHarnessFactory {
|
|
|
55
53
|
return new GasBridgingTestHarness(
|
|
56
54
|
aztecNode,
|
|
57
55
|
aztecNodeAdmin,
|
|
58
|
-
|
|
56
|
+
wallet,
|
|
59
57
|
logger,
|
|
60
58
|
gasL2,
|
|
61
59
|
ethAccount,
|
|
@@ -85,8 +83,8 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness {
|
|
|
85
83
|
public aztecNode: AztecNode,
|
|
86
84
|
/** Aztec node admin interface */
|
|
87
85
|
public aztecNodeAdmin: AztecNodeAdmin | undefined,
|
|
88
|
-
/**
|
|
89
|
-
public
|
|
86
|
+
/** Wallet. */
|
|
87
|
+
public wallet: Wallet,
|
|
90
88
|
/** Logger. */
|
|
91
89
|
public logger: Logger,
|
|
92
90
|
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
EthAddress,
|
|
5
5
|
Fr,
|
|
6
6
|
type Logger,
|
|
7
|
-
type PXE,
|
|
8
7
|
computeAuthWitMessageHash,
|
|
9
8
|
generateClaimSecret,
|
|
10
9
|
} from '@aztec/aztec.js';
|
|
@@ -43,8 +42,6 @@ const TIMEOUT = 360_000;
|
|
|
43
42
|
export type UniswapSetupContext = {
|
|
44
43
|
/** Aztec Node instance */
|
|
45
44
|
aztecNode: AztecNode;
|
|
46
|
-
/** The Private eXecution Environment (PXE). */
|
|
47
|
-
pxe: PXE;
|
|
48
45
|
/** Logger instance named as the current test. */
|
|
49
46
|
logger: Logger;
|
|
50
47
|
/** The L1 wallet client, extended with public actions. */
|
|
@@ -75,7 +72,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
75
72
|
const DAI_ADDRESS: EthAddress = EthAddress.fromString('0x6B175474E89094C44Da98b954EedeAC495271d0F');
|
|
76
73
|
|
|
77
74
|
let aztecNode: AztecNode;
|
|
78
|
-
let pxe: PXE;
|
|
79
75
|
let logger: Logger;
|
|
80
76
|
|
|
81
77
|
let l1Client: ExtendedViemWalletClient;
|
|
@@ -102,7 +98,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
102
98
|
let cheatCodes: CheatCodes;
|
|
103
99
|
let version: number;
|
|
104
100
|
beforeAll(async () => {
|
|
105
|
-
({ aztecNode,
|
|
101
|
+
({ aztecNode, logger, l1Client, wallet, ownerAddress, sponsorAddress, deployL1ContractsValues, cheatCodes } =
|
|
106
102
|
await setup());
|
|
107
103
|
|
|
108
104
|
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
@@ -121,7 +117,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
121
117
|
logger.info('Deploying DAI Portal, initializing and deploying l2 contract...');
|
|
122
118
|
daiCrossChainHarness = await CrossChainTestHarness.new(
|
|
123
119
|
aztecNode,
|
|
124
|
-
pxe,
|
|
125
120
|
deployL1ContractsValues.l1Client,
|
|
126
121
|
wallet,
|
|
127
122
|
ownerAddress,
|
|
@@ -132,7 +127,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
132
127
|
logger.info('Deploying WETH Portal, initializing and deploying l2 contract...');
|
|
133
128
|
wethCrossChainHarness = await CrossChainTestHarness.new(
|
|
134
129
|
aztecNode,
|
|
135
|
-
pxe,
|
|
136
130
|
l1Client,
|
|
137
131
|
wallet,
|
|
138
132
|
ownerAddress,
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
type FeePaymentMethod,
|
|
7
7
|
Fr,
|
|
8
8
|
L1FeeJuicePortalManager,
|
|
9
|
-
type PXE,
|
|
10
9
|
SponsoredFeePaymentMethod,
|
|
11
10
|
type Wallet,
|
|
12
11
|
createAztecNodeClient,
|
|
@@ -25,7 +24,6 @@ import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
|
25
24
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
26
25
|
|
|
27
26
|
export interface TestAccounts {
|
|
28
|
-
pxe: PXE;
|
|
29
27
|
aztecNode: AztecNode;
|
|
30
28
|
wallet: TestWallet;
|
|
31
29
|
accounts: AztecAddress[];
|
|
@@ -52,7 +50,7 @@ export async function setupTestAccountsWithTokens(
|
|
|
52
50
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
53
51
|
const wallet = new TestWallet(pxe, aztecNode);
|
|
54
52
|
|
|
55
|
-
const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(
|
|
53
|
+
const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(wallet)).slice(0, ACCOUNT_COUNT + 1);
|
|
56
54
|
|
|
57
55
|
const tokenAdmin = accounts[0];
|
|
58
56
|
const tokenAddress = await deployTokenAndMint(
|
|
@@ -66,7 +64,6 @@ export async function setupTestAccountsWithTokens(
|
|
|
66
64
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
67
65
|
|
|
68
66
|
return {
|
|
69
|
-
pxe,
|
|
70
67
|
aztecNode,
|
|
71
68
|
accounts: accounts.map(acc => acc.address),
|
|
72
69
|
wallet,
|
|
@@ -79,23 +76,23 @@ export async function setupTestAccountsWithTokens(
|
|
|
79
76
|
}
|
|
80
77
|
|
|
81
78
|
export async function deploySponsoredTestAccounts(
|
|
82
|
-
|
|
79
|
+
wallet: TestWallet,
|
|
83
80
|
aztecNode: AztecNode,
|
|
84
81
|
mintAmount: bigint,
|
|
85
82
|
logger: Logger,
|
|
86
83
|
numberOfFundedWallets = 1,
|
|
87
84
|
): Promise<TestAccounts> {
|
|
88
|
-
const wallet = new TestWallet(pxe, aztecNode);
|
|
89
85
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
90
86
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
91
87
|
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
92
88
|
|
|
93
89
|
await registerSponsoredFPC(wallet);
|
|
94
90
|
|
|
91
|
+
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
92
|
+
await recipientAccount.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 });
|
|
95
93
|
await Promise.all(
|
|
96
94
|
fundedAccounts.map(async a => {
|
|
97
|
-
|
|
98
|
-
await recipientAccount.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
|
|
95
|
+
await a.deploy({ fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
|
|
99
96
|
logger.info(`Account deployed at ${a.getAddress()}`);
|
|
100
97
|
}),
|
|
101
98
|
);
|
|
@@ -112,7 +109,6 @@ export async function deploySponsoredTestAccounts(
|
|
|
112
109
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
113
110
|
|
|
114
111
|
return {
|
|
115
|
-
pxe,
|
|
116
112
|
aztecNode,
|
|
117
113
|
wallet,
|
|
118
114
|
accounts: fundedAccounts.map(acc => acc.getAddress()),
|
|
@@ -143,7 +139,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
143
139
|
|
|
144
140
|
const claims = await Promise.all(
|
|
145
141
|
fundedAccounts.map(a =>
|
|
146
|
-
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey,
|
|
142
|
+
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.getAddress(), undefined, logger),
|
|
147
143
|
),
|
|
148
144
|
);
|
|
149
145
|
|
|
@@ -172,7 +168,6 @@ export async function deployTestAccountsWithTokens(
|
|
|
172
168
|
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
173
169
|
|
|
174
170
|
return {
|
|
175
|
-
pxe,
|
|
176
171
|
aztecNode,
|
|
177
172
|
wallet,
|
|
178
173
|
accounts: fundedAccounts.map(acc => acc.getAddress()),
|
|
@@ -187,7 +182,6 @@ export async function deployTestAccountsWithTokens(
|
|
|
187
182
|
async function bridgeL1FeeJuice(
|
|
188
183
|
l1RpcUrls: string[],
|
|
189
184
|
mnemonicOrPrivateKey: string,
|
|
190
|
-
pxe: PXE,
|
|
191
185
|
aztecNode: AztecNode,
|
|
192
186
|
recipient: AztecAddress,
|
|
193
187
|
amount: bigint | undefined,
|
|
@@ -293,23 +287,25 @@ export async function performTransfers({
|
|
|
293
287
|
}
|
|
294
288
|
}
|
|
295
289
|
|
|
296
|
-
export async function
|
|
290
|
+
export async function createWalletAndAztecNodeClient(
|
|
297
291
|
nodeUrl: string,
|
|
298
292
|
proverEnabled: boolean,
|
|
299
293
|
logger: Logger,
|
|
300
|
-
): Promise<{
|
|
301
|
-
const
|
|
294
|
+
): Promise<{ wallet: TestWallet; aztecNode: AztecNode; cleanup: () => Promise<void> }> {
|
|
295
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
302
296
|
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
303
|
-
const pxe = await createPXEService(
|
|
297
|
+
const pxe = await createPXEService(aztecNode, {
|
|
304
298
|
dataDirectory: undefined,
|
|
305
299
|
dataStoreMapSizeKB: 1024 * 1024,
|
|
306
300
|
...bbConfig,
|
|
307
301
|
...acvmConfig,
|
|
308
302
|
proverEnabled,
|
|
309
303
|
});
|
|
304
|
+
const wallet = new TestWallet(pxe, aztecNode);
|
|
310
305
|
|
|
311
306
|
return {
|
|
312
|
-
|
|
307
|
+
wallet,
|
|
308
|
+
aztecNode,
|
|
313
309
|
async cleanup() {
|
|
314
310
|
await pxe.stop();
|
|
315
311
|
await bbConfig?.cleanup();
|