@aztec/end-to-end 3.0.0-nightly.20250930 → 3.0.0-nightly.20251002
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 -3
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +17 -12
- package/dest/e2e_fees/bridging_race.notest.js +1 -1
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +0 -10
- package/dest/e2e_p2p/p2p_network.d.ts +1 -1
- package/dest/e2e_p2p/shared.js +2 -2
- package/dest/fixtures/snapshot_manager.d.ts +1 -1
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +6 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +2 -4
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +6 -8
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +1 -3
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +3 -2
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +0 -4
- package/dest/simulators/token_simulator.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 +22 -18
- package/package.json +38 -38
- package/src/bench/client_flows/client_flows_benchmark.ts +22 -14
- package/src/e2e_fees/bridging_race.notest.ts +1 -1
- package/src/e2e_fees/fees_test.ts +0 -12
- package/src/e2e_p2p/shared.ts +2 -2
- package/src/fixtures/snapshot_manager.ts +7 -5
- package/src/fixtures/token_utils.ts +2 -5
- package/src/fixtures/utils.ts +5 -7
- package/src/guides/up_quick_start.sh +2 -10
- package/src/shared/cross_chain_test_harness.ts +0 -4
- package/src/shared/submit-transactions.ts +2 -1
- package/src/shared/uniswap_l1_l2.ts +0 -4
- package/src/simulators/token_simulator.ts +1 -1
- package/src/spartan/setup_test_wallets.ts +24 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/end-to-end",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251002",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,42 +25,42 @@
|
|
|
25
25
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
29
|
-
"@aztec/archiver": "3.0.0-nightly.
|
|
30
|
-
"@aztec/aztec": "3.0.0-nightly.
|
|
31
|
-
"@aztec/aztec-node": "3.0.0-nightly.
|
|
32
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
33
|
-
"@aztec/bb-prover": "3.0.0-nightly.
|
|
34
|
-
"@aztec/blob-lib": "3.0.0-nightly.
|
|
35
|
-
"@aztec/blob-sink": "3.0.0-nightly.
|
|
36
|
-
"@aztec/bot": "3.0.0-nightly.
|
|
37
|
-
"@aztec/cli": "3.0.0-nightly.
|
|
38
|
-
"@aztec/constants": "3.0.0-nightly.
|
|
39
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
40
|
-
"@aztec/epoch-cache": "3.0.0-nightly.
|
|
41
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
42
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
43
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
44
|
-
"@aztec/l1-artifacts": "3.0.0-nightly.
|
|
45
|
-
"@aztec/merkle-tree": "3.0.0-nightly.
|
|
46
|
-
"@aztec/node-keystore": "3.0.0-nightly.
|
|
47
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
48
|
-
"@aztec/noir-noirc_abi": "3.0.0-nightly.
|
|
49
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
50
|
-
"@aztec/noir-test-contracts.js": "3.0.0-nightly.
|
|
51
|
-
"@aztec/p2p": "3.0.0-nightly.
|
|
52
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
53
|
-
"@aztec/prover-client": "3.0.0-nightly.
|
|
54
|
-
"@aztec/prover-node": "3.0.0-nightly.
|
|
55
|
-
"@aztec/pxe": "3.0.0-nightly.
|
|
56
|
-
"@aztec/sequencer-client": "3.0.0-nightly.
|
|
57
|
-
"@aztec/simulator": "3.0.0-nightly.
|
|
58
|
-
"@aztec/slasher": "3.0.0-nightly.
|
|
59
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
60
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
61
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
62
|
-
"@aztec/validator-client": "3.0.0-nightly.
|
|
63
|
-
"@aztec/world-state": "3.0.0-nightly.
|
|
28
|
+
"@aztec/accounts": "3.0.0-nightly.20251002",
|
|
29
|
+
"@aztec/archiver": "3.0.0-nightly.20251002",
|
|
30
|
+
"@aztec/aztec": "3.0.0-nightly.20251002",
|
|
31
|
+
"@aztec/aztec-node": "3.0.0-nightly.20251002",
|
|
32
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251002",
|
|
33
|
+
"@aztec/bb-prover": "3.0.0-nightly.20251002",
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20251002",
|
|
35
|
+
"@aztec/blob-sink": "3.0.0-nightly.20251002",
|
|
36
|
+
"@aztec/bot": "3.0.0-nightly.20251002",
|
|
37
|
+
"@aztec/cli": "3.0.0-nightly.20251002",
|
|
38
|
+
"@aztec/constants": "3.0.0-nightly.20251002",
|
|
39
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251002",
|
|
40
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20251002",
|
|
41
|
+
"@aztec/ethereum": "3.0.0-nightly.20251002",
|
|
42
|
+
"@aztec/foundation": "3.0.0-nightly.20251002",
|
|
43
|
+
"@aztec/kv-store": "3.0.0-nightly.20251002",
|
|
44
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20251002",
|
|
45
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20251002",
|
|
46
|
+
"@aztec/node-keystore": "3.0.0-nightly.20251002",
|
|
47
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251002",
|
|
48
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20251002",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251002",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20251002",
|
|
51
|
+
"@aztec/p2p": "3.0.0-nightly.20251002",
|
|
52
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251002",
|
|
53
|
+
"@aztec/prover-client": "3.0.0-nightly.20251002",
|
|
54
|
+
"@aztec/prover-node": "3.0.0-nightly.20251002",
|
|
55
|
+
"@aztec/pxe": "3.0.0-nightly.20251002",
|
|
56
|
+
"@aztec/sequencer-client": "3.0.0-nightly.20251002",
|
|
57
|
+
"@aztec/simulator": "3.0.0-nightly.20251002",
|
|
58
|
+
"@aztec/slasher": "3.0.0-nightly.20251002",
|
|
59
|
+
"@aztec/stdlib": "3.0.0-nightly.20251002",
|
|
60
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251002",
|
|
61
|
+
"@aztec/test-wallet": "3.0.0-nightly.20251002",
|
|
62
|
+
"@aztec/validator-client": "3.0.0-nightly.20251002",
|
|
63
|
+
"@aztec/world-state": "3.0.0-nightly.20251002",
|
|
64
64
|
"@iarna/toml": "^2.2.5",
|
|
65
65
|
"@jest/globals": "^30.0.0",
|
|
66
66
|
"@noble/curves": "=1.0.0",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"snappy": "^7.2.2",
|
|
93
93
|
"stream-browserify": "^3.0.0",
|
|
94
94
|
"string-argv": "^0.3.2",
|
|
95
|
-
"ts-loader": "^9.
|
|
95
|
+
"ts-loader": "^9.5.4",
|
|
96
96
|
"ts-node": "^10.9.1",
|
|
97
97
|
"tslib": "^2.4.0",
|
|
98
98
|
"typescript": "^5.3.3",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
type AppConfigurableFeePaymentMethod,
|
|
2
3
|
AztecAddress,
|
|
3
4
|
type AztecNode,
|
|
4
|
-
FeeJuicePaymentMethod,
|
|
5
5
|
FeeJuicePaymentMethodWithClaim,
|
|
6
|
-
type FeePaymentMethod,
|
|
7
6
|
type Logger,
|
|
8
7
|
PrivateFeePaymentMethod,
|
|
9
8
|
SponsoredFeePaymentMethod,
|
|
@@ -26,6 +25,7 @@ import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contract
|
|
|
26
25
|
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
27
26
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
28
27
|
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
28
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
29
29
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
30
30
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
31
31
|
|
|
@@ -49,7 +49,10 @@ import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './c
|
|
|
49
49
|
const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
|
|
50
50
|
|
|
51
51
|
export type AccountType = 'ecdsar1' | 'schnorr';
|
|
52
|
-
export type FeePaymentMethodGetter = (
|
|
52
|
+
export type FeePaymentMethodGetter = (
|
|
53
|
+
wallet: Wallet,
|
|
54
|
+
sender: AztecAddress,
|
|
55
|
+
) => Promise<AppConfigurableFeePaymentMethod | undefined>;
|
|
53
56
|
export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
|
|
54
57
|
|
|
55
58
|
export class ClientFlowsBenchmark {
|
|
@@ -112,7 +115,7 @@ export class ClientFlowsBenchmark {
|
|
|
112
115
|
},
|
|
113
116
|
// eslint-disable-next-line camelcase
|
|
114
117
|
fee_juice: {
|
|
115
|
-
forWallet:
|
|
118
|
+
forWallet: () => Promise.resolve(undefined),
|
|
116
119
|
circuits: 0,
|
|
117
120
|
},
|
|
118
121
|
};
|
|
@@ -344,17 +347,22 @@ export class ClientFlowsBenchmark {
|
|
|
344
347
|
public async createAndFundBenchmarkingAccountOnUserWallet(accountType: AccountType) {
|
|
345
348
|
const benchysAccountManager = await this.createBenchmarkingAccountManager(this.adminWallet, accountType);
|
|
346
349
|
const benchysAccount = await benchysAccountManager.getAccount();
|
|
347
|
-
const benchysAddress = benchysAccountManager.
|
|
350
|
+
const benchysAddress = benchysAccountManager.address;
|
|
348
351
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
|
|
349
|
-
const
|
|
350
|
-
await
|
|
352
|
+
const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
|
|
353
|
+
await behchysDeployMethod
|
|
354
|
+
.send({
|
|
355
|
+
from: AztecAddress.ZERO,
|
|
356
|
+
fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
|
|
357
|
+
})
|
|
358
|
+
.wait();
|
|
351
359
|
// Register benchy on the user's Wallet, where we're going to be interacting from
|
|
352
360
|
const accountManager = await this.userWallet.createAccount({
|
|
353
361
|
secret: benchysAccount.getSecretKey(),
|
|
354
362
|
salt: new Fr(benchysAccount.salt),
|
|
355
363
|
contract: benchysAccountManager.getAccountContract(),
|
|
356
364
|
});
|
|
357
|
-
return accountManager.
|
|
365
|
+
return accountManager.address;
|
|
358
366
|
}
|
|
359
367
|
|
|
360
368
|
public async applyDeployAmmSnapshot() {
|
|
@@ -388,15 +396,15 @@ export class ClientFlowsBenchmark {
|
|
|
388
396
|
return new FeeJuicePaymentMethodWithClaim(sender, claim);
|
|
389
397
|
}
|
|
390
398
|
|
|
391
|
-
public getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
|
|
392
|
-
|
|
399
|
+
public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
|
|
400
|
+
// The private fee paying method assembled on the app side requires knowledge of the maximum
|
|
401
|
+
// fee the user is willing to pay
|
|
402
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentBaseFees()).mul(1.5);
|
|
403
|
+
const gasSettings = GasSettings.default({ maxFeesPerGas });
|
|
404
|
+
return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
|
|
393
405
|
}
|
|
394
406
|
|
|
395
407
|
public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet, _sender: AztecAddress) {
|
|
396
408
|
return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
|
|
397
409
|
}
|
|
398
|
-
|
|
399
|
-
public getFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
|
|
400
|
-
return Promise.resolve(new FeeJuicePaymentMethod(sender));
|
|
401
|
-
}
|
|
402
410
|
}
|
|
@@ -48,7 +48,7 @@ describe('e2e_fees bridging_race', () => {
|
|
|
48
48
|
salt: bobsSalt,
|
|
49
49
|
contract: new SchnorrAccountContract(bobsPrivateSigningKey),
|
|
50
50
|
});
|
|
51
|
-
bobsAddress = bobsAccountManager.
|
|
51
|
+
bobsAddress = bobsAccountManager.address;
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
it('Alice bridges funds to Bob', async () => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
1
|
import { type AztecAddress, type AztecNode, type Logger, createLogger, sleep } from '@aztec/aztec.js';
|
|
3
2
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
4
3
|
import { type DeployL1ContractsArgs, RollupContract, createExtendedL1Client } from '@aztec/ethereum';
|
|
@@ -190,17 +189,6 @@ export class FeesTest {
|
|
|
190
189
|
this.accounts = deployedAccounts.map(a => a.address);
|
|
191
190
|
this.accounts.forEach((a, i) => this.logger.verbose(`Account ${i} address: ${a}`));
|
|
192
191
|
[this.aliceAddress, this.bobAddress, this.sequencerAddress] = this.accounts.slice(0, 3);
|
|
193
|
-
await Promise.all(
|
|
194
|
-
deployedAccounts.map(async acc => {
|
|
195
|
-
const accountData = {
|
|
196
|
-
secret: acc.secret,
|
|
197
|
-
salt: acc.salt,
|
|
198
|
-
contract: new SchnorrAccountContract(acc.signingKey),
|
|
199
|
-
};
|
|
200
|
-
const accountManager = await this.wallet.createAccount(accountData);
|
|
201
|
-
return accountManager.register();
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
192
|
|
|
205
193
|
// We set Alice as the FPC admin to avoid the need for deployment of another account.
|
|
206
194
|
this.fpcAdmin = this.aliceAddress;
|
package/src/e2e_p2p/shared.ts
CHANGED
|
@@ -65,7 +65,7 @@ export const submitTransactions = async (
|
|
|
65
65
|
rpcConfig.proverEnabled = false;
|
|
66
66
|
const wallet = await TestWallet.create(node, { ...getPXEConfig(), proverEnabled: false }, { useLogSuffix: true });
|
|
67
67
|
const fundedAccountManager = await wallet.createSchnorrAccount(fundedAccount.secret, fundedAccount.salt);
|
|
68
|
-
return submitTxsTo(wallet, fundedAccountManager.
|
|
68
|
+
return submitTxsTo(wallet, fundedAccountManager.address, numTxs, logger);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export async function prepareTransactions(
|
|
@@ -87,7 +87,7 @@ export async function prepareTransactions(
|
|
|
87
87
|
const contract = await TestContract.at(testContractInstance.address, wallet);
|
|
88
88
|
|
|
89
89
|
return timesAsync(numTxs, async () => {
|
|
90
|
-
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: fundedAccountManager.
|
|
90
|
+
const tx = await contract.methods.emit_nullifier(Fr.random()).prove({ from: fundedAccountManager.address });
|
|
91
91
|
const txHash = tx.getTxHash();
|
|
92
92
|
logger.info(`Tx prepared with hash ${txHash}`);
|
|
93
93
|
return tx;
|
|
@@ -2,7 +2,7 @@ import { SchnorrAccountContractArtifact } from '@aztec/accounts/schnorr';
|
|
|
2
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
|
+
AztecAddress,
|
|
6
6
|
type AztecNode,
|
|
7
7
|
BatchCall,
|
|
8
8
|
type ContractFunctionInteraction,
|
|
@@ -447,7 +447,7 @@ async function setupFromFresh(
|
|
|
447
447
|
// Only enable proving if specifically requested.
|
|
448
448
|
pxeConfig.proverEnabled = !!opts.realProofs;
|
|
449
449
|
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
450
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls,
|
|
450
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, aztecNode, dateProvider);
|
|
451
451
|
|
|
452
452
|
if (statePath) {
|
|
453
453
|
writeFileSync(`${statePath}/aztec_node_config.json`, JSON.stringify(aztecNodeConfig, resolver));
|
|
@@ -575,7 +575,7 @@ async function setupFromState(statePath: string, logger: Logger): Promise<Subsys
|
|
|
575
575
|
const pxeConfig = getPXEConfig();
|
|
576
576
|
pxeConfig.dataDirectory = statePath;
|
|
577
577
|
const wallet = await TestWallet.create(aztecNode, pxeConfig);
|
|
578
|
-
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls,
|
|
578
|
+
const cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, aztecNode, dateProvider);
|
|
579
579
|
|
|
580
580
|
return {
|
|
581
581
|
aztecNodeConfig,
|
|
@@ -620,8 +620,10 @@ export const deployAccounts =
|
|
|
620
620
|
deployedAccounts[i].salt,
|
|
621
621
|
deployedAccounts[i].signingKey,
|
|
622
622
|
);
|
|
623
|
-
await accountManager
|
|
624
|
-
|
|
623
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
624
|
+
await deployMethod
|
|
625
|
+
.send({
|
|
626
|
+
from: AztecAddress.ZERO,
|
|
625
627
|
skipClassPublication: i !== 0, // Publish the contract class at most once.
|
|
626
628
|
})
|
|
627
629
|
.wait();
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { type AztecAddress, BatchCall, type Logger, type Wallet } from '@aztec/aztec.js';
|
|
2
2
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
3
|
|
|
4
|
-
// docs:start:token_utils
|
|
5
|
-
|
|
6
4
|
export async function deployToken(wallet: Wallet, admin: AztecAddress, initialAdminBalance: bigint, logger: Logger) {
|
|
7
5
|
logger.info(`Deploying Token contract...`);
|
|
8
6
|
const contract = await TokenContract.deploy(wallet, admin, 'TokenName', 'TokenSymbol', 18)
|
|
@@ -26,7 +24,6 @@ export async function mintTokensToPrivate(
|
|
|
26
24
|
) {
|
|
27
25
|
await token.methods.mint_to_private(recipient, amount).send({ from: minter }).wait();
|
|
28
26
|
}
|
|
29
|
-
// docs:end:token_utils
|
|
30
27
|
|
|
31
28
|
export async function expectTokenBalance(
|
|
32
29
|
wallet: Wallet,
|
|
@@ -49,9 +46,9 @@ export async function mintNotes(
|
|
|
49
46
|
asset: TokenContract,
|
|
50
47
|
noteAmounts: bigint[],
|
|
51
48
|
): Promise<bigint> {
|
|
52
|
-
// We can only mint
|
|
49
|
+
// We can only mint 5 notes at a time, since that's the maximum number of calls our entrypoints allow
|
|
53
50
|
// TODO(#13024): mint as many notes as possible in a single tx
|
|
54
|
-
const notesPerIteration =
|
|
51
|
+
const notesPerIteration = 5;
|
|
55
52
|
for (let mintedNotes = 0; mintedNotes < noteAmounts.length; mintedNotes += notesPerIteration) {
|
|
56
53
|
const toMint = noteAmounts.slice(mintedNotes, mintedNotes + notesPerIteration);
|
|
57
54
|
const actions = toMint.map(amt => asset.methods.mint_to_private(recipient, amt));
|
package/src/fixtures/utils.ts
CHANGED
|
@@ -220,7 +220,7 @@ async function setupWithRemoteEnvironment(
|
|
|
220
220
|
};
|
|
221
221
|
const ethCheatCodes = new EthCheatCodes(config.l1RpcUrls, new DateProvider());
|
|
222
222
|
const wallet = await TestWallet.create(aztecNode);
|
|
223
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls,
|
|
223
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, new DateProvider());
|
|
224
224
|
const teardown = () => Promise.resolve();
|
|
225
225
|
|
|
226
226
|
logger.verbose('Populating wallet from already registered accounts...');
|
|
@@ -234,7 +234,7 @@ async function setupWithRemoteEnvironment(
|
|
|
234
234
|
const testAccounts = await Promise.all(
|
|
235
235
|
initialFundedAccounts.slice(0, numberOfAccounts).map(async account => {
|
|
236
236
|
const accountManager = await wallet.createSchnorrAccount(account.secret, account.salt, account.signingKey);
|
|
237
|
-
return accountManager.
|
|
237
|
+
return accountManager.address;
|
|
238
238
|
}),
|
|
239
239
|
);
|
|
240
240
|
|
|
@@ -636,7 +636,7 @@ export async function setup(
|
|
|
636
636
|
logger.verbose('Creating a pxe...');
|
|
637
637
|
const { wallet, teardown: pxeTeardown } = await setupPXEAndGetWallet(aztecNode!, pxeOpts, logger);
|
|
638
638
|
|
|
639
|
-
const cheatCodes = await CheatCodes.create(config.l1RpcUrls,
|
|
639
|
+
const cheatCodes = await CheatCodes.create(config.l1RpcUrls, aztecNode, dateProvider);
|
|
640
640
|
|
|
641
641
|
if (
|
|
642
642
|
(opts.aztecTargetCommitteeSize && opts.aztecTargetCommitteeSize > 0) ||
|
|
@@ -659,8 +659,8 @@ export async function setup(
|
|
|
659
659
|
`${numberOfAccounts} accounts are being deployed. Reliably progressing past genesis by setting minTxsPerBlock to 1 and waiting for the accounts to be deployed`,
|
|
660
660
|
);
|
|
661
661
|
const accountsData = initialFundedAccounts.slice(0, numberOfAccounts);
|
|
662
|
-
const accountManagers = await deployFundedSchnorrAccounts(wallet, accountsData);
|
|
663
|
-
accounts = accountManagers.map(accountManager => accountManager.
|
|
662
|
+
const accountManagers = await deployFundedSchnorrAccounts(wallet, aztecNode, accountsData);
|
|
663
|
+
accounts = accountManagers.map(accountManager => accountManager.address);
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
// Now we restore the original minTxsPerBlock setting.
|
|
@@ -733,7 +733,6 @@ export async function setup(
|
|
|
733
733
|
* @param accountsToDeploy - Which accounts to publicly deploy.
|
|
734
734
|
*/
|
|
735
735
|
|
|
736
|
-
// docs:start:public_deploy_accounts
|
|
737
736
|
export async function ensureAccountContractsPublished(wallet: Wallet, accountsToDeploy: AztecAddress[]) {
|
|
738
737
|
// We have to check whether the accounts are already deployed. This can happen if the test runs against
|
|
739
738
|
// the sandbox and the test accounts exist
|
|
@@ -762,7 +761,6 @@ export async function ensureAccountContractsPublished(wallet: Wallet, accountsTo
|
|
|
762
761
|
const batch = new BatchCall(wallet, requests);
|
|
763
762
|
await batch.send({ from: accountsToDeploy[0] }).wait();
|
|
764
763
|
}
|
|
765
|
-
// docs:end:public_deploy_accounts
|
|
766
764
|
|
|
767
765
|
/** Returns the job name for the current test. */
|
|
768
766
|
function getJobName() {
|
|
@@ -19,36 +19,28 @@ aztec-wallet() {
|
|
|
19
19
|
aztec-wallet import-test-accounts
|
|
20
20
|
|
|
21
21
|
# docs:start:declare-accounts
|
|
22
|
-
aztec-wallet create-account -a alice
|
|
23
|
-
aztec-wallet create-account -a bob
|
|
22
|
+
aztec-wallet create-account -a alice -f test0
|
|
23
|
+
aztec-wallet create-account -a bob -f test0
|
|
24
24
|
# docs:end:declare-accounts
|
|
25
25
|
|
|
26
|
-
# docs:start:deploy
|
|
27
26
|
DEPLOY_OUTPUT=$(aztec-wallet deploy ../noir-contracts.js/artifacts/token_contract-Token.json --args accounts:test0 Test TST 18 -f test0)
|
|
28
27
|
TOKEN_ADDRESS=$(echo "$DEPLOY_OUTPUT" | grep -oE 'Contract deployed at 0x[0-9a-fA-F]+' | cut -d ' ' -f4)
|
|
29
28
|
echo "Deployed contract at $TOKEN_ADDRESS"
|
|
30
|
-
# docs:end:deploy
|
|
31
29
|
|
|
32
|
-
# docs:start:mint-private
|
|
33
30
|
MINT_AMOUNT=69
|
|
34
31
|
aztec-wallet send mint_to_private -ca last --args accounts:alice $MINT_AMOUNT -f test0
|
|
35
|
-
# docs:end:mint-private
|
|
36
32
|
|
|
37
|
-
# docs:start:get-balance
|
|
38
33
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
39
34
|
if ! echo $ALICE_BALANCE | grep -q $MINT_AMOUNT; then
|
|
40
35
|
echo "Incorrect Alice balance after transaction (expected $MINT_AMOUNT but got $ALICE_BALANCE)"
|
|
41
36
|
exit 1
|
|
42
37
|
fi
|
|
43
|
-
# docs:end:get-balance
|
|
44
38
|
|
|
45
|
-
# docs:start:transfer
|
|
46
39
|
TRANSFER_AMOUNT=42
|
|
47
40
|
|
|
48
41
|
aztec-wallet create-authwit transfer_in_private accounts:test0 -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -f alice
|
|
49
42
|
|
|
50
43
|
aztec-wallet send transfer_in_private -ca last --args accounts:alice accounts:bob $TRANSFER_AMOUNT 1 -aw authwits:last -f test0
|
|
51
|
-
# docs:end:transfer
|
|
52
44
|
|
|
53
45
|
# Test end result
|
|
54
46
|
ALICE_BALANCE=$(aztec-wallet simulate balance_of_private -ca last --args accounts:alice -f alice)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// docs:start:cross_chain_test_harness
|
|
2
1
|
import {
|
|
3
2
|
AuthWitness,
|
|
4
3
|
type AztecAddress,
|
|
@@ -25,7 +24,6 @@ import { type Hex, getContract } from 'viem';
|
|
|
25
24
|
|
|
26
25
|
import { mintTokensToPrivate } from '../fixtures/token_utils.js';
|
|
27
26
|
|
|
28
|
-
// docs:start:deployAndInitializeTokenAndBridgeContracts
|
|
29
27
|
/**
|
|
30
28
|
* Deploy L1 token and portal, initialize portal, deploy a non native l2 token contract, its L2 bridge contract and attach is to the portal.
|
|
31
29
|
* @param wallet - the wallet instance
|
|
@@ -110,7 +108,6 @@ export async function deployAndInitializeTokenAndBridgeContracts(
|
|
|
110
108
|
|
|
111
109
|
return { token, bridge, tokenPortalAddress, tokenPortal, underlyingERC20 };
|
|
112
110
|
}
|
|
113
|
-
// docs:end:deployAndInitializeTokenAndBridgeContracts
|
|
114
111
|
|
|
115
112
|
export type CrossChainContext = {
|
|
116
113
|
l2Token: AztecAddress;
|
|
@@ -382,4 +379,3 @@ export class CrossChainTestHarness {
|
|
|
382
379
|
};
|
|
383
380
|
}
|
|
384
381
|
}
|
|
385
|
-
// docs:end:cross_chain_test_harness
|
|
@@ -13,7 +13,8 @@ export const submitTxsTo = async (
|
|
|
13
13
|
await Promise.all(
|
|
14
14
|
times(numTxs, async () => {
|
|
15
15
|
const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
|
|
16
|
-
const
|
|
16
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
17
|
+
const tx = deployMethod.send({ from: submitter });
|
|
17
18
|
const txHash = await tx.getTxHash();
|
|
18
19
|
|
|
19
20
|
logger.info(`Tx sent with hash ${txHash}`);
|
|
@@ -35,7 +35,6 @@ import { CrossChainTestHarness } from './cross_chain_test_harness.js';
|
|
|
35
35
|
// anvil --fork-url https://mainnet.infura.io/v3/9928b52099854248b3a096be07a6b23c --fork-block-number 17514288 --chain-id 31337
|
|
36
36
|
// For CI, this is configured in `run_tests.sh` and `docker-compose-images.yml`
|
|
37
37
|
|
|
38
|
-
// docs:start:uniswap_l1_l2_test_setup_const
|
|
39
38
|
const TIMEOUT = 360_000;
|
|
40
39
|
|
|
41
40
|
/** Objects to be returned by the uniswap setup function */
|
|
@@ -57,14 +56,12 @@ export type UniswapSetupContext = {
|
|
|
57
56
|
/** Cheat codes instance. */
|
|
58
57
|
cheatCodes: CheatCodes;
|
|
59
58
|
};
|
|
60
|
-
// docs:end:uniswap_l1_l2_test_setup_const
|
|
61
59
|
|
|
62
60
|
export const uniswapL1L2TestSuite = (
|
|
63
61
|
setup: () => Promise<UniswapSetupContext>,
|
|
64
62
|
cleanup: () => Promise<void>,
|
|
65
63
|
expectedForkBlockNumber = 17514288,
|
|
66
64
|
) => {
|
|
67
|
-
// docs:start:uniswap_l1_l2_test_beforeAll
|
|
68
65
|
describe('uniswap_trade_on_l1_from_l2', () => {
|
|
69
66
|
jest.setTimeout(TIMEOUT);
|
|
70
67
|
|
|
@@ -164,7 +161,6 @@ export const uniswapL1L2TestSuite = (
|
|
|
164
161
|
const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress);
|
|
165
162
|
expect(wethBalance).toBe(parseEther('1000'));
|
|
166
163
|
});
|
|
167
|
-
// docs:end:uniswap_l1_l2_test_beforeAll
|
|
168
164
|
|
|
169
165
|
afterAll(async () => {
|
|
170
166
|
await cleanup();
|
|
@@ -104,7 +104,7 @@ export class TokenSimulator {
|
|
|
104
104
|
|
|
105
105
|
const results = (
|
|
106
106
|
await Promise.all(
|
|
107
|
-
chunk(calls,
|
|
107
|
+
chunk(calls, 5).map(batch => new BatchCall(this.defaultWallet, batch).simulate({ from: this.defaultAddress })),
|
|
108
108
|
)
|
|
109
109
|
).flat();
|
|
110
110
|
expect(results[0]).toEqual(this.totalSupply);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
2
|
import {
|
|
3
|
-
type
|
|
3
|
+
type AppConfigurableFeePaymentMethod,
|
|
4
|
+
AztecAddress,
|
|
4
5
|
type AztecNode,
|
|
5
6
|
FeeJuicePaymentMethodWithClaim,
|
|
6
|
-
type FeePaymentMethod,
|
|
7
7
|
Fr,
|
|
8
8
|
L1FeeJuicePortalManager,
|
|
9
9
|
SponsoredFeePaymentMethod,
|
|
@@ -82,19 +82,21 @@ export async function deploySponsoredTestAccounts(
|
|
|
82
82
|
await registerSponsoredFPC(wallet);
|
|
83
83
|
|
|
84
84
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
85
|
-
|
|
85
|
+
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
86
|
+
await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
|
|
86
87
|
await Promise.all(
|
|
87
88
|
fundedAccounts.map(async a => {
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const deployMethod = await a.getDeployMethod();
|
|
90
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
|
|
91
|
+
logger.info(`Account deployed at ${a.address}`);
|
|
90
92
|
}),
|
|
91
93
|
);
|
|
92
94
|
|
|
93
95
|
const tokenAdmin = fundedAccounts[0];
|
|
94
96
|
const tokenAddress = await deployTokenAndMint(
|
|
95
97
|
wallet,
|
|
96
|
-
fundedAccounts.map(acc => acc.
|
|
97
|
-
tokenAdmin.
|
|
98
|
+
fundedAccounts.map(acc => acc.address),
|
|
99
|
+
tokenAdmin.address,
|
|
98
100
|
mintAmount,
|
|
99
101
|
new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
|
|
100
102
|
logger,
|
|
@@ -104,12 +106,12 @@ export async function deploySponsoredTestAccounts(
|
|
|
104
106
|
return {
|
|
105
107
|
aztecNode,
|
|
106
108
|
wallet,
|
|
107
|
-
accounts: fundedAccounts.map(acc => acc.
|
|
108
|
-
tokenAdminAddress: tokenAdmin.
|
|
109
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
110
|
+
tokenAdminAddress: tokenAdmin.address,
|
|
109
111
|
tokenName: TOKEN_NAME,
|
|
110
112
|
tokenAddress,
|
|
111
113
|
tokenContract,
|
|
112
|
-
recipientAddress: recipientAccount.
|
|
114
|
+
recipientAddress: recipientAccount.address,
|
|
113
115
|
};
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -129,9 +131,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
129
131
|
const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
130
132
|
|
|
131
133
|
const claims = await Promise.all(
|
|
132
|
-
fundedAccounts.map(a =>
|
|
133
|
-
bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.getAddress(), undefined, logger),
|
|
134
|
-
),
|
|
134
|
+
fundedAccounts.map(a => bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, aztecNode, a.address, undefined, logger)),
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
@@ -141,17 +141,18 @@ export async function deployTestAccountsWithTokens(
|
|
|
141
141
|
|
|
142
142
|
await Promise.all(
|
|
143
143
|
fundedAccounts.map(async (a, i) => {
|
|
144
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
145
|
+
const deployMethod = await a.getDeployMethod();
|
|
146
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait();
|
|
147
|
+
logger.info(`Account deployed at ${a.address}`);
|
|
147
148
|
}),
|
|
148
149
|
);
|
|
149
150
|
|
|
150
151
|
const tokenAdmin = fundedAccounts[0];
|
|
151
152
|
const tokenAddress = await deployTokenAndMint(
|
|
152
153
|
wallet,
|
|
153
|
-
fundedAccounts.map(acc => acc.
|
|
154
|
-
tokenAdmin.
|
|
154
|
+
fundedAccounts.map(acc => acc.address),
|
|
155
|
+
tokenAdmin.address,
|
|
155
156
|
mintAmount,
|
|
156
157
|
undefined,
|
|
157
158
|
logger,
|
|
@@ -161,12 +162,12 @@ export async function deployTestAccountsWithTokens(
|
|
|
161
162
|
return {
|
|
162
163
|
aztecNode,
|
|
163
164
|
wallet,
|
|
164
|
-
accounts: fundedAccounts.map(acc => acc.
|
|
165
|
-
tokenAdminAddress: tokenAdmin.
|
|
165
|
+
accounts: fundedAccounts.map(acc => acc.address),
|
|
166
|
+
tokenAdminAddress: tokenAdmin.address,
|
|
166
167
|
tokenName: TOKEN_NAME,
|
|
167
168
|
tokenAddress,
|
|
168
169
|
tokenContract,
|
|
169
|
-
recipientAddress: recipientAccount.
|
|
170
|
+
recipientAddress: recipientAccount.address,
|
|
170
171
|
};
|
|
171
172
|
}
|
|
172
173
|
|
|
@@ -182,10 +183,8 @@ async function bridgeL1FeeJuice(
|
|
|
182
183
|
const chain = createEthereumChain(l1RpcUrls, l1ChainId);
|
|
183
184
|
const l1Client = createExtendedL1Client(chain.rpcUrls, mnemonicOrPrivateKey, chain.chainInfo);
|
|
184
185
|
|
|
185
|
-
// docs:start:bridge_fee_juice
|
|
186
186
|
const portal = await L1FeeJuicePortalManager.new(aztecNode, l1Client, log);
|
|
187
187
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
188
|
-
// docs:end:bridge_fee_juice
|
|
189
188
|
|
|
190
189
|
const isSynced = async () =>
|
|
191
190
|
(await aztecNode.getL1ToL2MessageBlock(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
@@ -216,7 +215,7 @@ async function deployTokenAndMint(
|
|
|
216
215
|
accounts: AztecAddress[],
|
|
217
216
|
admin: AztecAddress,
|
|
218
217
|
mintAmount: bigint,
|
|
219
|
-
paymentMethod:
|
|
218
|
+
paymentMethod: AppConfigurableFeePaymentMethod | undefined,
|
|
220
219
|
logger: Logger,
|
|
221
220
|
) {
|
|
222
221
|
logger.verbose(`Deploying TokenContract...`);
|
|
@@ -258,7 +257,7 @@ export async function performTransfers({
|
|
|
258
257
|
rounds: number;
|
|
259
258
|
transferAmount: bigint;
|
|
260
259
|
logger: Logger;
|
|
261
|
-
feePaymentMethod?:
|
|
260
|
+
feePaymentMethod?: AppConfigurableFeePaymentMethod;
|
|
262
261
|
}) {
|
|
263
262
|
const recipient = testAccounts.recipientAddress;
|
|
264
263
|
// Default to sponsored fee payment if no fee method is provided
|