@@ -153,7 +153,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
153153 private peerDiscoveryService : PeerDiscoveryService ,
154154 private reqresp : ReqRespInterface ,
155155 private peerManager : PeerManagerInterface ,
156- protected mempools : MemPools < T > ,
156+ protected mempools : MemPools ,
157157 private archiver : L2BlockSource & ContractDataSource ,
158158 private epochCache : EpochCacheInterface ,
159159 private proofVerifier : ClientProtocolCircuitVerifier ,
@@ -185,7 +185,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
185185
186186 // Use FishermanAttestationValidator in fisherman mode to validate attestation payloads against proposals
187187 this . attestationValidator = config . fishermanMode
188- ? new FishermanAttestationValidator ( epochCache , mempools . attestationPool ! , telemetry )
188+ ? new FishermanAttestationValidator ( epochCache , mempools . attestationPool , telemetry )
189189 : new AttestationValidator ( epochCache ) ;
190190 this . blockProposalValidator = new BlockProposalValidator ( epochCache , { txsPermitted : ! config . disableTransactions } ) ;
191191
@@ -215,7 +215,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
215215 config : P2PConfig ,
216216 peerId : PeerId ,
217217 deps : {
218- mempools : MemPools < T > ;
218+ mempools : MemPools ;
219219 l2BlockSource : L2BlockSource & ContractDataSource ;
220220 epochCache : EpochCacheInterface ;
221221 proofVerifier : ClientProtocolCircuitVerifier ;
@@ -486,8 +486,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
486486 [ ReqRespSubProtocol . BLOCK ] : blockHandler . bind ( this ) ,
487487 } ;
488488
489- // Only handle block transactions request if attestation pool is available to the client
490- if ( this . mempools . attestationPool && ! this . config . disableTransactions ) {
489+ if ( ! this . config . disableTransactions ) {
491490 const blockTxsHandler = reqRespBlockTxsHandler ( this . mempools . attestationPool , this . mempools . txPool ) ;
492491 requestResponseHandlers [ ReqRespSubProtocol . BLOCK_TXS ] = blockTxsHandler . bind ( this ) ;
493492 }
@@ -809,7 +808,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
809808 private async processAttestationFromPeer ( payloadData : Buffer , msgId : string , source : PeerId ) : Promise < void > {
810809 const validationFunc : ( ) => Promise < ReceivedMessageValidationResult < BlockAttestation > > = async ( ) => {
811810 const attestation = BlockAttestation . fromBuffer ( payloadData ) ;
812- const pool = this . mempools . attestationPool ! ;
811+ const pool = this . mempools . attestationPool ;
813812 const isValid = await this . validateAttestation ( source , attestation ) ;
814813 const exists = isValid && ( await pool . hasAttestation ( attestation ) ) ;
815814
@@ -866,7 +865,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
866865 } ,
867866 ) ;
868867
869- await this . mempools . attestationPool ! . addAttestations ( [ attestation ] ) ;
868+ await this . mempools . attestationPool . addAttestations ( [ attestation ] ) ;
870869 }
871870
872871 private async processBlockFromPeer ( payloadData : Buffer , msgId : string , source : PeerId ) : Promise < void > {
@@ -875,10 +874,8 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
875874 const isValid = await this . validateBlockProposal ( source , block ) ;
876875 const pool = this . mempools . attestationPool ;
877876
878- // Note that we dont have an attestation pool if we're a prover node, but we still
879- // subscribe to block proposal topics in order to prevent their txs from being cleared.
880- const exists = isValid && pool ? await pool . hasBlockProposal ( block ) : false ;
881- const canAdd = isValid && pool ? await pool . canAddProposal ( block ) : true ; // If pool DNE, set canAdd to true to avoid peer penalization (the block is not added to the pool)
877+ const exists = isValid && ( await pool . hasBlockProposal ( block ) ) ;
878+ const canAdd = isValid && ( await pool . canAddProposal ( block ) ) ;
882879
883880 this . logger . trace ( `Validate propagated block proposal` , {
884881 isValid,
@@ -934,14 +931,12 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
934931 archive : block . archive . toString ( ) ,
935932 source : sender . toString ( ) ,
936933 } ) ;
937- const attestationsForPreviousSlot = await this . mempools . attestationPool ?. getAttestationsForSlot ( previousSlot ) ;
938- if ( attestationsForPreviousSlot !== undefined ) {
939- this . logger . verbose ( `Received ${ attestationsForPreviousSlot . length } attestations for slot ${ previousSlot } ` ) ;
940- }
934+ const attestationsForPreviousSlot = await this . mempools . attestationPool . getAttestationsForSlot ( previousSlot ) ;
935+ this . logger . verbose ( `Received ${ attestationsForPreviousSlot . length } attestations for slot ${ previousSlot } ` ) ;
941936
942937 // Attempt to add proposal, then mark the txs in this proposal as non-evictable
943938 try {
944- await this . mempools . attestationPool ? .addBlockProposal ( block ) ;
939+ await this . mempools . attestationPool . addBlockProposal ( block ) ;
945940 } catch ( err : unknown ) {
946941 // Drop proposals if we hit per-slot cap in the attestation pool; rethrow unknown errors
947942 if ( err instanceof ProposalSlotCapExceededError ) {
@@ -1047,7 +1042,7 @@ export class LibP2PService<T extends P2PClientType = P2PClientType.Full> extends
10471042 }
10481043
10491044 // Given proposal (should have locally), ensure returned txs are valid subset and match request indices
1050- const proposal = await this . mempools . attestationPool ? .getBlockProposal ( request . blockHash . toString ( ) ) ;
1045+ const proposal = await this . mempools . attestationPool . getBlockProposal ( request . blockHash . toString ( ) ) ;
10511046 if ( proposal ) {
10521047 // Build intersected indices
10531048 const intersectIdx = request . txIndices . getTrueIndices ( ) . filter ( i => response . txIndices . isSet ( i ) ) ;
0 commit comments