@aztec/end-to-end 0.87.5 → 0.87.7

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.
@@ -0,0 +1,60 @@
1
+ import type { ContractFunctionInteraction, DeployMethod, DeployOptions, Logger, ProfileMethodOptions } from '@aztec/aztec.js';
2
+ import { type PrivateExecutionStep } from '@aztec/stdlib/kernel';
3
+ import type { ProvingStats, ProvingTimings, SimulationStats, 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 CallRecording = {
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, CallRecording>;
42
+ };
43
+ type ClientFlowBenchmark = {
44
+ name: string;
45
+ timings: Omit<ProvingTimings & SimulationTimings, 'perFunction'> & {
46
+ witgen: number;
47
+ };
48
+ maxMemory: number;
49
+ rpc: Record<string, CallRecording>;
50
+ proverType: ProverType;
51
+ minimumTrace: StructuredTrace;
52
+ totalGateCount: number;
53
+ steps: Step[];
54
+ error: string | undefined;
55
+ };
56
+ export declare function generateBenchmark(flow: string, logs: Log[], stats: ProvingStats | SimulationStats, privateExecutionSteps: PrivateExecutionStep[], proverType: ProverType, error: string | undefined): ClientFlowBenchmark;
57
+ export declare function convertProfileToGHBenchmark(benchmark: ClientFlowBenchmark): GithubActionBenchmarkResult[];
58
+ export declare function captureProfile(label: string, interaction: ContractFunctionInteraction | DeployMethod, opts?: Omit<ProfileMethodOptions & DeployOptions, 'profileMode'>, expectedSteps?: number): Promise<import("@aztec/aztec.js").TxProfileResult>;
59
+ export {};
60
+ //# 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,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMzG,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;AA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K,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B,CAAC;AAsCF,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,GAAG,EAAE,EACX,KAAK,EAAE,YAAY,GAAG,eAAe,EACrC,qBAAqB,EAAE,oBAAoB,EAAE,EAC7C,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,mBAAmB,CAsErB;AAED,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,mBAAmB,GAAG,2BAA2B,EAAE,CAmDzG;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,259 @@
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, stats, 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 timings = stats.timings;
140
+ const totalGateCount = steps[steps.length - 1].accGateCount;
141
+ return {
142
+ name: flow,
143
+ timings: {
144
+ total: timings.total,
145
+ sync: timings.sync,
146
+ proving: timings.proving,
147
+ unaccounted: timings.unaccounted,
148
+ witgen: timings.perFunction.reduce((acc, fn)=>acc + fn.time, 0)
149
+ },
150
+ rpc: Object.entries(stats.nodeRPCCalls ?? {}).reduce((acc, [RPCName, RPCCalls])=>{
151
+ const total = RPCCalls.times.reduce((sum, time)=>sum + time, 0);
152
+ const calls = RPCCalls.times.length;
153
+ acc[RPCName] = {
154
+ calls,
155
+ max: Math.max(...RPCCalls.times),
156
+ min: Math.min(...RPCCalls.times),
157
+ total,
158
+ avg: total / calls
159
+ };
160
+ return acc;
161
+ }, {}),
162
+ maxMemory,
163
+ proverType,
164
+ minimumTrace: minimumTrace,
165
+ totalGateCount: totalGateCount,
166
+ steps,
167
+ error
168
+ };
169
+ }
170
+ export function convertProfileToGHBenchmark(benchmark) {
171
+ const totalRPCCalls = Object.values(benchmark.rpc).reduce((acc, call)=>acc + call.calls, 0);
172
+ const benches = [
173
+ {
174
+ name: `${benchmark.name}/witgen`,
175
+ value: benchmark.timings.witgen,
176
+ unit: 'ms'
177
+ },
178
+ {
179
+ name: `${benchmark.name}/total`,
180
+ value: benchmark.timings.total,
181
+ unit: 'ms'
182
+ },
183
+ {
184
+ name: `${benchmark.name}/sync`,
185
+ value: benchmark.timings.sync,
186
+ unit: 'ms'
187
+ },
188
+ {
189
+ name: `${benchmark.name}/unaccounted`,
190
+ value: benchmark.timings.unaccounted,
191
+ unit: 'ms'
192
+ },
193
+ {
194
+ name: `${benchmark.name}/total_gate_count`,
195
+ value: benchmark.totalGateCount,
196
+ unit: 'gates'
197
+ },
198
+ {
199
+ name: `${benchmark.name}/rpc`,
200
+ value: totalRPCCalls,
201
+ unit: 'calls'
202
+ }
203
+ ];
204
+ if (benchmark.timings.proving) {
205
+ benches.push({
206
+ name: `${benchmark.name}/proving`,
207
+ value: benchmark.timings.proving,
208
+ unit: 'ms'
209
+ });
210
+ }
211
+ if (benchmark.maxMemory) {
212
+ benches.push({
213
+ name: `${benchmark.name}/max_memory`,
214
+ value: benchmark.maxMemory,
215
+ unit: 'MiB'
216
+ });
217
+ }
218
+ return benches;
219
+ }
220
+ export async function captureProfile(label, interaction, opts, expectedSteps) {
221
+ // Make sure the proxy logger starts from a clean slate
222
+ ProxyLogger.getInstance().flushLogs();
223
+ const result = await interaction.profile({
224
+ ...opts,
225
+ profileMode: 'full',
226
+ skipProofGeneration: false
227
+ });
228
+ const logs = ProxyLogger.getInstance().getLogs();
229
+ if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
230
+ throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
231
+ }
232
+ const benchmark = generateBenchmark(label, logs, result.stats, result.executionSteps, 'wasm', undefined);
233
+ const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
234
+ if (ivcFolder) {
235
+ logger.info(`Capturing client ivc execution profile for ${label}`);
236
+ const resultsDirectory = join(ivcFolder, label);
237
+ logger.info(`Writing private execution steps to ${resultsDirectory}`);
238
+ await mkdir(resultsDirectory, {
239
+ recursive: true
240
+ });
241
+ // Write the client IVC files read by the prover.
242
+ const ivcInputsPath = join(resultsDirectory, 'ivc-inputs.msgpack');
243
+ await writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
244
+ await writeFile(join(resultsDirectory, 'logs.json'), JSON.stringify(logs, null, 2));
245
+ await writeFile(join(resultsDirectory, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
246
+ logger.info(`Wrote private execution steps to ${resultsDirectory}`);
247
+ }
248
+ const benchOutput = process.env.BENCH_OUTPUT;
249
+ if (benchOutput) {
250
+ await mkdir(benchOutput, {
251
+ recursive: true
252
+ });
253
+ const ghBenchmark = convertProfileToGHBenchmark(benchmark);
254
+ const benchFile = join(benchOutput, `${label}.bench.json`);
255
+ await writeFile(benchFile, JSON.stringify(ghBenchmark));
256
+ logger.info(`Wrote benchmark to ${benchFile}`);
257
+ }
258
+ return result;
259
+ }
@@ -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,EAAE,KAAK,qBAAqB,EAA4D,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAI3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,IAAI,UAAU,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAO5F,OAAO,EAEL,KAAK,iBAAiB,EAGvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAEL,KAA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
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":""}