Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions yarn-project/p2p/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const createP2PClient = async (
peerId,
txPool,
attestationsPool,
epochProofQuotePool,
l2BlockSource,
proofVerifier,
worldStateSynchronizer,
Expand Down
14 changes: 14 additions & 0 deletions yarn-project/p2p/src/service/libp2p_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
BlockAttestation,
BlockProposal,
type ClientProtocolCircuitVerifier,
EpochProofQuote,
type Gossipable,
type L2BlockSource,
MerkleTreeId,
Expand Down Expand Up @@ -33,6 +34,7 @@ import { createLibp2p } from 'libp2p';

import { type AttestationPool } from '../attestation_pool/attestation_pool.js';
import { type P2PConfig } from '../config.js';
import { type EpochProofQuotePool } from '../epoch_proof_quote_pool/epoch_proof_quote_pool.js';
import { type TxPool } from '../tx_pool/index.js';
import {
DataTxValidator,
Expand Down Expand Up @@ -98,6 +100,7 @@ export class LibP2PService implements P2PService {
private peerDiscoveryService: PeerDiscoveryService,
private txPool: TxPool,
private attestationPool: AttestationPool,
private epochProofQuotePool: EpochProofQuotePool,
private l2BlockSource: L2BlockSource,
private proofVerifier: ClientProtocolCircuitVerifier,
private worldStateSynchronizer: WorldStateSynchronizer,
Expand Down Expand Up @@ -202,6 +205,7 @@ export class LibP2PService implements P2PService {
peerId: PeerId,
txPool: TxPool,
attestationPool: AttestationPool,
epochProofQuotePool: EpochProofQuotePool,
l2BlockSource: L2BlockSource,
proofVerifier: ClientProtocolCircuitVerifier,
worldStateSynchronizer: WorldStateSynchronizer,
Expand Down Expand Up @@ -291,6 +295,7 @@ export class LibP2PService implements P2PService {
peerDiscoveryService,
txPool,
attestationPool,
epochProofQuotePool,
l2BlockSource,
proofVerifier,
worldStateSynchronizer,
Expand Down Expand Up @@ -372,6 +377,10 @@ export class LibP2PService implements P2PService {
const block = BlockProposal.fromBuffer(Buffer.from(message.data));
await this.processBlockFromPeer(block);
}
if (message.topic == EpochProofQuote.p2pTopic) {
const epochProofQuote = EpochProofQuote.fromBuffer(Buffer.from(message.data));
this.processEpochProofQuoteFromPeer(epochProofQuote);
}

return;
}
Expand Down Expand Up @@ -404,6 +413,11 @@ export class LibP2PService implements P2PService {
}
}

private processEpochProofQuoteFromPeer(epochProofQuote: EpochProofQuote): void {
this.logger.verbose(`Received epoch proof quote ${epochProofQuote.p2pMessageIdentifier()} from external peer.`);
this.epochProofQuotePool.addQuote(epochProofQuote);
}

/**
* Propagates provided message to peers.
* @param message - The message to propagate.
Expand Down