@aztec/p2p 0.0.1-commit.e3c1de76 → 0.0.1-commit.e558bd1c
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/client/factory.d.ts +3 -3
- package/dest/client/factory.d.ts.map +1 -1
- package/dest/client/factory.js +5 -3
- package/dest/client/interface.d.ts +9 -2
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +7 -4
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +22 -7
- package/dest/client/test/tx_proposal_collector/proposal_tx_collector_worker.js +1 -1
- package/dest/config.d.ts +9 -3
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +3 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +94 -87
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool.js +411 -3
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +2 -2
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.js +351 -85
- package/dest/mem_pools/attestation_pool/index.d.ts +2 -3
- package/dest/mem_pools/attestation_pool/index.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/index.js +1 -2
- package/dest/mem_pools/index.d.ts +2 -2
- package/dest/mem_pools/index.d.ts.map +1 -1
- package/dest/mem_pools/index.js +1 -1
- package/dest/mem_pools/interface.d.ts +3 -3
- package/dest/mem_pools/interface.d.ts.map +1 -1
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts +2 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/index.js +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts +43 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/archive/tx_archive.js +103 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts +47 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/eviction_manager.js +119 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.js +90 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts +19 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.js +89 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts +10 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/index.js +11 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts +131 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/interfaces.js +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.js +63 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts +17 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.js +91 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts +16 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.js +70 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts +20 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.js +63 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts +15 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.js +19 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts +5 -0
- package/dest/mem_pools/tx_pool_v2/index.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/index.js +4 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts +197 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/interfaces.js +6 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts +71 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_metadata.js +95 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts +26 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_bench_metrics.js +70 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts +99 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_indices.js +332 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts +55 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2.js +156 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts +69 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.d.ts.map +1 -0
- package/dest/mem_pools/tx_pool_v2/tx_pool_v2_impl.js +748 -0
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +3 -3
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/services/dummy_service.d.ts +6 -2
- package/dest/services/dummy_service.d.ts.map +1 -1
- package/dest/services/dummy_service.js +3 -0
- package/dest/services/index.d.ts +2 -1
- package/dest/services/index.d.ts.map +1 -1
- package/dest/services/index.js +1 -0
- package/dest/services/libp2p/libp2p_service.d.ts +74 -33
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +299 -228
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts +4 -4
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.d.ts.map +1 -1
- package/dest/services/reqresp/batch-tx-requester/batch_tx_requester.js +8 -8
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts +6 -4
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_handler.js +16 -11
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts +15 -10
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.d.ts.map +1 -1
- package/dest/services/reqresp/protocols/block_txs/block_txs_reqresp.js +12 -11
- package/dest/services/service.d.ts +18 -1
- package/dest/services/service.d.ts.map +1 -1
- package/dest/services/tx_collection/config.d.ts +3 -3
- package/dest/services/tx_collection/config.js +3 -3
- package/dest/services/tx_collection/fast_tx_collection.d.ts +4 -5
- package/dest/services/tx_collection/fast_tx_collection.d.ts.map +1 -1
- package/dest/services/tx_collection/fast_tx_collection.js +10 -14
- package/dest/services/tx_collection/index.d.ts +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.d.ts +12 -12
- package/dest/services/tx_collection/proposal_tx_collector.d.ts.map +1 -1
- package/dest/services/tx_collection/proposal_tx_collector.js +4 -5
- package/dest/services/tx_file_store/config.d.ts +18 -0
- package/dest/services/tx_file_store/config.d.ts.map +1 -0
- package/dest/services/tx_file_store/config.js +26 -0
- package/dest/services/tx_file_store/index.d.ts +4 -0
- package/dest/services/tx_file_store/index.d.ts.map +1 -0
- package/dest/services/tx_file_store/index.js +3 -0
- package/dest/services/tx_file_store/instrumentation.d.ts +15 -0
- package/dest/services/tx_file_store/instrumentation.d.ts.map +1 -0
- package/dest/services/tx_file_store/instrumentation.js +29 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts +47 -0
- package/dest/services/tx_file_store/tx_file_store.d.ts.map +1 -0
- package/dest/services/tx_file_store/tx_file_store.js +149 -0
- package/dest/test-helpers/testbench-utils.d.ts +10 -16
- package/dest/test-helpers/testbench-utils.d.ts.map +1 -1
- package/dest/test-helpers/testbench-utils.js +32 -30
- package/dest/testbench/p2p_client_testbench_worker.js +1 -1
- package/package.json +14 -14
- package/src/client/factory.ts +7 -4
- package/src/client/interface.ts +13 -1
- package/src/client/p2p_client.ts +30 -8
- package/src/client/test/tx_proposal_collector/proposal_tx_collector_worker.ts +1 -1
- package/src/config.ts +8 -1
- package/src/mem_pools/attestation_pool/attestation_pool.ts +444 -90
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +436 -100
- package/src/mem_pools/attestation_pool/index.ts +9 -2
- package/src/mem_pools/index.ts +1 -1
- package/src/mem_pools/interface.ts +2 -2
- package/src/mem_pools/tx_pool_v2/README.md +209 -0
- package/src/mem_pools/tx_pool_v2/archive/index.ts +1 -0
- package/src/mem_pools/tx_pool_v2/archive/tx_archive.ts +120 -0
- package/src/mem_pools/tx_pool_v2/eviction/eviction_manager.ts +147 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_eviction_rule.ts +118 -0
- package/src/mem_pools/tx_pool_v2/eviction/fee_payer_balance_pre_add_rule.ts +111 -0
- package/src/mem_pools/tx_pool_v2/eviction/index.ts +23 -0
- package/src/mem_pools/tx_pool_v2/eviction/interfaces.ts +164 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_mining_rule.ts +74 -0
- package/src/mem_pools/tx_pool_v2/eviction/invalid_txs_after_reorg_rule.ts +101 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_eviction_rule.ts +86 -0
- package/src/mem_pools/tx_pool_v2/eviction/low_priority_pre_add_rule.ts +72 -0
- package/src/mem_pools/tx_pool_v2/eviction/nullifier_conflict_rule.ts +31 -0
- package/src/mem_pools/tx_pool_v2/index.ts +11 -0
- package/src/mem_pools/tx_pool_v2/interfaces.ts +227 -0
- package/src/mem_pools/tx_pool_v2/tx_metadata.ts +161 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_bench_metrics.ts +77 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_indices.ts +417 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2.ts +212 -0
- package/src/mem_pools/tx_pool_v2/tx_pool_v2_impl.ts +882 -0
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +2 -2
- package/src/services/dummy_service.ts +6 -0
- package/src/services/index.ts +1 -0
- package/src/services/libp2p/libp2p_service.ts +304 -230
- package/src/services/reqresp/batch-tx-requester/README.md +7 -7
- package/src/services/reqresp/batch-tx-requester/batch_tx_requester.ts +11 -11
- package/src/services/reqresp/protocols/block_txs/block_txs_handler.ts +22 -13
- package/src/services/reqresp/protocols/block_txs/block_txs_reqresp.ts +21 -15
- package/src/services/service.ts +20 -0
- package/src/services/tx_collection/config.ts +6 -6
- package/src/services/tx_collection/fast_tx_collection.ts +14 -24
- package/src/services/tx_collection/index.ts +1 -1
- package/src/services/tx_collection/proposal_tx_collector.ts +12 -14
- package/src/services/tx_file_store/config.ts +43 -0
- package/src/services/tx_file_store/index.ts +3 -0
- package/src/services/tx_file_store/instrumentation.ts +36 -0
- package/src/services/tx_file_store/tx_file_store.ts +173 -0
- package/src/test-helpers/testbench-utils.ts +18 -39
- package/src/testbench/p2p_client_testbench_worker.ts +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +0 -40
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +0 -218
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +0 -31
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +0 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +0 -180
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +0 -320
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +0 -264
|
@@ -1,18 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
+
import type { AztecAsyncKVStore } from '@aztec/kv-store';
|
|
3
|
+
import { BlockProposal, CheckpointAttestation, type CheckpointProposalCore } from '@aztec/stdlib/p2p';
|
|
4
|
+
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
5
|
+
/** Result of trying to add an item (proposal or attestation) to the pool */
|
|
6
|
+
export type TryAddResult = {
|
|
7
|
+
/** Whether the item was added */
|
|
8
|
+
added: boolean;
|
|
9
|
+
/** Whether the exact item already existed */
|
|
10
|
+
alreadyExists: boolean;
|
|
11
|
+
/** Total items for this position - used for duplicate detection */
|
|
12
|
+
totalForPosition: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const MAX_PROPOSALS_PER_SLOT = 5;
|
|
15
|
+
export declare const MAX_PROPOSALS_PER_POSITION = 3;
|
|
16
|
+
export declare const ATTESTATION_CAP_BUFFER = 10;
|
|
17
|
+
/** Public API interface for attestation pools. Used for typing mocks and test implementations. */
|
|
18
|
+
export type AttestationPoolApi = Pick<AttestationPool, 'tryAddBlockProposal' | 'getBlockProposal' | 'tryAddCheckpointProposal' | 'getCheckpointProposal' | 'addOwnCheckpointAttestations' | 'tryAddCheckpointAttestation' | 'deleteOlderThan' | 'getCheckpointAttestationsForSlot' | 'getCheckpointAttestationsForSlotAndProposal' | 'isEmpty'>;
|
|
3
19
|
/**
|
|
4
|
-
*
|
|
20
|
+
* Pool for storing attestations and proposals collected by a validator.
|
|
5
21
|
*
|
|
6
|
-
* Attestations
|
|
22
|
+
* Attestations and proposals observed via the p2p network are stored for requests
|
|
7
23
|
* from the validator to produce a block, or to serve to other peers.
|
|
8
24
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
export declare class AttestationPool {
|
|
26
|
+
private store;
|
|
27
|
+
private log;
|
|
28
|
+
private metrics;
|
|
29
|
+
private checkpointAttestations;
|
|
30
|
+
private checkpointProposals;
|
|
31
|
+
private checkpointProposalsForSlot;
|
|
32
|
+
private blockProposals;
|
|
33
|
+
private blockProposalsForSlotAndIndex;
|
|
34
|
+
constructor(store: AztecAsyncKVStore, telemetry?: TelemetryClient, log?: import("@aztec/foundation/log").Logger);
|
|
35
|
+
private poolStats;
|
|
36
|
+
/** Returns whether the pool is empty. */
|
|
37
|
+
isEmpty(): Promise<boolean>;
|
|
38
|
+
private getProposalKey;
|
|
39
|
+
private getAttestationKey;
|
|
40
|
+
/** Returns range bounds for querying all attestations for a given slot. */
|
|
41
|
+
private getAttestationKeyRangeForSlot;
|
|
42
|
+
/** Returns range bounds for querying all attestations for a given (slot, proposalId). */
|
|
43
|
+
private getAttestationKeyRangeForProposal;
|
|
44
|
+
/** Number of bits reserved for indexWithinCheckpoint in position keys. */
|
|
45
|
+
private static readonly INDEX_BITS;
|
|
46
|
+
/** Maximum indexWithinCheckpoint value (2^10 - 1 = 1023). */
|
|
47
|
+
private static readonly MAX_INDEX;
|
|
48
|
+
/** Creates a position key for block proposals: (slot << 10) | indexWithinCheckpoint. */
|
|
49
|
+
private getBlockPositionKey;
|
|
50
|
+
/**
|
|
51
|
+
* Attempts to add a block proposal to the pool.
|
|
52
|
+
*
|
|
53
|
+
* This method performs validation and addition in a single call:
|
|
54
|
+
* - Checks if the proposal already exists (returns alreadyExists: true if so)
|
|
55
|
+
* - Checks if the position has reached the proposal cap (returns added: false if so)
|
|
56
|
+
* - Adds the proposal if validation passes
|
|
57
|
+
*
|
|
58
|
+
* @param blockProposal - The block proposal to add
|
|
59
|
+
* @returns Result indicating whether the proposal was added and duplicate detection info
|
|
60
|
+
*/
|
|
61
|
+
tryAddBlockProposal(blockProposal: BlockProposal): Promise<TryAddResult>;
|
|
62
|
+
/** Gets the count of block proposals for a given position (slot, indexWithinCheckpoint). */
|
|
63
|
+
private getBlockProposalCountForPosition;
|
|
64
|
+
private addBlockProposal;
|
|
65
|
+
/**
|
|
66
|
+
* Get block proposal by its ID.
|
|
16
67
|
*
|
|
17
68
|
* @param id - The ID of the block proposal to retrieve. The ID is proposal.payload.archive
|
|
18
69
|
*
|
|
@@ -20,24 +71,22 @@ export interface AttestationPool {
|
|
|
20
71
|
*/
|
|
21
72
|
getBlockProposal(id: string): Promise<BlockProposal | undefined>;
|
|
22
73
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @param idOrProposal - The ID of the block proposal or the block proposal itself to check. The ID is proposal.payload.archive
|
|
74
|
+
* Attempts to add a checkpoint proposal to the pool.
|
|
26
75
|
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* Adds a checkpoint proposal to the pool.
|
|
76
|
+
* This method performs validation and addition in a single call:
|
|
77
|
+
* - Checks if the proposal already exists (returns alreadyExists: true if so)
|
|
78
|
+
* - Checks if the slot has reached the proposal cap (returns added: false if so)
|
|
79
|
+
* - Adds the proposal if validation passes
|
|
32
80
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
81
|
+
* Note: This method only handles the CheckpointProposalCore. If the original
|
|
82
|
+
* CheckpointProposal contains a lastBlock, the caller should extract it via
|
|
83
|
+
* getBlockProposal() and add it separately via tryAddBlockProposal().
|
|
36
84
|
*
|
|
37
|
-
* @param proposal - The checkpoint proposal to add
|
|
38
|
-
* @
|
|
85
|
+
* @param proposal - The checkpoint proposal core to add
|
|
86
|
+
* @returns Result indicating whether the proposal was added and duplicate detection info
|
|
39
87
|
*/
|
|
40
|
-
|
|
88
|
+
tryAddCheckpointProposal(proposal: CheckpointProposalCore): Promise<TryAddResult>;
|
|
89
|
+
private addCheckpointProposal;
|
|
41
90
|
/**
|
|
42
91
|
* Get checkpoint proposal by its ID.
|
|
43
92
|
*
|
|
@@ -49,33 +98,19 @@ export interface AttestationPool {
|
|
|
49
98
|
*/
|
|
50
99
|
getCheckpointProposal(id: string): Promise<CheckpointProposalCore | undefined>;
|
|
51
100
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param idOrProposal - The ID of the checkpoint proposal or the proposal itself
|
|
55
|
-
* @return True if the proposal exists, false otherwise.
|
|
56
|
-
*/
|
|
57
|
-
hasCheckpointProposal(idOrProposal: string | CheckpointProposal): Promise<boolean>;
|
|
58
|
-
/**
|
|
59
|
-
* Add checkpoint attestations to the pool
|
|
60
|
-
*
|
|
61
|
-
* @param attestations - Checkpoint attestations to add into the pool
|
|
62
|
-
*/
|
|
63
|
-
addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Delete checkpoint attestations older than the given slot
|
|
66
|
-
*
|
|
67
|
-
* @param slot - The oldest slot to keep.
|
|
101
|
+
* Adds own checkpoint attestations to the pool.
|
|
102
|
+
* Skips validations on number of checkpoint attestations stored for the given slot.
|
|
68
103
|
*/
|
|
69
|
-
|
|
104
|
+
addOwnCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
70
105
|
/**
|
|
71
|
-
* Get all checkpoint attestations for a given slot
|
|
106
|
+
* Get all checkpoint attestations for a given slot.
|
|
72
107
|
*
|
|
73
108
|
* @param slot - The slot to query
|
|
74
109
|
* @return CheckpointAttestations
|
|
75
110
|
*/
|
|
76
111
|
getCheckpointAttestationsForSlot(slot: SlotNumber): Promise<CheckpointAttestation[]>;
|
|
77
112
|
/**
|
|
78
|
-
* Get checkpoint attestations for slot and given proposal
|
|
113
|
+
* Get checkpoint attestations for slot and given proposal.
|
|
79
114
|
*
|
|
80
115
|
* @param slot - The slot to query
|
|
81
116
|
* @param proposalId - The proposal to query
|
|
@@ -83,54 +118,26 @@ export interface AttestationPool {
|
|
|
83
118
|
*/
|
|
84
119
|
getCheckpointAttestationsForSlotAndProposal(slot: SlotNumber, proposalId: string): Promise<CheckpointAttestation[]>;
|
|
85
120
|
/**
|
|
86
|
-
*
|
|
121
|
+
* Delete all pool data (attestations, proposals) older than the given slot.
|
|
87
122
|
*
|
|
88
|
-
* @param
|
|
89
|
-
* @return True if the attestation exists, false otherwise
|
|
123
|
+
* @param oldestSlot - The oldest slot to keep.
|
|
90
124
|
*/
|
|
91
|
-
|
|
125
|
+
deleteOlderThan(oldestSlot: SlotNumber): Promise<void>;
|
|
92
126
|
/**
|
|
93
|
-
*
|
|
94
|
-
* - True if the proposal already exists, allow overwrite to keep parity with tests.
|
|
95
|
-
* - True if the slot is below the proposal cap.
|
|
96
|
-
* - False if the slot is at/above cap and this would be a new unique proposal.
|
|
127
|
+
* Attempts to add a checkpoint attestation to the pool.
|
|
97
128
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Returns whether adding this checkpoint proposal is permitted at current capacity.
|
|
129
|
+
* This method performs validation and addition in a single call:
|
|
130
|
+
* - Checks if the attestation already exists (returns alreadyExists: true if so)
|
|
131
|
+
* - Checks if the (slot, proposalId) has reached the attestation cap (returns added: false if so)
|
|
132
|
+
* - Adds the attestation if validation passes
|
|
104
133
|
*
|
|
105
|
-
* @param
|
|
106
|
-
* @returns True if the proposal can be added, false otherwise.
|
|
107
|
-
*/
|
|
108
|
-
canAddCheckpointProposal(proposal: CheckpointProposal): Promise<boolean>;
|
|
109
|
-
/**
|
|
110
|
-
* Returns whether a checkpoint attestation would be accepted for (slot, proposalId).
|
|
111
|
-
*
|
|
112
|
-
* @param attestation - The attestation to check
|
|
134
|
+
* @param attestation - The checkpoint attestation to add
|
|
113
135
|
* @param committeeSize - Committee size for the attestation's slot
|
|
114
|
-
* @returns
|
|
115
|
-
*/
|
|
116
|
-
canAddCheckpointAttestation(attestation: CheckpointAttestation, committeeSize: number): Promise<boolean>;
|
|
117
|
-
/**
|
|
118
|
-
* Returns whether the checkpoint proposal cap for the given slot has been reached.
|
|
119
|
-
*
|
|
120
|
-
* @param slot - The slot to check
|
|
121
|
-
* @returns True if the cap has been reached, false otherwise.
|
|
136
|
+
* @returns Result indicating whether the attestation was added and existence info
|
|
122
137
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
* Returns whether the checkpoint attestation cap for the given slot and proposal has been reached.
|
|
126
|
-
*
|
|
127
|
-
* @param slot - The slot to check
|
|
128
|
-
* @param proposalId - The proposal to check
|
|
129
|
-
* @param committeeSize - Committee size for the slot
|
|
130
|
-
* @returns True if the cap has been reached, false otherwise.
|
|
131
|
-
*/
|
|
132
|
-
hasReachedCheckpointAttestationCap(slot: SlotNumber, proposalId: string, committeeSize: number): Promise<boolean>;
|
|
133
|
-
/** Returns whether the pool is empty. */
|
|
134
|
-
isEmpty(): Promise<boolean>;
|
|
138
|
+
tryAddCheckpointAttestation(attestation: CheckpointAttestation, committeeSize: number): Promise<TryAddResult>;
|
|
139
|
+
private getAttestationCount;
|
|
135
140
|
}
|
|
136
|
-
|
|
141
|
+
/** Creates an AttestationPool backed by a temporary store for testing. */
|
|
142
|
+
export declare function createTestAttestationPool(telemetry?: TelemetryClient): Promise<AttestationPool>;
|
|
143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DLFdBQVcsRUFBRSxxQkFBcUIsRUFDbEMsYUFBYSxFQUFFLE1BQU0sR0FDcEIsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQW1DdkI7WUFHYSxtQkFBbUI7Q0FRbEM7QUFFRCwwRUFBMEU7QUFDMUUsd0JBQXNCLHlCQUF5QixDQUFDLFNBQVMsQ0FBQyxFQUFFLGVBQWUsR0FBRyxPQUFPLENBQUMsZUFBZSxDQUFDLENBSXJHIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attestation_pool.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"attestation_pool.d.ts","sourceRoot":"","sources":["../../../src/mem_pools/attestation_pool/attestation_pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAIpF,OAAO,KAAK,EAAE,iBAAiB,EAAqC,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EACL,aAAa,EACb,qBAAqB,EAErB,KAAK,sBAAsB,EAC5B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB,CAAC;AAInF,4EAA4E;AAC5E,MAAM,MAAM,YAAY,GAAG;IACzB,iCAAiC;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,6CAA6C;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,mEAAmE;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,0BAA0B,IAAI,CAAC;AAC5C,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,kGAAkG;AAClG,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,eAAe,EACb,qBAAqB,GACrB,kBAAkB,GAClB,0BAA0B,GAC1B,uBAAuB,GACvB,8BA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