@aztec/end-to-end 0.0.1-commit.f2ce05ee → 0.0.1-commit.f8ca9b2f3
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 +2 -2
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +2 -2
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +2 -2
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts +1 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +7 -2
- package/dest/e2e_fees/fees_test.d.ts +2 -2
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.d.ts +2 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +2 -1
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -2
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.d.ts +2 -2
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/setup.d.ts +14 -14
- package/dest/fixtures/setup.d.ts.map +1 -1
- package/dest/fixtures/setup.js +12 -76
- package/dest/shared/submit-transactions.d.ts +2 -2
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +2 -2
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +3 -1
- package/dest/test-wallet/test_wallet.d.ts +82 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +213 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/package.json +40 -39
- package/src/bench/client_flows/client_flows_benchmark.ts +6 -6
- package/src/bench/utils.ts +1 -1
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +4 -4
- package/src/e2e_deploy_contract/deploy_test.ts +3 -3
- package/src/e2e_epochs/epochs_test.ts +12 -3
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +7 -7
- package/src/e2e_nested_contract/nested_contract_test.ts +1 -1
- package/src/e2e_p2p/inactivity_slash_test.ts +4 -4
- package/src/e2e_p2p/p2p_network.ts +5 -5
- package/src/e2e_p2p/reqresp/utils.ts +4 -4
- package/src/e2e_p2p/shared.ts +2 -1
- package/src/e2e_token_contract/token_contract_test.ts +2 -2
- package/src/fixtures/e2e_prover_test.ts +4 -4
- package/src/fixtures/setup.ts +22 -106
- package/src/shared/submit-transactions.ts +2 -1
- package/src/shared/uniswap_l1_l2.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +3 -1
- package/src/test-wallet/test_wallet.ts +296 -0
- package/src/test-wallet/utils.ts +112 -0
|
@@ -20,7 +20,6 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
20
20
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
21
21
|
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
22
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
24
23
|
|
|
25
24
|
import { getContract } from 'viem';
|
|
26
25
|
|
|
@@ -36,6 +35,7 @@ import {
|
|
|
36
35
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
37
36
|
import { type BalancesFn, getBalancesFn, setupSponsoredFPC } from '../fixtures/utils.js';
|
|
38
37
|
import { FeeJuicePortalTestingHarnessFactory, type GasBridgingTestHarness } from '../shared/gas_portal_test_harness.js';
|
|
38
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
* Test fixture for testing fees. Provides the following setup steps:
|
|
@@ -113,7 +113,7 @@ export class FeesTest {
|
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
this.rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
116
|
-
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider
|
|
116
|
+
this.chainMonitor = new ChainMonitor(this.rollupContract, this.context.dateProvider, this.logger, 200).start();
|
|
117
117
|
|
|
118
118
|
await this.applyBaseSetup();
|
|
119
119
|
|
|
@@ -126,7 +126,7 @@ export class FeesTest {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
setIsMarkingAsProven(b: boolean) {
|
|
129
|
-
this.context.watcher
|
|
129
|
+
this.context.watcher.setIsMarkingAsProven(b);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
async catchUpProvenChain() {
|
|
@@ -188,8 +188,8 @@ export class FeesTest {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
this.wallet = this.context.wallet;
|
|
191
|
-
this.aztecNode = this.context.aztecNodeService
|
|
192
|
-
this.aztecNodeAdmin = this.context.aztecNodeService
|
|
191
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
192
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
193
193
|
this.gasSettings = GasSettings.default({ maxFeesPerGas: (await this.aztecNode.getCurrentMinFees()).mul(2) });
|
|
194
194
|
this.cheatCodes = this.context.cheatCodes;
|
|
195
195
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
@@ -221,8 +221,8 @@ export class FeesTest {
|
|
|
221
221
|
);
|
|
222
222
|
|
|
223
223
|
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
224
|
-
aztecNode: this.context.aztecNodeService
|
|
225
|
-
aztecNodeAdmin: this.context.aztecNodeService
|
|
224
|
+
aztecNode: this.context.aztecNodeService,
|
|
225
|
+
aztecNodeAdmin: this.context.aztecNodeService,
|
|
226
226
|
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
227
227
|
wallet: this.wallet,
|
|
228
228
|
logger: this.logger,
|
|
@@ -44,7 +44,7 @@ export class NestedContractTest {
|
|
|
44
44
|
});
|
|
45
45
|
this.wallet = this.context.wallet;
|
|
46
46
|
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
47
|
-
this.aztecNode = this.context.aztecNodeService
|
|
47
|
+
this.aztecNode = this.context.aztecNodeService;
|
|
48
48
|
|
|
49
49
|
this.logger.info('Public deploy accounts');
|
|
50
50
|
await publicDeployAccounts(this.wallet, [this.defaultAccountAddress]);
|
|
@@ -98,13 +98,13 @@ export class P2PInactivityTest {
|
|
|
98
98
|
this.rollup = rollup;
|
|
99
99
|
|
|
100
100
|
if (!this.keepInitialNode) {
|
|
101
|
-
await this.test.ctx.aztecNodeService
|
|
101
|
+
await this.test.ctx.aztecNodeService.stop();
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
// Create all active nodes
|
|
105
105
|
this.activeNodes = await createNodes(
|
|
106
106
|
this.test.ctx.aztecNodeConfig,
|
|
107
|
-
this.test.ctx.dateProvider
|
|
107
|
+
this.test.ctx.dateProvider,
|
|
108
108
|
this.test.bootstrapNodeEnr,
|
|
109
109
|
NUM_NODES - this.inactiveNodeCount - Number(this.keepInitialNode),
|
|
110
110
|
BOOT_NODE_UDP_PORT,
|
|
@@ -118,7 +118,7 @@ export class P2PInactivityTest {
|
|
|
118
118
|
const inactiveConfig = { ...this.test.ctx.aztecNodeConfig, dontStartSequencer: true };
|
|
119
119
|
this.inactiveNodes = await createNodes(
|
|
120
120
|
inactiveConfig,
|
|
121
|
-
this.test.ctx.dateProvider
|
|
121
|
+
this.test.ctx.dateProvider,
|
|
122
122
|
this.test.bootstrapNodeEnr,
|
|
123
123
|
this.inactiveNodeCount,
|
|
124
124
|
BOOT_NODE_UDP_PORT,
|
|
@@ -129,7 +129,7 @@ export class P2PInactivityTest {
|
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
this.nodes = [
|
|
132
|
-
...(this.keepInitialNode ? [this.test.ctx.aztecNodeService
|
|
132
|
+
...(this.keepInitialNode ? [this.test.ctx.aztecNodeService] : []),
|
|
133
133
|
...this.activeNodes,
|
|
134
134
|
...this.inactiveNodes,
|
|
135
135
|
];
|
|
@@ -27,7 +27,6 @@ import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
|
27
27
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
28
28
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
29
29
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
30
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
31
30
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
32
31
|
|
|
33
32
|
import getPort from 'get-port';
|
|
@@ -49,6 +48,7 @@ import {
|
|
|
49
48
|
generatePrivateKeys,
|
|
50
49
|
} from '../fixtures/setup_p2p_test.js';
|
|
51
50
|
import { getEndToEndTestTelemetryClient } from '../fixtures/with_telemetry_utils.js';
|
|
51
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
52
52
|
|
|
53
53
|
// Use a fixed bootstrap node private key so that we can re-use the same snapshot and the nodes can find each other
|
|
54
54
|
const BOOTSTRAP_NODE_PRIVATE_KEY = '080212208f988fc0899e4a73a5aee4d271a5f20670603a756ad8d84f2c94263a6427c591';
|
|
@@ -333,9 +333,9 @@ export class P2PNetworkTest {
|
|
|
333
333
|
const block = await this.context.deployL1ContractsValues.l1Client.getBlock({
|
|
334
334
|
blockNumber: receipt.blockNumber,
|
|
335
335
|
});
|
|
336
|
-
this.context.dateProvider
|
|
336
|
+
this.context.dateProvider.setTime(Number(block.timestamp) * 1000);
|
|
337
337
|
|
|
338
|
-
await this.context.aztecNodeService
|
|
338
|
+
await this.context.aztecNodeService.stop();
|
|
339
339
|
}
|
|
340
340
|
|
|
341
341
|
async sendDummyTx() {
|
|
@@ -374,8 +374,8 @@ export class P2PNetworkTest {
|
|
|
374
374
|
this.prefilledPublicData = prefilledPublicData;
|
|
375
375
|
|
|
376
376
|
const rollupContract = RollupContract.getFromL1ContractsValues(this.context.deployL1ContractsValues);
|
|
377
|
-
this.monitor = new ChainMonitor(rollupContract, this.context.dateProvider
|
|
378
|
-
this.monitor.on('l1-block', ({ timestamp }) => this.context.dateProvider
|
|
377
|
+
this.monitor = new ChainMonitor(rollupContract, this.context.dateProvider).start();
|
|
378
|
+
this.monitor.on('l1-block', ({ timestamp }) => this.context.dateProvider.setTime(Number(timestamp) * 1000));
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
async stopNodes(nodes: AztecNodeService[]) {
|
|
@@ -81,7 +81,7 @@ export async function runReqrespTxTest(params: {
|
|
|
81
81
|
|
|
82
82
|
const nodes = await createNodes(
|
|
83
83
|
aztecNodeConfig,
|
|
84
|
-
t.ctx.dateProvider
|
|
84
|
+
t.ctx.dateProvider,
|
|
85
85
|
t.bootstrapNodeEnr,
|
|
86
86
|
NUM_VALIDATORS,
|
|
87
87
|
BOOT_NODE_UDP_PORT,
|
|
@@ -95,7 +95,7 @@ export async function runReqrespTxTest(params: {
|
|
|
95
95
|
|
|
96
96
|
await t.setupAccount();
|
|
97
97
|
|
|
98
|
-
const targetBlockNumber = await t.ctx.aztecNodeService
|
|
98
|
+
const targetBlockNumber = await t.ctx.aztecNodeService.getBlockNumber();
|
|
99
99
|
await retryUntil(
|
|
100
100
|
async () => {
|
|
101
101
|
const blockNumbers = await Promise.all(nodes.map(node => node.getBlockNumber()));
|
|
@@ -108,7 +108,7 @@ export async function runReqrespTxTest(params: {
|
|
|
108
108
|
|
|
109
109
|
t.logger.info('Preparing transactions to send');
|
|
110
110
|
const txBatches = await timesAsync(2, () =>
|
|
111
|
-
prepareTransactions(t.logger, t.ctx.aztecNodeService
|
|
111
|
+
prepareTransactions(t.logger, t.ctx.aztecNodeService, NUM_TXS_PER_NODE, t.fundedAccount),
|
|
112
112
|
);
|
|
113
113
|
|
|
114
114
|
t.logger.info('Removing initial node');
|
|
@@ -116,7 +116,7 @@ export async function runReqrespTxTest(params: {
|
|
|
116
116
|
|
|
117
117
|
t.logger.info('Starting fresh slot');
|
|
118
118
|
const [timestamp] = await t.ctx.cheatCodes.rollup.advanceToNextSlot();
|
|
119
|
-
t.ctx.dateProvider
|
|
119
|
+
t.ctx.dateProvider.setTime(Number(timestamp) * 1000);
|
|
120
120
|
const startSlotTimestamp = BigInt(timestamp);
|
|
121
121
|
|
|
122
122
|
const { proposerIndexes, nodesToTurnOffTxGossip } = await getProposerIndexes(t, startSlotTimestamp);
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -22,9 +22,10 @@ import { getPXEConfig, getPXEConfig as getRpcConfig } from '@aztec/pxe/server';
|
|
|
22
22
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
23
23
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
24
24
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
25
|
-
import { type ProvenTx, TestWallet, proveInteraction } from '@aztec/test-wallet/server';
|
|
26
25
|
|
|
27
26
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
27
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
28
|
+
import { type ProvenTx, proveInteraction } from '../test-wallet/utils.js';
|
|
28
29
|
|
|
29
30
|
// submits a set of transactions to the provided Private eXecution Environment (PXE)
|
|
30
31
|
export const submitComplexTxsTo = async (
|
|
@@ -3,13 +3,13 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
3
3
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
4
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
5
5
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
6
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
7
6
|
|
|
8
7
|
import { jest } from '@jest/globals';
|
|
9
8
|
|
|
10
9
|
import { type EndToEndContext, deployAccounts, publicDeployAccounts, setup, teardown } from '../fixtures/setup.js';
|
|
11
10
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
12
11
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
12
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
13
13
|
|
|
14
14
|
const { METRICS_PORT: metricsPort } = process.env;
|
|
15
15
|
|
|
@@ -70,7 +70,7 @@ export class TokenContractTest {
|
|
|
70
70
|
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
this.node = this.context.aztecNodeService
|
|
73
|
+
this.node = this.context.aztecNodeService;
|
|
74
74
|
this.wallet = this.context.wallet;
|
|
75
75
|
[this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map(acc => acc.address);
|
|
76
76
|
|
|
@@ -20,13 +20,13 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
20
20
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
21
21
|
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
22
22
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
|
-
import { TestWallet } from '@aztec/test-wallet/server';
|
|
24
23
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
25
24
|
|
|
26
25
|
import { type Hex, getContract } from 'viem';
|
|
27
26
|
import { privateKeyToAddress } from 'viem/accounts';
|
|
28
27
|
|
|
29
28
|
import { TokenSimulator } from '../simulators/token_simulator.js';
|
|
29
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
30
30
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
31
31
|
import { getBBConfig } from './get_bb_config.js';
|
|
32
32
|
import {
|
|
@@ -144,7 +144,7 @@ export class FullProverTest {
|
|
|
144
144
|
this.logger.info(`Enabling proving`, { realProofs: this.realProofs });
|
|
145
145
|
|
|
146
146
|
// We don't wish to mark as proven automatically, so we set the flag to false
|
|
147
|
-
this.context.watcher
|
|
147
|
+
this.context.watcher.setIsMarkingAsProven(false);
|
|
148
148
|
|
|
149
149
|
this.simulatedProverNode = this.context.proverNode!;
|
|
150
150
|
({
|
|
@@ -152,7 +152,7 @@ export class FullProverTest {
|
|
|
152
152
|
deployL1ContractsValues: this.l1Contracts,
|
|
153
153
|
cheatCodes: this.cheatCodes,
|
|
154
154
|
} = this.context);
|
|
155
|
-
this.aztecNodeAdmin = this.context.aztecNodeService
|
|
155
|
+
this.aztecNodeAdmin = this.context.aztecNodeService;
|
|
156
156
|
|
|
157
157
|
const config = this.context.aztecNodeConfig;
|
|
158
158
|
const blobClient = await createBlobClientWithFileStores(config, this.logger);
|
|
@@ -225,7 +225,7 @@ export class FullProverTest {
|
|
|
225
225
|
this.logger.verbose('Starting archiver for new prover node');
|
|
226
226
|
const archiver = await createArchiver(
|
|
227
227
|
{ ...this.context.aztecNodeConfig, dataDirectory: undefined },
|
|
228
|
-
{ blobClient, dateProvider: this.context.dateProvider
|
|
228
|
+
{ blobClient, dateProvider: this.context.dateProvider },
|
|
229
229
|
{ blockUntilSync: true },
|
|
230
230
|
);
|
|
231
231
|
|
package/src/fixtures/setup.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type InitialAccountData, generateSchnorrAccounts
|
|
2
|
+
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
5
5
|
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
14
14
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
15
15
|
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
16
|
-
import {
|
|
16
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
17
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
18
18
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
19
19
|
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
initTelemetryClient,
|
|
68
68
|
} from '@aztec/telemetry-client';
|
|
69
69
|
import { BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
70
|
-
import {
|
|
70
|
+
import { deployFundedSchnorrAccounts } from '@aztec/wallets/testing';
|
|
71
71
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
72
72
|
|
|
73
73
|
import type { Anvil } from '@viem/anvil';
|
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
} from 'viem/accounts';
|
|
85
85
|
import { type Chain, foundry } from 'viem/chains';
|
|
86
86
|
|
|
87
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
87
88
|
import { MNEMONIC, TEST_MAX_PENDING_TX_POOL_COUNT, TEST_PEER_CHECK_INTERVAL_MS } from './fixtures.js';
|
|
88
89
|
import { getACVMConfig } from './get_acvm_config.js';
|
|
89
90
|
import { getBBConfig } from './get_bb_config.js';
|
|
@@ -92,9 +93,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
92
93
|
|
|
93
94
|
export { startAnvil };
|
|
94
95
|
|
|
95
|
-
const { AZTEC_NODE_URL = '' } = process.env;
|
|
96
|
-
const getAztecUrl = () => AZTEC_NODE_URL;
|
|
97
|
-
|
|
98
96
|
let telemetry: TelemetryClient | undefined = undefined;
|
|
99
97
|
async function getTelemetryClient(partialConfig: Partial<TelemetryClientConfig> & { benchmark?: boolean } = {}) {
|
|
100
98
|
if (!telemetry) {
|
|
@@ -217,13 +215,13 @@ export type EndToEndContext = {
|
|
|
217
215
|
anvil: Anvil | undefined;
|
|
218
216
|
/** The Aztec Node service or client a connected to it. */
|
|
219
217
|
aztecNode: AztecNode;
|
|
220
|
-
/** The Aztec Node as a service
|
|
221
|
-
aztecNodeService: AztecNodeService
|
|
222
|
-
/** Client to the Aztec Node admin interface
|
|
223
|
-
aztecNodeAdmin: AztecNodeAdmin
|
|
218
|
+
/** The Aztec Node as a service. */
|
|
219
|
+
aztecNodeService: AztecNodeService;
|
|
220
|
+
/** Client to the Aztec Node admin interface. */
|
|
221
|
+
aztecNodeAdmin: AztecNodeAdmin;
|
|
224
222
|
/** The prover node service (only set if startProverNode is true) */
|
|
225
223
|
proverNode: ProverNode | undefined;
|
|
226
|
-
/** A client to the sequencer service
|
|
224
|
+
/** A client to the sequencer service. */
|
|
227
225
|
sequencer: SequencerClient | undefined;
|
|
228
226
|
/** Return values from deployAztecL1Contracts function. */
|
|
229
227
|
deployL1ContractsValues: DeployAztecL1ContractsReturnType;
|
|
@@ -243,12 +241,12 @@ export type EndToEndContext = {
|
|
|
243
241
|
cheatCodes: CheatCodes;
|
|
244
242
|
/** The cheat codes for L1 */
|
|
245
243
|
ethCheatCodes: EthCheatCodes;
|
|
246
|
-
/** The anvil test watcher
|
|
247
|
-
watcher: AnvilTestWatcher
|
|
248
|
-
/** Allows tweaking current system time, used by the epoch cache only
|
|
249
|
-
dateProvider: TestDateProvider
|
|
244
|
+
/** The anvil test watcher. */
|
|
245
|
+
watcher: AnvilTestWatcher;
|
|
246
|
+
/** Allows tweaking current system time, used by the epoch cache only. */
|
|
247
|
+
dateProvider: TestDateProvider;
|
|
250
248
|
/** Telemetry client */
|
|
251
|
-
telemetryClient: TelemetryClient
|
|
249
|
+
telemetryClient: TelemetryClient;
|
|
252
250
|
/** Mock gossip sub network used for gossipping messages (only if mockGossipSubNetwork was set to true in opts) */
|
|
253
251
|
mockGossipSubNetwork: MockGossipSubNetwork | undefined;
|
|
254
252
|
/** Prefilled public data used for setting up nodes. */
|
|
@@ -258,87 +256,11 @@ export type EndToEndContext = {
|
|
|
258
256
|
/** BB config (only set if running locally). */
|
|
259
257
|
bbConfig: Awaited<ReturnType<typeof getBBConfig>>;
|
|
260
258
|
/** Directory to cleanup on teardown. */
|
|
261
|
-
directoryToCleanup: string
|
|
259
|
+
directoryToCleanup: string;
|
|
262
260
|
/** Function to stop the started services. */
|
|
263
261
|
teardown: () => Promise<void>;
|
|
264
262
|
};
|
|
265
263
|
|
|
266
|
-
/**
|
|
267
|
-
* Function to setup the test against a remote deployment. It is assumed that L1 contract are already deployed
|
|
268
|
-
*/
|
|
269
|
-
async function setupWithRemoteEnvironment(
|
|
270
|
-
account: HDAccount | PrivateKeyAccount,
|
|
271
|
-
config: AztecNodeConfig & SetupOptions,
|
|
272
|
-
logger: Logger,
|
|
273
|
-
numberOfAccounts: number,
|
|
274
|
-
): Promise<EndToEndContext> {
|
|
275
|
-
const aztecNodeUrl = getAztecUrl();
|
|
276
|
-
logger.verbose(`Creating Aztec Node client to remote host ${aztecNodeUrl}`);
|
|
277
|
-
const aztecNode = createAztecNodeClient(aztecNodeUrl);
|
|
278
|
-
await waitForNode(aztecNode, logger);
|
|
279
|
-
logger.verbose('JSON RPC client connected to Aztec Node');
|
|
280
|
-
logger.verbose(`Retrieving contract addresses from ${aztecNodeUrl}`);
|
|
281
|
-
const { l1ContractAddresses, rollupVersion } = await aztecNode.getNodeInfo();
|
|
282
|
-
|
|
283
|
-
const l1Client = createExtendedL1Client(config.l1RpcUrls, account, foundry);
|
|
284
|
-
|
|
285
|
-
const deployL1ContractsValues: DeployAztecL1ContractsReturnType = {
|
|
286
|
-
l1ContractAddresses,
|
|
287
|
-
l1Client,
|
|
288
|
-
rollupVersion,
|
|
289
|
-
};
|
|
290
|
-
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
291
|
-
const wallet = await TestWallet.create(aztecNode);
|
|
292
|
-
|
|
293
|
-
if (config.walletMinFeePadding !== undefined) {
|
|
294
|
-
wallet.setMinFeePadding(config.walletMinFeePadding);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
298
|
-
const teardown = () => Promise.resolve();
|
|
299
|
-
|
|
300
|
-
logger.verbose('Populating wallet from already registered accounts...');
|
|
301
|
-
const initialFundedAccounts = await getInitialTestAccountsData();
|
|
302
|
-
|
|
303
|
-
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
304
|
-
throw new Error(`Required ${numberOfAccounts} accounts. Found ${initialFundedAccounts.length}.`);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const testAccounts = await Promise.all(
|
|
308
|
-
initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
|
|
309
|
-
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
310
|
-
return accountManager.address;
|
|
311
|
-
}),
|
|
312
|
-
);
|
|
313
|
-
|
|
314
|
-
return {
|
|
315
|
-
anvil: undefined,
|
|
316
|
-
aztecNode,
|
|
317
|
-
aztecNodeService: undefined,
|
|
318
|
-
aztecNodeAdmin: undefined,
|
|
319
|
-
sequencer: undefined,
|
|
320
|
-
proverNode: undefined,
|
|
321
|
-
deployL1ContractsValues,
|
|
322
|
-
config,
|
|
323
|
-
aztecNodeConfig: config,
|
|
324
|
-
initialFundedAccounts,
|
|
325
|
-
wallet,
|
|
326
|
-
accounts: testAccounts,
|
|
327
|
-
logger,
|
|
328
|
-
cheatCodes,
|
|
329
|
-
ethCheatCodes,
|
|
330
|
-
prefilledPublicData: undefined,
|
|
331
|
-
mockGossipSubNetwork: undefined,
|
|
332
|
-
watcher: undefined,
|
|
333
|
-
dateProvider: undefined,
|
|
334
|
-
telemetryClient: undefined,
|
|
335
|
-
acvmConfig: undefined,
|
|
336
|
-
bbConfig: undefined,
|
|
337
|
-
directoryToCleanup: undefined,
|
|
338
|
-
teardown,
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
264
|
/**
|
|
343
265
|
* Sets up the environment for the end-to-end tests.
|
|
344
266
|
* @param numberOfAccounts - The number of new accounts to be created once the PXE is initiated.
|
|
@@ -381,12 +303,6 @@ export async function setup(
|
|
|
381
303
|
if (!isAnvilTestChain(chain.id)) {
|
|
382
304
|
throw new Error(`No ETHEREUM_HOSTS set but non anvil chain requested`);
|
|
383
305
|
}
|
|
384
|
-
if (AZTEC_NODE_URL) {
|
|
385
|
-
throw new Error(
|
|
386
|
-
`AZTEC_NODE_URL provided but no ETHEREUM_HOSTS set. Refusing to run, please set both variables so tests can deploy L1 contracts to the same Anvil instance`,
|
|
387
|
-
);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
306
|
const res = await startAnvil({
|
|
391
307
|
l1BlockTime: opts.ethereumSlotDuration,
|
|
392
308
|
accounts: opts.anvilAccounts,
|
|
@@ -441,11 +357,6 @@ export async function setup(
|
|
|
441
357
|
config.coinbase = EthAddress.fromString(publisherHdAccount.address);
|
|
442
358
|
}
|
|
443
359
|
|
|
444
|
-
if (AZTEC_NODE_URL) {
|
|
445
|
-
// we are setting up against a remote environment, l1 contracts are assumed to already be deployed
|
|
446
|
-
return await setupWithRemoteEnvironment(publisherHdAccount!, config, logger, numberOfAccounts);
|
|
447
|
-
}
|
|
448
|
-
|
|
449
360
|
// Determine which addresses to fund in genesis
|
|
450
361
|
const initialFundedAccounts =
|
|
451
362
|
opts.initialFundedAccounts ??
|
|
@@ -595,7 +506,7 @@ export async function setup(
|
|
|
595
506
|
const proverNodeConfig = {
|
|
596
507
|
...config.proverNodeConfig,
|
|
597
508
|
dataDirectory: proverNodeDataDirectory,
|
|
598
|
-
p2pEnabled:
|
|
509
|
+
p2pEnabled: !!mockGossipSubNetwork,
|
|
599
510
|
};
|
|
600
511
|
proverNode = await createAndSyncProverNode(
|
|
601
512
|
proverNodePrivateKeyHex,
|
|
@@ -603,6 +514,11 @@ export async function setup(
|
|
|
603
514
|
proverNodeConfig,
|
|
604
515
|
aztecNodeService,
|
|
605
516
|
prefilledPublicData,
|
|
517
|
+
{
|
|
518
|
+
p2pClientDeps: mockGossipSubNetwork
|
|
519
|
+
? { p2pServiceFactory: getMockPubSubP2PServiceFactory(mockGossipSubNetwork) }
|
|
520
|
+
: undefined,
|
|
521
|
+
},
|
|
606
522
|
);
|
|
607
523
|
}
|
|
608
524
|
|
|
@@ -683,7 +599,7 @@ export async function setup(
|
|
|
683
599
|
logger.error(`Error during e2e test teardown`, err);
|
|
684
600
|
} finally {
|
|
685
601
|
try {
|
|
686
|
-
await telemetryClient
|
|
602
|
+
await telemetryClient.stop();
|
|
687
603
|
} catch (err) {
|
|
688
604
|
logger.error(`Error during telemetry client stop`, err);
|
|
689
605
|
}
|
|
@@ -4,7 +4,8 @@ import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
|
|
|
4
4
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
5
5
|
import { TxHash, type TxReceipt, TxStatus } from '@aztec/aztec.js/tx';
|
|
6
6
|
import { times } from '@aztec/foundation/collection';
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
8
9
|
|
|
9
10
|
// submits a set of transactions to the provided Wallet
|
|
10
11
|
export const submitTxsTo = async (
|
|
@@ -17,12 +17,12 @@ import { InboxAbi, UniswapPortalAbi, UniswapPortalBytecode } from '@aztec/l1-art
|
|
|
17
17
|
import { UniswapContract } from '@aztec/noir-contracts.js/Uniswap';
|
|
18
18
|
import { computeL2ToL1MessageHash } from '@aztec/stdlib/hash';
|
|
19
19
|
import { computeL2ToL1MembershipWitness } from '@aztec/stdlib/messaging';
|
|
20
|
-
import type { TestWallet } from '@aztec/test-wallet/server';
|
|
21
20
|
|
|
22
21
|
import { jest } from '@jest/globals';
|
|
23
22
|
import { type GetContractReturnType, getContract, parseEther, toFunctionSelector } from 'viem';
|
|
24
23
|
|
|
25
24
|
import { type EndToEndContext, ensureAccountContractsPublished } from '../fixtures/utils.js';
|
|
25
|
+
import type { TestWallet } from '../test-wallet/test_wallet.js';
|
|
26
26
|
import { CrossChainTestHarness } from './cross_chain_test_harness.js';
|
|
27
27
|
|
|
28
28
|
// PSA: This tests works on forked mainnet. There is a dump of the data in `dumpedState` such that we
|
|
@@ -84,7 +84,7 @@ export const uniswapL1L2TestSuite = (
|
|
|
84
84
|
|
|
85
85
|
l1Client = deployL1ContractsValues.l1Client;
|
|
86
86
|
|
|
87
|
-
t.watcher
|
|
87
|
+
t.watcher.setIsMarkingAsProven(false);
|
|
88
88
|
|
|
89
89
|
if (Number(await l1Client.getBlockNumber()) < expectedForkBlockNumber) {
|
|
90
90
|
throw new Error('This test must be run on a fork of mainnet with the expected fork block');
|
|
@@ -13,11 +13,13 @@ import type { Logger } from '@aztec/foundation/log';
|
|
|
13
13
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
14
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
15
15
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
16
|
-
import {
|
|
16
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
17
17
|
|
|
18
18
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
19
19
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
20
20
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
21
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
22
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
21
23
|
|
|
22
24
|
export interface TestAccounts {
|
|
23
25
|
aztecNode: AztecNode;
|