@aztec/end-to-end 0.0.1-commit.d3ec352c → 0.0.1-commit.d431d1c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +14 -15
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +110 -138
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +6 -6
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +18 -11
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +6 -7
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +98 -113
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +19 -13
- 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 +91 -71
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -3
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +3 -2
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +13 -11
- package/dest/e2e_fees/bridging_race.notest.js +3 -5
- package/dest/e2e_fees/fees_test.d.ts +18 -15
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +126 -141
- package/dest/e2e_l1_publisher/write_json.d.ts +3 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +19 -15
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +32 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +4 -4
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +6 -9
- package/dest/e2e_p2p/p2p_network.d.ts +13 -11
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +116 -111
- package/dest/e2e_p2p/shared.d.ts +2 -2
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +4 -4
- package/dest/e2e_token_contract/token_contract_test.d.ts +16 -9
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +90 -92
- package/dest/fixtures/e2e_prover_test.d.ts +10 -18
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +88 -103
- package/dest/fixtures/fixtures.d.ts +2 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +1 -2
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/setup.d.ts +216 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +684 -0
- package/dest/fixtures/setup_p2p_test.js +3 -3
- package/dest/fixtures/utils.d.ts +5 -638
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +16 -4
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +3 -3
- package/dest/shared/gas_portal_test_harness.d.ts +12 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +43 -23
- package/dest/simulators/lending_simulator.d.ts +6 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +1 -1
- package/dest/spartan/setup_test_wallets.d.ts +4 -3
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +2 -1
- package/dest/spartan/tx_metrics.d.ts +52 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +248 -0
- package/dest/spartan/utils.d.ts +51 -12
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +262 -102
- package/package.json +40 -39
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +150 -200
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +22 -14
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +107 -142
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -125
- package/src/e2e_deploy_contract/deploy_test.ts +21 -14
- package/src/e2e_epochs/epochs_test.ts +26 -13
- package/src/e2e_fees/bridging_race.notest.ts +3 -6
- package/src/e2e_fees/fees_test.ts +177 -216
- package/src/e2e_l1_publisher/write_json.ts +22 -17
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +35 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +9 -12
- package/src/e2e_p2p/p2p_network.ts +174 -183
- package/src/e2e_p2p/shared.ts +11 -6
- package/src/e2e_token_contract/token_contract_test.ts +105 -118
- package/src/fixtures/e2e_prover_test.ts +112 -144
- package/src/fixtures/fixtures.ts +1 -3
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +1010 -0
- package/src/fixtures/setup_p2p_test.ts +3 -3
- package/src/fixtures/utils.ts +27 -966
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +6 -10
- package/src/shared/gas_portal_test_harness.ts +1 -1
- package/src/shared/index.ts +1 -1
- package/src/shared/uniswap_l1_l2.ts +53 -67
- package/src/simulators/lending_simulator.ts +2 -2
- package/src/spartan/setup_test_wallets.ts +9 -2
- package/src/spartan/tx_metrics.ts +231 -0
- package/src/spartan/utils.ts +308 -45
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -7,7 +7,13 @@ import {
|
|
|
7
7
|
import type { Logger } from '@aztec/aztec.js/log';
|
|
8
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
9
9
|
import { type PrivateExecutionStep, serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
ProvingStats,
|
|
12
|
+
ProvingTimings,
|
|
13
|
+
RoundTripStats,
|
|
14
|
+
SimulationStats,
|
|
15
|
+
SimulationTimings,
|
|
16
|
+
} from '@aztec/stdlib/tx';
|
|
11
17
|
|
|
12
18
|
import assert from 'node:assert';
|
|
13
19
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
@@ -119,6 +125,7 @@ type ClientFlowBenchmark = {
|
|
|
119
125
|
timings: Omit<ProvingTimings & SimulationTimings, 'perFunction'> & { witgen: number };
|
|
120
126
|
maxMemory: number;
|
|
121
127
|
rpc: Record<string, CallRecording>;
|
|
128
|
+
roundTrips: RoundTripStats;
|
|
122
129
|
proverType: ProverType;
|
|
123
130
|
minimumTrace: StructuredTrace;
|
|
124
131
|
totalGateCount: number;
|
|
@@ -212,6 +219,10 @@ export function generateBenchmark(
|
|
|
212
219
|
}, []);
|
|
213
220
|
const timings = stats.timings;
|
|
214
221
|
const totalGateCount = steps[steps.length - 1].accGateCount;
|
|
222
|
+
const nodeRPCCalls = stats.nodeRPCCalls ?? {
|
|
223
|
+
perMethod: {},
|
|
224
|
+
roundTrips: { roundTrips: 0, totalBlockingTime: 0, roundTripDurations: [], roundTripMethods: [] },
|
|
225
|
+
};
|
|
215
226
|
return {
|
|
216
227
|
name: flow,
|
|
217
228
|
timings: {
|
|
@@ -221,7 +232,7 @@ export function generateBenchmark(
|
|
|
221
232
|
unaccounted: timings.unaccounted,
|
|
222
233
|
witgen: timings.perFunction.reduce((acc, fn) => acc + fn.time, 0),
|
|
223
234
|
},
|
|
224
|
-
rpc: Object.entries(
|
|
235
|
+
rpc: Object.entries(nodeRPCCalls.perMethod).reduce(
|
|
225
236
|
(acc, [RPCName, RPCCalls]) => {
|
|
226
237
|
const total = RPCCalls.times.reduce((sum, time) => sum + time, 0);
|
|
227
238
|
const calls = RPCCalls.times.length;
|
|
@@ -236,6 +247,7 @@ export function generateBenchmark(
|
|
|
236
247
|
},
|
|
237
248
|
{} as Record<string, CallRecording>,
|
|
238
249
|
),
|
|
250
|
+
roundTrips: nodeRPCCalls.roundTrips,
|
|
239
251
|
maxMemory,
|
|
240
252
|
proverType,
|
|
241
253
|
minimumTrace: minimumTrace!,
|
|
@@ -280,6 +292,16 @@ export function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): Git
|
|
|
280
292
|
value: totalRPCCalls,
|
|
281
293
|
unit: 'calls',
|
|
282
294
|
},
|
|
295
|
+
{
|
|
296
|
+
name: `${benchmark.name}/round_trips`,
|
|
297
|
+
value: benchmark.roundTrips.roundTrips,
|
|
298
|
+
unit: 'round_trips',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: `${benchmark.name}/round_trips_blocking_time`,
|
|
302
|
+
value: benchmark.roundTrips.totalBlockingTime,
|
|
303
|
+
unit: 'ms',
|
|
304
|
+
},
|
|
283
305
|
];
|
|
284
306
|
if (benchmark.timings.proving) {
|
|
285
307
|
benches.push({
|
|
@@ -5,11 +5,14 @@ import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
|
5
5
|
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
6
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
7
|
import { CheatCodes } from '@aztec/aztec/testing';
|
|
8
|
-
import {
|
|
8
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
9
|
+
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
10
|
+
import type { DeployAztecL1ContractsArgs } from '@aztec/ethereum/deploy-aztec-l1-contracts';
|
|
11
|
+
import { deployL1Contract } from '@aztec/ethereum/deploy-l1-contract';
|
|
9
12
|
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
10
|
-
import { randomBytes } from '@aztec/foundation/crypto';
|
|
13
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
11
15
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
12
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
13
16
|
import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
14
17
|
import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
|
|
15
18
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
@@ -26,14 +29,9 @@ import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
|
26
29
|
import { TestWallet } from '@aztec/test-wallet/server';
|
|
27
30
|
|
|
28
31
|
import { MNEMONIC } from '../../fixtures/fixtures.js';
|
|
29
|
-
import {
|
|
30
|
-
type ISnapshotManager,
|
|
31
|
-
type SubsystemsContext,
|
|
32
|
-
createSnapshotManager,
|
|
33
|
-
deployAccounts,
|
|
34
|
-
} from '../../fixtures/snapshot_manager.js';
|
|
32
|
+
import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js';
|
|
35
33
|
import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
|
|
36
|
-
import {
|
|
34
|
+
import { setupSponsoredFPC } from '../../fixtures/utils.js';
|
|
37
35
|
import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
|
|
38
36
|
import {
|
|
39
37
|
FeeJuicePortalTestingHarnessFactory,
|
|
@@ -42,19 +40,17 @@ import {
|
|
|
42
40
|
import { ProxyLogger } from './benchmark.js';
|
|
43
41
|
import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
|
|
44
42
|
|
|
45
|
-
const {
|
|
43
|
+
const { BENCHMARK_CONFIG } = process.env;
|
|
46
44
|
|
|
47
45
|
export type AccountType = 'ecdsar1' | 'schnorr';
|
|
48
46
|
export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
|
|
49
47
|
export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
|
|
50
48
|
|
|
51
49
|
export class ClientFlowsBenchmark {
|
|
52
|
-
private snapshotManager: ISnapshotManager;
|
|
53
|
-
|
|
54
50
|
public logger: Logger;
|
|
55
51
|
public aztecNode!: AztecNode;
|
|
56
52
|
public cheatCodes!: CheatCodes;
|
|
57
|
-
public context!:
|
|
53
|
+
public context!: EndToEndContext;
|
|
58
54
|
public chainMonitor!: ChainMonitor;
|
|
59
55
|
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
60
56
|
public adminWallet!: TestWallet;
|
|
@@ -122,33 +118,37 @@ export class ClientFlowsBenchmark {
|
|
|
122
118
|
public config: ClientFlowsConfig;
|
|
123
119
|
|
|
124
120
|
private proxyLogger: ProxyLogger;
|
|
121
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs>;
|
|
125
122
|
|
|
126
|
-
constructor(testName?: string, setupOptions: Partial<SetupOptions &
|
|
123
|
+
constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
|
|
127
124
|
this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
|
|
128
|
-
this.
|
|
129
|
-
`bench_client_flows${testName ? `/${testName}` : ''}`,
|
|
130
|
-
dataPath,
|
|
131
|
-
{ startProverNode: true, ...setupOptions },
|
|
132
|
-
{ ...setupOptions },
|
|
133
|
-
);
|
|
125
|
+
this.setupOptions = { startProverNode: true, ...setupOptions };
|
|
134
126
|
this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
|
|
135
127
|
ProxyLogger.create();
|
|
136
128
|
this.proxyLogger = ProxyLogger.getInstance();
|
|
137
129
|
}
|
|
138
130
|
|
|
139
131
|
async setup() {
|
|
140
|
-
|
|
141
|
-
await
|
|
132
|
+
this.logger.info('Setting up subsystems from fresh');
|
|
133
|
+
this.context = await setup(0, {
|
|
134
|
+
...this.setupOptions,
|
|
135
|
+
fundSponsoredFPC: true,
|
|
136
|
+
skipAccountDeployment: true,
|
|
137
|
+
l1ContractsArgs: this.setupOptions,
|
|
138
|
+
});
|
|
139
|
+
await this.applyBaseSetup();
|
|
142
140
|
|
|
143
|
-
|
|
144
|
-
|
|
141
|
+
await this.context.aztecNodeService!.setConfig({ feeRecipient: this.sequencerAddress, coinbase: this.coinbase });
|
|
142
|
+
|
|
143
|
+
const rollupContract = RollupContract.getFromConfig(this.context.config);
|
|
144
|
+
this.chainMonitor = new ChainMonitor(rollupContract, this.context.dateProvider!, this.logger, 200).start();
|
|
145
145
|
|
|
146
146
|
return this;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
async teardown() {
|
|
150
150
|
await this.chainMonitor.stop();
|
|
151
|
-
await this.
|
|
151
|
+
await teardown(this.context);
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
async mintAndBridgeFeeJuice(address: AztecAddress) {
|
|
@@ -190,161 +190,124 @@ export class ClientFlowsBenchmark {
|
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
public async
|
|
194
|
-
await this.
|
|
195
|
-
await this.
|
|
193
|
+
public async applyBaseSetup() {
|
|
194
|
+
await this.applyInitialAccounts();
|
|
195
|
+
await this.applySetupFeeJuice();
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
async
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
198
|
+
async applyInitialAccounts() {
|
|
199
|
+
this.logger.info('Applying initial accounts setup');
|
|
200
|
+
const { deployedAccounts } = await deployAccounts(
|
|
201
|
+
2,
|
|
202
|
+
this.logger,
|
|
203
|
+
)({
|
|
204
|
+
wallet: this.context.wallet,
|
|
205
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const [{ address: adminAddress }, { address: sequencerAddress }] = deployedAccounts;
|
|
209
|
+
|
|
210
|
+
this.adminWallet = this.context.wallet;
|
|
211
|
+
this.aztecNode = this.context.aztecNodeService!;
|
|
212
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
213
|
+
|
|
214
|
+
this.adminAddress = adminAddress;
|
|
215
|
+
this.sequencerAddress = sequencerAddress;
|
|
216
|
+
|
|
217
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
218
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
|
|
219
|
+
this.coinbase = EthAddress.random();
|
|
220
|
+
|
|
221
|
+
const userPXEConfig = getPXEConfig();
|
|
222
|
+
const userPXEConfigWithContracts = {
|
|
223
|
+
...userPXEConfig,
|
|
224
|
+
proverEnabled: this.realProofs,
|
|
225
|
+
} as PXEConfig;
|
|
226
|
+
|
|
227
|
+
this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
|
|
228
|
+
loggers: {
|
|
229
|
+
prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
|
|
228
230
|
},
|
|
229
|
-
);
|
|
231
|
+
});
|
|
230
232
|
}
|
|
231
233
|
|
|
232
|
-
async
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
aztecNodeAdmin: context.aztecNode,
|
|
244
|
-
l1Client: context.deployL1ContractsValues.l1Client,
|
|
245
|
-
wallet: this.adminWallet,
|
|
246
|
-
logger: this.logger,
|
|
247
|
-
});
|
|
248
|
-
},
|
|
249
|
-
);
|
|
234
|
+
async applySetupFeeJuice() {
|
|
235
|
+
this.logger.info('Applying fee juice setup');
|
|
236
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
|
|
237
|
+
|
|
238
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
239
|
+
aztecNode: this.context.aztecNodeService!,
|
|
240
|
+
aztecNodeAdmin: this.context.aztecNodeService!,
|
|
241
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
242
|
+
wallet: this.adminWallet,
|
|
243
|
+
logger: this.logger,
|
|
244
|
+
});
|
|
250
245
|
}
|
|
251
246
|
|
|
252
|
-
async
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
return { bananaCoinAddress: bananaCoin.address, bananaCoinInstance };
|
|
267
|
-
},
|
|
268
|
-
({ bananaCoinAddress, bananaCoinInstance }) => {
|
|
269
|
-
this.bananaCoin = BananaCoin.at(bananaCoinAddress, this.adminWallet);
|
|
270
|
-
this.bananaCoinInstance = bananaCoinInstance;
|
|
271
|
-
return Promise.resolve();
|
|
272
|
-
},
|
|
273
|
-
);
|
|
247
|
+
async applyDeployBananaToken() {
|
|
248
|
+
this.logger.info('Applying banana token deployment');
|
|
249
|
+
const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
|
|
250
|
+
this.adminWallet,
|
|
251
|
+
this.adminAddress,
|
|
252
|
+
'BC',
|
|
253
|
+
'BC',
|
|
254
|
+
18n,
|
|
255
|
+
)
|
|
256
|
+
.send({ from: this.adminAddress })
|
|
257
|
+
.wait();
|
|
258
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
259
|
+
this.bananaCoin = bananaCoin;
|
|
260
|
+
this.bananaCoinInstance = bananaCoinInstance;
|
|
274
261
|
}
|
|
275
262
|
|
|
276
|
-
async
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return { candyBarCoinAddress: candyBarCoin.address, candyBarCoinInstance };
|
|
291
|
-
},
|
|
292
|
-
({ candyBarCoinAddress, candyBarCoinInstance }) => {
|
|
293
|
-
this.candyBarCoin = TokenContract.at(candyBarCoinAddress, this.adminWallet);
|
|
294
|
-
this.candyBarCoinInstance = candyBarCoinInstance;
|
|
295
|
-
return Promise.resolve();
|
|
296
|
-
},
|
|
297
|
-
);
|
|
263
|
+
async applyDeployCandyBarToken() {
|
|
264
|
+
this.logger.info('Applying candy bar token deployment');
|
|
265
|
+
const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
|
|
266
|
+
this.adminWallet,
|
|
267
|
+
this.adminAddress,
|
|
268
|
+
'CBC',
|
|
269
|
+
'CBC',
|
|
270
|
+
18n,
|
|
271
|
+
)
|
|
272
|
+
.send({ from: this.adminAddress })
|
|
273
|
+
.wait();
|
|
274
|
+
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
275
|
+
this.candyBarCoin = candyBarCoin;
|
|
276
|
+
this.candyBarCoinInstance = candyBarCoinInstance;
|
|
298
277
|
}
|
|
299
278
|
|
|
300
|
-
public async
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
305
|
-
expect((await context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
279
|
+
public async applyFPCSetup() {
|
|
280
|
+
this.logger.info('Applying FPC setup');
|
|
281
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
282
|
+
expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
306
283
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
284
|
+
const bananaCoin = this.bananaCoin;
|
|
285
|
+
const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
|
|
286
|
+
this.adminWallet,
|
|
287
|
+
bananaCoin.address,
|
|
288
|
+
this.adminAddress,
|
|
289
|
+
)
|
|
290
|
+
.send({ from: this.adminAddress })
|
|
291
|
+
.wait();
|
|
315
292
|
|
|
316
|
-
|
|
293
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
317
294
|
|
|
318
|
-
|
|
295
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
|
|
319
296
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
data => {
|
|
323
|
-
this.bananaFPC = FPCContract.at(data.bananaFPCAddress, this.adminWallet);
|
|
324
|
-
this.bananaFPCInstance = data.bananaFPCInstance;
|
|
325
|
-
return Promise.resolve();
|
|
326
|
-
},
|
|
327
|
-
);
|
|
297
|
+
this.bananaFPC = bananaFPC;
|
|
298
|
+
this.bananaFPCInstance = bananaFPCInstance;
|
|
328
299
|
}
|
|
329
300
|
|
|
330
|
-
async
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return { sponsoredFPCAddress: sponsoredFPCInstance.address, sponsoredFPCInstance };
|
|
337
|
-
},
|
|
338
|
-
({ sponsoredFPCAddress, sponsoredFPCInstance }) => {
|
|
339
|
-
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCAddress, this.adminWallet);
|
|
340
|
-
this.sponsoredFPCInstance = sponsoredFPCInstance;
|
|
341
|
-
return Promise.resolve();
|
|
342
|
-
},
|
|
343
|
-
);
|
|
301
|
+
async applyDeploySponsoredFPC() {
|
|
302
|
+
this.logger.info('Applying sponsored FPC deployment');
|
|
303
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
|
|
304
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
305
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.adminWallet);
|
|
306
|
+
this.sponsoredFPCInstance = sponsoredFPCInstance;
|
|
344
307
|
}
|
|
345
308
|
|
|
346
309
|
public async createCrossChainTestHarness(owner: AztecAddress) {
|
|
347
|
-
const l1Client = createExtendedL1Client(this.context.
|
|
310
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
348
311
|
|
|
349
312
|
const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
350
313
|
'Underlying',
|
|
@@ -388,44 +351,31 @@ export class ClientFlowsBenchmark {
|
|
|
388
351
|
return accountManager.address;
|
|
389
352
|
}
|
|
390
353
|
|
|
391
|
-
public async
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
ammInstance,
|
|
417
|
-
liquidityTokenAddress: liquidityToken.address,
|
|
418
|
-
liquidityTokenInstance,
|
|
419
|
-
};
|
|
420
|
-
},
|
|
421
|
-
({ ammAddress, ammInstance, liquidityTokenAddress, liquidityTokenInstance }) => {
|
|
422
|
-
this.liquidityToken = TokenContract.at(liquidityTokenAddress, this.adminWallet);
|
|
423
|
-
this.liquidityTokenInstance = liquidityTokenInstance;
|
|
424
|
-
this.amm = AMMContract.at(ammAddress, this.adminWallet);
|
|
425
|
-
this.ammInstance = ammInstance;
|
|
426
|
-
return Promise.resolve();
|
|
427
|
-
},
|
|
428
|
-
);
|
|
354
|
+
public async applyDeployAmm() {
|
|
355
|
+
this.logger.info('Applying AMM deployment');
|
|
356
|
+
const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
|
|
357
|
+
this.adminWallet,
|
|
358
|
+
this.adminAddress,
|
|
359
|
+
'LPT',
|
|
360
|
+
'LPT',
|
|
361
|
+
18n,
|
|
362
|
+
)
|
|
363
|
+
.send({ from: this.adminAddress })
|
|
364
|
+
.wait();
|
|
365
|
+
const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
|
|
366
|
+
this.adminWallet,
|
|
367
|
+
this.bananaCoin.address,
|
|
368
|
+
this.candyBarCoin.address,
|
|
369
|
+
liquidityToken.address,
|
|
370
|
+
)
|
|
371
|
+
.send({ from: this.adminAddress })
|
|
372
|
+
.wait();
|
|
373
|
+
this.logger.info(`AMM deployed at ${amm.address}`);
|
|
374
|
+
await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress }).wait();
|
|
375
|
+
this.liquidityToken = liquidityToken;
|
|
376
|
+
this.liquidityTokenInstance = liquidityTokenInstance;
|
|
377
|
+
this.amm = amm;
|
|
378
|
+
this.ammInstance = ammInstance;
|
|
429
379
|
}
|
|
430
380
|
|
|
431
381
|
public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
|
|
@@ -436,7 +386,7 @@ export class ClientFlowsBenchmark {
|
|
|
436
386
|
public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
|
|
437
387
|
// The private fee paying method assembled on the app side requires knowledge of the maximum
|
|
438
388
|
// fee the user is willing to pay
|
|
439
|
-
const maxFeesPerGas = (await this.aztecNode.
|
|
389
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1.5);
|
|
440
390
|
const gasSettings = GasSettings.default({ maxFeesPerGas });
|
|
441
391
|
return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
|
|
442
392
|
}
|
|
@@ -22,7 +22,7 @@ async function main() {
|
|
|
22
22
|
logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
|
|
23
23
|
const simulator = new WASMSimulator();
|
|
24
24
|
const log = proxyLogger.createLogger('bb:prover');
|
|
25
|
-
const prover = new BBBundlePrivateKernelProver(simulator, log);
|
|
25
|
+
const prover = new BBBundlePrivateKernelProver(simulator, { logger: log });
|
|
26
26
|
|
|
27
27
|
const userLog = createLogger('chonk_flows:data_processor');
|
|
28
28
|
|
package/src/bench/utils.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AztecNodeService } from '@aztec/aztec-node';
|
|
2
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
3
|
import { BatchCall, type SentTx, type WaitOpts } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { mean, stdDev, times } from '@aztec/foundation/collection';
|
|
4
5
|
import { BenchmarkingContract } from '@aztec/noir-test-contracts.js/Benchmarking';
|
|
5
|
-
import type {
|
|
6
|
+
import type { MetricDefinition } from '@aztec/telemetry-client';
|
|
6
7
|
import type { BenchmarkDataPoint, BenchmarkMetricsType, BenchmarkTelemetryClient } from '@aztec/telemetry-client/bench';
|
|
7
8
|
|
|
8
9
|
import { mkdirSync, writeFileSync } from 'fs';
|
|
@@ -15,7 +16,7 @@ import { type EndToEndContext, type SetupOptions, setup } from '../fixtures/util
|
|
|
15
16
|
*/
|
|
16
17
|
export async function benchmarkSetup(
|
|
17
18
|
opts: Partial<SetupOptions> & {
|
|
18
|
-
/** What metrics to export */ metrics: (
|
|
19
|
+
/** What metrics to export */ metrics: (MetricDefinition | MetricFilter)[];
|
|
19
20
|
/** Where to output the benchmark data (defaults to BENCH_OUTPUT or bench.json) */
|
|
20
21
|
benchOutput?: string;
|
|
21
22
|
},
|
|
@@ -46,7 +47,7 @@ export async function benchmarkSetup(
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
type MetricFilter = {
|
|
49
|
-
source:
|
|
50
|
+
source: MetricDefinition;
|
|
50
51
|
transform: (value: number) => number;
|
|
51
52
|
name: string;
|
|
52
53
|
unit?: string;
|
|
@@ -61,17 +62,21 @@ export type GithubActionBenchmarkResult = {
|
|
|
61
62
|
extra?: string;
|
|
62
63
|
};
|
|
63
64
|
|
|
65
|
+
function isMetricDefinition(f: MetricDefinition | MetricFilter): f is MetricDefinition {
|
|
66
|
+
return 'description' in f;
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
function formatMetricsForGithubBenchmarkAction(
|
|
65
70
|
data: BenchmarkMetricsType,
|
|
66
|
-
filter: (
|
|
71
|
+
filter: (MetricDefinition | MetricFilter)[],
|
|
67
72
|
): GithubActionBenchmarkResult[] {
|
|
68
73
|
const allFilters: MetricFilter[] = filter.map(f =>
|
|
69
|
-
|
|
74
|
+
isMetricDefinition(f) ? { name: f.name, source: f, transform: (x: number) => x, unit: f.unit } : f,
|
|
70
75
|
);
|
|
71
76
|
return data.flatMap(meter => {
|
|
72
77
|
return meter.metrics
|
|
73
|
-
.filter(metric => allFilters.map(f => f.source).includes(metric.name
|
|
74
|
-
.map(metric => [metric, allFilters.find(f => f.source === metric.name)!] as const)
|
|
78
|
+
.filter(metric => allFilters.map(f => f.source.name).includes(metric.name))
|
|
79
|
+
.map(metric => [metric, allFilters.find(f => f.source.name === metric.name)!] as const)
|
|
75
80
|
.map(([metric, filter]) => ({
|
|
76
81
|
name: `${meter.name}/${filter.name}`,
|
|
77
82
|
unit: filter.unit ?? metric.unit ?? 'unknown',
|
|
@@ -103,19 +108,22 @@ function getMetricValues(points: BenchmarkDataPoint[]) {
|
|
|
103
108
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
104
109
|
* @returns A BatchCall instance.
|
|
105
110
|
*/
|
|
106
|
-
function makeCall(
|
|
111
|
+
async function makeCall(
|
|
107
112
|
index: number,
|
|
108
113
|
context: EndToEndContext,
|
|
109
114
|
contract: BenchmarkingContract,
|
|
110
115
|
heavyPublicCompute: boolean,
|
|
111
116
|
) {
|
|
112
|
-
const [owner] = context.accounts;
|
|
113
117
|
if (heavyPublicCompute) {
|
|
114
118
|
return new BatchCall(context.wallet, [contract.methods.sha256_hash_1024(randomBytesAsBigInts(1024))]);
|
|
115
119
|
} else {
|
|
120
|
+
// We use random address for the new note owner because we can emit at most UNFINALIZED_TAGGING_INDEXES_WINDOW_LEN
|
|
121
|
+
// logs for a given sender-recipient-contract tuple.
|
|
122
|
+
const ownerOfNewNote = await AztecAddress.random();
|
|
123
|
+
const [ownerOfBalance] = context.accounts;
|
|
116
124
|
return new BatchCall(context.wallet, [
|
|
117
|
-
contract.methods.create_note(
|
|
118
|
-
contract.methods.increment_balance(
|
|
125
|
+
contract.methods.create_note(ownerOfNewNote, index + 1),
|
|
126
|
+
contract.methods.increment_balance(ownerOfBalance, index + 1),
|
|
119
127
|
]);
|
|
120
128
|
}
|
|
121
129
|
}
|
|
@@ -129,13 +137,13 @@ function makeCall(
|
|
|
129
137
|
* @param heavyPublicCompute - Whether the transactions include heavy public compute (like a big sha256).
|
|
130
138
|
* @returns Array of sent txs.
|
|
131
139
|
*/
|
|
132
|
-
export function sendTxs(
|
|
140
|
+
export async function sendTxs(
|
|
133
141
|
txCount: number,
|
|
134
142
|
context: EndToEndContext,
|
|
135
143
|
contract: BenchmarkingContract,
|
|
136
144
|
heavyPublicCompute: boolean = false,
|
|
137
|
-
): SentTx[] {
|
|
138
|
-
const calls = times(txCount, index => makeCall(index, context, contract, heavyPublicCompute));
|
|
145
|
+
): Promise<SentTx[]> {
|
|
146
|
+
const calls = await Promise.all(times(txCount, index => makeCall(index, context, contract, heavyPublicCompute)));
|
|
139
147
|
context.logger.info(`Creating ${txCount} txs`);
|
|
140
148
|
const [from] = context.accounts;
|
|
141
149
|
context.logger.info(`Sending ${txCount} txs`);
|