@aztec/end-to-end 2.1.0-rc.9 → 3.0.0-devnet.2
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 +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +16 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +54 -58
- package/dest/bench/utils.d.ts +2 -11
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +10 -34
- 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 +10 -8
- 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 +31 -33
- package/dest/e2e_deploy_contract/deploy_test.d.ts +10 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -18
- package/dest/e2e_epochs/epochs_test.d.ts +3 -1
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +10 -9
- package/dest/e2e_fees/bridging_race.notest.js +12 -9
- 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 +23 -31
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -1
- 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 +6 -3
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +7 -9
- 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 +5 -2
- package/dest/e2e_p2p/p2p_network.d.ts +16 -4
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +32 -10
- package/dest/e2e_p2p/shared.d.ts +11 -13
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +49 -45
- package/dest/e2e_token_contract/token_contract_test.d.ts +5 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +14 -17
- package/dest/fixtures/e2e_prover_test.d.ts +8 -6
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +40 -50
- 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 +0 -7
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.d.ts +10 -7
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +44 -34
- package/dest/fixtures/token_utils.d.ts +6 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +11 -15
- package/dest/fixtures/utils.d.ts +23 -27
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +76 -101
- package/dest/fixtures/web3signer.d.ts +1 -1
- package/dest/fixtures/web3signer.d.ts.map +1 -1
- package/dest/fixtures/web3signer.js +16 -5
- 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 +16 -10
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +13 -15
- package/dest/shared/gas_portal_test_harness.d.ts +9 -6
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +10 -7
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +5 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +8 -7
- package/dest/shared/uniswap_l1_l2.d.ts +9 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +29 -45
- package/dest/simulators/lending_simulator.d.ts +2 -1
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +3 -2
- package/dest/simulators/token_simulator.d.ts +3 -1
- 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 +19 -13
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -85
- package/dest/spartan/utils.d.ts +44 -0
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +212 -20
- package/package.json +38 -37
- package/src/bench/client_flows/benchmark.ts +6 -6
- package/src/bench/client_flows/client_flows_benchmark.ts +62 -82
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +9 -37
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +46 -63
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +33 -47
- package/src/e2e_deploy_contract/deploy_test.ts +17 -35
- package/src/e2e_epochs/epochs_test.ts +12 -14
- package/src/e2e_fees/bridging_race.notest.ts +14 -9
- package/src/e2e_fees/fees_test.ts +26 -38
- package/src/e2e_l1_publisher/write_json.ts +8 -6
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +11 -10
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -3
- package/src/e2e_p2p/p2p_network.ts +105 -67
- package/src/e2e_p2p/shared.ts +50 -55
- package/src/e2e_token_contract/token_contract_test.ts +17 -17
- package/src/fixtures/e2e_prover_test.ts +51 -88
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +3 -2
- package/src/fixtures/setup_l1_contracts.ts +3 -3
- package/src/fixtures/setup_p2p_test.ts +0 -8
- package/src/fixtures/snapshot_manager.ts +61 -61
- package/src/fixtures/token_utils.ts +13 -21
- package/src/fixtures/utils.ts +87 -138
- package/src/fixtures/web3signer.ts +22 -5
- package/src/guides/up_quick_start.sh +2 -10
- package/src/quality_of_service/alert_checker.ts +1 -1
- package/src/shared/cross_chain_test_harness.ts +18 -29
- package/src/shared/gas_portal_test_harness.ts +12 -19
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +12 -8
- package/src/shared/uniswap_l1_l2.ts +61 -67
- package/src/simulators/lending_simulator.ts +3 -2
- package/src/simulators/token_simulator.ts +5 -2
- package/src/spartan/DEVELOP.md +8 -3
- package/src/spartan/setup_test_wallets.ts +133 -126
- package/src/spartan/utils.ts +268 -18
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SchnorrAccountContractArtifact,
|
|
3
|
-
getSchnorrAccount,
|
|
4
|
-
getSchnorrWalletWithSecretKey,
|
|
5
|
-
} from '@aztec/accounts/schnorr';
|
|
6
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
7
2
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type CompleteAddress,
|
|
12
|
-
EthAddress,
|
|
13
|
-
type Logger,
|
|
14
|
-
type PXE,
|
|
15
|
-
createLogger,
|
|
16
|
-
} from '@aztec/aztec.js';
|
|
3
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
17
6
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
18
7
|
import {
|
|
19
8
|
BBCircuitVerifier,
|
|
@@ -29,8 +18,8 @@ import { SecretValue } from '@aztec/foundation/config';
|
|
|
29
18
|
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts';
|
|
30
19
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
31
20
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
32
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
33
21
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
22
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
34
23
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
35
24
|
|
|
36
25
|
import { type Hex, getContract } from 'viem';
|
|
@@ -46,12 +35,12 @@ import {
|
|
|
46
35
|
deployAccounts,
|
|
47
36
|
publicDeployAccounts,
|
|
48
37
|
} from './snapshot_manager.js';
|
|
49
|
-
import { getPrivateKeyFromIndex, getSponsoredFPCAddress,
|
|
38
|
+
import { getPrivateKeyFromIndex, getSponsoredFPCAddress, setupPXEAndGetWallet } from './utils.js';
|
|
50
39
|
|
|
51
40
|
const { E2E_DATA_PATH: dataPath } = process.env;
|
|
52
41
|
|
|
53
42
|
type ProvenSetup = {
|
|
54
|
-
|
|
43
|
+
wallet: TestWallet;
|
|
55
44
|
teardown: () => Promise<void>;
|
|
56
45
|
};
|
|
57
46
|
|
|
@@ -68,21 +57,21 @@ export class FullProverTest {
|
|
|
68
57
|
static TOKEN_DECIMALS = 18n;
|
|
69
58
|
private snapshotManager: ISnapshotManager;
|
|
70
59
|
logger: Logger;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
accounts:
|
|
60
|
+
wallet!: TestWallet;
|
|
61
|
+
provenWallet!: TestWallet;
|
|
62
|
+
accounts: AztecAddress[] = [];
|
|
63
|
+
deployedAccounts!: InitialAccountData[];
|
|
74
64
|
fakeProofsAsset!: TokenContract;
|
|
75
65
|
tokenSim!: TokenSimulator;
|
|
76
66
|
aztecNode!: AztecNode;
|
|
77
67
|
aztecNodeAdmin!: AztecNodeAdmin;
|
|
78
|
-
pxe!: PXEService;
|
|
79
68
|
cheatCodes!: CheatCodes;
|
|
80
69
|
blobSink!: BlobSinkServer;
|
|
81
70
|
private provenComponents: ProvenSetup[] = [];
|
|
82
71
|
private bbConfigCleanup?: () => Promise<void>;
|
|
83
72
|
private acvmConfigCleanup?: () => Promise<void>;
|
|
84
73
|
circuitProofVerifier?: ClientProtocolCircuitVerifier;
|
|
85
|
-
|
|
74
|
+
provenAsset!: TokenContract;
|
|
86
75
|
private context!: SubsystemsContext;
|
|
87
76
|
private proverNode!: ProverNode;
|
|
88
77
|
private simulatedProverNode!: ProverNode;
|
|
@@ -115,13 +104,11 @@ export class FullProverTest {
|
|
|
115
104
|
await this.snapshotManager.snapshot(
|
|
116
105
|
'2_accounts',
|
|
117
106
|
deployAccounts(2, this.logger),
|
|
118
|
-
|
|
107
|
+
({ deployedAccounts }, { wallet }) => {
|
|
119
108
|
this.deployedAccounts = deployedAccounts;
|
|
120
|
-
this.
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
this.accounts = this.wallets.map(w => w.getCompleteAddress());
|
|
124
|
-
this.wallets.forEach((w, i) => this.logger.verbose(`Wallet ${i} address: ${w.getAddress()}`));
|
|
109
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
110
|
+
this.wallet = wallet;
|
|
111
|
+
return Promise.resolve();
|
|
125
112
|
},
|
|
126
113
|
);
|
|
127
114
|
|
|
@@ -131,17 +118,17 @@ export class FullProverTest {
|
|
|
131
118
|
// Create the token contract state.
|
|
132
119
|
// Move this account thing to addAccounts above?
|
|
133
120
|
this.logger.verbose(`Public deploy accounts...`);
|
|
134
|
-
await publicDeployAccounts(this.
|
|
121
|
+
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
135
122
|
|
|
136
123
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
137
124
|
const asset = await TokenContract.deploy(
|
|
138
|
-
this.
|
|
125
|
+
this.wallet,
|
|
139
126
|
this.accounts[0],
|
|
140
127
|
FullProverTest.TOKEN_NAME,
|
|
141
128
|
FullProverTest.TOKEN_SYMBOL,
|
|
142
129
|
FullProverTest.TOKEN_DECIMALS,
|
|
143
130
|
)
|
|
144
|
-
.send({ from: this.
|
|
131
|
+
.send({ from: this.accounts[0] })
|
|
145
132
|
.deployed();
|
|
146
133
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
147
134
|
|
|
@@ -149,19 +136,19 @@ export class FullProverTest {
|
|
|
149
136
|
},
|
|
150
137
|
async ({ tokenContractAddress }) => {
|
|
151
138
|
// Restore the token contract state.
|
|
152
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.
|
|
139
|
+
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
153
140
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
154
141
|
|
|
155
142
|
this.tokenSim = new TokenSimulator(
|
|
156
143
|
this.fakeProofsAsset,
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
144
|
+
this.wallet,
|
|
145
|
+
this.accounts[0],
|
|
159
146
|
this.logger,
|
|
160
|
-
this.accounts
|
|
147
|
+
this.accounts,
|
|
161
148
|
);
|
|
162
149
|
|
|
163
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0]
|
|
164
|
-
this.accounts[0].
|
|
150
|
+
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
|
|
151
|
+
this.accounts[0].toBigInt(),
|
|
165
152
|
);
|
|
166
153
|
},
|
|
167
154
|
);
|
|
@@ -175,7 +162,6 @@ export class FullProverTest {
|
|
|
175
162
|
|
|
176
163
|
this.simulatedProverNode = this.context.proverNode!;
|
|
177
164
|
({
|
|
178
|
-
pxe: this.pxe,
|
|
179
165
|
aztecNode: this.aztecNode,
|
|
180
166
|
deployL1ContractsValues: this.l1Contracts,
|
|
181
167
|
cheatCodes: this.cheatCodes,
|
|
@@ -224,51 +210,31 @@ export class FullProverTest {
|
|
|
224
210
|
await this.context.cheatCodes.rollup.markAsProven();
|
|
225
211
|
|
|
226
212
|
this.logger.verbose(`Main setup completed, initializing full prover PXE, Node, and Prover Node`);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
240
|
-
|
|
241
|
-
for (let i = 0; i < 2; i++) {
|
|
242
|
-
await result.pxe.registerAccount(
|
|
243
|
-
this.deployedAccounts[i].secret,
|
|
244
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
245
|
-
);
|
|
246
|
-
await this.pxe.registerAccount(
|
|
247
|
-
this.deployedAccounts[i].secret,
|
|
248
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
const account = await getSchnorrAccount(
|
|
253
|
-
result.pxe,
|
|
254
|
-
this.deployedAccounts[0].secret,
|
|
255
|
-
this.deployedAccounts[0].signingKey,
|
|
256
|
-
this.deployedAccounts[0].salt,
|
|
257
|
-
);
|
|
258
|
-
|
|
259
|
-
await result.pxe.registerContract({
|
|
260
|
-
instance: account.getInstance(),
|
|
261
|
-
artifact: SchnorrAccountContractArtifact,
|
|
262
|
-
});
|
|
213
|
+
const { wallet: provenWallet, teardown: provenTeardown } = await setupPXEAndGetWallet(
|
|
214
|
+
this.aztecNode,
|
|
215
|
+
{
|
|
216
|
+
proverEnabled: this.realProofs,
|
|
217
|
+
bbBinaryPath: bbConfig?.bbBinaryPath,
|
|
218
|
+
bbWorkingDirectory: bbConfig?.bbWorkingDirectory,
|
|
219
|
+
},
|
|
220
|
+
undefined,
|
|
221
|
+
true,
|
|
222
|
+
);
|
|
223
|
+
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
224
|
+
await provenWallet.registerContract(this.fakeProofsAsset);
|
|
263
225
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this.
|
|
267
|
-
pxe: result.pxe,
|
|
268
|
-
teardown: result.teardown,
|
|
269
|
-
});
|
|
270
|
-
this.provenAssets.push(asset);
|
|
226
|
+
for (let i = 0; i < 2; i++) {
|
|
227
|
+
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
228
|
+
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
271
229
|
}
|
|
230
|
+
|
|
231
|
+
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
232
|
+
this.provenComponents.push({
|
|
233
|
+
wallet: provenWallet,
|
|
234
|
+
teardown: provenTeardown,
|
|
235
|
+
});
|
|
236
|
+
this.provenAsset = asset;
|
|
237
|
+
this.provenWallet = provenWallet;
|
|
272
238
|
this.logger.info(`Full prover PXE started`);
|
|
273
239
|
|
|
274
240
|
// Shutdown the current, simulated prover node
|
|
@@ -369,15 +335,12 @@ export class FullProverTest {
|
|
|
369
335
|
|
|
370
336
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
371
337
|
await asset.methods
|
|
372
|
-
.mint_to_public(accounts[0]
|
|
373
|
-
.send({ from: accounts[0]
|
|
338
|
+
.mint_to_public(accounts[0], privateAmount + publicAmount)
|
|
339
|
+
.send({ from: accounts[0] })
|
|
374
340
|
.wait();
|
|
375
341
|
|
|
376
342
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
377
|
-
await asset.methods
|
|
378
|
-
.transfer_to_private(accounts[0].address, privateAmount)
|
|
379
|
-
.send({ from: accounts[0].address })
|
|
380
|
-
.wait();
|
|
343
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
|
|
381
344
|
|
|
382
345
|
this.logger.verbose(`Minting complete.`);
|
|
383
346
|
|
|
@@ -386,7 +349,7 @@ export class FullProverTest {
|
|
|
386
349
|
async ({ amount }) => {
|
|
387
350
|
const {
|
|
388
351
|
fakeProofsAsset: asset,
|
|
389
|
-
accounts: [
|
|
352
|
+
accounts: [address],
|
|
390
353
|
tokenSim,
|
|
391
354
|
} = this;
|
|
392
355
|
tokenSim.mintPublic(address, amount);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
import type { BBConfig } from '@aztec/bb-prover';
|
|
3
3
|
import { tryRmDir } from '@aztec/foundation/fs';
|
|
4
4
|
|
|
5
5
|
import fs from 'node:fs/promises';
|
|
6
6
|
import { tmpdir } from 'node:os';
|
|
7
7
|
import path from 'path';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
8
9
|
|
|
9
10
|
const {
|
|
10
11
|
BB_RELEASE_DIR = 'barretenberg/cpp/build/bin',
|
|
@@ -22,7 +23,7 @@ export const getBBConfig = async (
|
|
|
22
23
|
try {
|
|
23
24
|
const bbBinaryPath =
|
|
24
25
|
BB_BINARY_PATH ??
|
|
25
|
-
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb');
|
|
26
|
+
path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../', BB_RELEASE_DIR, 'bb-avm');
|
|
26
27
|
await fs.access(bbBinaryPath, fs.constants.R_OK);
|
|
27
28
|
|
|
28
29
|
let bbWorkingDirectory: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Logger } from '@aztec/aztec.js';
|
|
1
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
2
2
|
import { type DeployL1ContractsArgs, type L1ContractsConfig, deployL1Contracts } from '@aztec/ethereum';
|
|
3
3
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
4
|
-
import {
|
|
4
|
+
import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
5
5
|
|
|
6
6
|
import type { HDAccount, PrivateKeyAccount } from 'viem';
|
|
7
7
|
import { foundry } from 'viem/chains';
|
|
@@ -16,7 +16,7 @@ export const setupL1Contracts = async (
|
|
|
16
16
|
) => {
|
|
17
17
|
const l1Data = await deployL1Contracts([l1RpcUrl], account, foundry, logger, {
|
|
18
18
|
vkTreeRoot: getVKTreeRoot(),
|
|
19
|
-
|
|
19
|
+
protocolContractsHash,
|
|
20
20
|
salt: undefined,
|
|
21
21
|
realVerifier: false,
|
|
22
22
|
...args,
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
* Test fixtures and utilities to set up and run a test using multiple validators
|
|
3
3
|
*/
|
|
4
4
|
import { type AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
5
|
-
import type { SentTx } from '@aztec/aztec.js';
|
|
6
5
|
import { SecretValue } from '@aztec/foundation/config';
|
|
7
6
|
import { addLogNameHandler, removeLogNameHandler } from '@aztec/foundation/log';
|
|
8
7
|
import { bufferToHex } from '@aztec/foundation/string';
|
|
9
8
|
import type { DateProvider } from '@aztec/foundation/timer';
|
|
10
9
|
import type { ProverNodeConfig, ProverNodeDeps } from '@aztec/prover-node';
|
|
11
|
-
import type { PXEService } from '@aztec/pxe/server';
|
|
12
10
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
13
11
|
|
|
14
12
|
import getPort from 'get-port';
|
|
@@ -23,12 +21,6 @@ import { getEndToEndTestTelemetryClient } from './with_telemetry_utils.js';
|
|
|
23
21
|
// to avoid running validators with the same key
|
|
24
22
|
export const ATTESTER_PRIVATE_KEYS_START_INDEX = 3;
|
|
25
23
|
|
|
26
|
-
export interface NodeContext {
|
|
27
|
-
node: AztecNodeService;
|
|
28
|
-
pxeService: PXEService;
|
|
29
|
-
txs: SentTx[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
24
|
export function generatePrivateKeys(startIndex: number, numberOfKeys: number): `0x${string}`[] {
|
|
33
25
|
const privateKeys: `0x${string}`[] = [];
|
|
34
26
|
// Do not start from 0 as it is used during setup
|
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
2
|
-
import { type InitialAccountData,
|
|
2
|
+
import { type InitialAccountData, generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
3
3
|
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
BatchCall,
|
|
8
|
-
type CompleteAddress,
|
|
9
|
-
type ContractFunctionInteraction,
|
|
10
|
-
DefaultWaitForProvenOpts,
|
|
11
|
-
EthAddress,
|
|
12
|
-
type Logger,
|
|
13
|
-
type PXE,
|
|
14
|
-
type Wallet,
|
|
15
|
-
getContractClassFromArtifact,
|
|
16
|
-
waitForProven,
|
|
17
|
-
} from '@aztec/aztec.js';
|
|
4
|
+
import { AztecAddress, EthAddress } from '@aztec/aztec.js/addresses';
|
|
5
|
+
import { getContractClassFromArtifact } from '@aztec/aztec.js/contracts';
|
|
6
|
+
import { BatchCall, type ContractFunctionInteraction, waitForProven } from '@aztec/aztec.js/contracts';
|
|
18
7
|
import { publishContractClass, publishInstance } from '@aztec/aztec.js/deployment';
|
|
8
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
9
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
10
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
19
11
|
import { AnvilTestWatcher, CheatCodes } from '@aztec/aztec/testing';
|
|
20
12
|
import { type BlobSinkServer, createBlobSinkServer } from '@aztec/blob-sink/server';
|
|
21
13
|
import {
|
|
@@ -34,10 +26,11 @@ import { createLogger } from '@aztec/foundation/log';
|
|
|
34
26
|
import { resolver, reviver } from '@aztec/foundation/serialize';
|
|
35
27
|
import { TestDateProvider } from '@aztec/foundation/timer';
|
|
36
28
|
import type { ProverNode } from '@aztec/prover-node';
|
|
37
|
-
import {
|
|
29
|
+
import { getPXEConfig } from '@aztec/pxe/server';
|
|
38
30
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
39
31
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
40
32
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
33
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
41
34
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
42
35
|
|
|
43
36
|
import type { Anvil } from '@viem/anvil';
|
|
@@ -70,7 +63,7 @@ export type SubsystemsContext = {
|
|
|
70
63
|
bbConfig: any;
|
|
71
64
|
aztecNode: AztecNodeService;
|
|
72
65
|
aztecNodeConfig: AztecNodeConfig;
|
|
73
|
-
|
|
66
|
+
wallet: TestWallet;
|
|
74
67
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
75
68
|
proverNode?: ProverNode;
|
|
76
69
|
watcher: AnvilTestWatcher;
|
|
@@ -206,7 +199,7 @@ class SnapshotManager implements ISnapshotManager {
|
|
|
206
199
|
await restore(snapshotData, context);
|
|
207
200
|
|
|
208
201
|
// Save the snapshot data.
|
|
209
|
-
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls);
|
|
202
|
+
const ethCheatCodes = new EthCheatCodesWithState(context.aztecNodeConfig.l1RpcUrls, context.dateProvider);
|
|
210
203
|
const anvilStateFile = `${this.livePath}/anvil.dat`;
|
|
211
204
|
await ethCheatCodes.dumpChainState(anvilStateFile);
|
|
212
205
|
writeFileSync(`${this.livePath}/${name}.json`, JSON.stringify(snapshotData || {}, resolver));
|
|
@@ -353,7 +346,9 @@ async function setupFromFresh(
|
|
|
353
346
|
const res = await startAnvil({ l1BlockTime: opts.ethereumSlotDuration });
|
|
354
347
|
const anvil = res.anvil;
|
|
355
348
|
aztecNodeConfig.l1RpcUrls = [res.rpcUrl];
|
|
356
|
-
|
|
349
|
+
|
|
350
|
+
const dateProvider = new TestDateProvider();
|
|
351
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
357
352
|
|
|
358
353
|
// Deploy our L1 contracts.
|
|
359
354
|
logger.verbose('Deploying L1 contracts...');
|
|
@@ -381,10 +376,8 @@ async function setupFromFresh(
|
|
|
381
376
|
aztecNodeConfig.l1Contracts = deployL1ContractsValues.l1ContractAddresses;
|
|
382
377
|
aztecNodeConfig.rollupVersion = deployL1ContractsValues.rollupVersion;
|
|
383
378
|
|
|
384
|
-
const dateProvider = new TestDateProvider();
|
|
385
|
-
|
|
386
379
|
const watcher = new AnvilTestWatcher(
|
|
387
|
-
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls),
|
|
380
|
+
new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider),
|
|
388
381
|
deployL1ContractsValues.l1ContractAddresses.rollupAddress,
|
|
389
382
|
deployL1ContractsValues.l1Client,
|
|
390
383
|
dateProvider,
|
|
@@ -413,7 +406,7 @@ async function setupFromFresh(
|
|
|
413
406
|
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
414
407
|
port: blobSinkPort,
|
|
415
408
|
dataDirectory: aztecNodeConfig.dataDirectory,
|
|
416
|
-
|
|
409
|
+
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
|
|
417
410
|
},
|
|
418
411
|
telemetry,
|
|
419
412
|
);
|
|
@@ -443,13 +436,12 @@ async function setupFromFresh(
|
|
|
443
436
|
}
|
|
444
437
|
|
|
445
438
|
logger.verbose('Creating pxe...');
|
|
446
|
-
const pxeConfig =
|
|
439
|
+
const pxeConfig = getPXEConfig();
|
|
447
440
|
pxeConfig.dataDirectory = statePath ?? path.join(directoryToCleanup, randomBytes(8).toString('hex'));
|
|
448
441
|
// Only enable proving if specifically requested.
|
|
449
442
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
443
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
444
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, aztecNode, dateProvider);
|
|
453
445
|
|
|
454
446
|
if (statePath) {
|
|
455
447
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -460,7 +452,7 @@ async function setupFromFresh(
|
|
|
460
452
|
aztecNodeConfig,
|
|
461
453
|
anvil,
|
|
462
454
|
aztecNode,
|
|
463
|
-
|
|
455
|
+
wallet,
|
|
464
456
|
sequencer: aztecNode.getSequencer()!,
|
|
465
457
|
acvmConfig,
|
|
466
458
|
bbConfig,
|
|
@@ -505,7 +497,9 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
505
497
|
aztecNodeConfig.l1RpcUrls = [rpcUrl];
|
|
506
498
|
// Load anvil state.
|
|
507
499
|
const anvilStateFile = `${statePath}/anvil.dat`;
|
|
508
|
-
|
|
500
|
+
|
|
501
|
+
const dateProvider = new TestDateProvider();
|
|
502
|
+
const ethCheatCodes = new EthCheatCodesWithState(aztecNodeConfig.l1RpcUrls, dateProvider);
|
|
509
503
|
await ethCheatCodes.loadChainState(anvilStateFile);
|
|
510
504
|
|
|
511
505
|
// TODO: Encapsulate this in a NativeAcvm impl.
|
|
@@ -524,9 +518,8 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
524
518
|
logger.verbose('Creating ETH clients...');
|
|
525
519
|
const l1Client = createExtendedL1Client(aztecNodeConfig.l1RpcUrls, mnemonicToAccount(MNEMONIC));
|
|
526
520
|
|
|
527
|
-
const dateProvider = new TestDateProvider();
|
|
528
521
|
const watcher = new AnvilTestWatcher(
|
|
529
|
-
|
|
522
|
+
ethCheatCodes,
|
|
530
523
|
aztecNodeConfig.l1Contracts.rollupAddress,
|
|
531
524
|
l1Client,
|
|
532
525
|
dateProvider,
|
|
@@ -541,7 +534,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
541
534
|
l1Contracts: aztecNodeConfig.l1Contracts,
|
|
542
535
|
port: blobSinkPort,
|
|
543
536
|
dataDirectory: statePath,
|
|
544
|
-
|
|
537
|
+
dataStoreMapSizeKb: aztecNodeConfig.dataStoreMapSizeKb,
|
|
545
538
|
},
|
|
546
539
|
telemetry,
|
|
547
540
|
);
|
|
@@ -573,17 +566,16 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
573
566
|
}
|
|
574
567
|
|
|
575
568
|
logger.verbose('Creating pxe...');
|
|
576
|
-
const pxeConfig =
|
|
569
|
+
const pxeConfig = getPXEConfig();
|
|
577
570
|
pxeConfig.dataDirectory = statePath;
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
571
|
+
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
572
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, aztecNode, dateProvider);
|
|
581
573
|
|
|
582
574
|
return {
|
|
583
575
|
aztecNodeConfig,
|
|
584
576
|
anvil,
|
|
585
577
|
aztecNode,
|
|
586
|
-
|
|
578
|
+
wallet,
|
|
587
579
|
sequencer: aztecNode.getSequencer()!,
|
|
588
580
|
acvmConfig,
|
|
589
581
|
bbConfig,
|
|
@@ -607,20 +599,29 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
607
599
|
* The 'restore' function is not provided, as it must be a closure within the test context to capture the results.
|
|
608
600
|
*/
|
|
609
601
|
export const deployAccounts =
|
|
610
|
-
(numberOfAccounts: number, logger: Logger
|
|
611
|
-
async ({
|
|
602
|
+
(numberOfAccounts: number, logger: Logger) =>
|
|
603
|
+
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
612
604
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
613
605
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
614
606
|
}
|
|
615
607
|
|
|
616
608
|
logger.verbose('Deploying accounts funded with fee juice...');
|
|
617
609
|
const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
610
|
+
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
611
|
+
for (let i = 0; i < deployedAccounts.length; i++) {
|
|
612
|
+
const accountManager = await wallet.createSchnorrAccount(
|
|
613
|
+
deployedAccounts[i].secret,
|
|
614
|
+
deployedAccounts[i].salt,
|
|
615
|
+
deployedAccounts[i].signingKey,
|
|
616
|
+
);
|
|
617
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
618
|
+
await deployMethod
|
|
619
|
+
.send({
|
|
620
|
+
from: AztecAddress.ZERO,
|
|
621
|
+
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
622
|
+
})
|
|
623
|
+
.wait();
|
|
624
|
+
}
|
|
624
625
|
|
|
625
626
|
return { deployedAccounts };
|
|
626
627
|
};
|
|
@@ -631,35 +632,34 @@ export const deployAccounts =
|
|
|
631
632
|
* @param sender - Wallet to send the deployment tx.
|
|
632
633
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
633
634
|
* @param waitUntilProven - Whether to wait for the tx to be proven.
|
|
634
|
-
* @param
|
|
635
|
+
* @param node - AztecNode used to wait for proven tx.
|
|
635
636
|
*/
|
|
636
637
|
export async function publicDeployAccounts(
|
|
637
|
-
|
|
638
|
-
accountsToDeploy:
|
|
638
|
+
wallet: Wallet,
|
|
639
|
+
accountsToDeploy: AztecAddress[],
|
|
639
640
|
waitUntilProven = false,
|
|
640
|
-
|
|
641
|
+
node?: AztecNode,
|
|
641
642
|
) {
|
|
642
|
-
const
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
).map(metadata => metadata.contractInstance);
|
|
643
|
+
const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
|
|
644
|
+
metadata => metadata.contractInstance,
|
|
645
|
+
);
|
|
646
646
|
|
|
647
647
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
648
|
-
const alreadyRegistered = (await
|
|
648
|
+
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
649
649
|
|
|
650
650
|
const calls: ContractFunctionInteraction[] = await Promise.all([
|
|
651
|
-
...(!alreadyRegistered ? [publishContractClass(
|
|
652
|
-
...instances.map(instance => publishInstance(
|
|
651
|
+
...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
|
|
652
|
+
...instances.map(instance => publishInstance(wallet, instance!)),
|
|
653
653
|
]);
|
|
654
654
|
|
|
655
|
-
const batch = new BatchCall(
|
|
655
|
+
const batch = new BatchCall(wallet, calls);
|
|
656
656
|
|
|
657
|
-
const txReceipt = await batch.send({ from:
|
|
657
|
+
const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
658
658
|
if (waitUntilProven) {
|
|
659
|
-
if (!
|
|
660
|
-
throw new Error('Need to provide
|
|
659
|
+
if (!node) {
|
|
660
|
+
throw new Error('Need to provide an AztecNode to wait for proven.');
|
|
661
661
|
} else {
|
|
662
|
-
await waitForProven(
|
|
662
|
+
await waitForProven(node, txReceipt);
|
|
663
663
|
}
|
|
664
664
|
}
|
|
665
665
|
}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { BatchCall } from '@aztec/aztec.js/contracts';
|
|
3
|
+
import type { Logger } from '@aztec/aztec.js/log';
|
|
4
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
2
5
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export async function deployToken(
|
|
7
|
-
adminWallet: Wallet,
|
|
8
|
-
deployerAddress: AztecAddress,
|
|
9
|
-
initialAdminBalance: bigint,
|
|
10
|
-
logger: Logger,
|
|
11
|
-
) {
|
|
7
|
+
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
12
8
|
logger.info(`Deploying Token contract...`);
|
|
13
|
-
const contract = await TokenContract.deploy(
|
|
14
|
-
.send({ from:
|
|
9
|
+
const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
10
|
+
.send({ from: admin })
|
|
15
11
|
.deployed();
|
|
16
12
|
|
|
17
13
|
if (initialAdminBalance > 0n) {
|
|
18
|
-
|
|
19
|
-
await mintTokensToPrivate(contract, deployerAddress, adminWallet, deployerAddress, initialAdminBalance);
|
|
14
|
+
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
20
15
|
}
|
|
21
16
|
|
|
22
17
|
logger.info('L2 contract deployed');
|
|
@@ -27,14 +22,11 @@ export async function deployToken(
|
|
|
27
22
|
export async function mintTokensToPrivate(
|
|
28
23
|
token: TokenContract,
|
|
29
24
|
minter: AztecAddress,
|
|
30
|
-
minterWallet: Wallet,
|
|
31
25
|
recipient: AztecAddress,
|
|
32
26
|
amount: bigint,
|
|
33
27
|
) {
|
|
34
|
-
|
|
35
|
-
await tokenAsMinter.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
28
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
36
29
|
}
|
|
37
|
-
// docs:end:token_utils
|
|
38
30
|
|
|
39
31
|
export async function expectTokenBalance(
|
|
40
32
|
wallet: Wallet,
|
|
@@ -51,19 +43,19 @@ export async function expectTokenBalance(
|
|
|
51
43
|
}
|
|
52
44
|
|
|
53
45
|
export async function mintNotes(
|
|
54
|
-
|
|
46
|
+
wallet: Wallet,
|
|
55
47
|
minter: AztecAddress,
|
|
56
48
|
recipient: AztecAddress,
|
|
57
49
|
asset: TokenContract,
|
|
58
50
|
noteAmounts: bigint[],
|
|
59
51
|
): Promise<bigint> {
|
|
60
|
-
// We can only mint
|
|
52
|
+
// We can only mint 5 notes at a time, since that's the maximum number of calls our entrypoints allow
|
|
61
53
|
// TODO(#13024): mint as many notes as possible in a single tx
|
|
62
|
-
const notesPerIteration =
|
|
54
|
+
const notesPerIteration = 5;
|
|
63
55
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
64
56
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
65
57
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
|
66
|
-
await new BatchCall(
|
|
58
|
+
await new BatchCall(wallet, actions).send({ from: minter }).wait();
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
return noteAmounts.reduce((prev, curr) => prev + curr, 0n);
|