Skip to content

Commit

Permalink
fix(p2p): default peer score penalties (#10896)
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 authored Dec 20, 2024
1 parent 79ac402 commit 73eec43
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions yarn-project/p2p/src/services/peer-scoring/peer_scoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { median } from '@aztec/foundation/collection';
import { type P2PConfig } from '../../config.js';

const DefaultPeerPenalties = {
[PeerErrorSeverity.LowToleranceError]: 2,
[PeerErrorSeverity.LowToleranceError]: 50,
[PeerErrorSeverity.MidToleranceError]: 10,
[PeerErrorSeverity.HighToleranceError]: 50,
[PeerErrorSeverity.HighToleranceError]: 2,
};

export class PeerScoring {
Expand All @@ -20,11 +20,11 @@ export class PeerScoring {
const orderedValues = config.peerPenaltyValues?.sort((a, b) => a - b);
this.peerPenalties = {
[PeerErrorSeverity.HighToleranceError]:
orderedValues?.[0] ?? DefaultPeerPenalties[PeerErrorSeverity.LowToleranceError],
orderedValues?.[0] ?? DefaultPeerPenalties[PeerErrorSeverity.HighToleranceError],
[PeerErrorSeverity.MidToleranceError]:
orderedValues?.[1] ?? DefaultPeerPenalties[PeerErrorSeverity.MidToleranceError],
[PeerErrorSeverity.LowToleranceError]:
orderedValues?.[2] ?? DefaultPeerPenalties[PeerErrorSeverity.HighToleranceError],
orderedValues?.[2] ?? DefaultPeerPenalties[PeerErrorSeverity.LowToleranceError],
};
}

Expand Down

0 comments on commit 73eec43

Please sign in to comment.