@aztec/end-to-end 0.0.1-commit.9b94fc1 → 0.0.1-commit.9ee6fcc6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bench/client_flows/benchmark.d.ts +3 -2
- package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/benchmark.js +21 -1
- package/dest/bench/client_flows/client_flows_benchmark.d.ts +15 -16
- package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
- package/dest/bench/client_flows/client_flows_benchmark.js +136 -141
- package/dest/bench/client_flows/config.d.ts +2 -2
- package/dest/bench/client_flows/config.d.ts.map +1 -1
- package/dest/bench/client_flows/config.js +18 -0
- package/dest/bench/client_flows/data_extractor.js +3 -1
- package/dest/bench/utils.d.ts +9 -8
- package/dest/bench/utils.d.ts.map +1 -1
- package/dest/bench/utils.js +31 -19
- package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +9 -8
- 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 +107 -113
- package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +20 -14
- 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 +92 -71
- package/dest/e2e_deploy_contract/deploy_test.d.ts +5 -4
- package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
- package/dest/e2e_deploy_contract/deploy_test.js +18 -13
- package/dest/e2e_epochs/epochs_test.d.ts +27 -15
- package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
- package/dest/e2e_epochs/epochs_test.js +104 -52
- package/dest/e2e_fees/bridging_race.notest.js +4 -6
- package/dest/e2e_fees/fees_test.d.ts +21 -17
- package/dest/e2e_fees/fees_test.d.ts.map +1 -1
- package/dest/e2e_fees/fees_test.js +137 -145
- package/dest/e2e_l1_publisher/write_json.d.ts +4 -3
- package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
- package/dest/e2e_l1_publisher/write_json.js +14 -16
- package/dest/e2e_multi_validator/utils.js +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.d.ts +6 -9
- package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
- package/dest/e2e_nested_contract/nested_contract_test.js +30 -40
- package/dest/e2e_p2p/inactivity_slash_test.d.ts +4 -4
- package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
- package/dest/e2e_p2p/inactivity_slash_test.js +6 -9
- package/dest/e2e_p2p/p2p_network.d.ts +17 -14
- package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
- package/dest/e2e_p2p/p2p_network.js +141 -115
- 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 +190 -0
- package/dest/e2e_p2p/shared.d.ts +27 -7
- package/dest/e2e_p2p/shared.d.ts.map +1 -1
- package/dest/e2e_p2p/shared.js +50 -22
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts +2 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fetcher.js +184 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts +18 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.d.ts.map +1 -0
- package/dest/e2e_storage_proof/fixtures/storage_proof_fixture.js +120 -0
- package/dest/e2e_token_contract/token_contract_test.d.ts +19 -10
- package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
- package/dest/e2e_token_contract/token_contract_test.js +100 -92
- package/dest/fixtures/authwit_proxy.d.ts +15 -0
- package/dest/fixtures/authwit_proxy.d.ts.map +1 -0
- package/dest/fixtures/authwit_proxy.js +30 -0
- package/dest/fixtures/e2e_prover_test.d.ts +16 -23
- package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
- package/dest/fixtures/e2e_prover_test.js +117 -138
- package/dest/fixtures/elu_monitor.d.ts +21 -0
- package/dest/fixtures/elu_monitor.d.ts.map +1 -0
- package/dest/fixtures/elu_monitor.js +102 -0
- package/dest/fixtures/fixtures.d.ts +6 -3
- package/dest/fixtures/fixtures.d.ts.map +1 -1
- package/dest/fixtures/fixtures.js +8 -3
- package/dest/fixtures/get_acvm_config.js +1 -1
- package/dest/fixtures/get_bb_config.d.ts +1 -1
- package/dest/fixtures/get_bb_config.d.ts.map +1 -1
- package/dest/fixtures/get_bb_config.js +5 -5
- package/dest/fixtures/ha_setup.d.ts +71 -0
- package/dest/fixtures/ha_setup.d.ts.map +1 -0
- package/dest/fixtures/ha_setup.js +116 -0
- package/dest/fixtures/index.d.ts +2 -1
- package/dest/fixtures/index.d.ts.map +1 -1
- package/dest/fixtures/index.js +1 -0
- package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
- package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
- package/dest/fixtures/l1_to_l2_messaging.js +2 -2
- package/dest/fixtures/setup.d.ts +239 -0
- package/dest/fixtures/setup.d.ts.map +1 -0
- package/dest/fixtures/setup.js +608 -0
- package/dest/fixtures/setup_p2p_test.d.ts +16 -9
- package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
- package/dest/fixtures/setup_p2p_test.js +43 -32
- package/dest/fixtures/token_utils.d.ts +2 -2
- package/dest/fixtures/token_utils.d.ts.map +1 -1
- package/dest/fixtures/token_utils.js +12 -8
- package/dest/fixtures/utils.d.ts +5 -637
- package/dest/fixtures/utils.d.ts.map +1 -1
- package/dest/fixtures/utils.js +4 -647
- package/dest/fixtures/web3signer.js +1 -1
- package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
- package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
- package/dest/fixtures/with_telemetry_utils.js +2 -2
- package/dest/quality_of_service/grafana_client.d.ts +41 -0
- package/dest/quality_of_service/grafana_client.d.ts.map +1 -0
- package/dest/quality_of_service/{alert_checker.js → grafana_client.js} +1 -1
- package/dest/quality_of_service/prometheus_client.d.ts +38 -0
- package/dest/quality_of_service/prometheus_client.d.ts.map +1 -0
- package/dest/quality_of_service/prometheus_client.js +67 -0
- package/dest/shared/cross_chain_test_harness.d.ts +18 -6
- package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
- package/dest/shared/cross_chain_test_harness.js +27 -27
- package/dest/shared/gas_portal_test_harness.d.ts +12 -2
- package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
- package/dest/shared/gas_portal_test_harness.js +3 -3
- package/dest/shared/index.d.ts +3 -2
- package/dest/shared/index.d.ts.map +1 -1
- package/dest/shared/index.js +1 -0
- package/dest/shared/jest_setup.js +41 -1
- package/dest/shared/mock_state_view.d.ts +86 -0
- package/dest/shared/mock_state_view.d.ts.map +1 -0
- package/dest/shared/mock_state_view.js +186 -0
- package/dest/shared/submit-transactions.d.ts +4 -4
- package/dest/shared/submit-transactions.d.ts.map +1 -1
- package/dest/shared/submit-transactions.js +9 -11
- package/dest/shared/uniswap_l1_l2.d.ts +3 -27
- package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
- package/dest/shared/uniswap_l1_l2.js +58 -39
- package/dest/simulators/lending_simulator.d.ts +6 -2
- package/dest/simulators/lending_simulator.d.ts.map +1 -1
- package/dest/simulators/lending_simulator.js +6 -6
- package/dest/simulators/token_simulator.d.ts +1 -1
- package/dest/simulators/token_simulator.d.ts.map +1 -1
- package/dest/simulators/token_simulator.js +3 -24
- package/dest/spartan/setup_test_wallets.d.ts +15 -5
- package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
- package/dest/spartan/setup_test_wallets.js +109 -38
- 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 +28 -0
- package/dest/spartan/utils/bot.d.ts.map +1 -0
- package/dest/spartan/utils/bot.js +142 -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 +45 -0
- package/dest/spartan/utils/config.d.ts.map +1 -0
- package/dest/spartan/utils/config.js +23 -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 +11 -0
- package/dest/spartan/utils/index.d.ts.map +1 -0
- package/dest/spartan/utils/index.js +22 -0
- package/dest/spartan/utils/k8s.d.ts +128 -0
- package/dest/spartan/utils/k8s.d.ts.map +1 -0
- package/dest/spartan/utils/k8s.js +381 -0
- package/dest/spartan/utils/nodes.d.ts +40 -0
- package/dest/spartan/utils/nodes.d.ts.map +1 -0
- package/dest/spartan/utils/nodes.js +461 -0
- package/dest/spartan/utils/pod_logs.d.ts +25 -0
- package/dest/spartan/utils/pod_logs.d.ts.map +1 -0
- package/dest/spartan/utils/pod_logs.js +74 -0
- package/dest/spartan/utils/scripts.d.ts +30 -0
- package/dest/spartan/utils/scripts.d.ts.map +1 -0
- package/dest/spartan/utils/scripts.js +81 -0
- package/dest/spartan/utils.d.ts +2 -218
- package/dest/spartan/utils.d.ts.map +1 -1
- package/dest/spartan/utils.js +1 -749
- package/dest/test-wallet/test_wallet.d.ts +76 -0
- package/dest/test-wallet/test_wallet.d.ts.map +1 -0
- package/dest/test-wallet/test_wallet.js +214 -0
- package/dest/test-wallet/utils.d.ts +41 -0
- package/dest/test-wallet/utils.d.ts.map +1 -0
- package/dest/test-wallet/utils.js +71 -0
- package/dest/test-wallet/wallet_worker_script.d.ts +2 -0
- package/dest/test-wallet/wallet_worker_script.d.ts.map +1 -0
- package/dest/test-wallet/wallet_worker_script.js +48 -0
- package/dest/test-wallet/worker_wallet.d.ts +52 -0
- package/dest/test-wallet/worker_wallet.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet.js +151 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts +274 -0
- package/dest/test-wallet/worker_wallet_schema.d.ts.map +1 -0
- package/dest/test-wallet/worker_wallet_schema.js +10 -0
- package/package.json +48 -45
- package/src/bench/client_flows/benchmark.ts +24 -2
- package/src/bench/client_flows/client_flows_benchmark.ts +156 -215
- package/src/bench/client_flows/config.ts +9 -1
- package/src/bench/client_flows/data_extractor.ts +1 -1
- package/src/bench/utils.ts +36 -21
- package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +120 -145
- package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +140 -126
- package/src/e2e_deploy_contract/deploy_test.ts +22 -15
- package/src/e2e_epochs/epochs_test.ts +172 -111
- package/src/e2e_fees/bridging_race.notest.ts +5 -11
- package/src/e2e_fees/fees_test.ts +178 -228
- package/src/e2e_l1_publisher/write_json.ts +16 -16
- package/src/e2e_multi_validator/utils.ts +1 -1
- package/src/e2e_nested_contract/nested_contract_test.ts +35 -56
- package/src/e2e_p2p/inactivity_slash_test.ts +7 -10
- package/src/e2e_p2p/p2p_network.ts +204 -181
- package/src/e2e_p2p/reqresp/utils.ts +256 -0
- package/src/e2e_p2p/shared.ts +87 -29
- package/src/e2e_storage_proof/fixtures/storage_proof.json +915 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts +190 -0
- package/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts +173 -0
- package/src/e2e_token_contract/token_contract_test.ts +121 -119
- package/src/fixtures/authwit_proxy.ts +50 -0
- package/src/fixtures/dumps/epoch_proof_result.json +1 -1
- package/src/fixtures/e2e_prover_test.ts +141 -188
- package/src/fixtures/elu_monitor.ts +126 -0
- package/src/fixtures/fixtures.ts +12 -5
- package/src/fixtures/get_acvm_config.ts +1 -1
- package/src/fixtures/get_bb_config.ts +7 -6
- package/src/fixtures/ha_setup.ts +186 -0
- package/src/fixtures/index.ts +1 -0
- package/src/fixtures/l1_to_l2_messaging.ts +4 -2
- package/src/fixtures/setup.ts +905 -0
- package/src/fixtures/setup_p2p_test.ts +43 -47
- package/src/fixtures/token_utils.ts +10 -6
- package/src/fixtures/utils.ts +27 -966
- package/src/fixtures/web3signer.ts +1 -1
- package/src/fixtures/with_telemetry_utils.ts +2 -2
- package/src/guides/up_quick_start.sh +3 -3
- package/src/quality_of_service/{alert_checker.ts → grafana_client.ts} +1 -1
- package/src/quality_of_service/prometheus_client.ts +113 -0
- package/src/shared/cross_chain_test_harness.ts +30 -43
- package/src/shared/gas_portal_test_harness.ts +3 -3
- package/src/shared/index.ts +2 -1
- package/src/shared/jest_setup.ts +51 -1
- package/src/shared/mock_state_view.ts +188 -0
- package/src/shared/submit-transactions.ts +11 -16
- package/src/shared/uniswap_l1_l2.ts +86 -102
- package/src/simulators/lending_simulator.ts +11 -7
- package/src/simulators/token_simulator.ts +6 -30
- package/src/spartan/DEVELOP.md +7 -0
- package/src/spartan/setup_test_wallets.ts +167 -27
- package/src/spartan/tx_metrics.ts +376 -0
- package/src/spartan/utils/bot.ts +188 -0
- package/src/spartan/utils/chaos.ts +253 -0
- package/src/spartan/utils/clients.ts +100 -0
- package/src/spartan/utils/config.ts +29 -0
- package/src/spartan/utils/health.ts +255 -0
- package/src/spartan/utils/helm.ts +84 -0
- package/src/spartan/utils/index.ts +71 -0
- package/src/spartan/utils/k8s.ts +535 -0
- package/src/spartan/utils/nodes.ts +543 -0
- package/src/spartan/utils/pod_logs.ts +99 -0
- package/src/spartan/utils/scripts.ts +99 -0
- package/src/spartan/utils.ts +1 -942
- package/src/test-wallet/test_wallet.ts +294 -0
- package/src/test-wallet/utils.ts +112 -0
- package/src/test-wallet/wallet_worker_script.ts +60 -0
- package/src/test-wallet/worker_wallet.ts +213 -0
- package/src/test-wallet/worker_wallet_schema.ts +13 -0
- package/dest/fixtures/setup_l1_contracts.d.ts +0 -477
- package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
- package/dest/fixtures/setup_l1_contracts.js +0 -17
- package/dest/fixtures/snapshot_manager.d.ts +0 -95
- package/dest/fixtures/snapshot_manager.d.ts.map +0 -1
- package/dest/fixtures/snapshot_manager.js +0 -505
- package/dest/quality_of_service/alert_checker.d.ts +0 -41
- package/dest/quality_of_service/alert_checker.d.ts.map +0 -1
- package/src/fixtures/setup_l1_contracts.ts +0 -26
- package/src/fixtures/snapshot_manager.ts +0 -665
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { generateSchnorrAccounts } from '@aztec/accounts/testing';
|
|
2
2
|
import { AztecAddress } from '@aztec/aztec.js/addresses';
|
|
3
|
+
import { NO_WAIT } from '@aztec/aztec.js/contracts';
|
|
3
4
|
import { L1FeeJuicePortalManager } from '@aztec/aztec.js/ethereum';
|
|
4
5
|
import { FeeJuicePaymentMethodWithClaim } from '@aztec/aztec.js/fee';
|
|
5
6
|
import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.js/fee';
|
|
6
7
|
import { Fr } from '@aztec/aztec.js/fields';
|
|
7
|
-
import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
|
|
8
|
+
import { type AztecNode, createAztecNodeClient, waitForTx } from '@aztec/aztec.js/node';
|
|
8
9
|
import type { Wallet } from '@aztec/aztec.js/wallet';
|
|
9
|
-
import { createEthereumChain
|
|
10
|
+
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
11
|
+
import { createExtendedL1Client } from '@aztec/ethereum/client';
|
|
10
12
|
import type { Logger } from '@aztec/foundation/log';
|
|
11
13
|
import { retryUntil } from '@aztec/foundation/retry';
|
|
12
14
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
13
15
|
import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
14
|
-
import {
|
|
16
|
+
import { registerInitialLocalNetworkAccountsInWallet } from '@aztec/wallets/testing';
|
|
15
17
|
|
|
16
18
|
import { getACVMConfig } from '../fixtures/get_acvm_config.js';
|
|
17
19
|
import { getBBConfig } from '../fixtures/get_bb_config.js';
|
|
18
20
|
import { getSponsoredFPCAddress, registerSponsoredFPC } from '../fixtures/utils.js';
|
|
21
|
+
import { TestWallet } from '../test-wallet/test_wallet.js';
|
|
22
|
+
import { proveInteraction } from '../test-wallet/utils.js';
|
|
23
|
+
import { WorkerWallet } from '../test-wallet/worker_wallet.js';
|
|
19
24
|
|
|
20
25
|
export interface TestAccounts {
|
|
21
26
|
aztecNode: AztecNode;
|
|
@@ -83,11 +88,19 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
83
88
|
|
|
84
89
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
85
90
|
const recipientDeployMethod = await recipientAccount.getDeployMethod();
|
|
86
|
-
await recipientDeployMethod.send({
|
|
91
|
+
await recipientDeployMethod.send({
|
|
92
|
+
from: AztecAddress.ZERO,
|
|
93
|
+
fee: { paymentMethod },
|
|
94
|
+
wait: { timeout: 2400 },
|
|
95
|
+
});
|
|
87
96
|
await Promise.all(
|
|
88
97
|
fundedAccounts.map(async a => {
|
|
89
98
|
const deployMethod = await a.getDeployMethod();
|
|
90
|
-
await deployMethod.send({
|
|
99
|
+
await deployMethod.send({
|
|
100
|
+
from: AztecAddress.ZERO,
|
|
101
|
+
fee: { paymentMethod },
|
|
102
|
+
wait: { timeout: 2400 },
|
|
103
|
+
}); // increase timeout on purpose in order to account for two empty epochs
|
|
91
104
|
logger.info(`Account deployed at ${a.address}`);
|
|
92
105
|
}),
|
|
93
106
|
);
|
|
@@ -115,11 +128,84 @@ export async function deploySponsoredTestAccountsWithTokens(
|
|
|
115
128
|
};
|
|
116
129
|
}
|
|
117
130
|
|
|
131
|
+
async function deployAccountWithDiagnostics(
|
|
132
|
+
account: { getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>; address: any },
|
|
133
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
134
|
+
aztecNode: AztecNode,
|
|
135
|
+
logger: Logger,
|
|
136
|
+
accountLabel: string,
|
|
137
|
+
estimateGas?: boolean,
|
|
138
|
+
): Promise<void> {
|
|
139
|
+
const deployMethod = await account.getDeployMethod();
|
|
140
|
+
let txHash;
|
|
141
|
+
try {
|
|
142
|
+
let gasSettings;
|
|
143
|
+
if (estimateGas) {
|
|
144
|
+
const sim = await deployMethod.simulate({ from: AztecAddress.ZERO, fee: { paymentMethod } });
|
|
145
|
+
gasSettings = sim.estimatedGas;
|
|
146
|
+
logger.info(`${accountLabel} estimated gas: DA=${gasSettings.gasLimits.daGas} L2=${gasSettings.gasLimits.l2Gas}`);
|
|
147
|
+
}
|
|
148
|
+
const deployResult = await deployMethod.send({
|
|
149
|
+
from: AztecAddress.ZERO,
|
|
150
|
+
fee: { paymentMethod, gasSettings },
|
|
151
|
+
wait: NO_WAIT,
|
|
152
|
+
});
|
|
153
|
+
txHash = deployResult.txHash;
|
|
154
|
+
await waitForTx(aztecNode, txHash, { timeout: 2400 });
|
|
155
|
+
logger.info(`${accountLabel} deployed at ${account.address}`);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
const blockNumber = await aztecNode.getBlockNumber();
|
|
158
|
+
let receipt;
|
|
159
|
+
try {
|
|
160
|
+
receipt = await aztecNode.getTxReceipt(txHash);
|
|
161
|
+
} catch {
|
|
162
|
+
receipt = 'unavailable';
|
|
163
|
+
}
|
|
164
|
+
logger.error(`${accountLabel} deployment failed`, {
|
|
165
|
+
txHash: txHash.toString(),
|
|
166
|
+
receipt: JSON.stringify(receipt),
|
|
167
|
+
currentBlockNumber: blockNumber,
|
|
168
|
+
error: String(error),
|
|
169
|
+
});
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function deployAccountsInBatches(
|
|
175
|
+
accounts: {
|
|
176
|
+
getDeployMethod: () => Promise<{ simulate: (opts: any) => any; send: (opts: any) => any }>;
|
|
177
|
+
address: any;
|
|
178
|
+
}[],
|
|
179
|
+
paymentMethod: SponsoredFeePaymentMethod,
|
|
180
|
+
aztecNode: AztecNode,
|
|
181
|
+
logger: Logger,
|
|
182
|
+
labelPrefix: string,
|
|
183
|
+
batchSize = 2,
|
|
184
|
+
estimateGas?: boolean,
|
|
185
|
+
): Promise<void> {
|
|
186
|
+
for (let i = 0; i < accounts.length; i += batchSize) {
|
|
187
|
+
const batch = accounts.slice(i, i + batchSize);
|
|
188
|
+
await Promise.all(
|
|
189
|
+
batch.map((account, idx) =>
|
|
190
|
+
deployAccountWithDiagnostics(
|
|
191
|
+
account,
|
|
192
|
+
paymentMethod,
|
|
193
|
+
aztecNode,
|
|
194
|
+
logger,
|
|
195
|
+
`${labelPrefix}${i + idx + 1}`,
|
|
196
|
+
estimateGas,
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
118
203
|
export async function deploySponsoredTestAccounts(
|
|
119
204
|
wallet: TestWallet,
|
|
120
205
|
aztecNode: AztecNode,
|
|
121
206
|
logger: Logger,
|
|
122
207
|
numberOfFundedWallets = 1,
|
|
208
|
+
opts?: { estimateGas?: boolean },
|
|
123
209
|
): Promise<TestAccountsWithoutTokens> {
|
|
124
210
|
const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
|
|
125
211
|
const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
|
|
@@ -128,14 +214,23 @@ export async function deploySponsoredTestAccounts(
|
|
|
128
214
|
await registerSponsoredFPC(wallet);
|
|
129
215
|
|
|
130
216
|
const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
|
|
131
|
-
|
|
132
|
-
await
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
217
|
+
|
|
218
|
+
await deployAccountWithDiagnostics(
|
|
219
|
+
recipientAccount,
|
|
220
|
+
paymentMethod,
|
|
221
|
+
aztecNode,
|
|
222
|
+
logger,
|
|
223
|
+
'Recipient account',
|
|
224
|
+
opts?.estimateGas,
|
|
225
|
+
);
|
|
226
|
+
await deployAccountsInBatches(
|
|
227
|
+
fundedAccounts,
|
|
228
|
+
paymentMethod,
|
|
229
|
+
aztecNode,
|
|
230
|
+
logger,
|
|
231
|
+
'Funded account ',
|
|
232
|
+
2,
|
|
233
|
+
opts?.estimateGas,
|
|
139
234
|
);
|
|
140
235
|
|
|
141
236
|
return {
|
|
@@ -174,7 +269,7 @@ export async function deployTestAccountsWithTokens(
|
|
|
174
269
|
fundedAccounts.map(async (a, i) => {
|
|
175
270
|
const paymentMethod = new FeeJuicePaymentMethodWithClaim(a.address, claims[i]);
|
|
176
271
|
const deployMethod = await a.getDeployMethod();
|
|
177
|
-
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } })
|
|
272
|
+
await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } });
|
|
178
273
|
logger.info(`Account deployed at ${a.address}`);
|
|
179
274
|
}),
|
|
180
275
|
);
|
|
@@ -218,7 +313,7 @@ async function bridgeL1FeeJuice(
|
|
|
218
313
|
const claim = await portal.bridgeTokensPublic(recipient, amount, true /* mint */);
|
|
219
314
|
|
|
220
315
|
const isSynced = async () =>
|
|
221
|
-
(await aztecNode.
|
|
316
|
+
(await aztecNode.getL1ToL2MessageCheckpoint(Fr.fromHexString(claim.messageHash))) !== undefined;
|
|
222
317
|
await retryUntil(isSynced, `message ${claim.messageHash} sync`, 24, 0.5);
|
|
223
318
|
|
|
224
319
|
log.info(`Created a claim for ${amount} L1 fee juice to ${recipient}.`, claim);
|
|
@@ -250,14 +345,15 @@ async function deployTokenAndMint(
|
|
|
250
345
|
logger: Logger,
|
|
251
346
|
) {
|
|
252
347
|
logger.verbose(`Deploying TokenContract...`);
|
|
253
|
-
const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
348
|
+
const {
|
|
349
|
+
receipt: { contract: tokenContract },
|
|
350
|
+
} = await TokenContract.deploy(wallet, admin, TOKEN_NAME, TOKEN_SYMBOL, TOKEN_DECIMALS).send({
|
|
351
|
+
from: admin,
|
|
352
|
+
fee: {
|
|
353
|
+
paymentMethod,
|
|
354
|
+
},
|
|
355
|
+
wait: { timeout: 600, returnReceipt: true },
|
|
356
|
+
});
|
|
261
357
|
|
|
262
358
|
const tokenAddress = tokenContract.address;
|
|
263
359
|
|
|
@@ -267,8 +363,7 @@ async function deployTokenAndMint(
|
|
|
267
363
|
accounts.map(acc =>
|
|
268
364
|
TokenContract.at(tokenAddress, wallet)
|
|
269
365
|
.methods.mint_to_public(acc, mintAmount)
|
|
270
|
-
.send({ from: admin, fee: { paymentMethod } })
|
|
271
|
-
.wait({ timeout: 600 }),
|
|
366
|
+
.send({ from: admin, fee: { paymentMethod }, wait: { timeout: 600 } }),
|
|
272
367
|
),
|
|
273
368
|
);
|
|
274
369
|
|
|
@@ -308,17 +403,23 @@ export async function performTransfers({
|
|
|
308
403
|
|
|
309
404
|
const provenTxs = await Promise.all(txs);
|
|
310
405
|
|
|
311
|
-
await Promise.all(provenTxs.map(t => t.send(
|
|
406
|
+
await Promise.all(provenTxs.map(t => t.send({ wait: { timeout: 600 } })));
|
|
312
407
|
|
|
313
408
|
logger.info(`Completed round ${i + 1} / ${rounds}`);
|
|
314
409
|
}
|
|
315
410
|
}
|
|
316
411
|
|
|
412
|
+
export type WalletWrapper = {
|
|
413
|
+
wallet: TestWallet;
|
|
414
|
+
aztecNode: AztecNode;
|
|
415
|
+
cleanup: () => Promise<void>;
|
|
416
|
+
};
|
|
417
|
+
|
|
317
418
|
export async function createWalletAndAztecNodeClient(
|
|
318
419
|
nodeUrl: string,
|
|
319
420
|
proverEnabled: boolean,
|
|
320
421
|
logger: Logger,
|
|
321
|
-
): Promise<
|
|
422
|
+
): Promise<WalletWrapper> {
|
|
322
423
|
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
323
424
|
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
324
425
|
const pxeConfig = {
|
|
@@ -340,3 +441,42 @@ export async function createWalletAndAztecNodeClient(
|
|
|
340
441
|
},
|
|
341
442
|
};
|
|
342
443
|
}
|
|
444
|
+
|
|
445
|
+
export type WorkerWalletWrapper = {
|
|
446
|
+
wallet: WorkerWallet;
|
|
447
|
+
aztecNode: AztecNode;
|
|
448
|
+
cleanup: () => Promise<void>;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
export async function createWorkerWalletClient(
|
|
452
|
+
nodeUrl: string,
|
|
453
|
+
proverEnabled: boolean,
|
|
454
|
+
logger: Logger,
|
|
455
|
+
): Promise<WorkerWalletWrapper> {
|
|
456
|
+
const aztecNode = createAztecNodeClient(nodeUrl);
|
|
457
|
+
const [bbConfig, acvmConfig] = await Promise.all([getBBConfig(logger), getACVMConfig(logger)]);
|
|
458
|
+
|
|
459
|
+
// Strip cleanup functions — they can't be structured-cloned for worker transfer
|
|
460
|
+
const { cleanup: bbCleanup, ...bbPaths } = bbConfig ?? {};
|
|
461
|
+
const { cleanup: acvmCleanup, ...acvmPaths } = acvmConfig ?? {};
|
|
462
|
+
|
|
463
|
+
const pxeConfig = {
|
|
464
|
+
dataDirectory: undefined,
|
|
465
|
+
dataStoreMapSizeKb: 1024 * 1024,
|
|
466
|
+
...bbPaths,
|
|
467
|
+
...acvmPaths,
|
|
468
|
+
proverEnabled,
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
const wallet = await WorkerWallet.create(nodeUrl, pxeConfig);
|
|
472
|
+
|
|
473
|
+
return {
|
|
474
|
+
wallet,
|
|
475
|
+
aztecNode,
|
|
476
|
+
async cleanup() {
|
|
477
|
+
await wallet.stop();
|
|
478
|
+
await bbCleanup?.();
|
|
479
|
+
await acvmCleanup?.();
|
|
480
|
+
},
|
|
481
|
+
};
|
|
482
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import type { AztecNode } from '@aztec/aztec.js/node';
|
|
2
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
3
|
+
import type { L2Block } from '@aztec/stdlib/block';
|
|
4
|
+
import type { TopicType } from '@aztec/stdlib/p2p';
|
|
5
|
+
import { Tx, type TxReceipt } from '@aztec/stdlib/tx';
|
|
6
|
+
|
|
7
|
+
import { createHistogram } from 'perf_hooks';
|
|
8
|
+
|
|
9
|
+
/** Metrics class for proving-related benchmarks. */
|
|
10
|
+
export class ProvingMetrics {
|
|
11
|
+
private successfulTxs: number | undefined;
|
|
12
|
+
private proofDuration: number | undefined;
|
|
13
|
+
private activeAgents: number | undefined;
|
|
14
|
+
private avgQueueTime: number | undefined;
|
|
15
|
+
private jobRetries: number | undefined;
|
|
16
|
+
private jobDuration: number | undefined;
|
|
17
|
+
private timedOutJobs: number | undefined;
|
|
18
|
+
private resolvedJobs: number | undefined;
|
|
19
|
+
private rejectedJobs: number | undefined;
|
|
20
|
+
private epochProvingDuration: number | undefined;
|
|
21
|
+
private provenTransactions: number | undefined;
|
|
22
|
+
private provenBlocks: number | undefined;
|
|
23
|
+
|
|
24
|
+
constructor(private prefix: string) {}
|
|
25
|
+
|
|
26
|
+
recordSuccessfulTxs(count: number): void {
|
|
27
|
+
this.successfulTxs = count;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
recordProofDuration(seconds: number): void {
|
|
31
|
+
this.proofDuration = seconds;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
recordActiveAgents(count: number): void {
|
|
35
|
+
this.activeAgents = count;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
recordAvgQueueTime(ms: number): void {
|
|
39
|
+
this.avgQueueTime = ms;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
recordJobRetries(count: number): void {
|
|
43
|
+
this.jobRetries = count;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
recordJobDuration(ms: number): void {
|
|
47
|
+
this.jobDuration = ms;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
recordTimedOutJobs(count: number): void {
|
|
51
|
+
this.timedOutJobs = count;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
recordResolvedJobs(count: number): void {
|
|
55
|
+
this.resolvedJobs = count;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
recordRejectedJobs(count: number): void {
|
|
59
|
+
this.rejectedJobs = count;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
recordEpochProvingDuration(seconds: number): void {
|
|
63
|
+
this.epochProvingDuration = seconds;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
recordProvenTransactions(count: number): void {
|
|
67
|
+
this.provenTransactions = count;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
recordProvenBlocks(count: number): void {
|
|
71
|
+
this.provenBlocks = count;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number }> {
|
|
75
|
+
const data: Array<{ name: string; unit: string; value: number }> = [];
|
|
76
|
+
|
|
77
|
+
if (this.successfulTxs !== undefined) {
|
|
78
|
+
data.push({ name: `${this.prefix}/successful_txs`, unit: 'count', value: this.successfulTxs });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.proofDuration !== undefined) {
|
|
82
|
+
data.push({ name: `${this.prefix}/proof_duration`, unit: 's', value: this.proofDuration });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.activeAgents !== undefined) {
|
|
86
|
+
data.push({ name: `${this.prefix}/active_agents`, unit: 'count', value: this.activeAgents });
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (this.avgQueueTime !== undefined) {
|
|
90
|
+
data.push({ name: `${this.prefix}/avg_queue_time`, unit: 'ms', value: this.avgQueueTime });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.jobRetries !== undefined) {
|
|
94
|
+
data.push({ name: `${this.prefix}/job_retries`, unit: 'count', value: this.jobRetries });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (this.jobDuration !== undefined) {
|
|
98
|
+
data.push({ name: `${this.prefix}/job_duration`, unit: 'ms', value: this.jobDuration });
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (this.timedOutJobs !== undefined) {
|
|
102
|
+
data.push({ name: `${this.prefix}/timed_out_jobs`, unit: 'count', value: this.timedOutJobs });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (this.resolvedJobs !== undefined) {
|
|
106
|
+
data.push({ name: `${this.prefix}/resolved_jobs`, unit: 'count', value: this.resolvedJobs });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (this.rejectedJobs !== undefined) {
|
|
110
|
+
data.push({ name: `${this.prefix}/rejected_jobs`, unit: 'count', value: this.rejectedJobs });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (this.epochProvingDuration !== undefined) {
|
|
114
|
+
data.push({ name: `${this.prefix}/epoch_proving_duration`, unit: 's', value: this.epochProvingDuration });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (this.provenTransactions !== undefined) {
|
|
118
|
+
data.push({ name: `${this.prefix}/proven_transactions`, unit: 'count', value: this.provenTransactions });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (this.provenBlocks !== undefined) {
|
|
122
|
+
data.push({ name: `${this.prefix}/proven_blocks`, unit: 'count', value: this.provenBlocks });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const scenario = process.env.BENCH_SCENARIO?.trim();
|
|
126
|
+
if (!scenario) {
|
|
127
|
+
return data;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const scenarioPrefix = `scenario/${scenario}/`;
|
|
131
|
+
return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type TxInclusionData = {
|
|
136
|
+
txHash: string;
|
|
137
|
+
sentAt: number;
|
|
138
|
+
minedAt: number;
|
|
139
|
+
attestedAt: number;
|
|
140
|
+
blocknumber: number;
|
|
141
|
+
priorityFee: number;
|
|
142
|
+
totalFee: number;
|
|
143
|
+
positionInBlock: number;
|
|
144
|
+
group: string;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export class TxInclusionMetrics {
|
|
148
|
+
private data = new Map<string, TxInclusionData>();
|
|
149
|
+
private groups = new Set<string>();
|
|
150
|
+
private blocks = new Map<number, Promise<L2Block | undefined>>();
|
|
151
|
+
|
|
152
|
+
private p2pGossipLatencyByTopic: Partial<Record<TopicType, { p50: number; p95: number }>> = {};
|
|
153
|
+
|
|
154
|
+
private attestationLatency: { p50: number; p95: number } | undefined;
|
|
155
|
+
private attestationCounts: { success: number; failedBad: number; failedNode: number } | undefined;
|
|
156
|
+
private reqRespStats: { fraction: number; delayP50: number; delayP95: number } | undefined;
|
|
157
|
+
private peerStats: { avgCount: number; connectionDurationP50: number; connectionDurationP95: number } | undefined;
|
|
158
|
+
private mempoolMinedDelay:
|
|
159
|
+
| { txP50: number; txP95: number; attestationP50: number; attestationP95: number }
|
|
160
|
+
| undefined;
|
|
161
|
+
|
|
162
|
+
constructor(
|
|
163
|
+
private aztecNode: AztecNode,
|
|
164
|
+
private logger?: Logger,
|
|
165
|
+
) {}
|
|
166
|
+
|
|
167
|
+
recordSentTx(tx: Tx, group: string): void {
|
|
168
|
+
const txHash = tx.getTxHash().toString();
|
|
169
|
+
const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
|
|
170
|
+
|
|
171
|
+
if (this.data.has(txHash)) {
|
|
172
|
+
this.logger?.debug(`Overwriting tx inclusion data for ${txHash}`, { txHash, group });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
this.data.set(txHash, {
|
|
176
|
+
txHash,
|
|
177
|
+
sentAt: Math.trunc(Date.now() / 1000),
|
|
178
|
+
minedAt: -1,
|
|
179
|
+
attestedAt: -1,
|
|
180
|
+
blocknumber: -1,
|
|
181
|
+
priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
|
|
182
|
+
totalFee: -1,
|
|
183
|
+
positionInBlock: -1,
|
|
184
|
+
group,
|
|
185
|
+
});
|
|
186
|
+
this.groups.add(group);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
|
|
190
|
+
const { txHash, blockNumber } = txReceipt;
|
|
191
|
+
if (!txReceipt.isMined() || !txReceipt.hasExecutionSucceeded() || !blockNumber) {
|
|
192
|
+
this.logger?.debug('Skipping mined tx record due to receipt status', {
|
|
193
|
+
txHash: txHash.toString(),
|
|
194
|
+
status: txReceipt.status,
|
|
195
|
+
blockNumber,
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (!this.blocks.has(blockNumber)) {
|
|
201
|
+
this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const block = await this.blocks.get(blockNumber)!;
|
|
205
|
+
if (!block) {
|
|
206
|
+
this.logger?.warn('Failed to load block for mined tx receipt', { txHash: txHash.toString(), blockNumber });
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
const data = this.data.get(txHash.toString());
|
|
210
|
+
if (!data) {
|
|
211
|
+
const message = `Missing sent tx record for mined tx ${txHash.toString()}`;
|
|
212
|
+
this.logger?.warn(message, { txHash: txHash.toString(), blockNumber });
|
|
213
|
+
throw new Error(message);
|
|
214
|
+
}
|
|
215
|
+
data.blocknumber = blockNumber;
|
|
216
|
+
data.minedAt = Number(block.header.globalVariables.timestamp);
|
|
217
|
+
data.attestedAt = -1;
|
|
218
|
+
data.totalFee = Number(txReceipt.transactionFee ?? 0n);
|
|
219
|
+
data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
public inclusionTimeInSeconds(group: string): {
|
|
223
|
+
count: number;
|
|
224
|
+
group: string;
|
|
225
|
+
min: number;
|
|
226
|
+
mean: number;
|
|
227
|
+
max: number;
|
|
228
|
+
median: number;
|
|
229
|
+
p99: number;
|
|
230
|
+
} {
|
|
231
|
+
const histogram = createHistogram({});
|
|
232
|
+
for (const tx of this.data.values()) {
|
|
233
|
+
if (!tx.blocknumber || tx.group !== group || tx.minedAt === -1) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
histogram.record(tx.minedAt - tx.sentAt);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (histogram.count === 0) {
|
|
241
|
+
return {
|
|
242
|
+
group,
|
|
243
|
+
count: 0,
|
|
244
|
+
mean: 0,
|
|
245
|
+
max: 0,
|
|
246
|
+
median: 0,
|
|
247
|
+
min: 0,
|
|
248
|
+
p99: 0,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
group,
|
|
254
|
+
count: histogram.count,
|
|
255
|
+
mean: histogram.mean,
|
|
256
|
+
max: histogram.max,
|
|
257
|
+
median: histogram.percentile(50),
|
|
258
|
+
min: histogram.min,
|
|
259
|
+
p99: histogram.percentile(99),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public recordP2PGossipLatency(topicName: TopicType, p50: number, p95: number): void {
|
|
264
|
+
this.p2pGossipLatencyByTopic[topicName] = { p50, p95 };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
public recordAttestationLatency(p50: number, p95: number): void {
|
|
268
|
+
this.attestationLatency = { p50, p95 };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
public recordAttestationCounts(success: number, failedBad: number, failedNode: number): void {
|
|
272
|
+
this.attestationCounts = { success, failedBad, failedNode };
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
public recordReqRespStats(fraction: number, delayP50: number, delayP95: number): void {
|
|
276
|
+
this.reqRespStats = { fraction, delayP50, delayP95 };
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
public recordPeerStats(avgCount: number, connectionDurationP50: number, connectionDurationP95: number): void {
|
|
280
|
+
this.peerStats = { avgCount, connectionDurationP50, connectionDurationP95 };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
public recordMempoolMinedDelay(txP50: number, txP95: number, attestationP50: number, attestationP95: number): void {
|
|
284
|
+
this.mempoolMinedDelay = { txP50, txP95, attestationP50, attestationP95 };
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
|
|
288
|
+
const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
|
|
289
|
+
for (const group of this.groups) {
|
|
290
|
+
const stats = this.inclusionTimeInSeconds(group);
|
|
291
|
+
|
|
292
|
+
data.push(
|
|
293
|
+
{
|
|
294
|
+
name: `${group}/avg_inclusion`,
|
|
295
|
+
unit: 's',
|
|
296
|
+
value: stats.mean,
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: `${group}/p50_inclusion`,
|
|
300
|
+
unit: 's',
|
|
301
|
+
value: stats.median,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: `${group}/p99_inclusion`,
|
|
305
|
+
unit: 's',
|
|
306
|
+
value: stats.p99,
|
|
307
|
+
},
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
for (const [topic, { p50, p95 }] of Object.entries(this.p2pGossipLatencyByTopic)) {
|
|
312
|
+
data.push({
|
|
313
|
+
name: `p2p_gossip_latency/${topic}/p50`,
|
|
314
|
+
unit: 'ms',
|
|
315
|
+
value: p50,
|
|
316
|
+
});
|
|
317
|
+
data.push({
|
|
318
|
+
name: `p2p_gossip_latency/${topic}/p95`,
|
|
319
|
+
unit: 'ms',
|
|
320
|
+
value: p95,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (this.attestationLatency) {
|
|
325
|
+
data.push(
|
|
326
|
+
{ name: 'attestation_latency/p50', unit: 'ms', value: this.attestationLatency.p50 },
|
|
327
|
+
{ name: 'attestation_latency/p95', unit: 'ms', value: this.attestationLatency.p95 },
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (this.attestationCounts) {
|
|
332
|
+
const { success, failedBad, failedNode } = this.attestationCounts;
|
|
333
|
+
const total = success + failedBad + failedNode;
|
|
334
|
+
const ratio = total > 0 ? success / total : 0;
|
|
335
|
+
data.push(
|
|
336
|
+
{ name: 'attestation/success_count', unit: 'count', value: success },
|
|
337
|
+
{ name: 'attestation/failed_bad_proposal_count', unit: 'count', value: failedBad },
|
|
338
|
+
{ name: 'attestation/failed_node_issue_count', unit: 'count', value: failedNode },
|
|
339
|
+
{ name: 'attestation/success_ratio', unit: 'ratio', value: ratio },
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (this.reqRespStats) {
|
|
344
|
+
data.push(
|
|
345
|
+
{ name: 'req_resp/txs_requested_fraction', unit: 'ratio', value: this.reqRespStats.fraction },
|
|
346
|
+
{ name: 'req_resp/delay_p50', unit: 'ms', value: this.reqRespStats.delayP50 },
|
|
347
|
+
{ name: 'req_resp/delay_p95', unit: 'ms', value: this.reqRespStats.delayP95 },
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
if (this.peerStats) {
|
|
352
|
+
data.push(
|
|
353
|
+
{ name: 'peers/avg_count', unit: 'peers', value: this.peerStats.avgCount },
|
|
354
|
+
{ name: 'peers/connection_duration_p50', unit: 'ms', value: this.peerStats.connectionDurationP50 },
|
|
355
|
+
{ name: 'peers/connection_duration_p95', unit: 'ms', value: this.peerStats.connectionDurationP95 },
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
if (this.mempoolMinedDelay) {
|
|
360
|
+
data.push(
|
|
361
|
+
{ name: 'mempool/tx_mined_delay_p50', unit: 'ms', value: this.mempoolMinedDelay.txP50 },
|
|
362
|
+
{ name: 'mempool/tx_mined_delay_p95', unit: 'ms', value: this.mempoolMinedDelay.txP95 },
|
|
363
|
+
{ name: 'mempool/attestation_mined_delay_p50', unit: 'ms', value: this.mempoolMinedDelay.attestationP50 },
|
|
364
|
+
{ name: 'mempool/attestation_mined_delay_p95', unit: 'ms', value: this.mempoolMinedDelay.attestationP95 },
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const scenario = process.env.BENCH_SCENARIO?.trim();
|
|
369
|
+
if (!scenario) {
|
|
370
|
+
return data;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const scenarioPrefix = `scenario/${scenario}/`;
|
|
374
|
+
return data.map(entry => ({ ...entry, name: `${scenarioPrefix}${entry.name}` }));
|
|
375
|
+
}
|
|
376
|
+
}
|