@aztec/end-to-end 0.0.0-test.1 → 0.0.1-fake-ceab37513c
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 +60 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +261 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +69 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +315 -0
- package/dest/bench/client_flows/config.d.ts +14 -0
- package/dest/bench/client_flows/config.d.ts.map +1 -0
- package/dest/bench/client_flows/config.js +106 -0
- package/dest/bench/client_flows/data_extractor.d.ts +2 -0
- package/dest/bench/client_flows/data_extractor.d.ts.map +1 -0
- package/dest/bench/client_flows/data_extractor.js +99 -0
- package/dest/bench/utils.d.ts +10 -27
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +27 -43
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +15 -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 +66 -38
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +10 -18
- 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 +34 -53
- package/dest/e2e_deploy_contract/deploy_test.d.ts +4 -2
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +9 -6
- package/dest/e2e_epochs/epochs_test.d.ts +56 -17
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +222 -42
- package/dest/e2e_fees/bridging_race.notest.d.ts +2 -0
- package/dest/e2e_fees/bridging_race.notest.d.ts.map +1 -0
- package/dest/e2e_fees/bridging_race.notest.js +60 -0
- package/dest/e2e_fees/fees_test.d.ts +16 -5
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +87 -88
- package/dest/e2e_l1_publisher/write_json.d.ts +8 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +57 -0
- package/dest/e2e_multi_validator/utils.d.ts +12 -0
- package/dest/e2e_multi_validator/utils.d.ts.map +1 -0
- package/dest/e2e_multi_validator/utils.js +214 -0
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +5 -5
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +19 -14
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +31 -0
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -0
- package/dest/e2e_p2p/inactivity_slash_test.js +132 -0
- package/dest/e2e_p2p/p2p_network.d.ts +56 -21
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +154 -125
- package/dest/e2e_p2p/shared.d.ts +41 -3
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +146 -6
- package/dest/e2e_token_contract/token_contract_test.d.ts +10 -5
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +51 -24
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.d.ts +7 -4
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/{e2e_prover → fixtures}/e2e_prover_test.js +67 -62
- package/dest/fixtures/fixtures.d.ts +5 -6
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +4 -3
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +2 -14
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +8 -15
- package/dest/fixtures/l1_to_l2_messaging.d.ts +8 -5
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +44 -18
- package/dest/fixtures/setup_l1_contracts.d.ts +3 -3
- package/dest/fixtures/setup_l1_contracts.d.ts.map +1 -1
- package/dest/fixtures/setup_l1_contracts.js +3 -3
- package/dest/fixtures/setup_p2p_test.d.ts +14 -6
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +73 -21
- package/dest/fixtures/snapshot_manager.d.ts +8 -3
- package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
- package/dest/fixtures/snapshot_manager.js +120 -104
- package/dest/fixtures/token_utils.d.ts +4 -3
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +24 -7
- package/dest/fixtures/utils.d.ts +65 -22
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +439 -318
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +42 -0
- package/dest/shared/cross_chain_test_harness.d.ts +28 -18
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +97 -41
- package/dest/shared/gas_portal_test_harness.d.ts +23 -18
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +43 -25
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.d.ts +5 -6
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +136 -90
- package/dest/simulators/lending_simulator.d.ts +5 -6
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +11 -15
- package/dest/simulators/token_simulator.d.ts +2 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +16 -13
- package/dest/spartan/setup_test_wallets.d.ts +8 -1
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +108 -22
- package/dest/spartan/utils.d.ts +60 -307
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +200 -115
- package/package.json +60 -56
- package/src/bench/client_flows/benchmark.ts +341 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +422 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +111 -0
- package/src/bench/utils.ts +26 -52
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +60 -40
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +47 -75
- package/src/e2e_deploy_contract/deploy_test.ts +11 -8
- package/src/e2e_epochs/epochs_test.ts +276 -54
- package/src/e2e_fees/bridging_race.notest.ts +75 -0
- package/src/e2e_fees/fees_test.ts +121 -108
- package/src/e2e_l1_publisher/write_json.ts +74 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +22 -14
- package/src/e2e_p2p/inactivity_slash_test.ts +174 -0
- package/src/e2e_p2p/p2p_network.ts +212 -144
- package/src/e2e_p2p/shared.ts +234 -14
- package/src/e2e_token_contract/token_contract_test.ts +42 -38
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/{e2e_prover → fixtures}/e2e_prover_test.ts +62 -69
- package/src/fixtures/fixtures.ts +4 -3
- package/src/fixtures/get_acvm_config.ts +2 -10
- package/src/fixtures/get_bb_config.ts +15 -11
- package/src/fixtures/l1_to_l2_messaging.ts +53 -23
- package/src/fixtures/setup_l1_contracts.ts +5 -6
- package/src/fixtures/setup_p2p_test.ts +112 -30
- package/src/fixtures/snapshot_manager.ts +150 -102
- package/src/fixtures/token_utils.ts +33 -8
- package/src/fixtures/utils.ts +530 -352
- package/src/fixtures/web3signer.ts +46 -0
- package/src/guides/up_quick_start.sh +4 -4
- package/src/shared/cross_chain_test_harness.ts +92 -52
- package/src/shared/gas_portal_test_harness.ts +47 -31
- package/src/shared/uniswap_l1_l2.ts +127 -124
- package/src/simulators/lending_simulator.ts +11 -15
- package/src/simulators/token_simulator.ts +17 -12
- package/src/spartan/DEVELOP.md +116 -0
- package/src/spartan/setup_test_wallets.ts +144 -29
- package/src/spartan/utils.ts +194 -116
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/sample-dapp/connect.js +0 -12
- package/dest/sample-dapp/contracts.js +0 -10
- package/dest/sample-dapp/deploy.js +0 -35
- package/dest/sample-dapp/index.js +0 -98
- package/src/sample-dapp/connect.mjs +0 -16
- package/src/sample-dapp/contracts.mjs +0 -14
- package/src/sample-dapp/deploy.mjs +0 -40
- package/src/sample-dapp/index.mjs +0 -128
|
@@ -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", "memory", "nnf", "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,0KAaN,CAAC;AAEX,KAAK,QAAQ,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C,KAAK,eAAe,GAAG;KACpB,CAAC,IAAI,QAAQ,GAAG,MAAM;CACxB,CAAC;AAEF,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,EA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BAA2B,CAAC,SAAS,EAAE,mBAAmB,GAAG,2BAA2B,EAAE,CAmDzG;AAED,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,2BAA2B,GAAG,YAAY,EACvD,IAAI,EAAE,IAAI,CAAC,oBAAoB,GAAG,aAAa,EAAE,aAAa,CAAC,EAC/D,aAAa,CAAC,EAAE,MAAM,sDAoCvB"}
|
|
@@ -0,0 +1,261 @@
|
|
|
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
|
+
'memory',
|
|
26
|
+
'nnf',
|
|
27
|
+
'poseidon2_external',
|
|
28
|
+
'poseidon2_internal',
|
|
29
|
+
'overflow'
|
|
30
|
+
];
|
|
31
|
+
export class ProxyLogger {
|
|
32
|
+
static instance;
|
|
33
|
+
logs = [];
|
|
34
|
+
constructor(){}
|
|
35
|
+
static create() {
|
|
36
|
+
ProxyLogger.instance = new ProxyLogger();
|
|
37
|
+
}
|
|
38
|
+
static getInstance() {
|
|
39
|
+
return ProxyLogger.instance;
|
|
40
|
+
}
|
|
41
|
+
createLogger(prefix) {
|
|
42
|
+
return new Proxy(createLogger(prefix), {
|
|
43
|
+
get: (target, prop)=>{
|
|
44
|
+
if (logLevel.includes(prop)) {
|
|
45
|
+
return function(...data) {
|
|
46
|
+
const loggingFn = prop;
|
|
47
|
+
const args = [
|
|
48
|
+
loggingFn,
|
|
49
|
+
prefix,
|
|
50
|
+
...data
|
|
51
|
+
];
|
|
52
|
+
ProxyLogger.getInstance().handleLog(...args);
|
|
53
|
+
target[loggingFn].call(this, ...[
|
|
54
|
+
data[0],
|
|
55
|
+
data[1]
|
|
56
|
+
]);
|
|
57
|
+
};
|
|
58
|
+
} else {
|
|
59
|
+
return target[prop];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
handleLog(type, prefix, message, data) {
|
|
65
|
+
this.logs.unshift({
|
|
66
|
+
type,
|
|
67
|
+
prefix,
|
|
68
|
+
message,
|
|
69
|
+
data,
|
|
70
|
+
timestamp: Date.now()
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
flushLogs() {
|
|
74
|
+
this.logs = [];
|
|
75
|
+
}
|
|
76
|
+
getLogs() {
|
|
77
|
+
return this.logs;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function getMinimumTrace(logs) {
|
|
81
|
+
const LOG_MESSAGE_CANDIDATE_PADDING = 5;
|
|
82
|
+
const minimumMessage = 'Minimum required block sizes for structured trace';
|
|
83
|
+
const minimumMessageIndex = logs.findIndex((log)=>log.message.includes(minimumMessage));
|
|
84
|
+
const candidateLogs = logs.slice(minimumMessageIndex - GATE_TYPES.length, minimumMessageIndex + LOG_MESSAGE_CANDIDATE_PADDING);
|
|
85
|
+
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);
|
|
86
|
+
const traceSizes = traceLogs.map((log)=>{
|
|
87
|
+
const [gateType, gateSizeStr] = log.replace(/\n.*\)$/, '').replace(/bb - /, '').split(':').map((s)=>s.trim());
|
|
88
|
+
const gateSize = parseInt(gateSizeStr);
|
|
89
|
+
assert(GATE_TYPES.includes(gateType), `Gate type ${gateType} is not recognized`);
|
|
90
|
+
return {
|
|
91
|
+
[gateType]: gateSize
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
assert(traceSizes.length === GATE_TYPES.length, 'Decoded trace sizes do not match expected amount of gate types');
|
|
95
|
+
return traceSizes.reduce((acc, curr)=>({
|
|
96
|
+
...acc,
|
|
97
|
+
...curr
|
|
98
|
+
}), {});
|
|
99
|
+
}
|
|
100
|
+
function getMaxMemory(logs) {
|
|
101
|
+
const candidateLogs = logs.slice(0, 100).filter((log)=>/\(mem: .*MiB\)/.test(log.message));
|
|
102
|
+
const usage = candidateLogs.map((log)=>{
|
|
103
|
+
const memStr = log ? log.message.slice(log.message.indexOf('(mem: ') + 6, log.message.indexOf('MiB') - 3) : '';
|
|
104
|
+
return memStr ? parseInt(memStr) : 0;
|
|
105
|
+
});
|
|
106
|
+
return Math.max(...usage);
|
|
107
|
+
}
|
|
108
|
+
export function generateBenchmark(flow, logs, stats, privateExecutionSteps, proverType, error) {
|
|
109
|
+
let maxMemory = 0;
|
|
110
|
+
let minimumTrace;
|
|
111
|
+
try {
|
|
112
|
+
minimumTrace = getMinimumTrace(logs);
|
|
113
|
+
maxMemory = getMaxMemory(logs);
|
|
114
|
+
} catch {
|
|
115
|
+
logger.warn(`Failed obtain minimum trace and max memory for ${flow}. Did you run with REAL_PROOFS=1?`);
|
|
116
|
+
}
|
|
117
|
+
const steps = privateExecutionSteps.reduce((acc, step, i)=>{
|
|
118
|
+
const previousAccGateCount = i === 0 ? 0 : acc[i - 1].accGateCount;
|
|
119
|
+
return [
|
|
120
|
+
...acc,
|
|
121
|
+
{
|
|
122
|
+
functionName: step.functionName,
|
|
123
|
+
gateCount: step.gateCount,
|
|
124
|
+
accGateCount: previousAccGateCount + step.gateCount,
|
|
125
|
+
time: step.timings.witgen,
|
|
126
|
+
oracles: Object.entries(step.timings.oracles ?? {}).reduce((acc, [oracleName, oracleData])=>{
|
|
127
|
+
const total = oracleData.times.reduce((sum, time)=>sum + time, 0);
|
|
128
|
+
const calls = oracleData.times.length;
|
|
129
|
+
acc[oracleName] = {
|
|
130
|
+
calls,
|
|
131
|
+
max: Math.max(...oracleData.times),
|
|
132
|
+
min: Math.min(...oracleData.times),
|
|
133
|
+
total,
|
|
134
|
+
avg: total / calls
|
|
135
|
+
};
|
|
136
|
+
return acc;
|
|
137
|
+
}, {})
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
}, []);
|
|
141
|
+
const timings = stats.timings;
|
|
142
|
+
const totalGateCount = steps[steps.length - 1].accGateCount;
|
|
143
|
+
return {
|
|
144
|
+
name: flow,
|
|
145
|
+
timings: {
|
|
146
|
+
total: timings.total,
|
|
147
|
+
sync: timings.sync,
|
|
148
|
+
proving: timings.proving,
|
|
149
|
+
unaccounted: timings.unaccounted,
|
|
150
|
+
witgen: timings.perFunction.reduce((acc, fn)=>acc + fn.time, 0)
|
|
151
|
+
},
|
|
152
|
+
rpc: Object.entries(stats.nodeRPCCalls ?? {}).reduce((acc, [RPCName, RPCCalls])=>{
|
|
153
|
+
const total = RPCCalls.times.reduce((sum, time)=>sum + time, 0);
|
|
154
|
+
const calls = RPCCalls.times.length;
|
|
155
|
+
acc[RPCName] = {
|
|
156
|
+
calls,
|
|
157
|
+
max: Math.max(...RPCCalls.times),
|
|
158
|
+
min: Math.min(...RPCCalls.times),
|
|
159
|
+
total,
|
|
160
|
+
avg: total / calls
|
|
161
|
+
};
|
|
162
|
+
return acc;
|
|
163
|
+
}, {}),
|
|
164
|
+
maxMemory,
|
|
165
|
+
proverType,
|
|
166
|
+
minimumTrace: minimumTrace,
|
|
167
|
+
totalGateCount: totalGateCount,
|
|
168
|
+
steps,
|
|
169
|
+
error
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export function convertProfileToGHBenchmark(benchmark) {
|
|
173
|
+
const totalRPCCalls = Object.values(benchmark.rpc).reduce((acc, call)=>acc + call.calls, 0);
|
|
174
|
+
const benches = [
|
|
175
|
+
{
|
|
176
|
+
name: `${benchmark.name}/witgen`,
|
|
177
|
+
value: benchmark.timings.witgen,
|
|
178
|
+
unit: 'ms'
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: `${benchmark.name}/total`,
|
|
182
|
+
value: benchmark.timings.total,
|
|
183
|
+
unit: 'ms'
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: `${benchmark.name}/sync`,
|
|
187
|
+
value: benchmark.timings.sync,
|
|
188
|
+
unit: 'ms'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: `${benchmark.name}/unaccounted`,
|
|
192
|
+
value: benchmark.timings.unaccounted,
|
|
193
|
+
unit: 'ms'
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: `${benchmark.name}/total_gate_count`,
|
|
197
|
+
value: benchmark.totalGateCount,
|
|
198
|
+
unit: 'gates'
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: `${benchmark.name}/rpc`,
|
|
202
|
+
value: totalRPCCalls,
|
|
203
|
+
unit: 'calls'
|
|
204
|
+
}
|
|
205
|
+
];
|
|
206
|
+
if (benchmark.timings.proving) {
|
|
207
|
+
benches.push({
|
|
208
|
+
name: `${benchmark.name}/proving`,
|
|
209
|
+
value: benchmark.timings.proving,
|
|
210
|
+
unit: 'ms'
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (benchmark.maxMemory) {
|
|
214
|
+
benches.push({
|
|
215
|
+
name: `${benchmark.name}/max_memory`,
|
|
216
|
+
value: benchmark.maxMemory,
|
|
217
|
+
unit: 'MiB'
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return benches;
|
|
221
|
+
}
|
|
222
|
+
export async function captureProfile(label, interaction, opts, expectedSteps) {
|
|
223
|
+
// Make sure the proxy logger starts from a clean slate
|
|
224
|
+
ProxyLogger.getInstance().flushLogs();
|
|
225
|
+
const result = await interaction.profile({
|
|
226
|
+
...opts,
|
|
227
|
+
profileMode: 'full',
|
|
228
|
+
skipProofGeneration: false
|
|
229
|
+
});
|
|
230
|
+
const logs = ProxyLogger.getInstance().getLogs();
|
|
231
|
+
if (expectedSteps !== undefined && result.executionSteps.length !== expectedSteps) {
|
|
232
|
+
throw new Error(`Expected ${expectedSteps} execution steps, got ${result.executionSteps.length}`);
|
|
233
|
+
}
|
|
234
|
+
const benchmark = generateBenchmark(label, logs, result.stats, result.executionSteps, 'wasm', undefined);
|
|
235
|
+
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
236
|
+
if (ivcFolder) {
|
|
237
|
+
logger.info(`Capturing client ivc execution profile for ${label}`);
|
|
238
|
+
const resultsDirectory = join(ivcFolder, label);
|
|
239
|
+
logger.info(`Writing private execution steps to ${resultsDirectory}`);
|
|
240
|
+
await mkdir(resultsDirectory, {
|
|
241
|
+
recursive: true
|
|
242
|
+
});
|
|
243
|
+
// Write the client IVC files read by the prover.
|
|
244
|
+
const ivcInputsPath = join(resultsDirectory, 'ivc-inputs.msgpack');
|
|
245
|
+
await writeFile(ivcInputsPath, serializePrivateExecutionSteps(result.executionSteps));
|
|
246
|
+
await writeFile(join(resultsDirectory, 'logs.json'), JSON.stringify(logs, null, 2));
|
|
247
|
+
await writeFile(join(resultsDirectory, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
|
|
248
|
+
logger.info(`Wrote private execution steps to ${resultsDirectory}`);
|
|
249
|
+
}
|
|
250
|
+
const benchOutput = process.env.BENCH_OUTPUT;
|
|
251
|
+
if (benchOutput) {
|
|
252
|
+
await mkdir(benchOutput, {
|
|
253
|
+
recursive: true
|
|
254
|
+
});
|
|
255
|
+
const ghBenchmark = convertProfileToGHBenchmark(benchmark);
|
|
256
|
+
const benchFile = join(benchOutput, `${label}.bench.json`);
|
|
257
|
+
await writeFile(benchFile, JSON.stringify(ghBenchmark));
|
|
258
|
+
logger.info(`Wrote benchmark to ${benchFile}`);
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
import { CheatCodes } from '@aztec/aztec/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' | 'fee_juice';
|
|
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
|
+
realProofs: boolean;
|
|
41
|
+
paymentMethods: Record<BenchmarkingFeePaymentMethod, {
|
|
42
|
+
forWallet: FeePaymentMethodGetter;
|
|
43
|
+
circuits: number;
|
|
44
|
+
}>;
|
|
45
|
+
config: ClientFlowsConfig;
|
|
46
|
+
private proxyLogger;
|
|
47
|
+
constructor(testName?: string, setupOptions?: Partial<SetupOptions & DeployL1ContractsArgs>);
|
|
48
|
+
setup(): Promise<this>;
|
|
49
|
+
teardown(): Promise<void>;
|
|
50
|
+
mintAndBridgeFeeJuice(address: AztecAddress): Promise<void>;
|
|
51
|
+
/** Admin mints bananaCoin tokens privately to the target address and redeems them. */
|
|
52
|
+
mintPrivateBananas(amount: bigint, address: AztecAddress): Promise<void>;
|
|
53
|
+
createBenchmarkingAccountManager(pxe: PXE, type: 'ecdsar1' | 'schnorr'): Promise<import("@aztec/aztec.js").AccountManager>;
|
|
54
|
+
applyBaseSnapshots(): Promise<void>;
|
|
55
|
+
applyInitialAccountsSnapshot(): Promise<void>;
|
|
56
|
+
applySetupFeeJuiceSnapshot(): Promise<void>;
|
|
57
|
+
applyDeployBananaTokenSnapshot(): Promise<void>;
|
|
58
|
+
applyDeployCandyBarTokenSnapshot(): Promise<void>;
|
|
59
|
+
applyFPCSetupSnapshot(): Promise<void>;
|
|
60
|
+
applyDeploySponsoredFPCSnapshot(): Promise<void>;
|
|
61
|
+
createCrossChainTestHarness(owner: AccountWallet): Promise<CrossChainTestHarness>;
|
|
62
|
+
createAndFundBenchmarkingWallet(accountType: AccountType): Promise<AccountWalletWithSecretKey>;
|
|
63
|
+
applyDeployAmmSnapshot(): Promise<void>;
|
|
64
|
+
getBridgedFeeJuicePaymentMethodForWallet(wallet: Wallet): Promise<FeeJuicePaymentMethodWithClaim>;
|
|
65
|
+
getPrivateFPCPaymentMethodForWallet(wallet: Wallet): Promise<PrivateFeePaymentMethod>;
|
|
66
|
+
getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet): Promise<SponsoredFeePaymentMethod>;
|
|
67
|
+
getFeeJuicePaymentMethodForWallet(wallet: Wallet): Promise<FeeJuicePaymentMethod>;
|
|
68
|
+
}
|
|
69
|
+
//# 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,0BAA0B,EAC1B,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,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,qBAAqB,EAA4D,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC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