@aztec/end-to-end 0.87.2 → 0.87.3-nightly.20250528

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 (33) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +59 -0
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
  3. package/dest/bench/client_flows/benchmark.js +240 -0
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts +5 -3
  5. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  6. package/dest/bench/client_flows/client_flows_benchmark.js +24 -14
  7. package/dest/bench/client_flows/data_extractor.d.ts +0 -21
  8. package/dest/bench/client_flows/data_extractor.d.ts.map +1 -1
  9. package/dest/bench/client_flows/data_extractor.js +5 -122
  10. package/dest/bench/utils.d.ts +7 -0
  11. package/dest/bench/utils.d.ts.map +1 -1
  12. package/dest/e2e_p2p/p2p_network.d.ts +3 -2
  13. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  14. package/dest/e2e_p2p/p2p_network.js +5 -4
  15. package/dest/e2e_p2p/shared.js +6 -2
  16. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  17. package/dest/fixtures/snapshot_manager.js +4 -4
  18. package/dest/fixtures/utils.d.ts +2 -3
  19. package/dest/fixtures/utils.d.ts.map +1 -1
  20. package/dest/fixtures/utils.js +7 -4
  21. package/package.json +35 -34
  22. package/src/bench/client_flows/benchmark.ts +308 -0
  23. package/src/bench/client_flows/client_flows_benchmark.ts +28 -10
  24. package/src/bench/client_flows/data_extractor.ts +8 -142
  25. package/src/bench/utils.ts +1 -1
  26. package/src/e2e_p2p/p2p_network.ts +13 -1
  27. package/src/e2e_p2p/shared.ts +2 -2
  28. package/src/fixtures/snapshot_manager.ts +5 -2
  29. package/src/fixtures/utils.ts +9 -5
  30. package/dest/shared/capture_private_execution_steps.d.ts +0 -7
  31. package/dest/shared/capture_private_execution_steps.d.ts.map +0 -1
  32. package/dest/shared/capture_private_execution_steps.js +0 -49
  33. package/src/shared/capture_private_execution_steps.ts +0 -68
@@ -0,0 +1,59 @@
1
+ import type { ContractFunctionInteraction, DeployMethod, DeployOptions, Logger, ProfileMethodOptions } from '@aztec/aztec.js';
2
+ import { type PrivateExecutionStep } from '@aztec/stdlib/kernel';
3
+ import type { ProvingTimings, SimulationTimings } from '@aztec/stdlib/tx';
4
+ import type { GithubActionBenchmarkResult } from '../utils.js';
5
+ declare const logLevel: readonly ["silent", "fatal", "error", "warn", "info", "verbose", "debug", "trace"];
6
+ type LogLevel = (typeof logLevel)[number];
7
+ export type Log = {
8
+ type: LogLevel;
9
+ timestamp: number;
10
+ prefix: string;
11
+ message: string;
12
+ data: any;
13
+ };
14
+ declare const GATE_TYPES: readonly ["ecc_op", "busread", "lookup", "pub_inputs", "arithmetic", "delta_range", "elliptic", "aux", "poseidon2_external", "poseidon2_internal", "overflow"];
15
+ type GateType = (typeof GATE_TYPES)[number];
16
+ type StructuredTrace = {
17
+ [k in GateType]: number;
18
+ };
19
+ export declare class ProxyLogger {
20
+ private static instance;
21
+ private logs;
22
+ private constructor();
23
+ static create(): void;
24
+ static getInstance(): ProxyLogger;
25
+ createLogger(prefix: string): Logger;
26
+ private handleLog;
27
+ flushLogs(): void;
28
+ getLogs(): Log[];
29
+ }
30
+ export type ProverType = 'wasm' | 'native';
31
+ type OracleRecording = {
32
+ calls: number;
33
+ max: number;
34
+ min: number;
35
+ avg: number;
36
+ total: number;
37
+ };
38
+ type Step = Pick<PrivateExecutionStep, 'functionName' | 'gateCount'> & {
39
+ time: number;
40
+ accGateCount?: number;
41
+ oracles: Record<string, OracleRecording>;
42
+ };
43
+ type ClientFlowBenchmark = {
44
+ name: string;
45
+ timings: Omit<ProvingTimings & SimulationTimings, 'perFunction'> & {
46
+ witgen: number;
47
+ };
48
+ maxMemory: number;
49
+ proverType: ProverType;
50
+ minimumTrace: StructuredTrace;
51
+ totalGateCount: number;
52
+ steps: Step[];
53
+ error: string | undefined;
54
+ };
55
+ export declare function generateBenchmark(flow: string, logs: Log[], timings: ProvingTimings | SimulationTimings, privateExecutionSteps: PrivateExecutionStep[], proverType: ProverType, error: string | undefined): ClientFlowBenchmark;
56
+ export declare function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): GithubActionBenchmarkResult[];
57
+ export declare function captureProfile(label: string, interaction: ContractFunctionInteraction | DeployMethod, opts?: Omit<ProfileMethodOptions & DeployOptions, 'profileMode'>, expectedSteps?: number): Promise<import("@aztec/aztec.js").TxProfileResult>;
58
+ export {};
59
+ //# sourceMappingURL=benchmark.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark.d.ts","sourceRoot":"","sources":["../../../src/bench/client_flows/benchmark.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,YAAY,EACZ,aAAa,EACb,MAAM,EACN,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,oBAAoB,EAAkC,MAAM,sBAAsB,CAAC;AACjG,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAM1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAI/D,QAAA,MAAM,QAAQ,oFAAqF,CAAC;AACpG,KAAK,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,MAAM,MAAM,GAAG,GAAG;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF,QAAA,MAAM,UAAU,gKAYN,CAAC;AAEX,KAAK,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,KAAK,eAAe,GAAG;KACpB,CAAC,IAAI,QAA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GAAG,iBAAiB,EAC3C,qBAAqB,EAAE,oBAAoB,EAAE,EAC7C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,mBAAmB,CAsDrB;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,mBAAmB,GAAG,2BAA2B,EAAE,CA6CzG;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,2BAA2B,GAAG,YAAY,EACvD,IAAI,CAAC,EAAE,IAAI,CAAC,oBAAoB,GAAG,aAAa,EAAE,aAAa,CAAC,EAChE,aAAa,CAAC,EAAE,MAAM,sDAoCvB"}
@@ -0,0 +1,240 @@
1
+ import { createLogger } from '@aztec/foundation/log';
2
+ import { serializePrivateExecutionSteps } from '@aztec/stdlib/kernel';
3
+ import assert from 'node:assert';
4
+ import { mkdir, writeFile } from 'node:fs/promises';
5
+ import { join } from 'node:path';
6
+ const logger = createLogger('bench:profile_capture');
7
+ const logLevel = [
8
+ 'silent',
9
+ 'fatal',
10
+ 'error',
11
+ 'warn',
12
+ 'info',
13
+ 'verbose',
14
+ 'debug',
15
+ 'trace'
16
+ ];
17
+ const GATE_TYPES = [
18
+ 'ecc_op',
19
+ 'busread',
20
+ 'lookup',
21
+ 'pub_inputs',
22
+ 'arithmetic',
23
+ 'delta_range',
24
+ 'elliptic',
25
+ 'aux',
26
+ 'poseidon2_external',
27
+ 'poseidon2_internal',
28
+ 'overflow'
29
+ ];
30
+ export class ProxyLogger {
31
+ static instance;
32
+ logs = [];
33
+ constructor(){}
34
+ static create() {
35
+ ProxyLogger.instance = new ProxyLogger();
36
+ }
37
+ static getInstance() {
38
+ return ProxyLogger.instance;
39
+ }
40
+ createLogger(prefix) {
41
+ return new Proxy(createLogger(prefix), {
42
+ get: (target, prop)=>{
43
+ if (logLevel.includes(prop)) {
44
+ return function(...data) {
45
+ const loggingFn = prop;
46
+ const args = [
47
+ loggingFn,
48
+ prefix,
49
+ ...data
50
+ ];
51
+ ProxyLogger.getInstance().handleLog(...args);
52
+ target[loggingFn].call(this, ...[
53
+ data[0],
54
+ data[1]
55
+ ]);
56
+ };
57
+ } else {
58
+ return target[prop];
59
+ }
60
+ }
61
+ });
62
+ }
63
+ handleLog(type, prefix, message, data) {
64
+ this.logs.unshift({
65
+ type,
66
+ prefix,
67
+ message,
68
+ data,
69
+ timestamp: Date.now()
70
+ });
71
+ }
72
+ flushLogs() {
73
+ this.logs = [];
74
+ }
75
+ getLogs() {
76
+ return this.logs;
77
+ }
78
+ }
79
+ function getMinimumTrace(logs) {
80
+ const minimumMessage = 'Minimum required block sizes for structured trace';
81
+ const minimumMessageIndex = logs.findIndex((log)=>log.message.includes(minimumMessage));
82
+ const candidateLogs = logs.slice(minimumMessageIndex - GATE_TYPES.length, minimumMessageIndex + 5);
83
+ const traceLogs = candidateLogs.filter((log)=>GATE_TYPES.some((type)=>log.message.includes(type))).map((log)=>log.message.split(/\t|\n/)).flat().map((log)=>log.replace(/\(mem: .*\)/, '').trim()).filter(Boolean);
84
+ const traceSizes = traceLogs.map((log)=>{
85
+ const [gateType, gateSizeStr] = log.replace(/\n.*\)$/, '').replace(/bb - /, '').split(':').map((s)=>s.trim());
86
+ const gateSize = parseInt(gateSizeStr);
87
+ assert(GATE_TYPES.includes(gateType), `Gate type ${gateType} is not recognized`);
88
+ return {
89
+ [gateType]: gateSize
90
+ };
91
+ });
92
+ assert(traceSizes.length === GATE_TYPES.length, 'Decoded trace sizes do not match expected amount of gate types');
93
+ return traceSizes.reduce((acc, curr)=>({
94
+ ...acc,
95
+ ...curr
96
+ }), {});
97
+ }
98
+ function getMaxMemory(logs) {
99
+ const candidateLogs = logs.slice(0, 100).filter((log)=>/\(mem: .*MiB\)/.test(log.message));
100
+ const usage = candidateLogs.map((log)=>{
101
+ const memStr = log ? log.message.slice(log.message.indexOf('(mem: ') + 6, log.message.indexOf('MiB') - 3) : '';
102
+ return memStr ? parseInt(memStr) : 0;
103
+ });
104
+ return Math.max(...usage);
105
+ }
106
+ export function generateBenchmark(flow, logs, timings, privateExecutionSteps, proverType, error) {
107
+ let maxMemory = 0;
108
+ let minimumTrace;
109
+ try {
110
+ minimumTrace = getMinimumTrace(logs);
111
+ maxMemory = getMaxMemory(logs);
112
+ } catch {
113
+ logger.warn(`Failed obtain minimum trace and max memory for ${flow}. Did you run with REAL_PROOFS=1?`);
114
+ }
115
+ const steps = privateExecutionSteps.reduce((acc, step, i)=>{
116
+ const previousAccGateCount = i === 0 ? 0 : acc[i - 1].accGateCount;
117
+ return [
118
+ ...acc,
119
+ {
120
+ functionName: step.functionName,
121
+ gateCount: step.gateCount,
122
+ accGateCount: previousAccGateCount + step.gateCount,
123
+ time: step.timings.witgen,
124
+ oracles: Object.entries(step.timings.oracles ?? {}).reduce((acc, [oracleName, oracleData])=>{
125
+ const total = oracleData.times.reduce((sum, time)=>sum + time, 0);
126
+ const calls = oracleData.times.length;
127
+ acc[oracleName] = {
128
+ calls,
129
+ max: Math.max(...oracleData.times),
130
+ min: Math.min(...oracleData.times),
131
+ total,
132
+ avg: total / calls
133
+ };
134
+ return acc;
135
+ }, {})
136
+ }
137
+ ];
138
+ }, []);
139
+ const totalGateCount = steps[steps.length - 1].accGateCount;
140
+ return {
141
+ name: flow,
142
+ timings: {
143
+ total: timings.total,
144
+ sync: timings.sync,
145
+ proving: timings.proving,
146
+ unaccounted: timings.unaccounted,
147
+ witgen: timings.perFunction.reduce((acc, fn)=>acc + fn.time, 0)
148
+ },
149
+ maxMemory,
150
+ proverType,
151
+ minimumTrace: minimumTrace,
152
+ totalGateCount: totalGateCount,
153
+ steps,
154
+ error
155
+ };
156
+ }
157
+ export function convertProfileToGHBenchmark(benchmark) {
158
+ const benches = [
159
+ {
160
+ name: `${benchmark.name}/witgen`,
161
+ value: benchmark.timings.witgen,
162
+ unit: 'ms'
163
+ },
164
+ {
165
+ name: `${benchmark.name}/total`,
166
+ value: benchmark.timings.total,
167
+ unit: 'ms'
168
+ },
169
+ {
170
+ name: `${benchmark.name}/sync`,
171
+ value: benchmark.timings.sync,
172
+ unit: 'ms'
173
+ },
174
+ {
175
+ name: `${benchmark.name}/unaccounted`,
176
+ value: benchmark.timings.unaccounted,
177
+ unit: 'ms'
178
+ },
179
+ {
180
+ name: `${benchmark.name}/total_gate_count`,
181
+ value: benchmark.totalGateCount,
182
+ unit: 'gates'
183
+ }
184
+ ];
185
+ if (benchmark.timings.proving) {
186
+ benches.push({
187
+ name: `${benchmark.name}/proving`,
188
+ value: benchmark.timings.proving,
189
+ unit: 'ms'
190
+ });
191
+ }
192
+ if (benchmark.maxMemory) {
193
+ benches.push({
194
+ name: `${benchmark.name}/max_memory`,
195
+ value: benchmark.maxMemory,
196
+ unit: 'MiB'
197
+ });
198
+ }
199
+ return benches;
200
+ }
201
+ export async function captureProfile(label, interaction, opts, expectedSteps) {
202
+ // Make sure the proxy logger starts from a clean slate
203
+ ProxyLogger.getInstance().flushLogs();
204
+ const result = await interaction.profile({
205
+ ...opts,
206
+ profileMode: 'full',
207
+ skipProofGeneration: false
208
+ });
209
+ const logs = ProxyLogger.getInstance().getLogs();
210
+ if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
211
+ throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
212
+ }
213
+ const benchmark = generateBenchmark(label, logs, result.timings, result.executionSteps, 'wasm', undefined);
214
+ const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
215
+ if (ivcFolder) {
216
+ logger.info(`Capturing client ivc execution profile for ${label}`);
217
+ const resultsDirectory = join(ivcFolder, label);
218
+ logger.info(`Writing private execution steps to ${resultsDirectory}`);
219
+ await mkdir(resultsDirectory, {
220
+ recursive: true
221
+ });
222
+ // Write the client IVC files read by the prover.
223
+ const ivcInputsPath = join(resultsDirectory, 'ivc-inputs.msgpack');
224
+ await writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
225
+ await writeFile(join(resultsDirectory, 'logs.json'), JSON.stringify(logs, null, 2));
226
+ await writeFile(join(resultsDirectory, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
227
+ logger.info(`Wrote private execution steps to ${resultsDirectory}`);
228
+ }
229
+ const benchOutput = process.env.BENCH_OUTPUT;
230
+ if (benchOutput) {
231
+ await mkdir(benchOutput, {
232
+ recursive: true
233
+ });
234
+ const ghBenchmark = convertProfileToGHBenchmark(benchmark);
235
+ const benchFile = join(benchOutput, `${label}.bench.json`);
236
+ await writeFile(benchFile, JSON.stringify(ghBenchmark));
237
+ logger.info(`Wrote benchmark to ${benchFile}`);
238
+ }
239
+ return result;
240
+ }
@@ -1,4 +1,4 @@
1
- import { type AccountWallet, AztecAddress, type AztecNode, FeeJuicePaymentMethod, FeeJuicePaymentMethodWithClaim, type FeePaymentMethod, type Logger, type PXE, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, type Wallet } from '@aztec/aztec.js';
1
+ import { type AccountWallet, AccountWalletWithSecretKey, AztecAddress, type AztecNode, FeeJuicePaymentMethod, FeeJuicePaymentMethodWithClaim, type FeePaymentMethod, type Logger, type PXE, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, type Wallet } from '@aztec/aztec.js';
2
2
  import { CheatCodes } from '@aztec/aztec.js/testing';
3
3
  import { type DeployL1ContractsArgs } from '@aztec/ethereum';
4
4
  import { ChainMonitor } from '@aztec/ethereum/test';
@@ -37,18 +37,20 @@ export declare class ClientFlowsBenchmark {
37
37
  liquidityToken: TokenContract;
38
38
  sponsoredFPC: SponsoredFPCContract;
39
39
  userPXE: PXE;
40
+ realProofs: boolean;
40
41
  paymentMethods: Record<BenchmarkingFeePaymentMethod, {
41
42
  forWallet: FeePaymentMethodGetter;
42
43
  circuits: number;
43
44
  }>;
44
45
  config: ClientFlowsConfig;
46
+ private proxyLogger;
45
47
  constructor(testName?: string, setupOptions?: Partial<SetupOptions & DeployL1ContractsArgs>);
46
48
  setup(): Promise<this>;
47
49
  teardown(): Promise<void>;
48
50
  mintAndBridgeFeeJuice(address: AztecAddress, amount: bigint): Promise<void>;
49
51
  /** Admin mints bananaCoin tokens privately to the target address and redeems them. */
50
52
  mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
51
- createBenchmarkingAccountManager(type: 'ecdsar1' | 'schnorr'): Promise<import("@aztec/aztec.js").AccountManager>;
53
+ createBenchmarkingAccountManager(pxe: PXE, type: 'ecdsar1' | 'schnorr'): Promise<import("@aztec/aztec.js").AccountManager>;
52
54
  applyBaseSnapshots(): Promise<void>;
53
55
  applyInitialAccountsSnapshot(): Promise<void>;
54
56
  applySetupFeeJuiceSnapshot(): Promise<void>;
@@ -57,7 +59,7 @@ export declare class ClientFlowsBenchmark {
57
59
  applyFPCSetupSnapshot(): Promise<void>;
58
60
  applyDeploySponsoredFPCSnapshot(): Promise<void>;
59
61
  createCrossChainTestHarness(owner: AccountWallet): Promise<CrossChainTestHarness>;
60
- createAndFundBenchmarkingWallet(accountType: AccountType): Promise<import("@aztec/aztec.js").AccountWalletWithSecretKey>;
62
+ createAndFundBenchmarkingWallet(accountType: AccountType): Promise<AccountWalletWithSecretKey>;
61
63
  applyDeployAmmSnapshot(): Promise<void>;
62
64
  getBridgedFeeJuicePaymentMethodForWallet(wallet: Wallet): Promise<FeeJuicePaymentMethodWithClaim>;
63
65
  getPrivateFPCPaymentMethodForWallet(wallet: Wallet): Promise<PrivateFeePaymentMethod>;
@@ -1 +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,YAAY,EACZ,KAAK,SAAS,EACd,qBAAqB,EACrB,8BAA8B,EAC9B,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACX,KAAK,GAAG,EACR,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EA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,OAAO,EAAE,YAAY;IASxD,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,GAAG,SAAS;IAmB/D,kBAAkB;IAKzB,4BAA4B;IAsC5B,0BAA0B;IAqB1B,8BAA8B;IAgB9B,gCAAgC;IAgBzB,qBAAqB;IAwB5B,+BAA+B;IAcxB,2BAA2B,CAAC,KAAK,EAAE,aAAa;IAwBhD,+BAA+B,CAAC,WAAW,EAAE,WAAW;IAyBxD,sBAAsB;IA0BtB,wCAAwC,CAAC,MAAM,EAAE,MAAM;IAQ7D,mCAAmC,CAAC,MAAM,EAAE,MAAM;IAIlD,qCAAqC,CAAC,OAAO,EAAE,MAAM;IAIrD,iCAAiC,CAAC,MAAM,EAAE,MAAM;CAGxD"}
@@ -1,6 +1,6 @@
1
1
  import { EcdsaRAccountContractArtifact, getEcdsaRAccount } from '@aztec/accounts/ecdsa';
2
2
  import { SchnorrAccountContractArtifact, getSchnorrAccount, getSchnorrWallet } from '@aztec/accounts/schnorr';
3
- import { FeeJuicePaymentMethod, FeeJuicePaymentMethodWithClaim, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, createLogger } from '@aztec/aztec.js';
3
+ import { AccountWalletWithSecretKey, FeeJuicePaymentMethod, FeeJuicePaymentMethodWithClaim, PrivateFeePaymentMethod, SponsoredFeePaymentMethod, createLogger } from '@aztec/aztec.js';
4
4
  import { CheatCodes } from '@aztec/aztec.js/testing';
5
5
  import { FEE_FUNDING_FOR_TESTER_ACCOUNT } from '@aztec/constants';
6
6
  import { RollupContract, createExtendedL1Client, deployL1Contract } from '@aztec/ethereum';
@@ -25,6 +25,7 @@ import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
25
25
  import { setupSponsoredFPC } from '../../fixtures/utils.js';
26
26
  import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
27
27
  import { FeeJuicePortalTestingHarnessFactory } from '../../shared/gas_portal_test_harness.js';
28
+ import { ProxyLogger } from './benchmark.js';
28
29
  import { FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
29
30
  const { E2E_DATA_PATH: dataPath, BENCHMARK_CONFIG } = process.env;
30
31
  export class ClientFlowsBenchmark {
@@ -57,6 +58,10 @@ export class ClientFlowsBenchmark {
57
58
  sponsoredFPC;
58
59
  // PXE used by the benchmarking user. It can be set up with client-side proving enabled
59
60
  userPXE;
61
+ realProofs = [
62
+ 'true',
63
+ '1'
64
+ ].includes(process.env.REAL_PROOFS ?? '');
60
65
  paymentMethods = {
61
66
  // eslint-disable-next-line camelcase
62
67
  bridged_fee_juice: {
@@ -83,6 +88,7 @@ export class ClientFlowsBenchmark {
83
88
  }
84
89
  };
85
90
  config;
91
+ proxyLogger;
86
92
  constructor(testName, setupOptions = {}){
87
93
  this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
88
94
  this.snapshotManager = createSnapshotManager(`bench_client_flows${testName ? `/${testName}` : ''}`, dataPath, {
@@ -92,6 +98,8 @@ export class ClientFlowsBenchmark {
92
98
  ...setupOptions
93
99
  });
94
100
  this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
101
+ ProxyLogger.create();
102
+ this.proxyLogger = ProxyLogger.getInstance();
95
103
  }
96
104
  async setup() {
97
105
  const context = await this.snapshotManager.setup();
@@ -118,17 +126,17 @@ export class ClientFlowsBenchmark {
118
126
  const balanceAfter = await this.bananaCoin.methods.balance_of_private(address).simulate();
119
127
  expect(balanceAfter).toEqual(balanceBefore + amount);
120
128
  }
121
- async createBenchmarkingAccountManager(type) {
129
+ async createBenchmarkingAccountManager(pxe, type) {
122
130
  const benchysSecretKey = Fr.random();
123
131
  const salt = Fr.random();
124
132
  let benchysPrivateSigningKey;
125
133
  let benchysAccountManager;
126
134
  if (type === 'schnorr') {
127
135
  benchysPrivateSigningKey = deriveSigningKey(benchysSecretKey);
128
- benchysAccountManager = await getSchnorrAccount(this.userPXE, benchysSecretKey, benchysPrivateSigningKey, salt);
136
+ benchysAccountManager = await getSchnorrAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
129
137
  } else if (type === 'ecdsar1') {
130
138
  benchysPrivateSigningKey = randomBytes(32);
131
- benchysAccountManager = await getEcdsaRAccount(this.userPXE, benchysSecretKey, benchysPrivateSigningKey, salt);
139
+ benchysAccountManager = await getEcdsaRAccount(pxe, benchysSecretKey, benchysPrivateSigningKey, salt);
132
140
  } else {
133
141
  throw new Error(`Unknown account type: ${type}`);
134
142
  }
@@ -155,13 +163,14 @@ export class ClientFlowsBenchmark {
155
163
  const l1Contracts = await aztecNode.getL1ContractAddresses();
156
164
  const userPXEConfigWithContracts = {
157
165
  ...userPXEConfig,
158
- proverEnabled: [
159
- 'true',
160
- '1'
161
- ].includes(process.env.REAL_PROOFS ?? ''),
166
+ proverEnabled: this.realProofs,
162
167
  l1Contracts
163
168
  };
164
- this.userPXE = await createPXEService(this.aztecNode, userPXEConfigWithContracts, 'pxe-user');
169
+ this.userPXE = await createPXEService(this.aztecNode, userPXEConfigWithContracts, {
170
+ loggers: {
171
+ prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied')
172
+ }
173
+ });
165
174
  });
166
175
  }
167
176
  async applySetupFeeJuiceSnapshot() {
@@ -239,7 +248,7 @@ export class ClientFlowsBenchmark {
239
248
  return crossChainTestHarness;
240
249
  }
241
250
  async createAndFundBenchmarkingWallet(accountType) {
242
- const benchysAccountManager = await this.createBenchmarkingAccountManager(accountType);
251
+ const benchysAccountManager = await this.createBenchmarkingAccountManager(this.pxe, accountType);
243
252
  const benchysWallet = await benchysAccountManager.getWallet();
244
253
  const benchysAddress = benchysAccountManager.getAddress();
245
254
  const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(FEE_FUNDING_FOR_TESTER_ACCOUNT, benchysAddress);
@@ -249,13 +258,14 @@ export class ClientFlowsBenchmark {
249
258
  paymentMethod
250
259
  }
251
260
  }).wait();
252
- // Register benchy on admin's PXE so we can check its balances
253
- await this.pxe.registerContract({
261
+ // Register benchy on the user's PXE, where we're going to be interacting from
262
+ await this.userPXE.registerContract({
254
263
  instance: benchysAccountManager.getInstance(),
255
264
  artifact: accountType === 'ecdsar1' ? EcdsaRAccountContractArtifact : SchnorrAccountContractArtifact
256
265
  });
257
- await this.pxe.registerAccount(benchysWallet.getSecretKey(), benchysWallet.getCompleteAddress().partialAddress);
258
- return benchysWallet;
266
+ await this.userPXE.registerAccount(benchysWallet.getSecretKey(), benchysWallet.getCompleteAddress().partialAddress);
267
+ const entrypoint = await benchysAccountManager.getAccount();
268
+ return new AccountWalletWithSecretKey(this.userPXE, entrypoint, benchysWallet.getSecretKey(), benchysAccountManager.salt);
259
269
  }
260
270
  async applyDeployAmmSnapshot() {
261
271
  await this.snapshotManager.snapshot('deploy_amm', async ()=>{
@@ -1,23 +1,2 @@
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
1
  export {};
23
2
  //# sourceMappingURL=data_extractor.d.ts.map
@@ -1 +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;AAa9C,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"}
1
+ {"version":3,"file":"data_extractor.d.ts","sourceRoot":"","sources":["../../../src/bench/client_flows/data_extractor.ts"],"names":[],"mappings":""}
@@ -4,81 +4,9 @@ import { createLogger, logger } from '@aztec/foundation/log';
4
4
  import { Timer } from '@aztec/foundation/timer';
5
5
  import { WASMSimulator } from '@aztec/simulator/client';
6
6
  import { Decoder } from 'msgpackr';
7
- import assert from 'node:assert';
8
7
  import { readFile, readdir, writeFile } from 'node:fs/promises';
9
8
  import { join } from 'node:path';
10
- const logLevel = [
11
- 'silent',
12
- 'fatal',
13
- 'error',
14
- 'warn',
15
- 'info',
16
- 'verbose',
17
- 'debug',
18
- 'trace'
19
- ];
20
- const GATE_TYPES = [
21
- 'ecc_op',
22
- 'busread',
23
- 'lookup',
24
- 'pub_inputs',
25
- 'arithmetic',
26
- 'delta_range',
27
- 'elliptic',
28
- 'aux',
29
- 'poseidon2_external',
30
- 'poseidon2_internal',
31
- 'overflow'
32
- ];
33
- export class ProxyLogger {
34
- static instance;
35
- logs = [];
36
- constructor(){}
37
- static create() {
38
- ProxyLogger.instance = new ProxyLogger();
39
- }
40
- static getInstance() {
41
- return ProxyLogger.instance;
42
- }
43
- createLogger(prefix) {
44
- return new Proxy(createLogger(prefix), {
45
- get: (target, prop)=>{
46
- if (logLevel.includes(prop)) {
47
- return function(...data) {
48
- const loggingFn = prop;
49
- const args = [
50
- loggingFn,
51
- prefix,
52
- ...data
53
- ];
54
- ProxyLogger.getInstance().handleLog(...args);
55
- target[loggingFn].call(this, ...[
56
- data[0],
57
- data[1]
58
- ]);
59
- };
60
- } else {
61
- return target[prop];
62
- }
63
- }
64
- });
65
- }
66
- handleLog(type, prefix, message, data) {
67
- this.logs.unshift({
68
- type,
69
- prefix,
70
- message,
71
- data,
72
- timestamp: Date.now()
73
- });
74
- }
75
- flushLogs() {
76
- this.logs = [];
77
- }
78
- getLogs() {
79
- return this.logs;
80
- }
81
- }
9
+ import { ProxyLogger, generateBenchmark } from './benchmark.js';
82
10
  async function createProver(config = {}, log) {
83
11
  const simulationProvider = new WASMSimulator();
84
12
  if (!config.bbBinaryPath || !config.bbWorkingDirectory) {
@@ -97,25 +25,6 @@ async function createProver(config = {}, log) {
97
25
  };
98
26
  }
99
27
  }
100
- function getMinimumTrace(logs) {
101
- const minimumMessage = 'Trace details:';
102
- const minimumMessageIndex = logs.findIndex((log)=>log.message.includes(minimumMessage));
103
- const candidateLogs = logs.slice(minimumMessageIndex - GATE_TYPES.length, minimumMessageIndex);
104
- const traceLogs = candidateLogs.filter((log)=>GATE_TYPES.some((type)=>log.message.includes(type))).map((log)=>log.message.split(/\t|\n/)).flat().map((log)=>log.replace(/\(mem: .*\)/, '').trim()).filter(Boolean);
105
- const traceSizes = traceLogs.map((log)=>{
106
- const [gateType, gateSizeStr] = log.replace(/\n.*\)$/, '').replace(/bb - /, '').split(':').map((s)=>s.trim());
107
- const gateSize = parseInt(gateSizeStr);
108
- assert(GATE_TYPES.includes(gateType), `Gate type ${gateType} is not recognized`);
109
- return {
110
- [gateType]: gateSize
111
- };
112
- });
113
- assert(traceSizes.length === GATE_TYPES.length, 'Decoded trace sizes do not match expected amount of gate types');
114
- return traceSizes.reduce((acc, curr)=>({
115
- ...acc,
116
- ...curr
117
- }), {});
118
- }
119
28
  async function main() {
120
29
  ProxyLogger.create();
121
30
  const proxyLogger = ProxyLogger.getInstance();
@@ -146,7 +55,7 @@ async function main() {
146
55
  const profileFile = await readFile(join(ivcFolder, flow, 'profile.json'));
147
56
  const profile = JSON.parse(profileFile.toString());
148
57
  const privateExecutionSteps = profile.steps.map((step, i)=>({
149
- functionName: step.fnName,
58
+ functionName: step.functionName,
150
59
  gateCount: step.gateCount,
151
60
  bytecode: stepsFromFile[i].bytecode,
152
61
  // TODO(AD) do we still want to take this from witness.json?
@@ -157,7 +66,6 @@ async function main() {
157
66
  gateCount: step.timings.witgen
158
67
  }
159
68
  }));
160
- let stats;
161
69
  let error;
162
70
  let currentLogs = [];
163
71
  let provingTime;
@@ -172,35 +80,10 @@ async function main() {
172
80
  // Extract logs from this run from the proxy and write them to disk unconditionally
173
81
  currentLogs = proxyLogger.getLogs();
174
82
  await writeFile(join(ivcFolder, flow, 'logs.json'), JSON.stringify(currentLogs, null, 2));
175
- if (!error) {
176
- stats = currentLogs[0].data;
83
+ if (!profile.timings.proving) {
84
+ profile.timings.proving = provingTime;
177
85
  }
178
- const minimumTrace = getMinimumTrace(currentLogs);
179
- const steps = profile.steps.reduce((acc, step, i)=>{
180
- const previousAccGateCount = i === 0 ? 0 : acc[i - 1].accGateCount;
181
- return [
182
- ...acc,
183
- {
184
- fnName: step.fnName,
185
- gateCount: step.gateCount,
186
- accGateCount: previousAccGateCount + step.gateCount,
187
- timings: {
188
- witgen: step.timings.witgen
189
- }
190
- }
191
- ];
192
- }, []);
193
- const totalGateCount = steps[steps.length - 1].accGateCount;
194
- const benchmark = {
195
- syncTime: profile.syncTime,
196
- provingTime,
197
- proverType,
198
- minimumTrace: minimumTrace,
199
- totalGateCount,
200
- stats,
201
- steps,
202
- error
203
- };
86
+ const benchmark = generateBenchmark(flow, currentLogs, profile.timings, privateExecutionSteps, proverType, error);
204
87
  await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
205
88
  proxyLogger.flushLogs();
206
89
  }