@aztec/end-to-end 3.0.0-nightly.20250908 → 3.0.0-nightly.20250911
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_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 +6 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +7 -9
- 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 +29 -25
- 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_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 +10 -10
- package/src/e2e_p2p/shared.ts +7 -16
- 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 +37 -41
- 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,42 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { generateSchnorrAccounts, getDeployedTestAccountsWallets } from '@aztec/accounts/testing';
|
|
1
|
+
import { generateSchnorrAccounts, getDeployedTestAccounts } from '@aztec/accounts/testing';
|
|
3
2
|
import { FeeJuicePaymentMethodWithClaim, Fr, L1FeeJuicePortalManager, SponsoredFeePaymentMethod, createAztecNodeClient, createCompatibleClient, retryUntil } from '@aztec/aztec.js';
|
|
4
3
|
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
4
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
6
5
|
import { createPXEService } from '@aztec/pxe/server';
|
|
6
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
7
7
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
8
8
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
9
9
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
10
10
|
const TOKEN_NAME = 'USDC';
|
|
11
11
|
const TOKEN_SYMBOL = 'USD';
|
|
12
12
|
const TOKEN_DECIMALS = 18n;
|
|
13
|
-
export async function
|
|
14
|
-
const
|
|
13
|
+
export async function setupTestAccountsWithTokens(pxeUrl, mintAmount, logger) {
|
|
14
|
+
const ACCOUNT_COUNT = 1; // TODO fix this to allow for 16 wallets again
|
|
15
15
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
16
|
+
const wallet = new TestWallet(pxe);
|
|
17
|
+
const [recipientAccount, ...accounts] = (await getDeployedTestAccounts(pxe)).slice(0, ACCOUNT_COUNT + 1);
|
|
18
|
+
const tokenAdmin = accounts[0];
|
|
19
|
+
const tokenAddress = await deployTokenAndMint(wallet, accounts.map((acc)=>acc.address), tokenAdmin.address, mintAmount, undefined, logger);
|
|
20
|
+
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
20
21
|
return {
|
|
21
22
|
pxe,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
tokenAdminAddress: tokenAdmin.
|
|
23
|
+
accounts: accounts.map((acc)=>acc.address),
|
|
24
|
+
wallet,
|
|
25
|
+
tokenAdminAddress: tokenAdmin.address,
|
|
25
26
|
tokenName: TOKEN_NAME,
|
|
26
27
|
tokenAddress,
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
tokenContract,
|
|
29
|
+
recipientAddress: recipientAccount.address
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
|
-
export async function
|
|
32
|
+
export async function deploySponsoredTestAccounts(pxe, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
33
|
+
const wallet = new TestWallet(pxe);
|
|
32
34
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
33
|
-
const
|
|
34
|
-
const fundedAccounts = await Promise.all(funded.map((a)=>
|
|
35
|
-
await registerSponsoredFPC(
|
|
36
|
-
|
|
37
|
-
const wallet = await a.getWallet();
|
|
35
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
36
|
+
const fundedAccounts = await Promise.all(funded.map((a)=>wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
37
|
+
await registerSponsoredFPC(wallet);
|
|
38
|
+
await Promise.all(fundedAccounts.map(async (a)=>{
|
|
38
39
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
39
|
-
await
|
|
40
|
+
await recipientAccount.deploy({
|
|
40
41
|
fee: {
|
|
41
42
|
paymentMethod
|
|
42
43
|
}
|
|
@@ -44,56 +45,54 @@ export async function deploySponsoredTestWallets(pxe, mintAmount, logger, number
|
|
|
44
45
|
timeout: 2400
|
|
45
46
|
}); // increase timeout on purpose in order to account for two empty epochs
|
|
46
47
|
logger.info(`Account deployed at ${a.getAddress()}`);
|
|
47
|
-
return wallet;
|
|
48
48
|
}));
|
|
49
|
-
const tokenAdmin =
|
|
50
|
-
const tokenAddress = await deployTokenAndMint(
|
|
51
|
-
const
|
|
49
|
+
const tokenAdmin = fundedAccounts[0];
|
|
50
|
+
const tokenAddress = await deployTokenAndMint(wallet, fundedAccounts.map((acc)=>acc.getAddress()), tokenAdmin.getAddress(), mintAmount, new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()), logger);
|
|
51
|
+
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
52
52
|
return {
|
|
53
53
|
pxe,
|
|
54
|
-
|
|
54
|
+
wallet,
|
|
55
|
+
accounts: fundedAccounts.map((acc)=>acc.getAddress()),
|
|
55
56
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
56
|
-
tokenAdminWallet,
|
|
57
57
|
tokenName: TOKEN_NAME,
|
|
58
58
|
tokenAddress,
|
|
59
|
-
|
|
60
|
-
recipientAddress:
|
|
59
|
+
tokenContract,
|
|
60
|
+
recipientAddress: recipientAccount.getAddress()
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
export async function
|
|
63
|
+
export async function deployTestAccountsWithTokens(pxeUrl, nodeUrl, l1RpcUrls, mnemonicOrPrivateKey, mintAmount, logger, numberOfFundedWallets = 1) {
|
|
64
64
|
const pxe = await createCompatibleClient(pxeUrl, logger);
|
|
65
65
|
const node = createAztecNodeClient(nodeUrl);
|
|
66
|
+
const wallet = new TestWallet(pxe);
|
|
66
67
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
67
|
-
const
|
|
68
|
-
const fundedAccounts = await Promise.all(funded.map((a)=>
|
|
68
|
+
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
69
|
+
const fundedAccounts = await Promise.all(funded.map((a)=>wallet.createSchnorrAccount(a.secret, a.salt)));
|
|
69
70
|
const claims = await Promise.all(fundedAccounts.map((a)=>bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, a.getAddress(), undefined, logger)));
|
|
70
71
|
// Progress by 3 L2 blocks so that the l1ToL2Message added above will be available to use on L2.
|
|
71
72
|
await advanceL2Block(node);
|
|
72
73
|
await advanceL2Block(node);
|
|
73
74
|
await advanceL2Block(node);
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(wallet, claims[i]);
|
|
75
|
+
await Promise.all(fundedAccounts.map(async (a, i)=>{
|
|
76
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.getAddress(), claims[i]);
|
|
77
77
|
await a.deploy({
|
|
78
78
|
fee: {
|
|
79
79
|
paymentMethod
|
|
80
80
|
}
|
|
81
81
|
}).wait();
|
|
82
82
|
logger.info(`Account deployed at ${a.getAddress()}`);
|
|
83
|
-
return wallet;
|
|
84
83
|
}));
|
|
85
|
-
const tokenAdmin =
|
|
86
|
-
const tokenAddress = await deployTokenAndMint(
|
|
87
|
-
const
|
|
84
|
+
const tokenAdmin = fundedAccounts[0];
|
|
85
|
+
const tokenAddress = await deployTokenAndMint(wallet, fundedAccounts.map((acc)=>acc.getAddress()), tokenAdmin.getAddress(), mintAmount, undefined, logger);
|
|
86
|
+
const tokenContract = await TokenContract.at(tokenAddress, wallet);
|
|
88
87
|
return {
|
|
89
88
|
pxe,
|
|
90
|
-
|
|
89
|
+
wallet,
|
|
90
|
+
accounts: fundedAccounts.map((acc)=>acc.getAddress()),
|
|
91
91
|
tokenAdminAddress: tokenAdmin.getAddress(),
|
|
92
|
-
tokenAdminWallet,
|
|
93
92
|
tokenName: TOKEN_NAME,
|
|
94
93
|
tokenAddress,
|
|
95
|
-
|
|
96
|
-
recipientAddress:
|
|
94
|
+
tokenContract,
|
|
95
|
+
recipientAddress: recipientAccount.getAddress()
|
|
97
96
|
};
|
|
98
97
|
}
|
|
99
98
|
async function bridgeL1FeeJuice(l1RpcUrls, mnemonicOrPrivateKey, pxe, recipient, amount, log) {
|
|
@@ -125,9 +124,9 @@ async function advanceL2Block(node, nodeAdmin) {
|
|
|
125
124
|
});
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
async function deployTokenAndMint(
|
|
127
|
+
async function deployTokenAndMint(wallet, accounts, admin, mintAmount, paymentMethod, logger) {
|
|
129
128
|
logger.verbose(`Deploying TokenContract...`);
|
|
130
|
-
const tokenContract = await TokenContract.deploy(
|
|
129
|
+
const tokenContract = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
|
|
131
130
|
from: admin,
|
|
132
131
|
fee: {
|
|
133
132
|
paymentMethod
|
|
@@ -136,8 +135,8 @@ async function deployTokenAndMint(wallets, admin, mintAmount, paymentMethod, log
|
|
|
136
135
|
timeout: 600
|
|
137
136
|
});
|
|
138
137
|
const tokenAddress = tokenContract.address;
|
|
139
|
-
logger.verbose(`Minting ${mintAmount} public assets to the ${
|
|
140
|
-
await Promise.all(
|
|
138
|
+
logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
|
|
139
|
+
await Promise.all(accounts.map(async (acc)=>(await TokenContract.at(tokenAddress, wallet)).methods.mint_to_public(acc, mintAmount).send({
|
|
141
140
|
from: admin,
|
|
142
141
|
fee: {
|
|
143
142
|
paymentMethod
|
|
@@ -148,11 +147,16 @@ async function deployTokenAndMint(wallets, admin, mintAmount, paymentMethod, log
|
|
|
148
147
|
logger.verbose(`Minting complete.`);
|
|
149
148
|
return tokenAddress;
|
|
150
149
|
}
|
|
151
|
-
export async function performTransfers({
|
|
152
|
-
const recipient =
|
|
150
|
+
export async function performTransfers({ testAccounts, rounds, transferAmount, logger, feePaymentMethod }) {
|
|
151
|
+
const recipient = testAccounts.recipientAddress;
|
|
152
|
+
// Default to sponsored fee payment if no fee method is provided
|
|
153
|
+
const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
153
154
|
for(let i = 0; i < rounds; i++){
|
|
154
|
-
const txs =
|
|
155
|
-
from:
|
|
155
|
+
const txs = testAccounts.accounts.map(async (acc)=>(await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet)).methods.transfer_in_public(acc, recipient, transferAmount, 0).prove({
|
|
156
|
+
from: acc,
|
|
157
|
+
fee: {
|
|
158
|
+
paymentMethod: defaultFeePaymentMethod
|
|
159
|
+
}
|
|
156
160
|
}));
|
|
157
161
|
const provenTxs = await Promise.all(txs);
|
|
158
162
|
await Promise.all(provenTxs.map((t)=>t.send().wait({
|
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.20250911",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": "./dest/index.js",
|
|
6
6
|
"inherits": [
|
|
@@ -25,41 +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/
|
|
62
|
-
"@aztec/
|
|
28
|
+
"@aztec/accounts": "3.0.0-nightly.20250911",
|
|
29
|
+
"@aztec/archiver": "3.0.0-nightly.20250911",
|
|
30
|
+
"@aztec/aztec": "3.0.0-nightly.20250911",
|
|
31
|
+
"@aztec/aztec-node": "3.0.0-nightly.20250911",
|
|
32
|
+
"@aztec/aztec.js": "3.0.0-nightly.20250911",
|
|
33
|
+
"@aztec/bb-prover": "3.0.0-nightly.20250911",
|
|
34
|
+
"@aztec/blob-lib": "3.0.0-nightly.20250911",
|
|
35
|
+
"@aztec/blob-sink": "3.0.0-nightly.20250911",
|
|
36
|
+
"@aztec/bot": "3.0.0-nightly.20250911",
|
|
37
|
+
"@aztec/cli": "3.0.0-nightly.20250911",
|
|
38
|
+
"@aztec/constants": "3.0.0-nightly.20250911",
|
|
39
|
+
"@aztec/entrypoints": "3.0.0-nightly.20250911",
|
|
40
|
+
"@aztec/epoch-cache": "3.0.0-nightly.20250911",
|
|
41
|
+
"@aztec/ethereum": "3.0.0-nightly.20250911",
|
|
42
|
+
"@aztec/foundation": "3.0.0-nightly.20250911",
|
|
43
|
+
"@aztec/kv-store": "3.0.0-nightly.20250911",
|
|
44
|
+
"@aztec/l1-artifacts": "3.0.0-nightly.20250911",
|
|
45
|
+
"@aztec/merkle-tree": "3.0.0-nightly.20250911",
|
|
46
|
+
"@aztec/node-keystore": "3.0.0-nightly.20250911",
|
|
47
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20250911",
|
|
48
|
+
"@aztec/noir-noirc_abi": "3.0.0-nightly.20250911",
|
|
49
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20250911",
|
|
50
|
+
"@aztec/noir-test-contracts.js": "3.0.0-nightly.20250911",
|
|
51
|
+
"@aztec/p2p": "3.0.0-nightly.20250911",
|
|
52
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20250911",
|
|
53
|
+
"@aztec/prover-client": "3.0.0-nightly.20250911",
|
|
54
|
+
"@aztec/prover-node": "3.0.0-nightly.20250911",
|
|
55
|
+
"@aztec/pxe": "3.0.0-nightly.20250911",
|
|
56
|
+
"@aztec/sequencer-client": "3.0.0-nightly.20250911",
|
|
57
|
+
"@aztec/simulator": "3.0.0-nightly.20250911",
|
|
58
|
+
"@aztec/slasher": "3.0.0-nightly.20250911",
|
|
59
|
+
"@aztec/stdlib": "3.0.0-nightly.20250911",
|
|
60
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20250911",
|
|
61
|
+
"@aztec/test-wallet": "3.0.0-nightly.20250911",
|
|
62
|
+
"@aztec/validator-client": "3.0.0-nightly.20250911",
|
|
63
|
+
"@aztec/world-state": "3.0.0-nightly.20250911",
|
|
63
64
|
"@iarna/toml": "^2.2.5",
|
|
64
65
|
"@jest/globals": "^30.0.0",
|
|
65
66
|
"@noble/curves": "=1.0.0",
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import { EcdsaRAccountContractArtifact, getEcdsaRAccount } from '@aztec/accounts/ecdsa';
|
|
2
|
-
import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWallet } from '@aztec/accounts/schnorr';
|
|
3
1
|
import {
|
|
4
|
-
type AccountWallet,
|
|
5
|
-
AccountWalletWithSecretKey,
|
|
6
2
|
AztecAddress,
|
|
7
3
|
type AztecNode,
|
|
8
4
|
FeeJuicePaymentMethod,
|
|
@@ -32,6 +28,7 @@ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
|
32
28
|
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
33
29
|
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
|
|
34
30
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
31
|
+
import { TestWallet } from '@aztec/test-wallet';
|
|
35
32
|
|
|
36
33
|
import { MNEMONIC } from '../../fixtures/fixtures.js';
|
|
37
34
|
import {
|
|
@@ -53,22 +50,22 @@ import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './c
|
|
|
53
50
|
const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
|
|
54
51
|
|
|
55
52
|
export type AccountType = 'ecdsar1' | 'schnorr';
|
|
56
|
-
export type FeePaymentMethodGetter = (wallet: Wallet) => Promise<FeePaymentMethod>;
|
|
53
|
+
export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod>;
|
|
57
54
|
export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
|
|
58
55
|
|
|
59
56
|
export class ClientFlowsBenchmark {
|
|
60
57
|
private snapshotManager: ISnapshotManager;
|
|
61
58
|
|
|
62
59
|
public logger: Logger;
|
|
63
|
-
|
|
60
|
+
private pxe!: PXE;
|
|
64
61
|
public aztecNode!: AztecNode;
|
|
65
62
|
public cheatCodes!: CheatCodes;
|
|
66
63
|
public context!: SubsystemsContext;
|
|
67
64
|
public chainMonitor!: ChainMonitor;
|
|
68
65
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
66
|
+
public adminWallet!: TestWallet;
|
|
69
67
|
|
|
70
68
|
// The admin that aids in the setup of the test
|
|
71
|
-
public adminWallet!: AccountWallet;
|
|
72
69
|
public adminAddress!: AztecAddress;
|
|
73
70
|
|
|
74
71
|
// Aztec Node config
|
|
@@ -89,8 +86,9 @@ export class ClientFlowsBenchmark {
|
|
|
89
86
|
// Sponsored FPC contract
|
|
90
87
|
public sponsoredFPC!: SponsoredFPCContract;
|
|
91
88
|
|
|
92
|
-
// PXE used by the benchmarking user. It can be set up with client-side proving enabled
|
|
93
|
-
public
|
|
89
|
+
// PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
|
|
90
|
+
public userWallet!: TestWallet;
|
|
91
|
+
private userPXE!: PXE;
|
|
94
92
|
|
|
95
93
|
public realProofs = ['true', '1'].includes(process.env.REAL_PROOFS ?? '');
|
|
96
94
|
|
|
@@ -169,7 +167,7 @@ export class ClientFlowsBenchmark {
|
|
|
169
167
|
.balance_of_private(address)
|
|
170
168
|
.simulate({ from: this.adminAddress });
|
|
171
169
|
|
|
172
|
-
await mintTokensToPrivate(this.bananaCoin, this.adminAddress,
|
|
170
|
+
await mintTokensToPrivate(this.bananaCoin, this.adminAddress, address, amount);
|
|
173
171
|
|
|
174
172
|
const balanceAfter = await this.bananaCoin.methods
|
|
175
173
|
.balance_of_private(address)
|
|
@@ -177,23 +175,20 @@ export class ClientFlowsBenchmark {
|
|
|
177
175
|
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
178
176
|
}
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
const
|
|
178
|
+
createBenchmarkingAccountManager(wallet: TestWallet, type: 'ecdsar1' | 'schnorr') {
|
|
179
|
+
const benchysSecret = Fr.random();
|
|
182
180
|
const salt = Fr.random();
|
|
183
181
|
|
|
184
182
|
let benchysPrivateSigningKey;
|
|
185
|
-
let benchysAccountManager;
|
|
186
183
|
if (type === 'schnorr') {
|
|
187
|
-
benchysPrivateSigningKey = deriveSigningKey(
|
|
188
|
-
|
|
184
|
+
benchysPrivateSigningKey = deriveSigningKey(benchysSecret);
|
|
185
|
+
return wallet.createSchnorrAccount(benchysSecret, salt, benchysPrivateSigningKey);
|
|
189
186
|
} else if (type === 'ecdsar1') {
|
|
190
187
|
benchysPrivateSigningKey = randomBytes(32);
|
|
191
|
-
|
|
188
|
+
return wallet.createECDSARAccount(benchysSecret, salt, benchysPrivateSigningKey);
|
|
192
189
|
} else {
|
|
193
190
|
throw new Error(`Unknown account type: ${type}`);
|
|
194
191
|
}
|
|
195
|
-
await benchysAccountManager.register();
|
|
196
|
-
return benchysAccountManager;
|
|
197
192
|
}
|
|
198
193
|
|
|
199
194
|
public async applyBaseSnapshots() {
|
|
@@ -205,18 +200,17 @@ export class ClientFlowsBenchmark {
|
|
|
205
200
|
await this.snapshotManager.snapshot(
|
|
206
201
|
'initial_accounts',
|
|
207
202
|
deployAccounts(2, this.logger),
|
|
208
|
-
async (
|
|
203
|
+
async (
|
|
204
|
+
{ deployedAccounts: [{ address: adminAddress }, { address: sequencerAddress }] },
|
|
205
|
+
{ wallet, pxe, aztecNode, aztecNodeConfig },
|
|
206
|
+
) => {
|
|
209
207
|
this.pxe = pxe;
|
|
210
|
-
|
|
208
|
+
this.adminWallet = wallet;
|
|
211
209
|
this.aztecNode = aztecNode;
|
|
212
210
|
this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
|
|
213
211
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
);
|
|
217
|
-
[this.adminWallet] = deployedWallets;
|
|
218
|
-
this.adminAddress = this.adminWallet.getAddress();
|
|
219
|
-
this.sequencerAddress = deployedWallets[1].getAddress();
|
|
212
|
+
this.adminAddress = adminAddress;
|
|
213
|
+
this.sequencerAddress = sequencerAddress;
|
|
220
214
|
|
|
221
215
|
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
222
216
|
this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
|
|
@@ -235,6 +229,7 @@ export class ClientFlowsBenchmark {
|
|
|
235
229
|
prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
|
|
236
230
|
},
|
|
237
231
|
});
|
|
232
|
+
this.userWallet = new TestWallet(this.userPXE);
|
|
238
233
|
},
|
|
239
234
|
);
|
|
240
235
|
}
|
|
@@ -330,7 +325,7 @@ export class ClientFlowsBenchmark {
|
|
|
330
325
|
);
|
|
331
326
|
}
|
|
332
327
|
|
|
333
|
-
public async createCrossChainTestHarness(owner:
|
|
328
|
+
public async createCrossChainTestHarness(owner: AztecAddress) {
|
|
334
329
|
const l1Client = createExtendedL1Client(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
|
|
335
330
|
|
|
336
331
|
const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
@@ -344,8 +339,8 @@ export class ClientFlowsBenchmark {
|
|
|
344
339
|
this.aztecNode,
|
|
345
340
|
this.pxe,
|
|
346
341
|
l1Client,
|
|
342
|
+
this.adminWallet,
|
|
347
343
|
owner,
|
|
348
|
-
owner.getAddress(),
|
|
349
344
|
this.logger,
|
|
350
345
|
underlyingERC20Address,
|
|
351
346
|
);
|
|
@@ -355,26 +350,20 @@ export class ClientFlowsBenchmark {
|
|
|
355
350
|
return crossChainTestHarness;
|
|
356
351
|
}
|
|
357
352
|
|
|
358
|
-
public async
|
|
359
|
-
const benchysAccountManager = await this.createBenchmarkingAccountManager(this.
|
|
360
|
-
const
|
|
353
|
+
public async createAndFundBenchmarkingAccountOnUserWallet(accountType: AccountType) {
|
|
354
|
+
const benchysAccountManager = await this.createBenchmarkingAccountManager(this.adminWallet, accountType);
|
|
355
|
+
const benchysAccount = await benchysAccountManager.getAccount();
|
|
361
356
|
const benchysAddress = benchysAccountManager.getAddress();
|
|
362
357
|
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
|
|
363
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(
|
|
358
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(benchysAddress, claim);
|
|
364
359
|
await benchysAccountManager.deploy({ fee: { paymentMethod } }).wait();
|
|
365
|
-
// Register benchy on the user's
|
|
366
|
-
await this.
|
|
367
|
-
|
|
368
|
-
|
|
360
|
+
// Register benchy on the user's Wallet, where we're going to be interacting from
|
|
361
|
+
const accountManager = await this.userWallet.createAccount({
|
|
362
|
+
secret: benchysAccount.getSecretKey(),
|
|
363
|
+
salt: new Fr(benchysAccount.salt),
|
|
364
|
+
contract: benchysAccountManager.getAccountContract(),
|
|
369
365
|
});
|
|
370
|
-
|
|
371
|
-
const entrypoint = await benchysAccountManager.getAccount();
|
|
372
|
-
return new AccountWalletWithSecretKey(
|
|
373
|
-
this.userPXE,
|
|
374
|
-
entrypoint,
|
|
375
|
-
benchysWallet.getSecretKey(),
|
|
376
|
-
benchysAccountManager.salt,
|
|
377
|
-
);
|
|
366
|
+
return accountManager.getAddress();
|
|
378
367
|
}
|
|
379
368
|
|
|
380
369
|
public async applyDeployAmmSnapshot() {
|
|
@@ -403,20 +392,20 @@ export class ClientFlowsBenchmark {
|
|
|
403
392
|
);
|
|
404
393
|
}
|
|
405
394
|
|
|
406
|
-
public async getBridgedFeeJuicePaymentMethodForWallet(
|
|
407
|
-
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(
|
|
408
|
-
return new FeeJuicePaymentMethodWithClaim(
|
|
395
|
+
public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
|
|
396
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(sender);
|
|
397
|
+
return new FeeJuicePaymentMethodWithClaim(sender, claim);
|
|
409
398
|
}
|
|
410
399
|
|
|
411
|
-
public getPrivateFPCPaymentMethodForWallet(wallet: Wallet) {
|
|
412
|
-
return Promise.resolve(new PrivateFeePaymentMethod(this.bananaFPC.address, wallet));
|
|
400
|
+
public getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
|
|
401
|
+
return Promise.resolve(new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet));
|
|
413
402
|
}
|
|
414
403
|
|
|
415
|
-
public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet) {
|
|
404
|
+
public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet, _sender: AztecAddress) {
|
|
416
405
|
return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
|
|
417
406
|
}
|
|
418
407
|
|
|
419
|
-
public getFeeJuicePaymentMethodForWallet(
|
|
420
|
-
return Promise.resolve(new FeeJuicePaymentMethod(
|
|
408
|
+
public getFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
|
|
409
|
+
return Promise.resolve(new FeeJuicePaymentMethod(sender));
|
|
421
410
|
}
|
|
422
411
|
}
|
package/src/bench/utils.ts
CHANGED
|
@@ -22,9 +22,8 @@ export async function benchmarkSetup(
|
|
|
22
22
|
},
|
|
23
23
|
) {
|
|
24
24
|
const context = await setup(1, { ...opts, telemetryConfig: { benchmark: true } });
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
.deployed();
|
|
25
|
+
const defaultAccountAddress = context.accounts[0];
|
|
26
|
+
const contract = await BenchmarkingContract.deploy(context.wallet).send({ from: defaultAccountAddress }).deployed();
|
|
28
27
|
context.logger.info(`Deployed benchmarking contract at ${contract.address}`);
|
|
29
28
|
const sequencer = (context.aztecNode as AztecNodeService).getSequencer()!;
|
|
30
29
|
const telemetry = context.telemetryClient! as BenchmarkTelemetryClient;
|
|
@@ -111,9 +110,9 @@ function makeCall(
|
|
|
111
110
|
contract: BenchmarkingContract,
|
|
112
111
|
heavyPublicCompute: boolean,
|
|
113
112
|
) {
|
|
114
|
-
const owner = context.
|
|
113
|
+
const [owner] = context.accounts;
|
|
115
114
|
if (heavyPublicCompute) {
|
|
116
|
-
return new BatchCall(context.wallet, [contract.methods.
|
|
115
|
+
return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
|
|
117
116
|
} else {
|
|
118
117
|
return new BatchCall(context.wallet, [
|
|
119
118
|
contract.methods.create_note(owner, index + 1),
|
|
@@ -139,7 +138,8 @@ export async function sendTxs(
|
|
|
139
138
|
): Promise<SentTx[]> {
|
|
140
139
|
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
141
140
|
context.logger.info(`Creating ${txCount} txs`);
|
|
142
|
-
const
|
|
141
|
+
const [from] = context.accounts;
|
|
142
|
+
const provenTxs = await Promise.all(calls.map(call => call.prove({ from })));
|
|
143
143
|
context.logger.info(`Sending ${txCount} txs`);
|
|
144
144
|
return provenTxs.map(tx => tx.send());
|
|
145
145
|
}
|