@aztec/p2p 4.0.0-nightly.20260112 → 4.0.0-nightly.20260113
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/interface.d.ts +18 -5
- package/dest/client/interface.d.ts.map +1 -1
- package/dest/client/p2p_client.d.ts +9 -12
- package/dest/client/p2p_client.d.ts.map +1 -1
- package/dest/client/p2p_client.js +59 -103
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts +61 -42
- package/dest/mem_pools/attestation_pool/attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/attestation_pool_test_suite.d.ts +1 -1
- 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 +225 -262
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts +21 -18
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/kv_attestation_pool.js +113 -108
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts +17 -16
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/memory_attestation_pool.js +89 -128
- package/dest/mem_pools/attestation_pool/mocks.d.ts +7 -6
- package/dest/mem_pools/attestation_pool/mocks.d.ts.map +1 -1
- package/dest/mem_pools/attestation_pool/mocks.js +9 -8
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts +4 -4
- package/dest/msg_validators/attestation_validator/attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/attestation_validator.js +12 -10
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts +5 -5
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.d.ts.map +1 -1
- package/dest/msg_validators/attestation_validator/fisherman_attestation_validator.js +5 -5
- package/dest/msg_validators/index.d.ts +2 -2
- package/dest/msg_validators/index.d.ts.map +1 -1
- package/dest/msg_validators/index.js +1 -1
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/block_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts +9 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/checkpoint_proposal_validator.js +6 -0
- package/dest/msg_validators/proposal_validator/index.d.ts +4 -0
- package/dest/msg_validators/proposal_validator/index.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/index.js +3 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts +13 -0
- package/dest/msg_validators/proposal_validator/proposal_validator.d.ts.map +1 -0
- package/dest/msg_validators/{block_proposal_validator/block_proposal_validator.js → proposal_validator/proposal_validator.js} +19 -21
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts +23 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.d.ts.map +1 -0
- package/dest/msg_validators/proposal_validator/proposal_validator_test_suite.js +183 -0
- 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/encoding.d.ts +1 -1
- package/dest/services/encoding.d.ts.map +1 -1
- package/dest/services/encoding.js +4 -2
- package/dest/services/libp2p/libp2p_service.d.ts +26 -10
- package/dest/services/libp2p/libp2p_service.d.ts.map +1 -1
- package/dest/services/libp2p/libp2p_service.js +218 -88
- package/dest/services/service.d.ts +16 -3
- package/dest/services/service.d.ts.map +1 -1
- package/dest/testbench/p2p_client_testbench_worker.js +25 -11
- package/dest/testbench/worker_client_manager.d.ts +1 -1
- package/dest/testbench/worker_client_manager.d.ts.map +1 -1
- package/dest/testbench/worker_client_manager.js +6 -1
- package/package.json +14 -14
- package/src/client/interface.ts +19 -4
- package/src/client/p2p_client.ts +69 -110
- package/src/mem_pools/attestation_pool/attestation_pool.ts +68 -41
- package/src/mem_pools/attestation_pool/attestation_pool_test_suite.ts +231 -287
- package/src/mem_pools/attestation_pool/kv_attestation_pool.ts +162 -140
- package/src/mem_pools/attestation_pool/memory_attestation_pool.ts +141 -164
- package/src/mem_pools/attestation_pool/mocks.ts +13 -9
- package/src/msg_validators/attestation_validator/attestation_validator.ts +16 -13
- package/src/msg_validators/attestation_validator/fisherman_attestation_validator.ts +7 -7
- package/src/msg_validators/index.ts +1 -1
- package/src/msg_validators/proposal_validator/block_proposal_validator.ts +10 -0
- package/src/msg_validators/proposal_validator/checkpoint_proposal_validator.ts +13 -0
- package/src/msg_validators/proposal_validator/index.ts +3 -0
- package/src/msg_validators/{block_proposal_validator/block_proposal_validator.ts → proposal_validator/proposal_validator.ts} +23 -28
- package/src/msg_validators/proposal_validator/proposal_validator_test_suite.ts +206 -0
- package/src/services/dummy_service.ts +6 -0
- package/src/services/encoding.ts +3 -1
- package/src/services/libp2p/libp2p_service.ts +258 -94
- package/src/services/service.ts +19 -4
- package/src/testbench/p2p_client_testbench_worker.ts +34 -11
- package/src/testbench/worker_client_manager.ts +6 -1
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts +0 -12
- package/dest/msg_validators/block_proposal_validator/block_proposal_validator.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/index.d.ts +0 -2
- package/dest/msg_validators/block_proposal_validator/index.d.ts.map +0 -1
- package/dest/msg_validators/block_proposal_validator/index.js +0 -1
- package/src/msg_validators/block_proposal_validator/index.ts +0 -1
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
2
|
-
import type {
|
|
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
|
-
*
|
|
40
|
+
* Adds a checkpoint proposal to the pool.
|
|
36
41
|
*
|
|
37
|
-
*
|
|
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
|
-
|
|
49
|
+
addCheckpointProposal(proposal: CheckpointProposal): Promise<void>;
|
|
40
50
|
|
|
41
51
|
/**
|
|
42
|
-
*
|
|
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
|
|
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
|
-
|
|
60
|
+
getCheckpointProposal(id: string): Promise<CheckpointProposalCore | undefined>;
|
|
47
61
|
|
|
48
62
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* Removes all attestations associated with a slot
|
|
63
|
+
* Check if a checkpoint proposal exists in the pool
|
|
52
64
|
*
|
|
53
|
-
* @param
|
|
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
|
-
|
|
68
|
+
hasCheckpointProposal(idOrProposal: string | CheckpointProposal): Promise<boolean>;
|
|
56
69
|
|
|
57
70
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* Removes all attestations associated with a slot
|
|
71
|
+
* Add checkpoint attestations to the pool
|
|
61
72
|
*
|
|
62
|
-
* @param
|
|
73
|
+
* @param attestations - Checkpoint attestations to add into the pool
|
|
63
74
|
*/
|
|
64
|
-
|
|
75
|
+
addCheckpointAttestations(attestations: CheckpointAttestation[]): Promise<void>;
|
|
65
76
|
|
|
66
77
|
/**
|
|
67
|
-
* Delete
|
|
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
|
|
72
|
-
* @param proposalId - The proposal to delete.
|
|
80
|
+
* @param slot - The oldest slot to keep.
|
|
73
81
|
*/
|
|
74
|
-
|
|
82
|
+
deleteCheckpointAttestationsOlderThan(slot: SlotNumber): Promise<void>;
|
|
75
83
|
|
|
76
84
|
/**
|
|
77
|
-
* Get all
|
|
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
|
|
88
|
+
* @return CheckpointAttestations
|
|
83
89
|
*/
|
|
84
|
-
|
|
90
|
+
getCheckpointAttestationsForSlot(slot: SlotNumber): Promise<CheckpointAttestation[]>;
|
|
85
91
|
|
|
86
92
|
/**
|
|
87
|
-
* Get
|
|
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
|
|
97
|
+
* @return CheckpointAttestations
|
|
94
98
|
*/
|
|
95
|
-
|
|
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
|
-
|
|
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
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
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
|
|
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
|
-
|
|
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>;
|