@aztec/p2p 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c

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 (213) hide show
  1. package/dest/client/interface.d.ts +18 -5
  2. package/dest/client/interface.d.ts.map +1 -1
  3. package/dest/client/p2p_client.d.ts +10 -13
  4. package/dest/client/p2p_client.d.ts.map +1 -1
  5. package/dest/client/p2p_client.js +449 -118
  6. package/dest/config.js +2 -2
  7. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +61 -42
  8. package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
  9. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
  10. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
  11. package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +237 -263
  12. package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +21 -18
  13. package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
  14. package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +113 -108
  15. package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +17 -16
  16. package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
  17. package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +89 -128
  18. package/dest/mem_pools/attestation_pool/mocks.d.ts +9 -6
  19. package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
  20. package/dest/mem_pools/attestation_pool/mocks.js +16 -12
  21. package/dest/mem_pools/instrumentation.d.ts +1 -1
  22. package/dest/mem_pools/instrumentation.d.ts.map +1 -1
  23. package/dest/mem_pools/instrumentation.js +4 -13
  24. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts +15 -10
  25. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.d.ts.map +1 -1
  26. package/dest/mem_pools/tx_pool/aztec_kv_tx_pool.js +91 -50
  27. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts +19 -5
  28. package/dest/mem_pools/tx_pool/eviction/eviction_manager.d.ts.map +1 -1
  29. package/dest/mem_pools/tx_pool/eviction/eviction_manager.js +59 -3
  30. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts +79 -5
  31. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.d.ts.map +1 -1
  32. package/dest/mem_pools/tx_pool/eviction/eviction_strategy.js +47 -0
  33. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts +16 -0
  34. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
  35. package/dest/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.js +122 -0
  36. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts +2 -2
  37. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -1
  38. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts +4 -4
  39. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -1
  40. package/dest/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.js +2 -0
  41. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts +2 -2
  42. package/dest/mem_pools/tx_pool/eviction/low_priority_eviction_rule.d.ts.map +1 -1
  43. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts +25 -0
  44. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.d.ts.map +1 -0
  45. package/dest/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.js +57 -0
  46. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +4 -4
  47. package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
  48. package/dest/msg_validators/attestation_validator/attestation_validator.js +51 -18
  49. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +5 -5
  50. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
  51. package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +18 -14
  52. package/dest/msg_validators/clock_tolerance.d.ts +21 -0
  53. package/dest/msg_validators/clock_tolerance.d.ts.map +1 -0
  54. package/dest/msg_validators/clock_tolerance.js +37 -0
  55. package/dest/msg_validators/index.d.ts +2 -2
  56. package/dest/msg_validators/index.d.ts.map +1 -1
  57. package/dest/msg_validators/index.js +1 -1
  58. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +9 -0
  59. package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -0
  60. package/dest/msg_validators/proposal_validator/block_proposal_validator.js +6 -0
  61. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +9 -0
  62. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -0
  63. package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +6 -0
  64. package/dest/msg_validators/proposal_validator/index.d.ts +4 -0
  65. package/dest/msg_validators/proposal_validator/index.d.ts.map +1 -0
  66. package/dest/msg_validators/proposal_validator/index.js +3 -0
  67. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -0
  68. package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -0
  69. package/dest/msg_validators/proposal_validator/proposal_validator.js +104 -0
  70. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +23 -0
  71. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -0
  72. package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +212 -0
  73. package/dest/msg_validators/tx_validator/block_header_validator.d.ts +1 -1
  74. package/dest/msg_validators/tx_validator/block_header_validator.d.ts.map +1 -1
  75. package/dest/msg_validators/tx_validator/block_header_validator.js +1 -1
  76. package/dest/msg_validators/tx_validator/data_validator.d.ts +1 -1
  77. package/dest/msg_validators/tx_validator/data_validator.d.ts.map +1 -1
  78. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts +10 -0
  79. package/dest/msg_validators/tx_validator/fee_payer_balance.d.ts.map +1 -0
  80. package/dest/msg_validators/tx_validator/fee_payer_balance.js +20 -0
  81. package/dest/msg_validators/tx_validator/gas_validator.d.ts +1 -1
  82. package/dest/msg_validators/tx_validator/gas_validator.d.ts.map +1 -1
  83. package/dest/msg_validators/tx_validator/gas_validator.js +8 -14
  84. package/dest/msg_validators/tx_validator/index.d.ts +2 -1
  85. package/dest/msg_validators/tx_validator/index.d.ts.map +1 -1
  86. package/dest/msg_validators/tx_validator/index.js +1 -0
  87. package/dest/msg_validators/tx_validator/metadata_validator.d.ts +1 -1
  88. package/dest/msg_validators/tx_validator/metadata_validator.d.ts.map +1 -1
  89. package/dest/msg_validators/tx_validator/size_validator.d.ts +6 -0
  90. package/dest/msg_validators/tx_validator/size_validator.d.ts.map +1 -0
  91. package/dest/msg_validators/tx_validator/size_validator.js +20 -0
  92. package/dest/msg_validators/tx_validator/timestamp_validator.d.ts +1 -1
  93. package/dest/msg_validators/tx_validator/timestamp_validator.d.ts.map +1 -1
  94. package/dest/services/dummy_service.d.ts +6 -2
  95. package/dest/services/dummy_service.d.ts.map +1 -1
  96. package/dest/services/dummy_service.js +3 -0
  97. package/dest/services/encoding.d.ts +1 -1
  98. package/dest/services/encoding.d.ts.map +1 -1
  99. package/dest/services/encoding.js +6 -5
  100. package/dest/services/libp2p/instrumentation.d.ts +1 -1
  101. package/dest/services/libp2p/instrumentation.d.ts.map +1 -1
  102. package/dest/services/libp2p/instrumentation.js +20 -73
  103. package/dest/services/libp2p/libp2p_service.d.ts +28 -11
  104. package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
  105. package/dest/services/libp2p/libp2p_service.js +711 -152
  106. package/dest/services/peer-manager/metrics.d.ts +1 -1
  107. package/dest/services/peer-manager/metrics.d.ts.map +1 -1
  108. package/dest/services/peer-manager/metrics.js +6 -26
  109. package/dest/services/peer-manager/peer_manager.d.ts +2 -2
  110. package/dest/services/peer-manager/peer_manager.d.ts.map +1 -1
  111. package/dest/services/peer-manager/peer_manager.js +0 -10
  112. package/dest/services/peer-manager/peer_scoring.d.ts +1 -1
  113. package/dest/services/peer-manager/peer_scoring.d.ts.map +1 -1
  114. package/dest/services/peer-manager/peer_scoring.js +2 -5
  115. package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts +1 -1
  116. package/dest/services/reqresp/connection-sampler/connection_sampler.d.ts.map +1 -1
  117. package/dest/services/reqresp/constants.d.ts +12 -0
  118. package/dest/services/reqresp/constants.d.ts.map +1 -0
  119. package/dest/services/reqresp/constants.js +7 -0
  120. package/dest/services/reqresp/metrics.d.ts +1 -1
  121. package/dest/services/reqresp/metrics.d.ts.map +1 -1
  122. package/dest/services/reqresp/metrics.js +5 -21
  123. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts +1 -1
  124. package/dest/services/reqresp/protocols/block_txs/bitvector.d.ts.map +1 -1
  125. package/dest/services/reqresp/protocols/block_txs/bitvector.js +7 -0
  126. package/dest/services/reqresp/protocols/status.d.ts +1 -1
  127. package/dest/services/reqresp/protocols/status.d.ts.map +1 -1
  128. package/dest/services/reqresp/protocols/status.js +4 -1
  129. package/dest/services/reqresp/reqresp.js +402 -24
  130. package/dest/services/service.d.ts +16 -3
  131. package/dest/services/service.d.ts.map +1 -1
  132. package/dest/services/tx_collection/instrumentation.d.ts +1 -1
  133. package/dest/services/tx_collection/instrumentation.d.ts.map +1 -1
  134. package/dest/services/tx_collection/instrumentation.js +4 -14
  135. package/dest/services/tx_collection/slow_tx_collection.d.ts +3 -3
  136. package/dest/services/tx_collection/slow_tx_collection.d.ts.map +1 -1
  137. package/dest/services/tx_collection/tx_collection.d.ts +5 -5
  138. package/dest/services/tx_collection/tx_collection.d.ts.map +1 -1
  139. package/dest/services/tx_provider.d.ts +3 -3
  140. package/dest/services/tx_provider.d.ts.map +1 -1
  141. package/dest/services/tx_provider_instrumentation.d.ts +1 -1
  142. package/dest/services/tx_provider_instrumentation.d.ts.map +1 -1
  143. package/dest/services/tx_provider_instrumentation.js +6 -19
  144. package/dest/testbench/p2p_client_testbench_worker.js +30 -17
  145. package/dest/testbench/worker_client_manager.d.ts +1 -1
  146. package/dest/testbench/worker_client_manager.d.ts.map +1 -1
  147. package/dest/testbench/worker_client_manager.js +6 -1
  148. package/package.json +16 -16
  149. package/src/client/interface.ts +19 -4
  150. package/src/client/p2p_client.ts +82 -132
  151. package/src/config.ts +2 -2
  152. package/src/mem_pools/attestation_pool/attestation_pool.ts +68 -41
  153. package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +239 -287
  154. package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +162 -140
  155. package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +141 -164
  156. package/src/mem_pools/attestation_pool/mocks.ts +19 -13
  157. package/src/mem_pools/instrumentation.ts +9 -18
  158. package/src/mem_pools/tx_pool/README.md +28 -13
  159. package/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +130 -75
  160. package/src/mem_pools/tx_pool/eviction/eviction_manager.ts +66 -5
  161. package/src/mem_pools/tx_pool/eviction/eviction_strategy.ts +119 -4
  162. package/src/mem_pools/tx_pool/eviction/fee_payer_balance_eviction_rule.ts +162 -0
  163. package/src/mem_pools/tx_pool/eviction/invalid_txs_after_reorg_rule.ts +4 -2
  164. package/src/mem_pools/tx_pool/eviction/nullifier_conflict_pre_add_rule.ts +75 -0
  165. package/src/msg_validators/attestation_validator/attestation_validator.ts +36 -21
  166. package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +13 -16
  167. package/src/msg_validators/clock_tolerance.ts +51 -0
  168. package/src/msg_validators/index.ts +1 -1
  169. package/src/msg_validators/proposal_validator/block_proposal_validator.ts +10 -0
  170. package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +13 -0
  171. package/src/msg_validators/proposal_validator/index.ts +3 -0
  172. package/src/msg_validators/proposal_validator/proposal_validator.ts +92 -0
  173. package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +230 -0
  174. package/src/msg_validators/tx_validator/block_header_validator.ts +3 -1
  175. package/src/msg_validators/tx_validator/data_validator.ts +12 -4
  176. package/src/msg_validators/tx_validator/fee_payer_balance.ts +40 -0
  177. package/src/msg_validators/tx_validator/gas_validator.ts +8 -25
  178. package/src/msg_validators/tx_validator/index.ts +1 -0
  179. package/src/msg_validators/tx_validator/metadata_validator.ts +12 -4
  180. package/src/msg_validators/tx_validator/size_validator.ts +18 -0
  181. package/src/msg_validators/tx_validator/timestamp_validator.ts +3 -1
  182. package/src/services/dummy_service.ts +6 -0
  183. package/src/services/encoding.ts +5 -4
  184. package/src/services/libp2p/instrumentation.ts +19 -73
  185. package/src/services/libp2p/libp2p_service.ts +351 -115
  186. package/src/services/peer-manager/metrics.ts +5 -26
  187. package/src/services/peer-manager/peer_manager.ts +1 -2
  188. package/src/services/peer-manager/peer_scoring.ts +1 -5
  189. package/src/services/reqresp/connection-sampler/connection_sampler.ts +3 -1
  190. package/src/services/reqresp/constants.ts +14 -0
  191. package/src/services/reqresp/metrics.ts +7 -23
  192. package/src/services/reqresp/protocols/block_txs/bitvector.ts +9 -0
  193. package/src/services/reqresp/protocols/status.ts +7 -4
  194. package/src/services/service.ts +19 -4
  195. package/src/services/tx_collection/instrumentation.ts +4 -21
  196. package/src/services/tx_collection/slow_tx_collection.ts +2 -2
  197. package/src/services/tx_collection/tx_collection.ts +4 -4
  198. package/src/services/tx_provider.ts +2 -2
  199. package/src/services/tx_provider_instrumentation.ts +11 -24
  200. package/src/testbench/p2p_client_testbench_worker.ts +40 -21
  201. package/src/testbench/worker_client_manager.ts +6 -1
  202. package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts +0 -15
  203. package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.d.ts.map +0 -1
  204. package/dest/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.js +0 -88
  205. package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -12
  206. package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +0 -1
  207. package/dest/msg_validators/block_proposal_validator/block_proposal_validator.js +0 -82
  208. package/dest/msg_validators/block_proposal_validator/index.d.ts +0 -2
  209. package/dest/msg_validators/block_proposal_validator/index.d.ts.map +0 -1
  210. package/dest/msg_validators/block_proposal_validator/index.js +0 -1
  211. package/src/mem_pools/tx_pool/eviction/insufficient_fee_payer_balance_rule.ts +0 -108
  212. package/src/msg_validators/block_proposal_validator/block_proposal_validator.ts +0 -97
  213. package/src/msg_validators/block_proposal_validator/index.ts +0 -1
@@ -1,30 +1,29 @@
1
- import { GENESIS_BLOCK_HEADER_HASH, INITIAL_L2_BLOCK_NUM } from '@aztec/constants';
1
+ import { GENESIS_BLOCK_HEADER_HASH } from '@aztec/constants';
2
2
  import { BlockNumber, SlotNumber } from '@aztec/foundation/branded-types';
3
3
  import { createLogger } from '@aztec/foundation/log';
4
4
  import { DateProvider } from '@aztec/foundation/timer';
5
- import type { AztecAsyncKVStore, AztecAsyncMap, AztecAsyncSingleton } from '@aztec/kv-store';
6
- import type {
7
- EthAddress,
8
- L2BlockId,
9
- L2BlockNew,
10
- L2BlockSource,
5
+ import type { AztecAsyncKVStore, AztecAsyncSingleton } from '@aztec/kv-store';
6
+ import { L2TipsKVStore } from '@aztec/kv-store/stores';
7
+ import {
8
+ type EthAddress,
9
+ type L2Block,
10
+ type L2BlockSource,
11
11
  L2BlockStream,
12
- L2BlockStreamEvent,
13
- L2Tips,
12
+ type L2BlockStreamEvent,
13
+ type L2Tips,
14
+ type L2TipsStore,
14
15
  } from '@aztec/stdlib/block';
15
16
  import type { ContractDataSource } from '@aztec/stdlib/contract';
16
17
  import { getTimestampForSlot } from '@aztec/stdlib/epoch-helpers';
17
18
  import { type PeerInfo, tryStop } from '@aztec/stdlib/interfaces/server';
18
- import { BlockAttestation, type BlockProposal, type P2PClientType } from '@aztec/stdlib/p2p';
19
- import type { Tx, TxHash } from '@aztec/stdlib/tx';
20
19
  import {
21
- Attributes,
22
- type TelemetryClient,
23
- TraceableL2BlockStream,
24
- WithTracer,
25
- getTelemetryClient,
26
- trackSpan,
27
- } from '@aztec/telemetry-client';
20
+ type BlockProposal,
21
+ CheckpointAttestation,
22
+ type CheckpointProposal,
23
+ type P2PClientType,
24
+ } from '@aztec/stdlib/p2p';
25
+ import type { Tx, TxHash } from '@aztec/stdlib/tx';
26
+ import { Attributes, type TelemetryClient, WithTracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
28
27
 
29
28
  import type { PeerId } from '@libp2p/interface';
30
29
  import type { ENR } from '@nethermindeth/enr';
@@ -40,7 +39,7 @@ import {
40
39
  type ReqRespSubProtocolValidators,
41
40
  } from '../services/reqresp/interface.js';
42
41
  import { chunkTxHashesRequest } from '../services/reqresp/protocols/tx.js';
43
- import type { P2PBlockReceivedCallback, P2PService } from '../services/service.js';
42
+ import type { P2PBlockReceivedCallback, P2PCheckpointReceivedCallback, P2PService } from '../services/service.js';
44
43
  import { TxCollection } from '../services/tx_collection/tx_collection.js';
45
44
  import { TxProvider } from '../services/tx_provider.js';
46
45
  import { type P2P, P2PClientState, type P2PSyncState } from './interface.js';
@@ -62,10 +61,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
62
61
  private provenBlockNumberAtStart = -1;
63
62
  private finalizedBlockNumberAtStart = -1;
64
63
 
65
- private synchedBlockHashes: AztecAsyncMap<BlockNumber, string>;
66
- private synchedLatestBlockNumber: AztecAsyncSingleton<BlockNumber>;
67
- private synchedProvenBlockNumber: AztecAsyncSingleton<BlockNumber>;
68
- private synchedFinalizedBlockNumber: AztecAsyncSingleton<BlockNumber>;
64
+ private l2Tips: L2TipsStore;
69
65
  private synchedLatestSlot: AztecAsyncSingleton<bigint>;
70
66
 
71
67
  private txPool: TxPool;
@@ -114,7 +110,8 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
114
110
  );
115
111
 
116
112
  // Default to collecting all txs when we see a valid proposal
117
- // This can be overridden by the validator client to attest, and it will call getTxsForBlockProposal on its own
113
+ // This can be overridden by the validator client to validate, and it will call getTxsForBlockProposal on its own
114
+ // Note: Validators do NOT attest to individual blocks - attestations are only for checkpoint proposals.
118
115
  // TODO(palla/txs): We should not trigger a request for txs on a proposal before fully validating it. We need to bring
119
116
  // validator-client code into here so we can validate a proposal is reasonable.
120
117
  this.registerBlockProposalHandler(async (block, sender) => {
@@ -123,21 +120,17 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
123
120
  const constants = this.txCollection.getConstants();
124
121
  const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(block.slotNumber + 1), constants));
125
122
  const deadline = new Date(nextSlotTimestampSeconds * 1000);
126
- const parentBlock = await this.l2BlockSource.getBlockHeaderByArchive(block.payload.header.lastArchiveRoot);
123
+ const parentBlock = await this.l2BlockSource.getBlockHeaderByArchive(block.blockHeader.lastArchive.root);
127
124
  if (!parentBlock) {
128
125
  this.log.debug(`Cannot collect txs for proposal as parent block not found`);
129
- return;
126
+ return false;
130
127
  }
131
128
  const blockNumber = BlockNumber(parentBlock.getBlockNumber() + 1);
132
129
  await this.txProvider.getTxsForBlockProposal(block, blockNumber, { pinnedPeer: sender, deadline });
133
- return undefined;
130
+ return true;
134
131
  });
135
132
 
136
- // REFACTOR: Try replacing these with an L2TipsStore
137
- this.synchedBlockHashes = store.openMap('p2p_pool_block_hashes');
138
- this.synchedLatestBlockNumber = store.openSingleton('p2p_pool_last_l2_block');
139
- this.synchedProvenBlockNumber = store.openSingleton('p2p_pool_last_proven_l2_block');
140
- this.synchedFinalizedBlockNumber = store.openSingleton('p2p_pool_last_finalized_l2_block');
133
+ this.l2Tips = new L2TipsKVStore(store, 'p2p_client');
141
134
  this.synchedLatestSlot = store.openSingleton('p2p_pool_last_l2_slot');
142
135
  }
143
136
 
@@ -163,7 +156,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
163
156
  }
164
157
 
165
158
  public getL2BlockHash(number: BlockNumber): Promise<string | undefined> {
166
- return this.synchedBlockHashes.getAsync(number);
159
+ return this.l2Tips.getL2BlockHash(number);
167
160
  }
168
161
 
169
162
  public updateP2PConfig(config: Partial<P2PConfig>): Promise<void> {
@@ -172,85 +165,45 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
172
165
  return Promise.resolve();
173
166
  }
174
167
 
175
- public async getL2Tips(): Promise<L2Tips> {
176
- const latestBlockNumber = await this.getSyncedLatestBlockNum();
177
- let latestBlockHash: string | undefined;
178
-
179
- const provenBlockNumber = await this.getSyncedProvenBlockNum();
180
- let provenBlockHash: string | undefined;
181
-
182
- const finalizedBlockNumber = await this.getSyncedFinalizedBlockNum();
183
- let finalizedBlockHash: string | undefined;
184
-
185
- if (latestBlockNumber > 0) {
186
- latestBlockHash = await this.synchedBlockHashes.getAsync(latestBlockNumber);
187
- if (typeof latestBlockHash === 'undefined') {
188
- throw new Error(`Block hash for latest block ${latestBlockNumber} not found in p2p client`);
189
- }
190
- }
191
-
192
- if (provenBlockNumber > 0) {
193
- provenBlockHash = await this.synchedBlockHashes.getAsync(provenBlockNumber);
194
- if (typeof provenBlockHash === 'undefined') {
195
- throw new Error(`Block hash for proven block ${provenBlockNumber} not found in p2p client`);
196
- }
197
- }
198
-
199
- if (finalizedBlockNumber > 0) {
200
- finalizedBlockHash = await this.synchedBlockHashes.getAsync(finalizedBlockNumber);
201
- if (typeof finalizedBlockHash === 'undefined') {
202
- throw new Error(`Block hash for finalized block ${finalizedBlockNumber} not found in p2p client`);
203
- }
204
- }
205
-
206
- const genesisHash = GENESIS_BLOCK_HEADER_HASH.toString();
207
-
208
- return {
209
- latest: { hash: latestBlockHash ?? genesisHash, number: latestBlockNumber },
210
- proven: { hash: provenBlockHash ?? genesisHash, number: provenBlockNumber },
211
- finalized: { hash: finalizedBlockHash ?? genesisHash, number: finalizedBlockNumber },
212
- };
168
+ public getL2Tips(): Promise<L2Tips> {
169
+ return this.l2Tips.getL2Tips();
213
170
  }
214
171
 
215
172
  public async handleBlockStreamEvent(event: L2BlockStreamEvent): Promise<void> {
216
173
  this.log.debug(`Handling block stream event ${event.type}`);
174
+
217
175
  switch (event.type) {
218
176
  case 'blocks-added':
219
- await this.handleLatestL2Blocks(event.blocks.map(b => b.block.toL2Block()));
177
+ await this.handleLatestL2Blocks(event.blocks);
220
178
  break;
221
179
  case 'chain-finalized': {
222
- // TODO (alexg): I think we can prune the block hashes map here
223
- await this.setBlockHash(event.block);
224
- const from = BlockNumber((await this.getSyncedFinalizedBlockNum()) + 1);
180
+ const oldFinalizedBlockNum = await this.getSyncedFinalizedBlockNum();
181
+ const from = BlockNumber(oldFinalizedBlockNum + 1);
225
182
  const limit = event.block.number - from + 1;
226
183
  if (limit > 0) {
227
184
  const oldBlocks = await this.l2BlockSource.getBlocks(from, limit);
228
- await this.handleFinalizedL2Blocks(oldBlocks.map(b => b.toL2Block()));
185
+ await this.handleFinalizedL2Blocks(oldBlocks);
229
186
  }
230
187
  break;
231
188
  }
232
- case 'chain-proven': {
233
- await this.setBlockHash(event.block);
189
+ case 'chain-proven':
234
190
  this.txCollection.stopCollectingForBlocksUpTo(event.block.number);
235
- await this.synchedProvenBlockNumber.set(event.block.number);
236
191
  break;
237
- }
238
192
  case 'chain-pruned':
239
- await this.setBlockHash(event.block);
240
193
  this.txCollection.stopCollectingForBlocksAfter(event.block.number);
241
194
  await this.handlePruneL2Blocks(event.block.number);
242
195
  break;
196
+ case 'chain-checkpointed':
197
+ break;
243
198
  default: {
244
199
  const _: never = event;
245
200
  break;
246
201
  }
247
202
  }
248
- }
249
203
 
250
- private async setBlockHash(block: L2BlockId): Promise<void> {
251
- if (block.hash !== undefined) {
252
- await this.synchedBlockHashes.set(block.number, block.hash.toString());
253
- }
204
+ // Pass the event through to our l2 tips store
205
+ await this.l2Tips.handleBlockStreamEvent(event);
206
+ await this.startServiceIfSynched();
254
207
  }
255
208
 
256
209
  #assertIsReady() {
@@ -274,9 +227,9 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
274
227
 
275
228
  // get the current latest block numbers
276
229
  const latestBlockNumbers = await this.l2BlockSource.getL2Tips();
277
- this.latestBlockNumberAtStart = latestBlockNumbers.latest.number;
278
- this.provenBlockNumberAtStart = latestBlockNumbers.proven.number;
279
- this.finalizedBlockNumberAtStart = latestBlockNumbers.finalized.number;
230
+ this.latestBlockNumberAtStart = latestBlockNumbers.proposed.number;
231
+ this.provenBlockNumberAtStart = latestBlockNumbers.proven.block.number;
232
+ this.finalizedBlockNumberAtStart = latestBlockNumbers.finalized.block.number;
280
233
 
281
234
  const syncedLatestBlock = (await this.getSyncedLatestBlockNum()) + 1;
282
235
  const syncedProvenBlock = (await this.getSyncedProvenBlockNum()) + 1;
@@ -335,12 +288,10 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
335
288
  private initBlockStream(startingBlock?: BlockNumber) {
336
289
  if (!this.blockStream) {
337
290
  const { blockRequestBatchSize: batchSize, blockCheckIntervalMS: pollIntervalMS } = this.config;
338
- this.blockStream = new TraceableL2BlockStream(
291
+ this.blockStream = new L2BlockStream(
339
292
  this.l2BlockSource,
340
293
  this,
341
294
  this,
342
- this.telemetry.getTracer('P2PL2BlockStream'),
343
- 'P2PL2BlockStream',
344
295
  createLogger(`${this.log.module}:l2-block-stream`),
345
296
  { batchSize, pollIntervalMS, startingBlock },
346
297
  );
@@ -380,23 +331,32 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
380
331
  return this.p2pService.propagate(proposal);
381
332
  }
382
333
 
383
- public async broadcastAttestations(attestations: BlockAttestation[]): Promise<void> {
384
- this.log.verbose(`Broadcasting ${attestations.length} attestations to peers`);
385
- await Promise.all(attestations.map(att => this.p2pService.propagate(att)));
334
+ @trackSpan('p2pClient.broadcastCheckpointProposal', async proposal => ({
335
+ [Attributes.SLOT_NUMBER]: proposal.slotNumber,
336
+ [Attributes.BLOCK_ARCHIVE]: proposal.archive.toString(),
337
+ [Attributes.P2P_ID]: (await proposal.p2pMessageLoggingIdentifier()).toString(),
338
+ }))
339
+ public broadcastCheckpointProposal(proposal: CheckpointProposal): Promise<void> {
340
+ this.log.verbose(`Broadcasting checkpoint proposal for slot ${proposal.slotNumber} to peers`);
341
+ return this.p2pService.propagate(proposal);
386
342
  }
387
343
 
388
- public async getAttestationsForSlot(slot: SlotNumber, proposalId?: string): Promise<BlockAttestation[]> {
389
- return await (proposalId
390
- ? this.attestationPool.getAttestationsForSlotAndProposal(slot, proposalId)
391
- : this.attestationPool.getAttestationsForSlot(slot));
344
+ public async broadcastCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void> {
345
+ this.log.verbose(`Broadcasting ${attestations.length} checkpoint attestations to peers`);
346
+ await Promise.all(attestations.map(att => this.p2pService.propagate(att)));
392
347
  }
393
348
 
394
- public addAttestations(attestations: BlockAttestation[]): Promise<void> {
395
- return this.attestationPool.addAttestations(attestations);
349
+ public async getCheckpointAttestationsForSlot(
350
+ slot: SlotNumber,
351
+ proposalId?: string,
352
+ ): Promise<CheckpointAttestation[]> {
353
+ return await (proposalId
354
+ ? this.attestationPool.getCheckpointAttestationsForSlotAndProposal(slot, proposalId)
355
+ : this.attestationPool.getCheckpointAttestationsForSlot(slot));
396
356
  }
397
357
 
398
- public deleteAttestation(attestation: BlockAttestation): Promise<void> {
399
- return this.attestationPool.deleteAttestations([attestation]);
358
+ public addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void> {
359
+ return this.attestationPool.addCheckpointAttestations(attestations);
400
360
  }
401
361
 
402
362
  // REVIEW: https://github.com/AztecProtocol/aztec-packages/issues/7963
@@ -405,6 +365,10 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
405
365
  this.p2pService.registerBlockReceivedCallback(handler);
406
366
  }
407
367
 
368
+ public registerCheckpointProposalHandler(handler: P2PCheckpointReceivedCallback): void {
369
+ this.p2pService.registerCheckpointReceivedCallback(handler);
370
+ }
371
+
408
372
  /**
409
373
  * Uses the batched Request Response protocol to request a set of transactions from the network.
410
374
  */
@@ -647,7 +611,8 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
647
611
  * @returns Block number of latest L2 Block we've synced with.
648
612
  */
649
613
  public async getSyncedLatestBlockNum(): Promise<BlockNumber> {
650
- return (await this.synchedLatestBlockNumber.getAsync()) ?? BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
614
+ const tips = await this.l2Tips.getL2Tips();
615
+ return tips.proposed.number;
651
616
  }
652
617
 
653
618
  /**
@@ -655,11 +620,13 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
655
620
  * @returns Block number of latest proven L2 Block we've synced with.
656
621
  */
657
622
  public async getSyncedProvenBlockNum(): Promise<BlockNumber> {
658
- return (await this.synchedProvenBlockNumber.getAsync()) ?? BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
623
+ const tips = await this.l2Tips.getL2Tips();
624
+ return tips.proven.block.number;
659
625
  }
660
626
 
661
627
  public async getSyncedFinalizedBlockNum(): Promise<BlockNumber> {
662
- return (await this.synchedFinalizedBlockNumber.getAsync()) ?? BlockNumber(INITIAL_L2_BLOCK_NUM - 1);
628
+ const tips = await this.l2Tips.getL2Tips();
629
+ return tips.finalized.block.number;
663
630
  }
664
631
 
665
632
  /** Returns latest L2 slot for which we have seen an L2 block. */
@@ -692,7 +659,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
692
659
  * @param blocks - A list of existing blocks with txs that the P2P client needs to ensure the tx pool is reconciled with.
693
660
  * @returns Empty promise.
694
661
  */
695
- private async markTxsAsMinedFromBlocks(blocks: L2BlockNew[]): Promise<void> {
662
+ private async markTxsAsMinedFromBlocks(blocks: L2Block[]): Promise<void> {
696
663
  for (const block of blocks) {
697
664
  const txHashes = block.body.txEffects.map(txEffect => txEffect.txHash);
698
665
  await this.txPool.markAsMined(txHashes, block.header);
@@ -704,7 +671,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
704
671
  * @param blocks - A list of existing blocks with txs that the P2P client needs to ensure the tx pool is reconciled with.
705
672
  * @returns Empty promise.
706
673
  */
707
- private async handleLatestL2Blocks(blocks: L2BlockNew[]): Promise<void> {
674
+ private async handleLatestL2Blocks(blocks: L2Block[]): Promise<void> {
708
675
  if (!blocks.length) {
709
676
  return Promise.resolve();
710
677
  }
@@ -714,24 +681,12 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
714
681
  await this.startCollectingMissingTxs(blocks);
715
682
 
716
683
  const lastBlock = blocks.at(-1)!;
717
-
718
- await Promise.all(
719
- blocks.map(async block =>
720
- this.setBlockHash({
721
- number: block.number,
722
- hash: await block.hash().then(h => h.toString()),
723
- }),
724
- ),
725
- );
726
-
727
- await this.synchedLatestBlockNumber.set(lastBlock.number);
728
684
  await this.synchedLatestSlot.set(BigInt(lastBlock.header.getSlot()));
729
685
  this.log.verbose(`Synched to latest block ${lastBlock.number}`);
730
- await this.startServiceIfSynched();
731
686
  }
732
687
 
733
688
  /** Request txs for unproven blocks so the prover node has more chances to get them. */
734
- private async startCollectingMissingTxs(blocks: L2BlockNew[]): Promise<void> {
689
+ private async startCollectingMissingTxs(blocks: L2Block[]): Promise<void> {
735
690
  try {
736
691
  // TODO(#15435): If the archiver has lagged behind L1, the reported proven block number may
737
692
  // be much lower than the actual one, and it does not update until the pending chain is
@@ -764,7 +719,7 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
764
719
  * @param blocks - A list of finalized L2 blocks.
765
720
  * @returns Empty promise.
766
721
  */
767
- private async handleFinalizedL2Blocks(blocks: L2BlockNew[]): Promise<void> {
722
+ private async handleFinalizedL2Blocks(blocks: L2Block[]): Promise<void> {
768
723
  if (!blocks.length) {
769
724
  return Promise.resolve();
770
725
  }
@@ -778,12 +733,9 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
778
733
  await this.txPool.deleteTxs(txHashes, { permanently: true });
779
734
  await this.txPool.cleanupDeletedMinedTxs(lastBlockNum);
780
735
 
781
- await this.attestationPool.deleteAttestationsOlderThan(lastBlockSlot);
736
+ await this.attestationPool.deleteCheckpointAttestationsOlderThan(lastBlockSlot);
782
737
 
783
- await this.synchedFinalizedBlockNumber.set(lastBlockNum);
784
738
  this.log.debug(`Synched to finalized block ${lastBlockNum} at slot ${lastBlockSlot}`);
785
-
786
- await this.startServiceIfSynched();
787
739
  }
788
740
 
789
741
  /**
@@ -831,18 +783,16 @@ export class P2PClient<T extends P2PClientType = P2PClientType.Full>
831
783
  } else {
832
784
  await this.txPool.markMinedAsPending(minedTxsFromReorg, latestBlock);
833
785
  }
834
-
835
- await this.synchedLatestBlockNumber.set(latestBlock);
836
- // no need to update block hashes, as they will be updated as new blocks are added
837
786
  }
838
787
 
839
788
  private async startServiceIfSynched() {
840
789
  if (this.currentState !== P2PClientState.SYNCHING) {
841
790
  return;
842
791
  }
843
- const syncedFinalizedBlock = await this.getSyncedFinalizedBlockNum();
844
- const syncedProvenBlock = await this.getSyncedProvenBlockNum();
845
- const syncedLatestBlock = await this.getSyncedLatestBlockNum();
792
+ const tips = await this.l2Tips.getL2Tips();
793
+ const syncedFinalizedBlock = tips.finalized.block.number;
794
+ const syncedProvenBlock = tips.proven.block.number;
795
+ const syncedLatestBlock = tips.proposed.number;
846
796
 
847
797
  if (
848
798
  syncedLatestBlock >= this.latestBlockNumberAtStart &&
package/src/config.ts CHANGED
@@ -2,10 +2,10 @@ import {
2
2
  type ConfigMappingsType,
3
3
  SecretValue,
4
4
  booleanConfigHelper,
5
- floatConfigHelper,
6
5
  getConfigFromMappings,
7
6
  getDefaultConfig,
8
7
  numberConfigHelper,
8
+ percentageConfigHelper,
9
9
  pickConfigMappings,
10
10
  secretStringConfigHelper,
11
11
  } from '@aztec/foundation/config';
@@ -407,7 +407,7 @@ export const p2pConfigMappings: ConfigMappingsType<P2PConfig> = {
407
407
  dropTransactionsProbability: {
408
408
  env: 'P2P_DROP_TX_CHANCE',
409
409
  description: 'The probability that a transaction is discarded (0 - 1). - For testing purposes only',
410
- ...floatConfigHelper(0),
410
+ ...percentageConfigHelper(0),
411
411
  },
412
412
  disableTransactions: {
413
413
  env: 'TRANSACTIONS_DISABLED',
@@ -1,5 +1,10 @@
1
1
  import type { SlotNumber } from '@aztec/foundation/branded-types';
2
- import type { BlockAttestation, BlockProposal } from '@aztec/stdlib/p2p';
2
+ import type {
3
+ BlockProposal,
4
+ CheckpointAttestation,
5
+ CheckpointProposal,
6
+ CheckpointProposalCore,
7
+ } from '@aztec/stdlib/p2p';
3
8
 
4
9
  /**
5
10
  * An Attestation Pool contains attestations collected by a validator
@@ -32,75 +37,74 @@ export interface AttestationPool {
32
37
  hasBlockProposal(idOrProposal: string | BlockProposal): Promise<boolean>;
33
38
 
34
39
  /**
35
- * AddAttestations
40
+ * Adds a checkpoint proposal to the pool.
36
41
  *
37
- * @param attestations - Attestations to add into the pool
42
+ * If the proposal contains a lastBlock, the BlockProposal is automatically extracted
43
+ * and stored separately via addBlockProposal. The checkpoint proposal is then stored
44
+ * without the lastBlock info (as CheckpointProposalCore).
45
+ *
46
+ * @param proposal - The checkpoint proposal to add
47
+ * @throws ProposalSlotCapExceededError if the slot has reached the maximum number of proposals
38
48
  */
39
- addAttestations(attestations: BlockAttestation[]): Promise<void>;
49
+ addCheckpointProposal(proposal: CheckpointProposal): Promise<void>;
40
50
 
41
51
  /**
42
- * DeleteAttestation
52
+ * Get checkpoint proposal by its ID.
53
+ *
54
+ * Returns a CheckpointProposalCore (without lastBlock info) since the lastBlock
55
+ * is extracted and stored separately as a BlockProposal when added.
43
56
  *
44
- * @param attestations - Attestations to remove from the pool
57
+ * @param id - The ID of the checkpoint proposal to retrieve (proposal.archive)
58
+ * @return The checkpoint proposal core if it exists, otherwise undefined.
45
59
  */
46
- deleteAttestations(attestations: BlockAttestation[]): Promise<void>;
60
+ getCheckpointProposal(id: string): Promise<CheckpointProposalCore | undefined>;
47
61
 
48
62
  /**
49
- * Delete Attestations with a slot number smaller than the given slot
50
- *
51
- * Removes all attestations associated with a slot
63
+ * Check if a checkpoint proposal exists in the pool
52
64
  *
53
- * @param slot - The oldest slot to keep.
65
+ * @param idOrProposal - The ID of the checkpoint proposal or the proposal itself
66
+ * @return True if the proposal exists, false otherwise.
54
67
  */
55
- deleteAttestationsOlderThan(slot: SlotNumber): Promise<void>;
68
+ hasCheckpointProposal(idOrProposal: string | CheckpointProposal): Promise<boolean>;
56
69
 
57
70
  /**
58
- * Delete Attestations for slot
59
- *
60
- * Removes all attestations associated with a slot
71
+ * Add checkpoint attestations to the pool
61
72
  *
62
- * @param slot - The slot to delete.
73
+ * @param attestations - Checkpoint attestations to add into the pool
63
74
  */
64
- deleteAttestationsForSlot(slot: SlotNumber): Promise<void>;
75
+ addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
65
76
 
66
77
  /**
67
- * Delete Attestations for slot and proposal
68
- *
69
- * Removes all attestations associated with a slot and proposal
78
+ * Delete checkpoint attestations older than the given slot
70
79
  *
71
- * @param slot - The slot to delete.
72
- * @param proposalId - The proposal to delete.
80
+ * @param slot - The oldest slot to keep.
73
81
  */
74
- deleteAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<void>;
82
+ deleteCheckpointAttestationsOlderThan(slot: SlotNumber): Promise<void>;
75
83
 
76
84
  /**
77
- * Get all Attestations for all proposals for a given slot
78
- *
79
- * Retrieve all of the attestations observed pertaining to a given slot
85
+ * Get all checkpoint attestations for a given slot
80
86
  *
81
87
  * @param slot - The slot to query
82
- * @return BlockAttestations
88
+ * @return CheckpointAttestations
83
89
  */
84
- getAttestationsForSlot(slot: SlotNumber): Promise<BlockAttestation[]>;
90
+ getCheckpointAttestationsForSlot(slot: SlotNumber): Promise<CheckpointAttestation[]>;
85
91
 
86
92
  /**
87
- * Get Attestations for slot and given proposal
88
- *
89
- * Retrieve all of the attestations observed pertaining to a given slot
93
+ * Get checkpoint attestations for slot and given proposal
90
94
  *
91
95
  * @param slot - The slot to query
92
96
  * @param proposalId - The proposal to query
93
- * @return BlockAttestations
97
+ * @return CheckpointAttestations
94
98
  */
95
- getAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<BlockAttestation[]>;
99
+ getCheckpointAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<CheckpointAttestation[]>;
96
100
 
97
101
  /**
98
- * Check if a specific attestation exists in the pool
102
+ * Check if a specific checkpoint attestation exists in the pool
99
103
  *
100
104
  * @param attestation - The attestation to check
101
105
  * @return True if the attestation exists, false otherwise
102
106
  */
103
- hasAttestation(attestation: BlockAttestation): Promise<boolean>;
107
+ hasCheckpointAttestation(attestation: CheckpointAttestation): Promise<boolean>;
104
108
 
105
109
  /**
106
110
  * Returns whether adding this proposal is permitted at current capacity:
@@ -114,16 +118,39 @@ export interface AttestationPool {
114
118
  canAddProposal(block: BlockProposal): Promise<boolean>;
115
119
 
116
120
  /**
117
- * Returns whether an attestation would be accepted for (slot, proposalId):
118
- * - True if the attestation already exists for this sender.
119
- * - True if the attestation cap for (slot, proposalId) has not been reached.
120
- * - False if the cap is reached and this attestation would be a new unique entry.
121
+ * Returns whether adding this checkpoint proposal is permitted at current capacity.
122
+ *
123
+ * @param proposal - The checkpoint proposal to check
124
+ * @returns True if the proposal can be added, false otherwise.
125
+ */
126
+ canAddCheckpointProposal(proposal: CheckpointProposal): Promise<boolean>;
127
+
128
+ /**
129
+ * Returns whether a checkpoint attestation would be accepted for (slot, proposalId).
121
130
  *
122
131
  * @param attestation - The attestation to check
123
- * @param committeeSize - Committee size for the attestation's slot, implementation may add a small buffer
132
+ * @param committeeSize - Committee size for the attestation's slot
124
133
  * @returns True if the attestation can be added, false otherwise.
125
134
  */
126
- canAddAttestation(attestation: BlockAttestation, committeeSize: number): Promise<boolean>;
135
+ canAddCheckpointAttestation(attestation: CheckpointAttestation, committeeSize: number): Promise<boolean>;
136
+
137
+ /**
138
+ * Returns whether the checkpoint proposal cap for the given slot has been reached.
139
+ *
140
+ * @param slot - The slot to check
141
+ * @returns True if the cap has been reached, false otherwise.
142
+ */
143
+ hasReachedCheckpointProposalCap(slot: SlotNumber): Promise<boolean>;
144
+
145
+ /**
146
+ * Returns whether the checkpoint attestation cap for the given slot and proposal has been reached.
147
+ *
148
+ * @param slot - The slot to check
149
+ * @param proposalId - The proposal to check
150
+ * @param committeeSize - Committee size for the slot
151
+ * @returns True if the cap has been reached, false otherwise.
152
+ */
153
+ hasReachedCheckpointAttestationCap(slot: SlotNumber, proposalId: string, committeeSize: number): Promise<boolean>;
127
154
 
128
155
  /** Returns whether the pool is empty. */
129
156
  isEmpty(): Promise<boolean>;