@aztec/end-to-end 0.82.2 → 0.82.3-nightly.20250403

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.
Files changed (61) hide show
  1. package/dest/bench/client_flows/client_flows_benchmark.d.ts +66 -0
  2. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/client_flows_benchmark.js +281 -0
  4. package/dest/bench/client_flows/config.d.ts +14 -0
  5. package/dest/bench/client_flows/config.d.ts.map +1 -0
  6. package/dest/bench/client_flows/config.js +85 -0
  7. package/dest/bench/client_flows/data_extractor.d.ts +23 -0
  8. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
  9. package/dest/bench/client_flows/data_extractor.js +198 -0
  10. package/dest/bench/utils.d.ts +0 -12
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/bench/utils.js +2 -28
  13. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +0 -12
  14. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +1 -13
  16. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  17. package/dest/e2e_fees/fees_test.js +3 -14
  18. package/dest/e2e_p2p/p2p_network.d.ts +5 -0
  19. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  20. package/dest/e2e_p2p/p2p_network.js +13 -4
  21. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  22. package/dest/e2e_p2p/shared.js +1 -0
  23. package/dest/fixtures/l1_to_l2_messaging.d.ts +2 -2
  24. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  25. package/dest/fixtures/l1_to_l2_messaging.js +2 -1
  26. package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
  27. package/dest/fixtures/setup_l1_contracts.js +1 -2
  28. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  29. package/dest/fixtures/snapshot_manager.js +7 -2
  30. package/dest/fixtures/token_utils.d.ts +2 -1
  31. package/dest/fixtures/token_utils.d.ts.map +1 -1
  32. package/dest/fixtures/token_utils.js +14 -1
  33. package/dest/fixtures/utils.d.ts +0 -4
  34. package/dest/fixtures/utils.d.ts.map +1 -1
  35. package/dest/fixtures/utils.js +216 -238
  36. package/dest/sample-dapp/contracts.js +4 -4
  37. package/dest/shared/capture_private_execution_steps.d.ts +2 -2
  38. package/dest/shared/capture_private_execution_steps.d.ts.map +1 -1
  39. package/dest/shared/capture_private_execution_steps.js +24 -6
  40. package/dest/shared/cross_chain_test_harness.d.ts +12 -1
  41. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  42. package/dest/shared/cross_chain_test_harness.js +14 -3
  43. package/dest/shared/uniswap_l1_l2.js +8 -6
  44. package/package.json +32 -32
  45. package/src/bench/client_flows/client_flows_benchmark.ts +395 -0
  46. package/src/bench/client_flows/config.ts +53 -0
  47. package/src/bench/client_flows/data_extractor.ts +217 -0
  48. package/src/bench/utils.ts +2 -30
  49. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +1 -25
  50. package/src/e2e_fees/fees_test.ts +2 -15
  51. package/src/e2e_p2p/p2p_network.ts +10 -6
  52. package/src/e2e_p2p/shared.ts +1 -0
  53. package/src/fixtures/l1_to_l2_messaging.ts +12 -3
  54. package/src/fixtures/setup_l1_contracts.ts +1 -2
  55. package/src/fixtures/snapshot_manager.ts +7 -2
  56. package/src/fixtures/token_utils.ts +22 -2
  57. package/src/fixtures/utils.ts +235 -261
  58. package/src/sample-dapp/contracts.mjs +4 -4
  59. package/src/shared/capture_private_execution_steps.ts +43 -6
  60. package/src/shared/cross_chain_test_harness.ts +26 -2
  61. package/src/shared/uniswap_l1_l2.ts +8 -8
@@ -0,0 +1,66 @@
1
+ import { type AccountWallet, AztecAddress, type AztecNode, FeeJuicePaymentMethodWithClaim, type FeePaymentMethod, type Logger, type PXE, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, type Wallet } from '@aztec/aztec.js';
2
+ import { CheatCodes } from '@aztec/aztec.js/testing';
3
+ import { type DeployL1ContractsArgs } from '@aztec/ethereum';
4
+ import { ChainMonitor } from '@aztec/ethereum/test';
5
+ import { EthAddress } from '@aztec/foundation/eth-address';
6
+ import { AMMContract } from '@aztec/noir-contracts.js/AMM';
7
+ import { FPCContract } from '@aztec/noir-contracts.js/FPC';
8
+ import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
9
+ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
10
+ import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contracts.js/Token';
11
+ import { type SubsystemsContext } from '../../fixtures/snapshot_manager.js';
12
+ import { type SetupOptions } from '../../fixtures/utils.js';
13
+ import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
14
+ import { type GasBridgingTestHarness } from '../../shared/gas_portal_test_harness.js';
15
+ import { type ClientFlowsConfig } from './config.js';
16
+ export type AccountType = 'ecdsar1' | 'schnorr';
17
+ export type FeePaymentMethodGetter = (wallet: Wallet) => Promise<FeePaymentMethod>;
18
+ export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc';
19
+ export declare class ClientFlowsBenchmark {
20
+ private snapshotManager;
21
+ logger: Logger;
22
+ pxe: PXE;
23
+ aztecNode: AztecNode;
24
+ cheatCodes: CheatCodes;
25
+ context: SubsystemsContext;
26
+ chainMonitor: ChainMonitor;
27
+ feeJuiceBridgeTestHarness: GasBridgingTestHarness;
28
+ adminWallet: AccountWallet;
29
+ adminAddress: AztecAddress;
30
+ sequencerAddress: AztecAddress;
31
+ coinbase: EthAddress;
32
+ feeJuiceContract: FeeJuiceContract;
33
+ bananaCoin: BananaCoin;
34
+ bananaFPC: FPCContract;
35
+ candyBarCoin: TokenContract;
36
+ amm: AMMContract;
37
+ liquidityToken: TokenContract;
38
+ sponsoredFPC: SponsoredFPCContract;
39
+ userPXE: PXE;
40
+ paymentMethods: Record<BenchmarkingFeePaymentMethod, {
41
+ forWallet: FeePaymentMethodGetter;
42
+ circuits: number;
43
+ }>;
44
+ config: ClientFlowsConfig;
45
+ constructor(testName?: string, setupOptions?: Partial<SetupOptions & DeployL1ContractsArgs>);
46
+ setup(): Promise<this>;
47
+ teardown(): Promise<void>;
48
+ mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint): Promise<void>;
49
+ /** Admin mints bananaCoin tokens privately to the target address and redeems them. */
50
+ mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
51
+ createBenchmarkingAccountManager(type: 'ecdsar1' | 'schnorr'): Promise<import("@aztec/aztec.js").AccountManager>;
52
+ applyBaseSnapshots(): Promise<void>;
53
+ applyInitialAccountsSnapshot(): Promise<void>;
54
+ applySetupFeeJuiceSnapshot(): Promise<void>;
55
+ applyDeployBananaTokenSnapshot(): Promise<void>;
56
+ applyDeployCandyBarTokenSnapshot(): Promise<void>;
57
+ applyFPCSetupSnapshot(): Promise<void>;
58
+ applyDeploySponsoredFPCSnapshot(): Promise<void>;
59
+ createCrossChainTestHarness(owner: AccountWallet): Promise<CrossChainTestHarness>;
60
+ createAndFundBenchmarkingWallet(accountType: AccountType): Promise<import("@aztec/aztec.js").AccountWalletWithSecretKey>;
61
+ applyDeployAmmSnapshot(): Promise<void>;
62
+ getBridgedFeeJuicePaymentMethodForWallet(wallet: Wallet): Promise<FeeJuicePaymentMethodWithClaim>;
63
+ getPrivateFPCPaymentMethodForWallet(wallet: Wallet): Promise<PrivateFeePaymentMethod>;
64
+ getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet): Promise<SponsoredFeePaymentMethod>;
65
+ }
66
+ //# sourceMappingURL=client_flows_benchmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client_flows_benchmark.d.ts","sourceRoot":"","sources":["../../../src/bench/client_flows/client_flows_benchmark.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,aAAa,EAClB,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BhD,+BAA+B,CAAC,WAAW,EAAE,WAAW;IAmBxD,sBAAsB;IA0BtB,wCAAwC,CAAC,MAAM,EAAE,MAAM;IAQ7D,mCAAmC,CAAC,MAAM,EAAE,MAAM;IAIlD,qCAAqC,CAAC,OAAO,EAAE,MAAM;CAG7D"}
@@ -0,0 +1,281 @@
1
+ import { EcdsaRAccountContractArtifact, getEcdsaRAccount } from '@aztec/accounts/ecdsa';
2
+ import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWallet } from '@aztec/accounts/schnorr';
3
+ import { FeeJuicePaymentMethodWithClaim, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, createLogger } from '@aztec/aztec.js';
4
+ import { CheatCodes } from '@aztec/aztec.js/testing';
5
+ import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
6
+ import { RollupContract, createL1Clients, deployL1Contract } from '@aztec/ethereum';
7
+ import { ChainMonitor } from '@aztec/ethereum/test';
8
+ import { randomBytes } from '@aztec/foundation/crypto';
9
+ import { EthAddress } from '@aztec/foundation/eth-address';
10
+ import { Fr } from '@aztec/foundation/fields';
11
+ import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
12
+ import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
13
+ import { AMMContract } from '@aztec/noir-contracts.js/AMM';
14
+ import { FPCContract } from '@aztec/noir-contracts.js/FPC';
15
+ import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
16
+ import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
17
+ import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contracts.js/Token';
18
+ import { ProtocolContractAddress } from '@aztec/protocol-contracts';
19
+ import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
20
+ import { createPXEService, getPXEServiceConfig } from '@aztec/pxe/server';
21
+ import { deriveSigningKey } from '@aztec/stdlib/keys';
22
+ import { MNEMONIC } from '../../fixtures/fixtures.js';
23
+ import { createSnapshotManager, deployAccounts } from '../../fixtures/snapshot_manager.js';
24
+ import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
25
+ import { setupSponsoredFPC } from '../../fixtures/utils.js';
26
+ import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
27
+ import { FeeJuicePortalTestingHarnessFactory } from '../../shared/gas_portal_test_harness.js';
28
+ import { FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
29
+ const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
30
+ export class ClientFlowsBenchmark {
31
+ snapshotManager;
32
+ logger;
33
+ pxe;
34
+ aztecNode;
35
+ cheatCodes;
36
+ context;
37
+ chainMonitor;
38
+ feeJuiceBridgeTestHarness;
39
+ // The admin that aids in the setup of the test
40
+ adminWallet;
41
+ adminAddress;
42
+ // Aztec Node config
43
+ sequencerAddress;
44
+ coinbase;
45
+ // Contracts
46
+ feeJuiceContract;
47
+ // Asset in which fees are paid via FPC
48
+ bananaCoin;
49
+ bananaFPC;
50
+ // Random asset we want to trade
51
+ candyBarCoin;
52
+ // AMM contract
53
+ amm;
54
+ // Liquidity token for AMM
55
+ liquidityToken;
56
+ // Sponsored FPC contract
57
+ sponsoredFPC;
58
+ // PXE used by the benchmarking user. It can be set up with client-side proving enabled
59
+ userPXE;
60
+ paymentMethods = {
61
+ // eslint-disable-next-line camelcase
62
+ bridged_fee_juice: {
63
+ forWallet: this.getBridgedFeeJuicePaymentMethodForWallet.bind(this),
64
+ circuits: 2
65
+ },
66
+ // eslint-disable-next-line camelcase
67
+ private_fpc: {
68
+ forWallet: this.getPrivateFPCPaymentMethodForWallet.bind(this),
69
+ circuits: 2 + // FPC entrypoint + kernel inner
70
+ 2 + // BananaCoin transfer_to_public + kernel inner
71
+ 2 + // Account verify_private_authwit + kernel inner
72
+ 2
73
+ },
74
+ // eslint-disable-next-line camelcase
75
+ sponsored_fpc: {
76
+ forWallet: this.getSponsoredFPCPaymentMethodForWallet.bind(this),
77
+ circuits: 2
78
+ }
79
+ };
80
+ config;
81
+ constructor(testName, setupOptions = {}){
82
+ this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
83
+ this.snapshotManager = createSnapshotManager(`bench_client_flows${testName ? `/${testName}` : ''}`, dataPath, {
84
+ startProverNode: true,
85
+ ...setupOptions
86
+ }, {
87
+ ...setupOptions
88
+ });
89
+ this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
90
+ }
91
+ async setup() {
92
+ const context = await this.snapshotManager.setup();
93
+ await context.aztecNode.setConfig({
94
+ feeRecipient: this.sequencerAddress,
95
+ coinbase: this.coinbase
96
+ });
97
+ const rollupContract = RollupContract.getFromConfig(context.aztecNodeConfig);
98
+ this.chainMonitor = new ChainMonitor(rollupContract, this.logger, 200).start();
99
+ return this;
100
+ }
101
+ async teardown() {
102
+ this.chainMonitor.stop();
103
+ await this.snapshotManager.teardown();
104
+ }
105
+ async mintAndBridgeFeeJuice(address, amount) {
106
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(amount, address);
107
+ const { claimSecret: secret, messageLeafIndex: index } = claim;
108
+ await this.feeJuiceContract.methods.claim(address, amount, secret, index).send().wait();
109
+ }
110
+ /** Admin mints bananaCoin tokens privately to the target address and redeems them. */ async mintPrivateBananas(amount, address) {
111
+ const balanceBefore = await this.bananaCoin.methods.balance_of_private(address).simulate();
112
+ await mintTokensToPrivate(this.bananaCoin, this.adminWallet, address, amount);
113
+ const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate();
114
+ expect(balanceAfter).toEqual(balanceBefore + amount);
115
+ }
116
+ async createBenchmarkingAccountManager(type) {
117
+ const benchysSecretKey = Fr.random();
118
+ const salt = Fr.random();
119
+ let benchysPrivateSigningKey;
120
+ let benchysAccountManager;
121
+ if (type === 'schnorr') {
122
+ benchysPrivateSigningKey = deriveSigningKey(benchysSecretKey);
123
+ benchysAccountManager = await getSchnorrAccount(this.userPXE, benchysSecretKey, benchysPrivateSigningKey, salt);
124
+ } else if (type === 'ecdsar1') {
125
+ benchysPrivateSigningKey = randomBytes(32);
126
+ benchysAccountManager = await getEcdsaRAccount(this.userPXE, benchysSecretKey, benchysPrivateSigningKey, salt);
127
+ } else {
128
+ throw new Error(`Unknown account type: ${type}`);
129
+ }
130
+ await benchysAccountManager.register();
131
+ return benchysAccountManager;
132
+ }
133
+ async applyBaseSnapshots() {
134
+ await this.applyInitialAccountsSnapshot();
135
+ await this.applySetupFeeJuiceSnapshot();
136
+ }
137
+ async applyInitialAccountsSnapshot() {
138
+ await this.snapshotManager.snapshot('initial_accounts', deployAccounts(2, this.logger), async ({ deployedAccounts }, { pxe, aztecNode, aztecNodeConfig })=>{
139
+ this.pxe = pxe;
140
+ this.aztecNode = aztecNode;
141
+ this.cheatCodes = await CheatCodes.create(aztecNodeConfig.l1RpcUrls, pxe);
142
+ const deployedWallets = await Promise.all(deployedAccounts.map((a)=>getSchnorrWallet(pxe, a.address, a.signingKey)));
143
+ [this.adminWallet] = deployedWallets;
144
+ this.adminAddress = this.adminWallet.getAddress();
145
+ this.sequencerAddress = deployedWallets[1].getAddress();
146
+ const canonicalFeeJuice = await getCanonicalFeeJuice();
147
+ this.feeJuiceContract = await FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
148
+ this.coinbase = EthAddress.random();
149
+ const userPXEConfig = getPXEServiceConfig();
150
+ const l1Contracts = await aztecNode.getL1ContractAddresses();
151
+ const userPXEConfigWithContracts = {
152
+ ...userPXEConfig,
153
+ proverEnabled: [
154
+ 'true',
155
+ '1'
156
+ ].includes(process.env.REAL_PROOFS ?? ''),
157
+ l1Contracts
158
+ };
159
+ this.userPXE = await createPXEService(this.aztecNode, userPXEConfigWithContracts, 'pxe-user');
160
+ });
161
+ }
162
+ async applySetupFeeJuiceSnapshot() {
163
+ await this.snapshotManager.snapshot('setup_fee_juice', async ()=>{}, async (_data, context)=>{
164
+ this.context = context;
165
+ this.feeJuiceContract = await FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
166
+ this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
167
+ aztecNode: context.aztecNode,
168
+ aztecNodeAdmin: context.aztecNode,
169
+ pxeService: context.pxe,
170
+ publicClient: context.deployL1ContractsValues.publicClient,
171
+ walletClient: context.deployL1ContractsValues.walletClient,
172
+ wallet: this.adminWallet,
173
+ logger: this.logger
174
+ });
175
+ });
176
+ }
177
+ async applyDeployBananaTokenSnapshot() {
178
+ await this.snapshotManager.snapshot('deploy_banana_token', async ()=>{
179
+ const bananaCoin = await BananaCoin.deploy(this.adminWallet, this.adminAddress, 'BC', 'BC', 18n).send().deployed();
180
+ this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
181
+ return {
182
+ bananaCoinAddress: bananaCoin.address
183
+ };
184
+ }, async ({ bananaCoinAddress })=>{
185
+ this.bananaCoin = await BananaCoin.at(bananaCoinAddress, this.adminWallet);
186
+ });
187
+ }
188
+ async applyDeployCandyBarTokenSnapshot() {
189
+ await this.snapshotManager.snapshot('deploy_candy_bar_token', async ()=>{
190
+ const candyBarCoin = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'CBC', 'CBC', 18n).send().deployed();
191
+ this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
192
+ return {
193
+ candyBarCoinAddress: candyBarCoin.address
194
+ };
195
+ }, async ({ candyBarCoinAddress })=>{
196
+ this.candyBarCoin = await TokenContract.at(candyBarCoinAddress, this.adminWallet);
197
+ });
198
+ }
199
+ async applyFPCSetupSnapshot() {
200
+ await this.snapshotManager.snapshot('fpc_setup', async (context)=>{
201
+ const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
202
+ expect((await context.pxe.getContractMetadata(feeJuiceContract.address)).isContractPubliclyDeployed).toBe(true);
203
+ const bananaCoin = this.bananaCoin;
204
+ const bananaFPC = await FPCContract.deploy(this.adminWallet, bananaCoin.address, this.adminAddress).send().deployed();
205
+ this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
206
+ await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(FEE_FUNDING_FOR_TESTER_ACCOUNT, bananaFPC.address);
207
+ return {
208
+ bananaFPCAddress: bananaFPC.address
209
+ };
210
+ }, async (data)=>{
211
+ this.bananaFPC = await FPCContract.at(data.bananaFPCAddress, this.adminWallet);
212
+ });
213
+ }
214
+ async applyDeploySponsoredFPCSnapshot() {
215
+ await this.snapshotManager.snapshot('deploy_sponsored_fpc', async ()=>{
216
+ const sponsoredFPC = await setupSponsoredFPC(this.pxe);
217
+ this.logger.info(`SponsoredFPC deployed at ${sponsoredFPC.address}`);
218
+ return {
219
+ sponsoredFPCAddress: sponsoredFPC.address
220
+ };
221
+ }, async ({ sponsoredFPCAddress })=>{
222
+ this.sponsoredFPC = await SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
223
+ });
224
+ }
225
+ async createCrossChainTestHarness(owner) {
226
+ const { publicClient, walletClient } = createL1Clients(this.context.aztecNodeConfig.l1RpcUrls, MNEMONIC);
227
+ const underlyingERC20Address = await deployL1Contract(walletClient, publicClient, TestERC20Abi, TestERC20Bytecode, [
228
+ 'Underlying',
229
+ 'UND',
230
+ walletClient.account.address
231
+ ]).then(({ address })=>address);
232
+ this.logger.verbose(`Setting up cross chain harness...`);
233
+ const crossChainTestHarness = await CrossChainTestHarness.new(this.aztecNode, this.pxe, publicClient, walletClient, owner, this.logger, underlyingERC20Address);
234
+ this.logger.verbose(`L2 token deployed to: ${crossChainTestHarness.l2Token.address}`);
235
+ return crossChainTestHarness;
236
+ }
237
+ async createAndFundBenchmarkingWallet(accountType) {
238
+ const benchysAccountManager = await this.createBenchmarkingAccountManager(accountType);
239
+ const benchysWallet = await benchysAccountManager.getWallet();
240
+ const benchysAddress = benchysAccountManager.getAddress();
241
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(FEE_FUNDING_FOR_TESTER_ACCOUNT, benchysAddress);
242
+ const paymentMethod = new FeeJuicePaymentMethodWithClaim(benchysWallet, claim);
243
+ await benchysAccountManager.deploy({
244
+ fee: {
245
+ paymentMethod
246
+ }
247
+ }).wait();
248
+ // Register benchy on admin's PXE so we can check its balances
249
+ await this.pxe.registerContract({
250
+ instance: benchysAccountManager.getInstance(),
251
+ artifact: accountType === 'ecdsar1' ? EcdsaRAccountContractArtifact : SchnorrAccountContractArtifact
252
+ });
253
+ await this.pxe.registerAccount(benchysWallet.getSecretKey(), benchysWallet.getCompleteAddress().partialAddress);
254
+ return benchysWallet;
255
+ }
256
+ async applyDeployAmmSnapshot() {
257
+ await this.snapshotManager.snapshot('deploy_amm', async ()=>{
258
+ const liquidityToken = await TokenContract.deploy(this.adminWallet, this.adminAddress, 'LPT', 'LPT', 18n).send().deployed();
259
+ const amm = await AMMContract.deploy(this.adminWallet, this.bananaCoin.address, this.candyBarCoin.address, liquidityToken.address).send().deployed();
260
+ this.logger.info(`AMM deployed at ${amm.address}`);
261
+ await liquidityToken.methods.set_minter(amm.address, true).send().wait();
262
+ return {
263
+ ammAddress: amm.address,
264
+ liquidityTokenAddress: liquidityToken.address
265
+ };
266
+ }, async ({ ammAddress, liquidityTokenAddress })=>{
267
+ this.liquidityToken = await TokenContract.at(liquidityTokenAddress, this.adminWallet);
268
+ this.amm = await AMMContract.at(ammAddress, this.adminWallet);
269
+ });
270
+ }
271
+ async getBridgedFeeJuicePaymentMethodForWallet(wallet) {
272
+ const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(FEE_FUNDING_FOR_TESTER_ACCOUNT, wallet.getAddress());
273
+ return new FeeJuicePaymentMethodWithClaim(wallet, claim);
274
+ }
275
+ getPrivateFPCPaymentMethodForWallet(wallet) {
276
+ return Promise.resolve(new PrivateFeePaymentMethod(this.bananaFPC.address, wallet));
277
+ }
278
+ getSponsoredFPCPaymentMethodForWallet(_wallet) {
279
+ return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
280
+ }
281
+ }
@@ -0,0 +1,14 @@
1
+ import type { AccountType, BenchmarkingFeePaymentMethod } from './client_flows_benchmark.js';
2
+ export type ClientFlowConfig = {
3
+ accounts: AccountType[];
4
+ feePaymentMethods: BenchmarkingFeePaymentMethod[];
5
+ recursions?: number[];
6
+ };
7
+ type ClientFlows = 'deployments' | 'transfers' | 'bridging' | 'amm';
8
+ export type ClientFlowsConfig = {
9
+ [key in ClientFlows]: ClientFlowConfig;
10
+ };
11
+ export declare const KEY_FLOWS_CONFIG: ClientFlowsConfig;
12
+ export declare const FULL_FLOWS_CONFIG: ClientFlowsConfig;
13
+ export {};
14
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/bench/client_flows/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE7F,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,iBAAiB,EAAE,4BAA4B,EAAE,CAAC;IAClD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,KAAK,WAAW,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,KAAK,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;KAC7B,GAAG,IAAI,WAAW,GAAG,gBAAgB;CACvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,iBAkB9B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,iBAkB/B,CAAC"}
@@ -0,0 +1,85 @@
1
+ export const KEY_FLOWS_CONFIG = {
2
+ deployments: {
3
+ accounts: [
4
+ 'ecdsar1',
5
+ 'schnorr'
6
+ ],
7
+ feePaymentMethods: [
8
+ 'sponsored_fpc'
9
+ ]
10
+ },
11
+ amm: {
12
+ accounts: [
13
+ 'ecdsar1'
14
+ ],
15
+ feePaymentMethods: [
16
+ 'sponsored_fpc'
17
+ ]
18
+ },
19
+ bridging: {
20
+ accounts: [
21
+ 'ecdsar1'
22
+ ],
23
+ feePaymentMethods: [
24
+ 'sponsored_fpc'
25
+ ]
26
+ },
27
+ transfers: {
28
+ accounts: [
29
+ 'ecdsar1'
30
+ ],
31
+ feePaymentMethods: [
32
+ 'sponsored_fpc'
33
+ ],
34
+ recursions: [
35
+ 1
36
+ ]
37
+ }
38
+ };
39
+ export const FULL_FLOWS_CONFIG = {
40
+ deployments: {
41
+ accounts: [
42
+ 'ecdsar1',
43
+ 'schnorr'
44
+ ],
45
+ feePaymentMethods: [
46
+ 'bridged_fee_juice',
47
+ 'sponsored_fpc'
48
+ ]
49
+ },
50
+ amm: {
51
+ accounts: [
52
+ 'ecdsar1',
53
+ 'schnorr'
54
+ ],
55
+ feePaymentMethods: [
56
+ 'sponsored_fpc',
57
+ 'private_fpc'
58
+ ]
59
+ },
60
+ bridging: {
61
+ accounts: [
62
+ 'ecdsar1',
63
+ 'schnorr'
64
+ ],
65
+ feePaymentMethods: [
66
+ 'sponsored_fpc',
67
+ 'private_fpc'
68
+ ]
69
+ },
70
+ transfers: {
71
+ accounts: [
72
+ 'ecdsar1',
73
+ 'schnorr'
74
+ ],
75
+ feePaymentMethods: [
76
+ 'sponsored_fpc',
77
+ 'private_fpc'
78
+ ],
79
+ recursions: [
80
+ 0,
81
+ 1,
82
+ 2
83
+ ]
84
+ }
85
+ };
@@ -0,0 +1,23 @@
1
+ import type { Logger } from '@aztec/aztec.js';
2
+ declare const logLevel: readonly ["silent", "fatal", "error", "warn", "info", "verbose", "debug", "trace"];
3
+ type LogLevel = (typeof logLevel)[number];
4
+ type Log = {
5
+ type: LogLevel;
6
+ timestamp: number;
7
+ prefix: string;
8
+ message: string;
9
+ data: any;
10
+ };
11
+ export declare class ProxyLogger {
12
+ private static instance;
13
+ private logs;
14
+ private constructor();
15
+ static create(): void;
16
+ static getInstance(): ProxyLogger;
17
+ createLogger(prefix: string): Logger;
18
+ private handleLog;
19
+ flushLogs(): void;
20
+ getLogs(): Log[];
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=data_extractor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data_extractor.d.ts","sourceRoot":"","sources":["../../../src/bench/client_flows/data_extractor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAY9C,QAAA,MAAM,QAAQ,oFAAqF,CAAC;AACpG,KAAK,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,KAAK,GAAG,GAAG;IACT,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAEhB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAsBF,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,IAAI,CAAa;IAEzB,OAAO;IAEP,MAAM,CAAC,MAAM;IAIb,MAAM,CAAC,WAAW;IAIlB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAiBpC,OAAO,CAAC,SAAS;IAIV,SAAS;IAIT,OAAO;CAGf"}