From 9f4f1e17fa4c6196921b9edee3662e25f795ba71 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:53:47 +0000 Subject: [PATCH] fmt --- .../attestation_validator/attestation_validator.ts | 2 +- .../epoch_proof_quote_validator.ts | 10 +++++----- yarn-project/p2p/src/services/libp2p/libp2p_service.ts | 1 + .../src/services/reqresp/reqresp.integration.test.ts | 6 ++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/yarn-project/p2p/src/msg_validators/attestation_validator/attestation_validator.ts b/yarn-project/p2p/src/msg_validators/attestation_validator/attestation_validator.ts index dea9a2000d8..ab07e9862ac 100644 --- a/yarn-project/p2p/src/msg_validators/attestation_validator/attestation_validator.ts +++ b/yarn-project/p2p/src/msg_validators/attestation_validator/attestation_validator.ts @@ -1,4 +1,4 @@ -import { type P2PValidator, PeerErrorSeverity , type BlockAttestation } from '@aztec/circuit-types'; +import { type BlockAttestation, type P2PValidator, PeerErrorSeverity } from '@aztec/circuit-types'; import { type EpochCache } from '@aztec/epoch-cache'; export class AttestationValidator implements P2PValidator { diff --git a/yarn-project/p2p/src/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.ts b/yarn-project/p2p/src/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.ts index dffd6f8cb0d..99eec5be73d 100644 --- a/yarn-project/p2p/src/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.ts +++ b/yarn-project/p2p/src/msg_validators/epoch_proof_quote_validator/epoch_proof_quote_validator.ts @@ -1,5 +1,5 @@ -import { EpochProofQuote, type P2PValidator, PeerErrorSeverity } from '@aztec/circuit-types'; -import { EpochCache } from '@aztec/epoch-cache'; +import { type EpochProofQuote, type P2PValidator, PeerErrorSeverity } from '@aztec/circuit-types'; +import { type EpochCache } from '@aztec/epoch-cache'; export class EpochProofQuoteValidator implements P2PValidator { private epochCache: EpochCache; @@ -8,15 +8,15 @@ export class EpochProofQuoteValidator implements P2PValidator { this.epochCache = epochCache; } - async validate(message: EpochProofQuote): Promise { + validate(message: EpochProofQuote): Promise { const { epoch } = this.epochCache.getEpochAndSlotNow(); // Check that the epoch proof quote is for the current epoch const epochToProve = message.payload.epochToProve; if (epochToProve !== epoch && epochToProve !== epoch - 1n) { - return PeerErrorSeverity.HighToleranceError; + return Promise.resolve(PeerErrorSeverity.HighToleranceError); } - return undefined; + return Promise.resolve(undefined); } } diff --git a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts index b66aae26784..2056cf80f28 100644 --- a/yarn-project/p2p/src/services/libp2p/libp2p_service.ts +++ b/yarn-project/p2p/src/services/libp2p/libp2p_service.ts @@ -128,6 +128,7 @@ export class LibP2PService extends WithTracer implement this.attestationValidator = new AttestationValidator(epochCache); this.blockProposalValidator = new BlockProposalValidator(epochCache); + this.epochProofQuoteValidator = new EpochProofQuoteValidator(epochCache); this.blockReceivedCallback = (block: BlockProposal): Promise => { this.logger.verbose( diff --git a/yarn-project/p2p/src/services/reqresp/reqresp.integration.test.ts b/yarn-project/p2p/src/services/reqresp/reqresp.integration.test.ts index 06eff6d71e4..d930341268c 100644 --- a/yarn-project/p2p/src/services/reqresp/reqresp.integration.test.ts +++ b/yarn-project/p2p/src/services/reqresp/reqresp.integration.test.ts @@ -4,7 +4,7 @@ import { type ClientProtocolCircuitVerifier, P2PClientType, PeerErrorSeverity, - Tx, + type Tx, type WorldStateSynchronizer, mockTx, } from '@aztec/circuit-types'; @@ -62,7 +62,9 @@ describe('Req Resp p2p client integration', () => { epochProofQuotePool = mock(); epochCache = mock(); - txPool.getAllTxs.mockResolvedValue([] as unknown as Tx[]); + txPool.getAllTxs.mockImplementation(() => { + return [] as Tx[]; + }); }); const getPorts = (numberOfPeers: number) => Promise.all(Array.from({ length: numberOfPeers }, () => getPort()));