@aztec/end-to-end 0.0.0-test.1 → 0.0.1-commit.023c3e5
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 +62 -0
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/benchmark.js +281 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +79 -0
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -0
- package/dest/bench/client_flows/client_flows_benchmark.js +321 -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 +79 -0
- package/dest/bench/utils.d.ts +16 -41
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +41 -72
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +26 -19
- 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 +114 -102
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +32 -32
- 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 +104 -104
- package/dest/e2e_deploy_contract/deploy_test.d.ts +19 -10
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +26 -27
- package/dest/e2e_epochs/epochs_test.d.ts +71 -22
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +260 -54
- 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 +61 -0
- package/dest/e2e_fees/fees_test.d.ts +38 -23
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +162 -183
- package/dest/e2e_l1_publisher/write_json.d.ts +11 -0
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -0
- package/dest/e2e_l1_publisher/write_json.js +56 -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 +15 -15
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +37 -41
- 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 +136 -0
- package/dest/e2e_p2p/p2p_network.d.ts +281 -27
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +237 -175
- package/dest/e2e_p2p/reqresp/utils.d.ts +22 -0
- package/dest/e2e_p2p/reqresp/utils.d.ts.map +1 -0
- package/dest/e2e_p2p/reqresp/utils.js +153 -0
- package/dest/e2e_p2p/shared.d.ts +44 -8
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +165 -27
- package/dest/e2e_token_contract/token_contract_test.d.ts +27 -14
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +96 -74
- package/dest/fixtures/e2e_prover_test.d.ts +55 -0
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -0
- package/dest/fixtures/e2e_prover_test.js +278 -0
- package/dest/fixtures/fixtures.d.ts +6 -8
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +5 -5
- package/dest/fixtures/get_acvm_config.d.ts +2 -2
- package/dest/fixtures/get_acvm_config.d.ts.map +1 -1
- package/dest/fixtures/get_acvm_config.js +3 -15
- package/dest/fixtures/get_bb_config.d.ts +2 -2
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +10 -17
- package/dest/fixtures/index.d.ts +1 -1
- package/dest/fixtures/l1_to_l2_messaging.d.ts +11 -7
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +45 -19
- package/dest/fixtures/logging.d.ts +1 -1
- package/dest/fixtures/setup.d.ts +218 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +695 -0
- package/dest/fixtures/setup_p2p_test.d.ts +15 -15
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +96 -31
- package/dest/fixtures/token_utils.d.ts +10 -4
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +31 -12
- package/dest/fixtures/utils.d.ts +5 -153
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -552
- package/dest/fixtures/web3signer.d.ts +5 -0
- package/dest/fixtures/web3signer.d.ts.map +1 -0
- package/dest/fixtures/web3signer.js +53 -0
- 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/index.d.ts +1 -1
- 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 +44 -27
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +105 -51
- package/dest/shared/gas_portal_test_harness.d.ts +33 -25
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +51 -30
- package/dest/shared/index.d.ts +2 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/jest_setup.d.ts +1 -1
- package/dest/shared/jest_setup.js +1 -1
- package/dest/shared/submit-transactions.d.ts +6 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +15 -16
- package/dest/shared/uniswap_l1_l2.d.ts +3 -25
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +176 -126
- package/dest/simulators/index.d.ts +1 -1
- package/dest/simulators/lending_simulator.d.ts +7 -7
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +17 -18
- package/dest/simulators/token_simulator.d.ts +6 -3
- 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 +27 -11
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +233 -62
- package/dest/spartan/tx_metrics.d.ts +88 -0
- package/dest/spartan/tx_metrics.d.ts.map +1 -0
- package/dest/spartan/tx_metrics.js +422 -0
- package/dest/spartan/utils/bot.d.ts +27 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +141 -0
- package/dest/spartan/utils/chaos.d.ts +79 -0
- package/dest/spartan/utils/chaos.d.ts.map +1 -0
- package/dest/spartan/utils/chaos.js +142 -0
- package/dest/spartan/utils/clients.d.ts +39 -0
- package/dest/spartan/utils/clients.d.ts.map +1 -0
- package/dest/spartan/utils/clients.js +90 -0
- package/dest/spartan/utils/config.d.ts +36 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +20 -0
- package/dest/spartan/utils/health.d.ts +63 -0
- package/dest/spartan/utils/health.d.ts.map +1 -0
- package/dest/spartan/utils/health.js +202 -0
- package/dest/spartan/utils/helm.d.ts +15 -0
- package/dest/spartan/utils/helm.d.ts.map +1 -0
- package/dest/spartan/utils/helm.js +47 -0
- package/dest/spartan/utils/index.d.ts +9 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +18 -0
- package/dest/spartan/utils/k8s.d.ts +126 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +375 -0
- package/dest/spartan/utils/nodes.d.ts +41 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/scripts.d.ts +16 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +66 -0
- package/dest/spartan/utils.d.ts +2 -415
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -445
- package/package.json +66 -58
- package/src/bench/client_flows/benchmark.ts +363 -0
- package/src/bench/client_flows/client_flows_benchmark.ts +384 -0
- package/src/bench/client_flows/config.ts +61 -0
- package/src/bench/client_flows/data_extractor.ts +89 -0
- package/src/bench/utils.ts +41 -85
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +134 -169
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +156 -182
- package/src/e2e_deploy_contract/deploy_test.ts +40 -48
- package/src/e2e_epochs/epochs_test.ts +341 -81
- package/src/e2e_fees/bridging_race.notest.ts +74 -0
- package/src/e2e_fees/fees_test.ts +220 -258
- package/src/e2e_l1_publisher/write_json.ts +77 -0
- package/src/e2e_multi_validator/utils.ts +258 -0
- package/src/e2e_nested_contract/nested_contract_test.ts +46 -59
- package/src/e2e_p2p/inactivity_slash_test.ts +179 -0
- package/src/e2e_p2p/p2p_network.ts +341 -234
- package/src/e2e_p2p/reqresp/utils.ts +207 -0
- package/src/e2e_p2p/shared.ts +260 -39
- package/src/e2e_token_contract/token_contract_test.ts +115 -126
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +336 -0
- package/src/fixtures/fixtures.ts +5 -7
- package/src/fixtures/get_acvm_config.ts +4 -12
- package/src/fixtures/get_bb_config.ts +18 -13
- package/src/fixtures/l1_to_l2_messaging.ts +56 -24
- package/src/fixtures/setup.ts +1017 -0
- package/src/fixtures/setup_p2p_test.ts +133 -50
- package/src/fixtures/token_utils.ts +33 -15
- package/src/fixtures/utils.ts +27 -820
- package/src/fixtures/web3signer.ts +63 -0
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +7 -15
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +2 -2
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +103 -91
- package/src/shared/gas_portal_test_harness.ts +59 -50
- package/src/shared/index.ts +1 -1
- package/src/shared/jest_setup.ts +1 -1
- package/src/shared/submit-transactions.ts +18 -20
- package/src/shared/uniswap_l1_l2.ts +197 -221
- package/src/simulators/lending_simulator.ts +16 -17
- package/src/simulators/token_simulator.ts +21 -13
- package/src/spartan/DEVELOP.md +128 -0
- package/src/spartan/setup_test_wallets.ts +308 -95
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +185 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +26 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +64 -0
- package/src/spartan/utils/k8s.ts +527 -0
- package/src/spartan/utils/nodes.ts +538 -0
- package/src/spartan/utils/scripts.ts +63 -0
- package/src/spartan/utils.ts +1 -582
- package/dest/e2e_prover/e2e_prover_test.d.ts +0 -56
- package/dest/e2e_prover/e2e_prover_test.d.ts.map +0 -1
- package/dest/e2e_prover/e2e_prover_test.js +0 -291
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
- 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 -87
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -479
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.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/e2e_prover/e2e_prover_test.ts +0 -418
- package/src/fixtures/setup_l1_contracts.ts +0 -27
- package/src/fixtures/snapshot_manager.ts +0 -617
- 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,384 @@
|
|
|
1
|
+
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
+
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
3
|
+
import { type FeePaymentMethod, PrivateFeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
4
|
+
import { type Logger, createLogger } from '@aztec/aztec.js/log';
|
|
5
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
6
|
+
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
7
|
+
import { CheatCodes } from '@aztec/aztec/testing';
|
|
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';
|
|
12
|
+
import { ChainMonitor } from '@aztec/ethereum/test';
|
|
13
|
+
import { randomBytes } from '@aztec/foundation/crypto/random';
|
|
14
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
15
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
16
|
+
import { TestERC20Abi } from '@aztec/l1-artifacts/TestERC20Abi';
|
|
17
|
+
import { TestERC20Bytecode } from '@aztec/l1-artifacts/TestERC20Bytecode';
|
|
18
|
+
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
19
|
+
import { FPCContract } from '@aztec/noir-contracts.js/FPC';
|
|
20
|
+
import { FeeJuiceContract } from '@aztec/noir-contracts.js/FeeJuice';
|
|
21
|
+
import { SponsoredFPCContract } from '@aztec/noir-contracts.js/SponsoredFPC';
|
|
22
|
+
import { TokenContract as BananaCoin, TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
23
|
+
import { ProtocolContractAddress } from '@aztec/protocol-contracts';
|
|
24
|
+
import { getCanonicalFeeJuice } from '@aztec/protocol-contracts/fee-juice';
|
|
25
|
+
import { type PXEConfig, getPXEConfig } from '@aztec/pxe/server';
|
|
26
|
+
import type { ContractInstanceWithAddress } from '@aztec/stdlib/contract';
|
|
27
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
28
|
+
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
29
|
+
import { TestWallet } from '@aztec/test-wallet/server';
|
|
30
|
+
|
|
31
|
+
import { MNEMONIC } from '../../fixtures/fixtures.js';
|
|
32
|
+
import { type EndToEndContext, type SetupOptions, deployAccounts, setup, teardown } from '../../fixtures/setup.js';
|
|
33
|
+
import { mintTokensToPrivate } from '../../fixtures/token_utils.js';
|
|
34
|
+
import { setupSponsoredFPC } from '../../fixtures/utils.js';
|
|
35
|
+
import { CrossChainTestHarness } from '../../shared/cross_chain_test_harness.js';
|
|
36
|
+
import {
|
|
37
|
+
FeeJuicePortalTestingHarnessFactory,
|
|
38
|
+
type GasBridgingTestHarness,
|
|
39
|
+
} from '../../shared/gas_portal_test_harness.js';
|
|
40
|
+
import { ProxyLogger } from './benchmark.js';
|
|
41
|
+
import { type ClientFlowsConfig, FULL_FLOWS_CONFIG, KEY_FLOWS_CONFIG } from './config.js';
|
|
42
|
+
|
|
43
|
+
const { BENCHMARK_CONFIG } = process.env;
|
|
44
|
+
|
|
45
|
+
export type AccountType = 'ecdsar1' | 'schnorr';
|
|
46
|
+
export type FeePaymentMethodGetter = (wallet: Wallet, sender: AztecAddress) => Promise<FeePaymentMethod | undefined>;
|
|
47
|
+
export type BenchmarkingFeePaymentMethod = 'bridged_fee_juice' | 'private_fpc' | 'sponsored_fpc' | 'fee_juice';
|
|
48
|
+
|
|
49
|
+
export class ClientFlowsBenchmark {
|
|
50
|
+
public logger: Logger;
|
|
51
|
+
public aztecNode!: AztecNode;
|
|
52
|
+
public cheatCodes!: CheatCodes;
|
|
53
|
+
public context!: EndToEndContext;
|
|
54
|
+
public chainMonitor!: ChainMonitor;
|
|
55
|
+
public feeJuiceBridgeTestHarness!: GasBridgingTestHarness;
|
|
56
|
+
public adminWallet!: TestWallet;
|
|
57
|
+
|
|
58
|
+
// The admin that aids in the setup of the test
|
|
59
|
+
public adminAddress!: AztecAddress;
|
|
60
|
+
|
|
61
|
+
// Aztec Node config
|
|
62
|
+
public sequencerAddress!: AztecAddress;
|
|
63
|
+
public coinbase!: EthAddress;
|
|
64
|
+
|
|
65
|
+
// Contracts
|
|
66
|
+
public feeJuiceContract!: FeeJuiceContract;
|
|
67
|
+
// Asset in which fees are paid via FPC
|
|
68
|
+
public bananaCoin!: BananaCoin;
|
|
69
|
+
public bananaCoinInstance!: ContractInstanceWithAddress;
|
|
70
|
+
public bananaFPC!: FPCContract;
|
|
71
|
+
public bananaFPCInstance!: ContractInstanceWithAddress;
|
|
72
|
+
// Random asset we want to trade
|
|
73
|
+
public candyBarCoin!: TokenContract;
|
|
74
|
+
public candyBarCoinInstance!: ContractInstanceWithAddress;
|
|
75
|
+
// AMM contract
|
|
76
|
+
public amm!: AMMContract;
|
|
77
|
+
public ammInstance!: ContractInstanceWithAddress;
|
|
78
|
+
// Liquidity token for AMM
|
|
79
|
+
public liquidityToken!: TokenContract;
|
|
80
|
+
public liquidityTokenInstance!: ContractInstanceWithAddress;
|
|
81
|
+
// Sponsored FPC contract
|
|
82
|
+
public sponsoredFPC!: SponsoredFPCContract;
|
|
83
|
+
public sponsoredFPCInstance!: ContractInstanceWithAddress;
|
|
84
|
+
|
|
85
|
+
// PXE and Wallet used by the benchmarking user. It can be set up with client-side proving enabled
|
|
86
|
+
public userWallet!: TestWallet;
|
|
87
|
+
|
|
88
|
+
public realProofs = ['true', '1'].includes(process.env.REAL_PROOFS ?? '');
|
|
89
|
+
|
|
90
|
+
public paymentMethods: Record<BenchmarkingFeePaymentMethod, { forWallet: FeePaymentMethodGetter; circuits: number }> =
|
|
91
|
+
{
|
|
92
|
+
// eslint-disable-next-line camelcase
|
|
93
|
+
bridged_fee_juice: {
|
|
94
|
+
forWallet: this.getBridgedFeeJuicePaymentMethodForWallet.bind(this),
|
|
95
|
+
circuits: 2, // FeeJuice claim + kernel inner
|
|
96
|
+
},
|
|
97
|
+
// eslint-disable-next-line camelcase
|
|
98
|
+
private_fpc: {
|
|
99
|
+
forWallet: this.getPrivateFPCPaymentMethodForWallet.bind(this),
|
|
100
|
+
circuits:
|
|
101
|
+
2 + // FPC entrypoint + kernel inner
|
|
102
|
+
2 + // BananaCoin transfer_to_public + kernel inner
|
|
103
|
+
2 + // Account verify_private_authwit + kernel inner
|
|
104
|
+
2, // BananaCoin prepare_private_balance_increase + kernel inner
|
|
105
|
+
},
|
|
106
|
+
// eslint-disable-next-line camelcase
|
|
107
|
+
sponsored_fpc: {
|
|
108
|
+
forWallet: this.getSponsoredFPCPaymentMethodForWallet.bind(this),
|
|
109
|
+
circuits: 2, // Sponsored FPC sponsor_unconditionally + kernel inner
|
|
110
|
+
},
|
|
111
|
+
// eslint-disable-next-line camelcase
|
|
112
|
+
fee_juice: {
|
|
113
|
+
forWallet: () => Promise.resolve(undefined),
|
|
114
|
+
circuits: 0,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
public config: ClientFlowsConfig;
|
|
119
|
+
|
|
120
|
+
private proxyLogger: ProxyLogger;
|
|
121
|
+
private setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs>;
|
|
122
|
+
|
|
123
|
+
constructor(testName?: string, setupOptions: Partial<SetupOptions & DeployAztecL1ContractsArgs> = {}) {
|
|
124
|
+
this.logger = createLogger(`bench:client_flows${testName ? `:${testName}` : ''}`);
|
|
125
|
+
this.setupOptions = { startProverNode: true, ...setupOptions };
|
|
126
|
+
this.config = BENCHMARK_CONFIG === 'key_flows' ? KEY_FLOWS_CONFIG : FULL_FLOWS_CONFIG;
|
|
127
|
+
ProxyLogger.create();
|
|
128
|
+
this.proxyLogger = ProxyLogger.getInstance();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async setup() {
|
|
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();
|
|
140
|
+
|
|
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
|
+
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async teardown() {
|
|
150
|
+
await this.chainMonitor.stop();
|
|
151
|
+
await teardown(this.context);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async mintAndBridgeFeeJuice(address: AztecAddress) {
|
|
155
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(address);
|
|
156
|
+
const { claimSecret: secret, messageLeafIndex: index } = claim;
|
|
157
|
+
await this.feeJuiceContract.methods
|
|
158
|
+
.claim(address, claim.claimAmount, secret, index)
|
|
159
|
+
.send({ from: this.adminAddress });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** Admin mints bananaCoin tokens privately to the target address and redeems them. */
|
|
163
|
+
async mintPrivateBananas(amount: bigint, address: AztecAddress) {
|
|
164
|
+
const balanceBefore = await this.bananaCoin.methods
|
|
165
|
+
.balance_of_private(address)
|
|
166
|
+
.simulate({ from: this.adminAddress });
|
|
167
|
+
|
|
168
|
+
await mintTokensToPrivate(this.bananaCoin, this.adminAddress, address, amount);
|
|
169
|
+
|
|
170
|
+
const balanceAfter = await this.bananaCoin.methods
|
|
171
|
+
.balance_of_private(address)
|
|
172
|
+
.simulate({ from: this.adminAddress });
|
|
173
|
+
expect(balanceAfter).toEqual(balanceBefore + amount);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
createBenchmarkingAccountManager(wallet: TestWallet, type: 'ecdsar1' | 'schnorr') {
|
|
177
|
+
const benchysSecret = Fr.random();
|
|
178
|
+
const salt = Fr.random();
|
|
179
|
+
|
|
180
|
+
let benchysPrivateSigningKey;
|
|
181
|
+
if (type === 'schnorr') {
|
|
182
|
+
benchysPrivateSigningKey = deriveSigningKey(benchysSecret);
|
|
183
|
+
return wallet.createSchnorrAccount(benchysSecret, salt, benchysPrivateSigningKey);
|
|
184
|
+
} else if (type === 'ecdsar1') {
|
|
185
|
+
benchysPrivateSigningKey = randomBytes(32);
|
|
186
|
+
return wallet.createECDSARAccount(benchysSecret, salt, benchysPrivateSigningKey);
|
|
187
|
+
} else {
|
|
188
|
+
throw new Error(`Unknown account type: ${type}`);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public async applyBaseSetup() {
|
|
193
|
+
await this.applyInitialAccounts();
|
|
194
|
+
await this.applySetupFeeJuice();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async applyInitialAccounts() {
|
|
198
|
+
this.logger.info('Applying initial accounts setup');
|
|
199
|
+
const { deployedAccounts } = await deployAccounts(
|
|
200
|
+
2,
|
|
201
|
+
this.logger,
|
|
202
|
+
)({
|
|
203
|
+
wallet: this.context.wallet,
|
|
204
|
+
initialFundedAccounts: this.context.initialFundedAccounts,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const [{ address: adminAddress }, { address: sequencerAddress }] = deployedAccounts;
|
|
208
|
+
|
|
209
|
+
this.adminWallet = this.context.wallet;
|
|
210
|
+
this.aztecNode = this.context.aztecNodeService!;
|
|
211
|
+
this.cheatCodes = this.context.cheatCodes;
|
|
212
|
+
|
|
213
|
+
this.adminAddress = adminAddress;
|
|
214
|
+
this.sequencerAddress = sequencerAddress;
|
|
215
|
+
|
|
216
|
+
const canonicalFeeJuice = await getCanonicalFeeJuice();
|
|
217
|
+
this.feeJuiceContract = FeeJuiceContract.at(canonicalFeeJuice.address, this.adminWallet);
|
|
218
|
+
this.coinbase = EthAddress.random();
|
|
219
|
+
|
|
220
|
+
const userPXEConfig = getPXEConfig();
|
|
221
|
+
const userPXEConfigWithContracts = {
|
|
222
|
+
...userPXEConfig,
|
|
223
|
+
proverEnabled: this.realProofs,
|
|
224
|
+
} as PXEConfig;
|
|
225
|
+
|
|
226
|
+
this.userWallet = await TestWallet.create(this.aztecNode, userPXEConfigWithContracts, {
|
|
227
|
+
loggers: {
|
|
228
|
+
prover: this.proxyLogger.createLogger('pxe:bb:wasm:bundle:proxied'),
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async applySetupFeeJuice() {
|
|
234
|
+
this.logger.info('Applying fee juice setup');
|
|
235
|
+
this.feeJuiceContract = FeeJuiceContract.at(ProtocolContractAddress.FeeJuice, this.adminWallet);
|
|
236
|
+
|
|
237
|
+
this.feeJuiceBridgeTestHarness = await FeeJuicePortalTestingHarnessFactory.create({
|
|
238
|
+
aztecNode: this.context.aztecNodeService!,
|
|
239
|
+
aztecNodeAdmin: this.context.aztecNodeService!,
|
|
240
|
+
l1Client: this.context.deployL1ContractsValues.l1Client,
|
|
241
|
+
wallet: this.adminWallet,
|
|
242
|
+
logger: this.logger,
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async applyDeployBananaToken() {
|
|
247
|
+
this.logger.info('Applying banana token deployment');
|
|
248
|
+
const { contract: bananaCoin, instance: bananaCoinInstance } = await BananaCoin.deploy(
|
|
249
|
+
this.adminWallet,
|
|
250
|
+
this.adminAddress,
|
|
251
|
+
'BC',
|
|
252
|
+
'BC',
|
|
253
|
+
18n,
|
|
254
|
+
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
255
|
+
this.logger.info(`BananaCoin deployed at ${bananaCoin.address}`);
|
|
256
|
+
this.bananaCoin = bananaCoin;
|
|
257
|
+
this.bananaCoinInstance = bananaCoinInstance;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async applyDeployCandyBarToken() {
|
|
261
|
+
this.logger.info('Applying candy bar token deployment');
|
|
262
|
+
const { contract: candyBarCoin, instance: candyBarCoinInstance } = await TokenContract.deploy(
|
|
263
|
+
this.adminWallet,
|
|
264
|
+
this.adminAddress,
|
|
265
|
+
'CBC',
|
|
266
|
+
'CBC',
|
|
267
|
+
18n,
|
|
268
|
+
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
269
|
+
this.logger.info(`CandyBarCoin deployed at ${candyBarCoin.address}`);
|
|
270
|
+
this.candyBarCoin = candyBarCoin;
|
|
271
|
+
this.candyBarCoinInstance = candyBarCoinInstance;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
public async applyFPCSetup() {
|
|
275
|
+
this.logger.info('Applying FPC setup');
|
|
276
|
+
const feeJuiceContract = this.feeJuiceBridgeTestHarness.feeJuice;
|
|
277
|
+
expect((await this.context.wallet.getContractMetadata(feeJuiceContract.address)).isContractPublished).toBe(true);
|
|
278
|
+
|
|
279
|
+
const bananaCoin = this.bananaCoin;
|
|
280
|
+
const { contract: bananaFPC, instance: bananaFPCInstance } = await FPCContract.deploy(
|
|
281
|
+
this.adminWallet,
|
|
282
|
+
bananaCoin.address,
|
|
283
|
+
this.adminAddress,
|
|
284
|
+
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
285
|
+
|
|
286
|
+
this.logger.info(`BananaPay deployed at ${bananaFPC.address}`);
|
|
287
|
+
|
|
288
|
+
await this.feeJuiceBridgeTestHarness.bridgeFromL1ToL2(bananaFPC.address, this.adminAddress);
|
|
289
|
+
|
|
290
|
+
this.bananaFPC = bananaFPC;
|
|
291
|
+
this.bananaFPCInstance = bananaFPCInstance;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async applyDeploySponsoredFPC() {
|
|
295
|
+
this.logger.info('Applying sponsored FPC deployment');
|
|
296
|
+
const sponsoredFPCInstance = await setupSponsoredFPC(this.adminWallet);
|
|
297
|
+
this.logger.info(`SponsoredFPC at ${sponsoredFPCInstance.address}`);
|
|
298
|
+
this.sponsoredFPC = SponsoredFPCContract.at(sponsoredFPCInstance.address, this.adminWallet);
|
|
299
|
+
this.sponsoredFPCInstance = sponsoredFPCInstance;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
public async createCrossChainTestHarness(owner: AztecAddress) {
|
|
303
|
+
const l1Client = createExtendedL1Client(this.context.config.l1RpcUrls, MNEMONIC);
|
|
304
|
+
|
|
305
|
+
const underlyingERC20Address = await deployL1Contract(l1Client, TestERC20Abi, TestERC20Bytecode, [
|
|
306
|
+
'Underlying',
|
|
307
|
+
'UND',
|
|
308
|
+
l1Client.account.address,
|
|
309
|
+
]).then(({ address }) => address);
|
|
310
|
+
|
|
311
|
+
this.logger.verbose(`Setting up cross chain harness...`);
|
|
312
|
+
const crossChainTestHarness = await CrossChainTestHarness.new(
|
|
313
|
+
this.aztecNode,
|
|
314
|
+
l1Client,
|
|
315
|
+
this.adminWallet,
|
|
316
|
+
owner,
|
|
317
|
+
this.logger,
|
|
318
|
+
underlyingERC20Address,
|
|
319
|
+
);
|
|
320
|
+
|
|
321
|
+
this.logger.verbose(`L2 token deployed to: ${crossChainTestHarness.l2Token.address}`);
|
|
322
|
+
|
|
323
|
+
return crossChainTestHarness;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
public async createAndFundBenchmarkingAccountOnUserWallet(accountType: AccountType) {
|
|
327
|
+
const benchysAccountManager = await this.createBenchmarkingAccountManager(this.adminWallet, accountType);
|
|
328
|
+
const benchysAccount = await benchysAccountManager.getAccount();
|
|
329
|
+
const benchysAddress = benchysAccountManager.address;
|
|
330
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(benchysAddress);
|
|
331
|
+
const behchysDeployMethod = await benchysAccountManager.getDeployMethod();
|
|
332
|
+
await behchysDeployMethod.send({
|
|
333
|
+
from: AztecAddress.ZERO,
|
|
334
|
+
fee: { paymentMethod: new FeeJuicePaymentMethodWithClaim(benchysAddress, claim) },
|
|
335
|
+
});
|
|
336
|
+
// Register benchy on the user's Wallet, where we're going to be interacting from
|
|
337
|
+
const accountManager = await this.userWallet.createAccount({
|
|
338
|
+
secret: benchysAccount.getSecretKey(),
|
|
339
|
+
salt: new Fr(benchysAccount.salt),
|
|
340
|
+
contract: benchysAccountManager.getAccountContract(),
|
|
341
|
+
});
|
|
342
|
+
return accountManager.address;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
public async applyDeployAmm() {
|
|
346
|
+
this.logger.info('Applying AMM deployment');
|
|
347
|
+
const { contract: liquidityToken, instance: liquidityTokenInstance } = await TokenContract.deploy(
|
|
348
|
+
this.adminWallet,
|
|
349
|
+
this.adminAddress,
|
|
350
|
+
'LPT',
|
|
351
|
+
'LPT',
|
|
352
|
+
18n,
|
|
353
|
+
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
354
|
+
const { contract: amm, instance: ammInstance } = await AMMContract.deploy(
|
|
355
|
+
this.adminWallet,
|
|
356
|
+
this.bananaCoin.address,
|
|
357
|
+
this.candyBarCoin.address,
|
|
358
|
+
liquidityToken.address,
|
|
359
|
+
).send({ from: this.adminAddress, wait: { returnReceipt: true } });
|
|
360
|
+
this.logger.info(`AMM deployed at ${amm.address}`);
|
|
361
|
+
await liquidityToken.methods.set_minter(amm.address, true).send({ from: this.adminAddress });
|
|
362
|
+
this.liquidityToken = liquidityToken;
|
|
363
|
+
this.liquidityTokenInstance = liquidityTokenInstance;
|
|
364
|
+
this.amm = amm;
|
|
365
|
+
this.ammInstance = ammInstance;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
public async getBridgedFeeJuicePaymentMethodForWallet(_wallet: Wallet, sender: AztecAddress) {
|
|
369
|
+
const claim = await this.feeJuiceBridgeTestHarness.prepareTokensOnL1(sender);
|
|
370
|
+
return new FeeJuicePaymentMethodWithClaim(sender, claim);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
public async getPrivateFPCPaymentMethodForWallet(wallet: Wallet, sender: AztecAddress) {
|
|
374
|
+
// The private fee paying method assembled on the app side requires knowledge of the maximum
|
|
375
|
+
// fee the user is willing to pay
|
|
376
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentMinFees()).mul(1.5);
|
|
377
|
+
const gasSettings = GasSettings.default({ maxFeesPerGas });
|
|
378
|
+
return new PrivateFeePaymentMethod(this.bananaFPC.address, sender, wallet, gasSettings);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
public getSponsoredFPCPaymentMethodForWallet(_wallet: Wallet, _sender: AztecAddress) {
|
|
382
|
+
return Promise.resolve(new SponsoredFeePaymentMethod(this.sponsoredFPC.address));
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AccountType, BenchmarkingFeePaymentMethod } from './client_flows_benchmark.js';
|
|
2
|
+
|
|
3
|
+
export type ClientFlowConfig = {
|
|
4
|
+
accounts: AccountType[];
|
|
5
|
+
feePaymentMethods: BenchmarkingFeePaymentMethod[];
|
|
6
|
+
recursions?: number[];
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type ClientFlows = 'accountDeployments' | 'deployments' | 'transfers' | 'bridging' | 'amm';
|
|
10
|
+
|
|
11
|
+
export type ClientFlowsConfig = {
|
|
12
|
+
[key in ClientFlows]: ClientFlowConfig;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const KEY_FLOWS_CONFIG: ClientFlowsConfig = {
|
|
16
|
+
accountDeployments: {
|
|
17
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
18
|
+
feePaymentMethods: ['sponsored_fpc'],
|
|
19
|
+
},
|
|
20
|
+
deployments: {
|
|
21
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
22
|
+
feePaymentMethods: ['sponsored_fpc'],
|
|
23
|
+
},
|
|
24
|
+
amm: {
|
|
25
|
+
accounts: ['ecdsar1'],
|
|
26
|
+
feePaymentMethods: ['sponsored_fpc'],
|
|
27
|
+
},
|
|
28
|
+
bridging: {
|
|
29
|
+
accounts: ['ecdsar1'],
|
|
30
|
+
feePaymentMethods: ['sponsored_fpc'],
|
|
31
|
+
},
|
|
32
|
+
transfers: {
|
|
33
|
+
accounts: ['ecdsar1'],
|
|
34
|
+
feePaymentMethods: ['sponsored_fpc', 'private_fpc'],
|
|
35
|
+
recursions: [0, 1],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const FULL_FLOWS_CONFIG: ClientFlowsConfig = {
|
|
40
|
+
accountDeployments: {
|
|
41
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
42
|
+
feePaymentMethods: ['bridged_fee_juice', 'sponsored_fpc'],
|
|
43
|
+
},
|
|
44
|
+
deployments: {
|
|
45
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
46
|
+
feePaymentMethods: ['bridged_fee_juice', 'sponsored_fpc'],
|
|
47
|
+
},
|
|
48
|
+
amm: {
|
|
49
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
50
|
+
feePaymentMethods: ['sponsored_fpc', 'private_fpc'],
|
|
51
|
+
},
|
|
52
|
+
bridging: {
|
|
53
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
54
|
+
feePaymentMethods: ['sponsored_fpc', 'private_fpc'],
|
|
55
|
+
},
|
|
56
|
+
transfers: {
|
|
57
|
+
accounts: ['ecdsar1', 'schnorr'],
|
|
58
|
+
feePaymentMethods: ['sponsored_fpc', 'private_fpc'],
|
|
59
|
+
recursions: [0, 1, 2],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { BBBundlePrivateKernelProver } from '@aztec/bb-prover/client/bundle';
|
|
2
|
+
import { createLogger, logger } from '@aztec/foundation/log';
|
|
3
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
4
|
+
import { WASMSimulator } from '@aztec/simulator/client';
|
|
5
|
+
import type { PrivateExecutionStep } from '@aztec/stdlib/kernel';
|
|
6
|
+
import type { ProvingStats, ProvingTimings, SimulationStats } from '@aztec/stdlib/tx';
|
|
7
|
+
|
|
8
|
+
import { Decoder } from 'msgpackr';
|
|
9
|
+
import { readFile, readdir, writeFile } from 'node:fs/promises';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
import { type Log, ProxyLogger, generateBenchmark } from './benchmark.js';
|
|
13
|
+
|
|
14
|
+
async function main() {
|
|
15
|
+
ProxyLogger.create();
|
|
16
|
+
const proxyLogger = ProxyLogger.getInstance();
|
|
17
|
+
const ivcFolder = process.env.CAPTURE_IVC_FOLDER;
|
|
18
|
+
if (!ivcFolder) {
|
|
19
|
+
throw new Error('CAPTURE_IVC_FOLDER is not set');
|
|
20
|
+
}
|
|
21
|
+
const flows = await readdir(ivcFolder);
|
|
22
|
+
logger.info(`Flows in ${ivcFolder}: \n${flows.map(flowName => `\t- ${flowName}`).join('\n')}`);
|
|
23
|
+
const simulator = new WASMSimulator();
|
|
24
|
+
const log = proxyLogger.createLogger('bb:prover');
|
|
25
|
+
const prover = new BBBundlePrivateKernelProver(simulator, { logger: log });
|
|
26
|
+
|
|
27
|
+
const userLog = createLogger('chonk_flows:data_processor');
|
|
28
|
+
|
|
29
|
+
for (const flow of flows) {
|
|
30
|
+
userLog.info(`Processing flow ${flow}`);
|
|
31
|
+
const ivcInputs = await readFile(join(ivcFolder, flow, 'ivc-inputs.msgpack'));
|
|
32
|
+
const stepsFromFile: PrivateExecutionStep[] = new Decoder({ useRecords: false }).unpack(ivcInputs);
|
|
33
|
+
const witnesses = await readFile(join(ivcFolder, flow, 'witnesses.json'));
|
|
34
|
+
|
|
35
|
+
const witnessStack = JSON.parse(witnesses.toString()).map((witnessMap: Record<string, string>) => {
|
|
36
|
+
return new Map<number, string>(Object.entries(witnessMap).map(([k, v]) => [Number(k), v]));
|
|
37
|
+
});
|
|
38
|
+
const profileFile = await readFile(join(ivcFolder, flow, 'profile.json'));
|
|
39
|
+
const profile = JSON.parse(profileFile.toString()) as {
|
|
40
|
+
stats: ProvingStats | SimulationStats;
|
|
41
|
+
steps: {
|
|
42
|
+
functionName: string;
|
|
43
|
+
gateCount: number;
|
|
44
|
+
timings: { witgen: number; gateCount: number };
|
|
45
|
+
}[];
|
|
46
|
+
};
|
|
47
|
+
const privateExecutionSteps: PrivateExecutionStep[] = profile.steps.map((step, i) => ({
|
|
48
|
+
functionName: step.functionName,
|
|
49
|
+
gateCount: step.gateCount,
|
|
50
|
+
bytecode: stepsFromFile[i].bytecode,
|
|
51
|
+
// TODO(AD) do we still want to take this from witness.json?
|
|
52
|
+
witness: witnessStack[i],
|
|
53
|
+
vk: stepsFromFile[i].vk,
|
|
54
|
+
timings: {
|
|
55
|
+
witgen: step.timings.witgen,
|
|
56
|
+
gateCount: step.timings.gateCount,
|
|
57
|
+
},
|
|
58
|
+
}));
|
|
59
|
+
|
|
60
|
+
let error: any;
|
|
61
|
+
let currentLogs: Log[] = [];
|
|
62
|
+
let provingTime;
|
|
63
|
+
try {
|
|
64
|
+
const provingTimer = new Timer();
|
|
65
|
+
await prover.createChonkProof(privateExecutionSteps);
|
|
66
|
+
provingTime = provingTimer.ms();
|
|
67
|
+
} catch (e) {
|
|
68
|
+
userLog.error(`Failed to generate chonk proof for ${flow}`, e);
|
|
69
|
+
error = (e as Error).message;
|
|
70
|
+
}
|
|
71
|
+
// Extract logs from this run from the proxy and write them to disk unconditionally
|
|
72
|
+
currentLogs = proxyLogger.getLogs();
|
|
73
|
+
await writeFile(join(ivcFolder, flow, 'logs.json'), JSON.stringify(currentLogs, null, 2));
|
|
74
|
+
if (!(profile.stats.timings as ProvingTimings).proving) {
|
|
75
|
+
(profile.stats.timings as ProvingTimings).proving = provingTime;
|
|
76
|
+
}
|
|
77
|
+
const benchmark = generateBenchmark(flow, currentLogs, profile.stats, privateExecutionSteps, 'native', error);
|
|
78
|
+
await writeFile(join(ivcFolder, flow, 'benchmark.json'), JSON.stringify(benchmark, null, 2));
|
|
79
|
+
proxyLogger.flushLogs();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
await main();
|
|
85
|
+
} catch (e) {
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
87
|
+
console.error(e);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|