@aztec/end-to-end 0.0.1-commit.b655e406 → 0.0.1-commit.c7c42ec

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dest/bench/client_flows/benchmark.d.ts +1 -1
  2. package/dest/bench/client_flows/benchmark.d.ts.map +1 -1
  3. package/dest/bench/client_flows/client_flows_benchmark.d.ts +10 -3
  4. package/dest/bench/client_flows/client_flows_benchmark.d.ts.map +1 -1
  5. package/dest/bench/client_flows/client_flows_benchmark.js +58 -33
  6. package/dest/bench/client_flows/config.d.ts +1 -1
  7. package/dest/bench/client_flows/data_extractor.d.ts +1 -1
  8. package/dest/bench/client_flows/data_extractor.js +5 -27
  9. package/dest/bench/utils.d.ts +3 -3
  10. package/dest/bench/utils.d.ts.map +1 -1
  11. package/dest/bench/utils.js +10 -6
  12. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts +1 -1
  13. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.d.ts.map +1 -1
  14. package/dest/e2e_blacklist_token_contract/blacklist_token_contract_test.js +2 -2
  15. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts +5 -4
  16. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.d.ts.map +1 -1
  17. package/dest/e2e_cross_chain_messaging/cross_chain_messaging_test.js +6 -4
  18. package/dest/e2e_deploy_contract/deploy_test.d.ts +2 -2
  19. package/dest/e2e_deploy_contract/deploy_test.d.ts.map +1 -1
  20. package/dest/e2e_epochs/epochs_test.d.ts +11 -9
  21. package/dest/e2e_epochs/epochs_test.d.ts.map +1 -1
  22. package/dest/e2e_epochs/epochs_test.js +17 -14
  23. package/dest/e2e_fees/bridging_race.notest.d.ts +1 -1
  24. package/dest/e2e_fees/bridging_race.notest.js +2 -2
  25. package/dest/e2e_fees/fees_test.d.ts +8 -4
  26. package/dest/e2e_fees/fees_test.d.ts.map +1 -1
  27. package/dest/e2e_fees/fees_test.js +16 -10
  28. package/dest/e2e_l1_publisher/write_json.d.ts +1 -1
  29. package/dest/e2e_l1_publisher/write_json.d.ts.map +1 -1
  30. package/dest/e2e_l1_publisher/write_json.js +5 -4
  31. package/dest/e2e_multi_validator/utils.d.ts +1 -1
  32. package/dest/e2e_multi_validator/utils.js +1 -1
  33. package/dest/e2e_nested_contract/nested_contract_test.d.ts +1 -1
  34. package/dest/e2e_nested_contract/nested_contract_test.d.ts.map +1 -1
  35. package/dest/e2e_nested_contract/nested_contract_test.js +4 -3
  36. package/dest/e2e_p2p/inactivity_slash_test.d.ts +3 -3
  37. package/dest/e2e_p2p/inactivity_slash_test.d.ts.map +1 -1
  38. package/dest/e2e_p2p/inactivity_slash_test.js +4 -3
  39. package/dest/e2e_p2p/p2p_network.d.ts +219 -13
  40. package/dest/e2e_p2p/p2p_network.d.ts.map +1 -1
  41. package/dest/e2e_p2p/p2p_network.js +15 -11
  42. package/dest/e2e_p2p/shared.d.ts +6 -6
  43. package/dest/e2e_p2p/shared.d.ts.map +1 -1
  44. package/dest/e2e_p2p/shared.js +6 -5
  45. package/dest/e2e_token_contract/token_contract_test.d.ts +1 -1
  46. package/dest/e2e_token_contract/token_contract_test.d.ts.map +1 -1
  47. package/dest/e2e_token_contract/token_contract_test.js +2 -2
  48. package/dest/fixtures/e2e_prover_test.d.ts +5 -5
  49. package/dest/fixtures/e2e_prover_test.d.ts.map +1 -1
  50. package/dest/fixtures/e2e_prover_test.js +23 -22
  51. package/dest/fixtures/fixtures.d.ts +2 -3
  52. package/dest/fixtures/fixtures.d.ts.map +1 -1
  53. package/dest/fixtures/fixtures.js +2 -3
  54. package/dest/fixtures/get_acvm_config.d.ts +1 -1
  55. package/dest/fixtures/get_acvm_config.js +1 -1
  56. package/dest/fixtures/get_bb_config.d.ts +1 -1
  57. package/dest/fixtures/get_bb_config.d.ts.map +1 -1
  58. package/dest/fixtures/index.d.ts +1 -1
  59. package/dest/fixtures/l1_to_l2_messaging.d.ts +4 -3
  60. package/dest/fixtures/l1_to_l2_messaging.d.ts.map +1 -1
  61. package/dest/fixtures/l1_to_l2_messaging.js +2 -2
  62. package/dest/fixtures/logging.d.ts +1 -1
  63. package/dest/fixtures/setup_p2p_test.d.ts +4 -4
  64. package/dest/fixtures/setup_p2p_test.d.ts.map +1 -1
  65. package/dest/fixtures/setup_p2p_test.js +18 -10
  66. package/dest/fixtures/snapshot_manager.d.ts +6 -8
  67. package/dest/fixtures/snapshot_manager.d.ts.map +1 -1
  68. package/dest/fixtures/snapshot_manager.js +34 -46
  69. package/dest/fixtures/token_utils.d.ts +5 -2
  70. package/dest/fixtures/token_utils.d.ts.map +1 -1
  71. package/dest/fixtures/token_utils.js +7 -4
  72. package/dest/fixtures/utils.d.ts +21 -19
  73. package/dest/fixtures/utils.d.ts.map +1 -1
  74. package/dest/fixtures/utils.js +56 -85
  75. package/dest/fixtures/web3signer.d.ts +1 -1
  76. package/dest/fixtures/web3signer.js +1 -1
  77. package/dest/fixtures/with_telemetry_utils.d.ts +2 -2
  78. package/dest/fixtures/with_telemetry_utils.d.ts.map +1 -1
  79. package/dest/fixtures/with_telemetry_utils.js +2 -2
  80. package/dest/index.d.ts +1 -1
  81. package/dest/quality_of_service/alert_checker.d.ts +1 -1
  82. package/dest/quality_of_service/alert_checker.d.ts.map +1 -1
  83. package/dest/shared/cross_chain_test_harness.d.ts +5 -14
  84. package/dest/shared/cross_chain_test_harness.d.ts.map +1 -1
  85. package/dest/shared/cross_chain_test_harness.js +1 -1
  86. package/dest/shared/gas_portal_test_harness.d.ts +2 -12
  87. package/dest/shared/gas_portal_test_harness.d.ts.map +1 -1
  88. package/dest/shared/gas_portal_test_harness.js +1 -1
  89. package/dest/shared/index.d.ts +1 -1
  90. package/dest/shared/jest_setup.d.ts +1 -1
  91. package/dest/shared/submit-transactions.d.ts +1 -1
  92. package/dest/shared/submit-transactions.d.ts.map +1 -1
  93. package/dest/shared/uniswap_l1_l2.d.ts +4 -3
  94. package/dest/shared/uniswap_l1_l2.d.ts.map +1 -1
  95. package/dest/shared/uniswap_l1_l2.js +15 -13
  96. package/dest/simulators/index.d.ts +1 -1
  97. package/dest/simulators/lending_simulator.d.ts +2 -6
  98. package/dest/simulators/lending_simulator.d.ts.map +1 -1
  99. package/dest/simulators/lending_simulator.js +5 -3
  100. package/dest/simulators/token_simulator.d.ts +1 -1
  101. package/dest/simulators/token_simulator.d.ts.map +1 -1
  102. package/dest/spartan/setup_test_wallets.d.ts +5 -3
  103. package/dest/spartan/setup_test_wallets.d.ts.map +1 -1
  104. package/dest/spartan/setup_test_wallets.js +45 -10
  105. package/dest/spartan/tx_metrics.d.ts +39 -0
  106. package/dest/spartan/tx_metrics.d.ts.map +1 -0
  107. package/dest/spartan/tx_metrics.js +95 -0
  108. package/dest/spartan/utils.d.ts +55 -20
  109. package/dest/spartan/utils.d.ts.map +1 -1
  110. package/dest/spartan/utils.js +203 -60
  111. package/package.json +42 -40
  112. package/src/bench/client_flows/client_flows_benchmark.ts +82 -34
  113. package/src/bench/client_flows/data_extractor.ts +6 -28
  114. package/src/bench/utils.ts +11 -7
  115. package/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +2 -2
  116. package/src/e2e_cross_chain_messaging/cross_chain_messaging_test.ts +17 -12
  117. package/src/e2e_deploy_contract/deploy_test.ts +1 -1
  118. package/src/e2e_epochs/epochs_test.ts +37 -23
  119. package/src/e2e_fees/bridging_race.notest.ts +2 -2
  120. package/src/e2e_fees/fees_test.ts +22 -13
  121. package/src/e2e_l1_publisher/write_json.ts +5 -4
  122. package/src/e2e_multi_validator/utils.ts +1 -1
  123. package/src/e2e_nested_contract/nested_contract_test.ts +4 -3
  124. package/src/e2e_p2p/inactivity_slash_test.ts +5 -4
  125. package/src/e2e_p2p/p2p_network.ts +16 -19
  126. package/src/e2e_p2p/shared.ts +13 -6
  127. package/src/e2e_token_contract/token_contract_test.ts +2 -2
  128. package/src/fixtures/e2e_prover_test.ts +22 -25
  129. package/src/fixtures/fixtures.ts +2 -5
  130. package/src/fixtures/get_acvm_config.ts +1 -1
  131. package/src/fixtures/l1_to_l2_messaging.ts +4 -2
  132. package/src/fixtures/setup_p2p_test.ts +23 -9
  133. package/src/fixtures/snapshot_manager.ts +51 -65
  134. package/src/fixtures/token_utils.ts +4 -4
  135. package/src/fixtures/utils.ts +91 -131
  136. package/src/fixtures/web3signer.ts +1 -1
  137. package/src/fixtures/with_telemetry_utils.ts +2 -2
  138. package/src/guides/up_quick_start.sh +1 -1
  139. package/src/shared/cross_chain_test_harness.ts +5 -2
  140. package/src/shared/gas_portal_test_harness.ts +2 -2
  141. package/src/shared/uniswap_l1_l2.ts +19 -21
  142. package/src/simulators/lending_simulator.ts +6 -4
  143. package/src/spartan/DEVELOP.md +7 -0
  144. package/src/spartan/setup_test_wallets.ts +49 -12
  145. package/src/spartan/tx_metrics.ts +130 -0
  146. package/src/spartan/utils.ts +267 -51
  147. package/dest/fixtures/setup_l1_contracts.d.ts +0 -6
  148. package/dest/fixtures/setup_l1_contracts.d.ts.map +0 -1
  149. package/dest/fixtures/setup_l1_contracts.js +0 -17
  150. package/src/fixtures/setup_l1_contracts.ts +0 -26
@@ -2,8 +2,9 @@
2
2
  import { AztecAddress } from '@aztec/aztec.js/addresses';
3
3
  import { Fr } from '@aztec/aztec.js/fields';
4
4
  import { CheatCodes } from '@aztec/aztec/testing';
5
- import type { RollupContract } from '@aztec/ethereum';
6
- import { pedersenHash } from '@aztec/foundation/crypto';
5
+ import type { RollupContract } from '@aztec/ethereum/contracts';
6
+ import { SlotNumber } from '@aztec/foundation/branded-types';
7
+ import { pedersenHash } from '@aztec/foundation/crypto/pedersen';
7
8
  import type { TestDateProvider } from '@aztec/foundation/timer';
8
9
  import type { LendingContract } from '@aztec/noir-contracts.js/Lending';
9
10
 
@@ -103,7 +104,8 @@ export class LendingSimulator {
103
104
  }
104
105
 
105
106
  const slot = await this.rollup.getSlotAt(BigInt(await this.cc.eth.timestamp()));
106
- const ts = Number(await this.rollup.getTimestampForSlot(slot + BigInt(diff)));
107
+ const targetSlot = SlotNumber(slot + diff);
108
+ const ts = Number(await this.rollup.getTimestampForSlot(targetSlot));
107
109
  const timeDiff = ts - this.time;
108
110
  this.time = ts;
109
111
 
@@ -112,7 +114,7 @@ export class LendingSimulator {
112
114
  if (dateProvider) {
113
115
  dateProvider.setTime(this.time * 1000);
114
116
  }
115
- await this.cc.rollup.markAsProven(await this.rollup.getBlockNumber());
117
+ await this.cc.rollup.markAsProven(await this.rollup.getCheckpointNumber());
116
118
  this.accumulator = muldivDown(this.accumulator, computeMultiplier(this.rate, BigInt(timeDiff)), BASE);
117
119
  }
118
120
 
@@ -61,10 +61,17 @@ The export is important there. The `AZTEC_DOCKER_IMAGE` env var is used as both:
61
61
  - the containers for the aztec infrastructure (validators, provers, etc)
62
62
 
63
63
  # Deploy Metrics
64
+
64
65
  ```bash
65
66
  ./spartan/bootstrap.sh metrics-kind
66
67
  ```
67
68
 
69
+ # Install Chaos Mesh
70
+
71
+ ```bash
72
+ ./spartan/bootstrap.sh chaos-mesh
73
+ ```
74
+
68
75
  # Deploy stuff
69
76
 
70
77
  ```bash
@@ -6,12 +6,13 @@ import { type FeePaymentMethod, SponsoredFeePaymentMethod } from '@aztec/aztec.j
6
6
  import { Fr } from '@aztec/aztec.js/fields';
7
7
  import { type AztecNode, createAztecNodeClient } from '@aztec/aztec.js/node';
8
8
  import type { Wallet } from '@aztec/aztec.js/wallet';
9
- import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
9
+ import { createEthereumChain } from '@aztec/ethereum/chain';
10
+ import { createExtendedL1Client } from '@aztec/ethereum/client';
10
11
  import type { Logger } from '@aztec/foundation/log';
11
12
  import { retryUntil } from '@aztec/foundation/retry';
12
13
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
13
14
  import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
14
- import { TestWallet, proveInteraction, registerInitialSandboxAccountsInWallet } from '@aztec/test-wallet/server';
15
+ import { TestWallet, proveInteraction, registerInitialLocalNetworkAccountsInWallet } from '@aztec/test-wallet/server';
15
16
 
16
17
  import { getACVMConfig } from '../fixtures/get_acvm_config.js';
17
18
  import { getBBConfig } from '../fixtures/get_bb_config.js';
@@ -28,6 +29,11 @@ export interface TestAccounts {
28
29
  tokenAddress: AztecAddress;
29
30
  }
30
31
 
32
+ export type TestAccountsWithoutTokens = Omit<
33
+ TestAccounts,
34
+ 'tokenAddress' | 'tokenContract' | 'tokenName' | 'tokenAdminAddress'
35
+ >;
36
+
31
37
  const TOKEN_NAME = 'USDC';
32
38
  const TOKEN_SYMBOL = 'USD';
33
39
  const TOKEN_DECIMALS = 18n;
@@ -42,14 +48,14 @@ export async function setupTestAccountsWithTokens(
42
48
  const aztecNode = createAztecNodeClient(nodeUrl);
43
49
  const wallet = await TestWallet.create(aztecNode);
44
50
 
45
- const [recipientAccount, ...accounts] = (await registerInitialSandboxAccountsInWallet(wallet)).slice(
51
+ const [recipientAccount, ...accounts] = (await registerInitialLocalNetworkAccountsInWallet(wallet)).slice(
46
52
  0,
47
53
  ACCOUNT_COUNT + 1,
48
54
  );
49
55
 
50
56
  const tokenAdmin = accounts[0];
51
57
  const tokenAddress = await deployTokenAndMint(wallet, accounts, tokenAdmin, mintAmount, undefined, logger);
52
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
58
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
53
59
 
54
60
  return {
55
61
  aztecNode,
@@ -63,7 +69,7 @@ export async function setupTestAccountsWithTokens(
63
69
  };
64
70
  }
65
71
 
66
- export async function deploySponsoredTestAccounts(
72
+ export async function deploySponsoredTestAccountsWithTokens(
67
73
  wallet: TestWallet,
68
74
  aztecNode: AztecNode,
69
75
  mintAmount: bigint,
@@ -96,7 +102,7 @@ export async function deploySponsoredTestAccounts(
96
102
  new SponsoredFeePaymentMethod(await getSponsoredFPCAddress()),
97
103
  logger,
98
104
  );
99
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
105
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
100
106
 
101
107
  return {
102
108
  aztecNode,
@@ -110,6 +116,37 @@ export async function deploySponsoredTestAccounts(
110
116
  };
111
117
  }
112
118
 
119
+ export async function deploySponsoredTestAccounts(
120
+ wallet: TestWallet,
121
+ aztecNode: AztecNode,
122
+ logger: Logger,
123
+ numberOfFundedWallets = 1,
124
+ ): Promise<TestAccountsWithoutTokens> {
125
+ const [recipient, ...funded] = await generateSchnorrAccounts(numberOfFundedWallets + 1);
126
+ const recipientAccount = await wallet.createSchnorrAccount(recipient.secret, recipient.salt);
127
+ const fundedAccounts = await Promise.all(funded.map(a => wallet.createSchnorrAccount(a.secret, a.salt)));
128
+
129
+ await registerSponsoredFPC(wallet);
130
+
131
+ const paymentMethod = new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
132
+ const recipientDeployMethod = await recipientAccount.getDeployMethod();
133
+ await recipientDeployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 });
134
+ await Promise.all(
135
+ fundedAccounts.map(async a => {
136
+ const deployMethod = await a.getDeployMethod();
137
+ await deployMethod.send({ from: AztecAddress.ZERO, fee: { paymentMethod } }).wait({ timeout: 2400 }); // increase timeout on purpose in order to account for two empty epochs
138
+ logger.info(`Account deployed at ${a.address}`);
139
+ }),
140
+ );
141
+
142
+ return {
143
+ aztecNode,
144
+ wallet,
145
+ accounts: fundedAccounts.map(acc => acc.address),
146
+ recipientAddress: recipientAccount.address,
147
+ };
148
+ }
149
+
113
150
  export async function deployTestAccountsWithTokens(
114
151
  nodeUrl: string,
115
152
  l1RpcUrls: string[],
@@ -152,7 +189,7 @@ export async function deployTestAccountsWithTokens(
152
189
  undefined,
153
190
  logger,
154
191
  );
155
- const tokenContract = await TokenContract.at(tokenAddress, wallet);
192
+ const tokenContract = TokenContract.at(tokenAddress, wallet);
156
193
 
157
194
  return {
158
195
  aztecNode,
@@ -228,9 +265,9 @@ async function deployTokenAndMint(
228
265
  logger.verbose(`Minting ${mintAmount} public assets to the ${accounts.length} accounts...`);
229
266
 
230
267
  await Promise.all(
231
- accounts.map(async acc =>
232
- (await TokenContract.at(tokenAddress, wallet)).methods
233
- .mint_to_public(acc, mintAmount)
268
+ accounts.map(acc =>
269
+ TokenContract.at(tokenAddress, wallet)
270
+ .methods.mint_to_public(acc, mintAmount)
234
271
  .send({ from: admin, fee: { paymentMethod } })
235
272
  .wait({ timeout: 600 }),
236
273
  ),
@@ -260,8 +297,8 @@ export async function performTransfers({
260
297
  // Default to sponsored fee payment if no fee method is provided
261
298
  const defaultFeePaymentMethod = feePaymentMethod || new SponsoredFeePaymentMethod(await getSponsoredFPCAddress());
262
299
  for (let i = 0; i < rounds; i++) {
263
- const txs = testAccounts.accounts.map(async acc => {
264
- const token = await TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
300
+ const txs = testAccounts.accounts.map(acc => {
301
+ const token = TokenContract.at(testAccounts.tokenAddress, testAccounts.wallet);
265
302
  return proveInteraction(wallet, token.methods.transfer_in_public(acc, recipient, transferAmount, 0), {
266
303
  from: acc,
267
304
  fee: {
@@ -0,0 +1,130 @@
1
+ import type { AztecNode } from '@aztec/aztec.js/node';
2
+ import type { L2Block } from '@aztec/stdlib/block';
3
+ import { Tx, type TxReceipt, TxStatus } from '@aztec/stdlib/tx';
4
+
5
+ import { createHistogram } from 'perf_hooks';
6
+
7
+ export type TxInclusionData = {
8
+ txHash: string;
9
+ sentAt: number;
10
+ minedAt: number;
11
+ attestedAt: number;
12
+ blocknumber: number;
13
+ priorityFee: number;
14
+ totalFee: number;
15
+ positionInBlock: number;
16
+ group: string;
17
+ };
18
+
19
+ export class TxInclusionMetrics {
20
+ private data = new Map<string, TxInclusionData>();
21
+ private groups = new Set<string>();
22
+ private blocks = new Map<number, Promise<L2Block>>();
23
+
24
+ constructor(private aztecNode: AztecNode) {}
25
+
26
+ recordSentTx(tx: Tx, group: string): void {
27
+ const txHash = tx.getTxHash().toString();
28
+ const priorityFees = tx.getGasSettings().maxPriorityFeesPerGas;
29
+
30
+ this.data.set(txHash, {
31
+ txHash,
32
+ sentAt: Math.trunc(Date.now() / 1000),
33
+ minedAt: -1,
34
+ attestedAt: -1,
35
+ blocknumber: -1,
36
+ priorityFee: Number(priorityFees.feePerDaGas + priorityFees.feePerL2Gas),
37
+ totalFee: -1,
38
+ positionInBlock: -1,
39
+ group,
40
+ });
41
+ this.groups.add(group);
42
+ }
43
+
44
+ async recordMinedTx(txReceipt: TxReceipt): Promise<void> {
45
+ const { status, txHash, blockNumber } = txReceipt;
46
+ if (status !== TxStatus.SUCCESS || !blockNumber) {
47
+ return;
48
+ }
49
+
50
+ if (!this.blocks.has(blockNumber)) {
51
+ this.blocks.set(blockNumber, this.aztecNode.getBlock(blockNumber) as Promise<L2Block>);
52
+ }
53
+
54
+ const block = await this.blocks.get(blockNumber)!;
55
+ const data = this.data.get(txHash.toString())!;
56
+ data.blocknumber = blockNumber;
57
+ data.minedAt = Number(block.header.globalVariables.timestamp);
58
+ data.attestedAt = -1;
59
+ data.totalFee = Number(txReceipt.transactionFee ?? 0n);
60
+ data.positionInBlock = block.body.txEffects.findIndex(txEffect => txEffect.txHash.equals(txHash));
61
+ }
62
+
63
+ public inclusionTimeInSeconds(group: string): {
64
+ count: number;
65
+ group: string;
66
+ min: number;
67
+ mean: number;
68
+ max: number;
69
+ median: number;
70
+ p99: number;
71
+ } {
72
+ const histogram = createHistogram({});
73
+ for (const tx of this.data.values()) {
74
+ if (!tx.blocknumber || tx.group !== group) {
75
+ continue;
76
+ }
77
+
78
+ histogram.record(tx.minedAt - tx.sentAt);
79
+ }
80
+
81
+ if (histogram.count === 0) {
82
+ return {
83
+ group,
84
+ count: 0,
85
+ mean: 0,
86
+ max: 0,
87
+ median: 0,
88
+ min: 0,
89
+ p99: 0,
90
+ };
91
+ }
92
+
93
+ return {
94
+ group,
95
+ count: histogram.count,
96
+ mean: histogram.mean,
97
+ max: histogram.max,
98
+ median: histogram.percentile(50),
99
+ min: histogram.min,
100
+ p99: histogram.percentile(99),
101
+ };
102
+ }
103
+
104
+ toGithubActionBenchmarkJSON(): Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> {
105
+ const data: Array<{ name: string; unit: string; value: number; range?: number; extra?: string }> = [];
106
+ for (const group of this.groups) {
107
+ const stats = this.inclusionTimeInSeconds(group);
108
+
109
+ data.push(
110
+ {
111
+ name: `${group}/avg_inclusion`,
112
+ unit: 's',
113
+ value: stats.mean,
114
+ },
115
+ {
116
+ name: `${group}/median_inclusion`,
117
+ unit: 's',
118
+ value: stats.median,
119
+ },
120
+ {
121
+ name: `${group}/p99_inclusion`,
122
+ unit: 's',
123
+ value: stats.p99,
124
+ },
125
+ );
126
+ }
127
+
128
+ return data;
129
+ }
130
+ }