@aztec/end-to-end 3.0.0-nightly.20250910 → 3.0.0-nightly.20250912
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +14 -12
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +35 -39
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +6 -4
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +3 -6
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +38 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +4 -5
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +16 -20
- package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +4 -7
- package/dest/e2e_epochs/epochs_test.d.ts +2 -0
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +5 -0
- package/dest/e2e_fees/bridging_race.notest.js +10 -8
- package/dest/e2e_fees/fees_test.d.ts +3 -4
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +26 -21
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +2 -2
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +4 -6
- package/dest/e2e_p2p/p2p_network.d.ts +3 -2
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +7 -11
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +10 -18
- package/dest/e2e_token_contract/token_contract_test.d.ts +2 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +13 -16
- package/dest/fixtures/e2e_prover_test.d.ts +4 -3
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +22 -29
- package/dest/fixtures/snapshot_manager.d.ts +6 -4
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +22 -12
- package/dest/fixtures/token_utils.d.ts +3 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +8 -10
- package/dest/fixtures/utils.d.ts +7 -7
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +31 -28
- package/dest/shared/cross_chain_test_harness.d.ts +6 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +5 -6
- package/dest/shared/gas_portal_test_harness.d.ts +1 -1
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/submit-transactions.d.ts +3 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +4 -5
- package/dest/shared/uniswap_l1_l2.d.ts +6 -4
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +18 -21
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +12 -10
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +54 -50
- package/package.json +37 -36
- package/src/bench/client_flows/client_flows_benchmark.ts +41 -52
- package/src/bench/utils.ts +6 -6
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +39 -50
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +15 -33
- package/src/e2e_deploy_contract/deploy_test.ts +6 -14
- package/src/e2e_epochs/epochs_test.ts +3 -0
- package/src/e2e_fees/bridging_race.notest.ts +12 -9
- package/src/e2e_fees/fees_test.ts +30 -30
- package/src/e2e_nested_contract/nested_contract_test.ts +6 -8
- package/src/e2e_p2p/p2p_network.ts +16 -15
- package/src/e2e_p2p/shared.ts +14 -21
- package/src/e2e_token_contract/token_contract_test.ts +14 -17
- package/src/fixtures/e2e_prover_test.ts +26 -60
- package/src/fixtures/snapshot_manager.ts +32 -24
- package/src/fixtures/token_utils.ts +7 -15
- package/src/fixtures/utils.ts +41 -44
- package/src/shared/cross_chain_test_harness.ts +5 -7
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/submit-transactions.ts +7 -8
- package/src/shared/uniswap_l1_l2.ts +40 -36
- package/src/simulators/lending_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +82 -73
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getSchnorrWalletWithSecretKey } from '@aztec/accounts/schnorr';
|
|
2
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
2
|
import type { AztecNodeConfig, AztecNodeService } from '@aztec/aztec-node';
|
|
4
|
-
import {
|
|
3
|
+
import { AztecAddress, EthAddress, Fr } from '@aztec/aztec.js';
|
|
5
4
|
import {
|
|
6
5
|
type EmpireSlashingProposerContract,
|
|
7
6
|
type ExtendedViemWalletClient,
|
|
@@ -26,6 +25,7 @@ import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
|
26
25
|
import { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
27
26
|
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
28
27
|
import { ZkPassportProofParams } from '@aztec/stdlib/zkpassport';
|
|
28
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
29
29
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
30
30
|
|
|
31
31
|
import getPort from 'get-port';
|
|
@@ -75,7 +75,7 @@ export class P2PNetworkTest {
|
|
|
75
75
|
public prefilledPublicData: PublicDataTreeLeaf[] = [];
|
|
76
76
|
|
|
77
77
|
// The re-execution test needs a wallet and a spam contract
|
|
78
|
-
public wallet?:
|
|
78
|
+
public wallet?: TestWallet;
|
|
79
79
|
public defaultAccountAddress?: AztecAddress;
|
|
80
80
|
public spamContract?: SpamContract;
|
|
81
81
|
|
|
@@ -260,7 +260,7 @@ export class P2PNetworkTest {
|
|
|
260
260
|
client: deployL1ContractsValues.l1Client,
|
|
261
261
|
});
|
|
262
262
|
|
|
263
|
-
const stakeNeeded =
|
|
263
|
+
const stakeNeeded = (await rollup.read.getActivationThreshold()) * BigInt(this.numberOfValidators);
|
|
264
264
|
await Promise.all(
|
|
265
265
|
[await stakingAsset.write.mint([multiAdder.address, stakeNeeded], {} as any)].map(txHash =>
|
|
266
266
|
deployL1ContractsValues.l1Client.waitForTransactionReceipt({ hash: txHash }),
|
|
@@ -291,14 +291,15 @@ export class P2PNetworkTest {
|
|
|
291
291
|
hash: await multiAdder.write.addValidators([validatorTuples]),
|
|
292
292
|
});
|
|
293
293
|
|
|
294
|
-
|
|
294
|
+
await cheatCodes.rollup.advanceToEpoch(
|
|
295
|
+
(await cheatCodes.rollup.getEpoch()) + (await rollup.read.getLagInEpochs()) + 1n,
|
|
296
|
+
{
|
|
297
|
+
updateDateProvider: dateProvider,
|
|
298
|
+
},
|
|
299
|
+
);
|
|
295
300
|
|
|
296
301
|
// Send and await a tx to make sure we mine a block for the warp to correctly progress.
|
|
297
302
|
await this._sendDummyTx(deployL1ContractsValues.l1Client);
|
|
298
|
-
|
|
299
|
-
// Set the system time in the node, only after we have warped the time and waited for a block
|
|
300
|
-
// Time is only set in the NEXT block
|
|
301
|
-
dateProvider.setTime(Number(timestamp) * 1000);
|
|
302
303
|
},
|
|
303
304
|
);
|
|
304
305
|
}
|
|
@@ -306,12 +307,12 @@ export class P2PNetworkTest {
|
|
|
306
307
|
async setupAccount() {
|
|
307
308
|
await this.snapshotManager.snapshot(
|
|
308
309
|
'setup-account',
|
|
309
|
-
deployAccounts(1, this.logger
|
|
310
|
-
|
|
310
|
+
deployAccounts(1, this.logger),
|
|
311
|
+
({ deployedAccounts }, { wallet }) => {
|
|
311
312
|
this.deployedAccounts = deployedAccounts;
|
|
312
|
-
|
|
313
|
-
this.wallet =
|
|
314
|
-
|
|
313
|
+
[{ address: this.defaultAccountAddress }] = deployedAccounts;
|
|
314
|
+
this.wallet = wallet;
|
|
315
|
+
return Promise.resolve();
|
|
315
316
|
},
|
|
316
317
|
);
|
|
317
318
|
}
|
|
@@ -415,7 +416,7 @@ export class P2PNetworkTest {
|
|
|
415
416
|
);
|
|
416
417
|
|
|
417
418
|
const slasherContract = getContract({
|
|
418
|
-
address: getAddress(await rollup.
|
|
419
|
+
address: getAddress(await rollup.getSlasherAddress()),
|
|
419
420
|
abi: SlasherAbi,
|
|
420
421
|
client: this.ctx.deployL1ContractsValues.l1Client,
|
|
421
422
|
});
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getSchnorrAccount } from '@aztec/accounts/schnorr';
|
|
2
1
|
import type { InitialAccountData } from '@aztec/accounts/testing';
|
|
3
2
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
4
3
|
import {
|
|
@@ -21,6 +20,7 @@ import { PXEService, createPXEService, getPXEServiceConfig as getRpcConfig } fro
|
|
|
21
20
|
import { getRoundForOffense } from '@aztec/slasher';
|
|
22
21
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
22
|
import type { SlashFactoryContract } from '@aztec/stdlib/l1-contracts';
|
|
23
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
24
24
|
|
|
25
25
|
import type { NodeContext } from '../fixtures/setup_p2p_test.js';
|
|
26
26
|
import { submitTxsTo } from '../shared/submit-transactions.js';
|
|
@@ -65,17 +65,9 @@ export const createPXEServiceAndSubmitTransactions = async (
|
|
|
65
65
|
const rpcConfig = getRpcConfig();
|
|
66
66
|
rpcConfig.proverEnabled = false;
|
|
67
67
|
const pxeService = await createPXEService(node, rpcConfig, { useLogSuffix: true });
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
fundedAccount.secret,
|
|
72
|
-
fundedAccount.signingKey,
|
|
73
|
-
fundedAccount.salt,
|
|
74
|
-
);
|
|
75
|
-
await account.register();
|
|
76
|
-
const wallet = await account.getWallet();
|
|
77
|
-
|
|
78
|
-
const txs = await submitTxsTo(pxeService, numTxs, wallet, logger);
|
|
68
|
+
const wallet = new TestWallet(pxeService);
|
|
69
|
+
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
70
|
+
const txs = await submitTxsTo(wallet, fundedAccountManager.getAddress(), numTxs, logger);
|
|
79
71
|
return { txs, pxeService, node };
|
|
80
72
|
};
|
|
81
73
|
|
|
@@ -89,16 +81,15 @@ export async function createPXEServiceAndPrepareTransactions(
|
|
|
89
81
|
rpcConfig.proverEnabled = false;
|
|
90
82
|
const pxe = await createPXEService(node, rpcConfig, { useLogSuffix: true });
|
|
91
83
|
|
|
92
|
-
const
|
|
93
|
-
await
|
|
94
|
-
const wallet = await account.getWallet();
|
|
84
|
+
const wallet = new TestWallet(pxe);
|
|
85
|
+
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
95
86
|
|
|
96
87
|
const testContractInstance = await getContractInstanceFromInstantiationParams(TestContractArtifact, {});
|
|
97
88
|
await wallet.registerContract({ instance: testContractInstance, artifact: TestContractArtifact });
|
|
98
89
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
99
90
|
|
|
100
91
|
const txs = await timesAsync(numTxs, async () => {
|
|
101
|
-
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from:
|
|
92
|
+
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: fundedAccountManager.getAddress() });
|
|
102
93
|
const txHash = tx.getTxHash();
|
|
103
94
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
104
95
|
return tx;
|
|
@@ -219,8 +210,9 @@ export async function awaitCommitteeKicked({
|
|
|
219
210
|
|
|
220
211
|
logger.info(`Advancing epochs so we start slashing`);
|
|
221
212
|
await cheatCodes.debugRollup();
|
|
222
|
-
await cheatCodes.
|
|
223
|
-
|
|
213
|
+
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n, {
|
|
214
|
+
updateDateProvider: dateProvider,
|
|
215
|
+
});
|
|
224
216
|
|
|
225
217
|
// Await for the slash payload to be created if empire (no payload is created on tally until execution time)
|
|
226
218
|
if (slashingProposer.type === 'empire') {
|
|
@@ -265,10 +257,11 @@ export async function awaitCommitteeKicked({
|
|
|
265
257
|
expect(attesterInfo.status).toEqual(2); // Living
|
|
266
258
|
}
|
|
267
259
|
|
|
268
|
-
logger.info(`Advancing
|
|
260
|
+
logger.info(`Advancing to check current committee`);
|
|
269
261
|
await cheatCodes.debugRollup();
|
|
270
|
-
await cheatCodes.
|
|
271
|
-
|
|
262
|
+
await cheatCodes.advanceToEpoch((await cheatCodes.getEpoch()) + (await rollup.getLagInEpochs()) + 1n, {
|
|
263
|
+
updateDateProvider: dateProvider,
|
|
264
|
+
});
|
|
272
265
|
await cheatCodes.debugRollup();
|
|
273
266
|
|
|
274
267
|
const committeeNextEpoch = await rollup.getCurrentEpochCommittee();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type AccountWallet, AztecAddress, type AztecNode, type Logger, createLogger } from '@aztec/aztec.js';
|
|
1
|
+
import { AztecAddress, type AztecNode, type Logger, type Wallet, createLogger } from '@aztec/aztec.js';
|
|
3
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
3
|
import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount';
|
|
5
4
|
|
|
@@ -28,11 +27,9 @@ export class TokenContractTest {
|
|
|
28
27
|
node!: AztecNode;
|
|
29
28
|
|
|
30
29
|
badAccount!: InvalidAccountContract;
|
|
31
|
-
|
|
30
|
+
wallet!: Wallet;
|
|
32
31
|
adminAddress!: AztecAddress;
|
|
33
|
-
account1!: AccountWallet;
|
|
34
32
|
account1Address!: AztecAddress;
|
|
35
|
-
account2!: AccountWallet;
|
|
36
33
|
account2Address!: AztecAddress;
|
|
37
34
|
|
|
38
35
|
constructor(testName: string) {
|
|
@@ -54,11 +51,11 @@ export class TokenContractTest {
|
|
|
54
51
|
await this.snapshotManager.snapshot(
|
|
55
52
|
'3_accounts',
|
|
56
53
|
deployAccounts(3, this.logger),
|
|
57
|
-
|
|
54
|
+
({ deployedAccounts }, { wallet, aztecNode }) => {
|
|
58
55
|
this.node = aztecNode;
|
|
59
|
-
|
|
60
|
-
[this.
|
|
61
|
-
|
|
56
|
+
this.wallet = wallet;
|
|
57
|
+
[this.adminAddress, this.account1Address, this.account2Address] = deployedAccounts.map(acc => acc.address);
|
|
58
|
+
return Promise.resolve();
|
|
62
59
|
},
|
|
63
60
|
);
|
|
64
61
|
|
|
@@ -68,11 +65,11 @@ export class TokenContractTest {
|
|
|
68
65
|
// Create the token contract state.
|
|
69
66
|
// Move this account thing to addAccounts above?
|
|
70
67
|
this.logger.verbose(`Public deploy accounts...`);
|
|
71
|
-
await publicDeployAccounts(this.
|
|
68
|
+
await publicDeployAccounts(this.wallet, [this.adminAddress, this.account1Address]);
|
|
72
69
|
|
|
73
70
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
74
71
|
const asset = await TokenContract.deploy(
|
|
75
|
-
this.
|
|
72
|
+
this.wallet,
|
|
76
73
|
this.adminAddress,
|
|
77
74
|
TokenContractTest.TOKEN_NAME,
|
|
78
75
|
TokenContractTest.TOKEN_SYMBOL,
|
|
@@ -83,22 +80,22 @@ export class TokenContractTest {
|
|
|
83
80
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
84
81
|
|
|
85
82
|
this.logger.verbose(`Deploying bad account...`);
|
|
86
|
-
this.badAccount = await InvalidAccountContract.deploy(this.
|
|
83
|
+
this.badAccount = await InvalidAccountContract.deploy(this.wallet).send({ from: this.adminAddress }).deployed();
|
|
87
84
|
this.logger.verbose(`Deployed to ${this.badAccount.address}.`);
|
|
88
85
|
|
|
89
86
|
return { tokenContractAddress: asset.address, badAccountAddress: this.badAccount.address };
|
|
90
87
|
},
|
|
91
88
|
async ({ tokenContractAddress, badAccountAddress }) => {
|
|
92
89
|
// Restore the token contract state.
|
|
93
|
-
this.asset = await TokenContract.at(tokenContractAddress, this.
|
|
90
|
+
this.asset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
94
91
|
this.logger.verbose(`Token contract address: ${this.asset.address}`);
|
|
95
92
|
|
|
96
|
-
this.tokenSim = new TokenSimulator(this.asset, this.
|
|
93
|
+
this.tokenSim = new TokenSimulator(this.asset, this.wallet, this.adminAddress, this.logger, [
|
|
97
94
|
this.adminAddress,
|
|
98
95
|
this.account1Address,
|
|
99
96
|
]);
|
|
100
97
|
|
|
101
|
-
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.
|
|
98
|
+
this.badAccount = await InvalidAccountContract.at(badAccountAddress, this.wallet);
|
|
102
99
|
this.logger.verbose(`Bad account address: ${this.badAccount.address}`);
|
|
103
100
|
|
|
104
101
|
expect(await this.asset.methods.get_admin().simulate({ from: this.adminAddress })).toBe(
|
|
@@ -131,14 +128,14 @@ export class TokenContractTest {
|
|
|
131
128
|
await this.snapshotManager.snapshot(
|
|
132
129
|
'mint',
|
|
133
130
|
async () => {
|
|
134
|
-
const { asset,
|
|
131
|
+
const { asset, adminAddress } = this;
|
|
135
132
|
const amount = 10000n;
|
|
136
133
|
|
|
137
134
|
this.logger.verbose(`Minting ${amount} publicly...`);
|
|
138
135
|
await asset.methods.mint_to_public(adminAddress, amount).send({ from: adminAddress }).wait();
|
|
139
136
|
|
|
140
137
|
this.logger.verbose(`Minting ${amount} privately...`);
|
|
141
|
-
await mintTokensToPrivate(asset, adminAddress,
|
|
138
|
+
await mintTokensToPrivate(asset, adminAddress, adminAddress, amount);
|
|
142
139
|
this.logger.verbose(`Minting complete.`);
|
|
143
140
|
|
|
144
141
|
return { amount };
|
|
@@ -1,19 +1,6 @@
|
|
|
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
|
-
type AccountWalletWithSecretKey,
|
|
10
|
-
type AztecNode,
|
|
11
|
-
type CompleteAddress,
|
|
12
|
-
EthAddress,
|
|
13
|
-
type Logger,
|
|
14
|
-
type PXE,
|
|
15
|
-
createLogger,
|
|
16
|
-
} from '@aztec/aztec.js';
|
|
3
|
+
import { AztecAddress, type AztecNode, EthAddress, type Logger, type PXE, createLogger } from '@aztec/aztec.js';
|
|
17
4
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
18
5
|
import {
|
|
19
6
|
BBCircuitVerifier,
|
|
@@ -31,6 +18,7 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
31
18
|
import { type ProverNode, type ProverNodeConfig, createProverNode } from '@aztec/prover-node';
|
|
32
19
|
import type { PXEService } from '@aztec/pxe/server';
|
|
33
20
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
21
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
34
22
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
35
23
|
|
|
36
24
|
import { type Hex, getContract } from 'viem';
|
|
@@ -68,9 +56,9 @@ export class FullProverTest {
|
|
|
68
56
|
static TOKEN_DECIMALS = 18n;
|
|
69
57
|
private snapshotManager: ISnapshotManager;
|
|
70
58
|
logger: Logger;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
wallet!: TestWallet;
|
|
60
|
+
accounts: AztecAddress[] = [];
|
|
61
|
+
deployedAccounts!: InitialAccountData[];
|
|
74
62
|
fakeProofsAsset!: TokenContract;
|
|
75
63
|
tokenSim!: TokenSimulator;
|
|
76
64
|
aztecNode!: AztecNode;
|
|
@@ -115,13 +103,11 @@ export class FullProverTest {
|
|
|
115
103
|
await this.snapshotManager.snapshot(
|
|
116
104
|
'2_accounts',
|
|
117
105
|
deployAccounts(2, this.logger),
|
|
118
|
-
|
|
106
|
+
({ deployedAccounts }, { wallet }) => {
|
|
119
107
|
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()}`));
|
|
108
|
+
this.accounts = deployedAccounts.map(a => a.address);
|
|
109
|
+
this.wallet = wallet;
|
|
110
|
+
return Promise.resolve();
|
|
125
111
|
},
|
|
126
112
|
);
|
|
127
113
|
|
|
@@ -131,17 +117,17 @@ export class FullProverTest {
|
|
|
131
117
|
// Create the token contract state.
|
|
132
118
|
// Move this account thing to addAccounts above?
|
|
133
119
|
this.logger.verbose(`Public deploy accounts...`);
|
|
134
|
-
await publicDeployAccounts(this.
|
|
120
|
+
await publicDeployAccounts(this.wallet, this.accounts.slice(0, 2));
|
|
135
121
|
|
|
136
122
|
this.logger.verbose(`Deploying TokenContract...`);
|
|
137
123
|
const asset = await TokenContract.deploy(
|
|
138
|
-
this.
|
|
124
|
+
this.wallet,
|
|
139
125
|
this.accounts[0],
|
|
140
126
|
FullProverTest.TOKEN_NAME,
|
|
141
127
|
FullProverTest.TOKEN_SYMBOL,
|
|
142
128
|
FullProverTest.TOKEN_DECIMALS,
|
|
143
129
|
)
|
|
144
|
-
.send({ from: this.
|
|
130
|
+
.send({ from: this.accounts[0] })
|
|
145
131
|
.deployed();
|
|
146
132
|
this.logger.verbose(`Token deployed to ${asset.address}`);
|
|
147
133
|
|
|
@@ -149,19 +135,19 @@ export class FullProverTest {
|
|
|
149
135
|
},
|
|
150
136
|
async ({ tokenContractAddress }) => {
|
|
151
137
|
// Restore the token contract state.
|
|
152
|
-
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.
|
|
138
|
+
this.fakeProofsAsset = await TokenContract.at(tokenContractAddress, this.wallet);
|
|
153
139
|
this.logger.verbose(`Token contract address: ${this.fakeProofsAsset.address}`);
|
|
154
140
|
|
|
155
141
|
this.tokenSim = new TokenSimulator(
|
|
156
142
|
this.fakeProofsAsset,
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
143
|
+
this.wallet,
|
|
144
|
+
this.accounts[0],
|
|
159
145
|
this.logger,
|
|
160
|
-
this.accounts
|
|
146
|
+
this.accounts,
|
|
161
147
|
);
|
|
162
148
|
|
|
163
|
-
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0]
|
|
164
|
-
this.accounts[0].
|
|
149
|
+
expect(await this.fakeProofsAsset.methods.get_admin().simulate({ from: this.accounts[0] })).toBe(
|
|
150
|
+
this.accounts[0].toBigInt(),
|
|
165
151
|
);
|
|
166
152
|
},
|
|
167
153
|
);
|
|
@@ -238,30 +224,13 @@ export class FullProverTest {
|
|
|
238
224
|
this.logger.debug(`Contract address ${this.fakeProofsAsset.address}`);
|
|
239
225
|
await result.pxe.registerContract(this.fakeProofsAsset);
|
|
240
226
|
|
|
227
|
+
const provenWallet = new TestWallet(result.pxe);
|
|
228
|
+
|
|
241
229
|
for (let i = 0; i < 2; i++) {
|
|
242
|
-
await
|
|
243
|
-
|
|
244
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
245
|
-
);
|
|
246
|
-
await this.pxe.registerAccount(
|
|
247
|
-
this.deployedAccounts[i].secret,
|
|
248
|
-
this.wallets[i].getCompleteAddress().partialAddress,
|
|
249
|
-
);
|
|
230
|
+
await provenWallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
231
|
+
await this.wallet.createSchnorrAccount(this.deployedAccounts[i].secret, this.deployedAccounts[i].salt);
|
|
250
232
|
}
|
|
251
233
|
|
|
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
|
-
});
|
|
263
|
-
|
|
264
|
-
const provenWallet = await account.getWallet();
|
|
265
234
|
const asset = await TokenContract.at(this.fakeProofsAsset.address, provenWallet);
|
|
266
235
|
this.provenComponents.push({
|
|
267
236
|
pxe: result.pxe,
|
|
@@ -368,15 +337,12 @@ export class FullProverTest {
|
|
|
368
337
|
|
|
369
338
|
this.logger.verbose(`Minting ${privateAmount + publicAmount} publicly...`);
|
|
370
339
|
await asset.methods
|
|
371
|
-
.mint_to_public(accounts[0]
|
|
372
|
-
.send({ from: accounts[0]
|
|
340
|
+
.mint_to_public(accounts[0], privateAmount + publicAmount)
|
|
341
|
+
.send({ from: accounts[0] })
|
|
373
342
|
.wait();
|
|
374
343
|
|
|
375
344
|
this.logger.verbose(`Transferring ${privateAmount} to private...`);
|
|
376
|
-
await asset.methods
|
|
377
|
-
.transfer_to_private(accounts[0].address, privateAmount)
|
|
378
|
-
.send({ from: accounts[0].address })
|
|
379
|
-
.wait();
|
|
345
|
+
await asset.methods.transfer_to_private(accounts[0], privateAmount).send({ from: accounts[0] }).wait();
|
|
380
346
|
|
|
381
347
|
this.logger.verbose(`Minting complete.`);
|
|
382
348
|
|
|
@@ -385,7 +351,7 @@ export class FullProverTest {
|
|
|
385
351
|
async ({ amount }) => {
|
|
386
352
|
const {
|
|
387
353
|
fakeProofsAsset: asset,
|
|
388
|
-
accounts: [
|
|
354
|
+
accounts: [address],
|
|
389
355
|
tokenSim,
|
|
390
356
|
} = this;
|
|
391
357
|
tokenSim.mintPublic(address, amount);
|
|
@@ -1,13 +1,11 @@
|
|
|
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
4
|
import {
|
|
5
5
|
type AztecAddress,
|
|
6
6
|
type AztecNode,
|
|
7
7
|
BatchCall,
|
|
8
|
-
type CompleteAddress,
|
|
9
8
|
type ContractFunctionInteraction,
|
|
10
|
-
DefaultWaitForProvenOpts,
|
|
11
9
|
EthAddress,
|
|
12
10
|
type Logger,
|
|
13
11
|
type PXE,
|
|
@@ -38,6 +36,7 @@ import { type PXEService, createPXEService, getPXEServiceConfig } from '@aztec/p
|
|
|
38
36
|
import type { SequencerClient } from '@aztec/sequencer-client';
|
|
39
37
|
import { tryStop } from '@aztec/stdlib/interfaces/server';
|
|
40
38
|
import { getConfigEnvVars as getTelemetryConfig, initTelemetryClient } from '@aztec/telemetry-client';
|
|
39
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
41
40
|
import { getGenesisValues } from '@aztec/world-state/testing';
|
|
42
41
|
|
|
43
42
|
import type { Anvil } from '@viem/anvil';
|
|
@@ -71,6 +70,7 @@ export type SubsystemsContext = {
|
|
|
71
70
|
aztecNode: AztecNodeService;
|
|
72
71
|
aztecNodeConfig: AztecNodeConfig;
|
|
73
72
|
pxe: PXEService;
|
|
73
|
+
wallet: TestWallet;
|
|
74
74
|
deployL1ContractsValues: DeployL1ContractsReturnType;
|
|
75
75
|
proverNode?: ProverNode;
|
|
76
76
|
watcher: AnvilTestWatcher;
|
|
@@ -444,7 +444,7 @@ async function setupFromFresh(
|
|
|
444
444
|
// Only enable proving if specifically requested.
|
|
445
445
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
446
446
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
447
|
-
|
|
447
|
+
const wallet = new TestWallet(pxe);
|
|
448
448
|
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
449
449
|
|
|
450
450
|
if (statePath) {
|
|
@@ -457,6 +457,7 @@ async function setupFromFresh(
|
|
|
457
457
|
anvil,
|
|
458
458
|
aztecNode,
|
|
459
459
|
pxe,
|
|
460
|
+
wallet,
|
|
460
461
|
sequencer: aztecNode.getSequencer()!,
|
|
461
462
|
acvmConfig,
|
|
462
463
|
bbConfig,
|
|
@@ -568,7 +569,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
568
569
|
const pxeConfig = getPXEServiceConfig();
|
|
569
570
|
pxeConfig.dataDirectory = statePath;
|
|
570
571
|
const pxe = await createPXEService(aztecNode, pxeConfig);
|
|
571
|
-
|
|
572
|
+
const wallet = new TestWallet(pxe);
|
|
572
573
|
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
573
574
|
|
|
574
575
|
return {
|
|
@@ -576,6 +577,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
576
577
|
anvil,
|
|
577
578
|
aztecNode,
|
|
578
579
|
pxe,
|
|
580
|
+
wallet,
|
|
579
581
|
sequencer: aztecNode.getSequencer()!,
|
|
580
582
|
acvmConfig,
|
|
581
583
|
bbConfig,
|
|
@@ -599,20 +601,27 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
599
601
|
* The 'restore' function is not provided, as it must be a closure within the test context to capture the results.
|
|
600
602
|
*/
|
|
601
603
|
export const deployAccounts =
|
|
602
|
-
(numberOfAccounts: number, logger: Logger
|
|
603
|
-
async ({
|
|
604
|
+
(numberOfAccounts: number, logger: Logger) =>
|
|
605
|
+
async ({ wallet, initialFundedAccounts }: { wallet: TestWallet; initialFundedAccounts: InitialAccountData[] }) => {
|
|
604
606
|
if (initialFundedAccounts.length < numberOfAccounts) {
|
|
605
607
|
throw new Error(`Cannot deploy more than ${initialFundedAccounts.length} initial accounts.`);
|
|
606
608
|
}
|
|
607
609
|
|
|
608
610
|
logger.verbose('Deploying accounts funded with fee juice...');
|
|
609
611
|
const deployedAccounts = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
612
|
+
// Serial due to https://github.com/AztecProtocol/aztec-packages/issues/12045
|
|
613
|
+
for (let i = 0; i < deployedAccounts.length; i++) {
|
|
614
|
+
const accountManager = await wallet.createSchnorrAccount(
|
|
615
|
+
deployedAccounts[i].secret,
|
|
616
|
+
deployedAccounts[i].salt,
|
|
617
|
+
deployedAccounts[i].signingKey,
|
|
618
|
+
);
|
|
619
|
+
await accountManager
|
|
620
|
+
.deploy({
|
|
621
|
+
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
622
|
+
})
|
|
623
|
+
.wait();
|
|
624
|
+
}
|
|
616
625
|
|
|
617
626
|
return { deployedAccounts };
|
|
618
627
|
};
|
|
@@ -626,27 +635,26 @@ export const deployAccounts =
|
|
|
626
635
|
* @param pxeOrNode - PXE or AztecNode to wait for proven.
|
|
627
636
|
*/
|
|
628
637
|
export async function publicDeployAccounts(
|
|
629
|
-
|
|
630
|
-
accountsToDeploy:
|
|
638
|
+
wallet: Wallet,
|
|
639
|
+
accountsToDeploy: AztecAddress[],
|
|
631
640
|
waitUntilProven = false,
|
|
632
641
|
pxeOrNode?: PXE | AztecNode,
|
|
633
642
|
) {
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
).map(metadata => metadata.contractInstance);
|
|
643
|
+
const instances = (await Promise.all(accountsToDeploy.map(account => wallet.getContractMetadata(account)))).map(
|
|
644
|
+
metadata => metadata.contractInstance,
|
|
645
|
+
);
|
|
638
646
|
|
|
639
647
|
const contractClass = await getContractClassFromArtifact(SchnorrAccountContractArtifact);
|
|
640
|
-
const alreadyRegistered = (await
|
|
648
|
+
const alreadyRegistered = (await wallet.getContractClassMetadata(contractClass.id)).isContractClassPubliclyRegistered;
|
|
641
649
|
|
|
642
650
|
const calls: ContractFunctionInteraction[] = await Promise.all([
|
|
643
|
-
...(!alreadyRegistered ? [publishContractClass(
|
|
644
|
-
...instances.map(instance => publishInstance(
|
|
651
|
+
...(!alreadyRegistered ? [publishContractClass(wallet, SchnorrAccountContractArtifact)] : []),
|
|
652
|
+
...instances.map(instance => publishInstance(wallet, instance!)),
|
|
645
653
|
]);
|
|
646
654
|
|
|
647
|
-
const batch = new BatchCall(
|
|
655
|
+
const batch = new BatchCall(wallet, calls);
|
|
648
656
|
|
|
649
|
-
const txReceipt = await batch.send({ from:
|
|
657
|
+
const txReceipt = await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
650
658
|
if (waitUntilProven) {
|
|
651
659
|
if (!pxeOrNode) {
|
|
652
660
|
throw new Error('Need to provide a PXE or AztecNode to wait for proven.');
|
|
@@ -3,20 +3,14 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
|
3
3
|
|
|
4
4
|
// docs:start:token_utils
|
|
5
5
|
|
|
6
|
-
export async function deployToken(
|
|
7
|
-
adminWallet: Wallet,
|
|
8
|
-
deployerAddress: AztecAddress,
|
|
9
|
-
initialAdminBalance: bigint,
|
|
10
|
-
logger: Logger,
|
|
11
|
-
) {
|
|
6
|
+
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
12
7
|
logger.info(`Deploying Token contract...`);
|
|
13
|
-
const contract = await TokenContract.deploy(
|
|
14
|
-
.send({ from:
|
|
8
|
+
const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
9
|
+
.send({ from: admin })
|
|
15
10
|
.deployed();
|
|
16
11
|
|
|
17
12
|
if (initialAdminBalance > 0n) {
|
|
18
|
-
|
|
19
|
-
await mintTokensToPrivate(contract, deployerAddress, adminWallet, deployerAddress, initialAdminBalance);
|
|
13
|
+
await mintTokensToPrivate(contract, admin, admin, initialAdminBalance);
|
|
20
14
|
}
|
|
21
15
|
|
|
22
16
|
logger.info('L2 contract deployed');
|
|
@@ -27,12 +21,10 @@ export async function deployToken(
|
|
|
27
21
|
export async function mintTokensToPrivate(
|
|
28
22
|
token: TokenContract,
|
|
29
23
|
minter: AztecAddress,
|
|
30
|
-
minterWallet: Wallet,
|
|
31
24
|
recipient: AztecAddress,
|
|
32
25
|
amount: bigint,
|
|
33
26
|
) {
|
|
34
|
-
|
|
35
|
-
await tokenAsMinter.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
27
|
+
await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
36
28
|
}
|
|
37
29
|
// docs:end:token_utils
|
|
38
30
|
|
|
@@ -51,7 +43,7 @@ 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,
|
|
@@ -63,7 +55,7 @@ export async function mintNotes(
|
|
|
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);
|