File tree 8 files changed +15
-6
lines changed
yarn-project/p2p/src/services
8 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,12 @@ export class LibP2PService<T extends P2PClientType> extends WithTracer implement
132
132
this . reqresp ,
133
133
) ;
134
134
135
+ // Update gossipsub score params
136
+ this . node . services . pubsub . score . params . appSpecificScore = ( peerId : string ) => {
137
+ return this . peerManager . getPeerScore ( peerId ) ;
138
+ } ;
139
+ this . node . services . pubsub . score . params . appSpecificWeight = 10 ;
140
+
135
141
this . attestationValidator = new AttestationValidator ( epochCache ) ;
136
142
this . blockProposalValidator = new BlockProposalValidator ( epochCache ) ;
137
143
this . epochProofQuoteValidator = new EpochProofQuoteValidator ( epochCache ) ;
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ export class PeerScoring {
88
88
}
89
89
90
90
public getScoreState ( peerId : string ) : PeerScoreState {
91
- // TODO: permanently store banned peers?
91
+ // TODO(#11329) : permanently store banned peers?
92
92
const score = this . getScore ( peerId ) ;
93
93
if ( score < MIN_SCORE_BEFORE_BAN ) {
94
94
return PeerScoreState . Banned ;
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export function prettyGoodbyeReason(reason: GoodByeReason): string {
54
54
return 'low_score' ;
55
55
case GoodByeReason . BANNED :
56
56
return 'banned' ;
57
- // TODO(https://github.com/AztecProtocol/aztec-packages/issues/ 11328): implement
57
+ // TODO(# 11328): implement
58
58
case GoodByeReason . WRONG_NETWORK :
59
59
return 'wrong_network' ;
60
60
case GoodByeReason . UNKNOWN :
@@ -81,8 +81,12 @@ export class GoodbyeProtocolHandler {
81
81
}
82
82
83
83
/**
84
- * Handles the goodbye request.
85
- * @param _msg - The goodbye request message.
84
+ * Handles the goodbye request. In request response, the goodbye request is handled by the peer manager.
85
+ *
86
+ * @dev Implemented as returning a function as the function is bound in the libp2p service, however
87
+ * its implementation is here to keep functionality together.
88
+ *
89
+ * @param peerManager - The peer manager.
86
90
* @returns A resolved promise with the goodbye response.
87
91
*/
88
92
export function reqGoodbyeHandler ( peerManager : PeerManager ) : ReqRespSubProtocolHandler {
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ export const DEFAULT_RATE_LIMITS: ReqRespSubProtocolRateLimits = {
32
32
quotaCount : 10 ,
33
33
} ,
34
34
} ,
35
- // TODO(md): feels like goodbye is an exception to the rule here
36
35
[ ReqRespSubProtocol . GOODBYE ] : {
37
36
peerLimit : {
38
37
quotaTimeMs : 1000 ,
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
15
15
startNodes ,
16
16
stopNodes ,
17
17
} from '../../mocks/index.js' ;
18
- import { PeerManager } from '../peer-manager/peer_manager.js' ;
18
+ import { type PeerManager } from '../peer-manager/peer_manager.js' ;
19
19
import { type PeerScoring } from '../peer-manager/peer_scoring.js' ;
20
20
import { ReqRespSubProtocol , RequestableBuffer } from './interface.js' ;
21
21
import { GoodByeReason , reqGoodbyeHandler } from './protocols/goodbye.js' ;
You can’t perform that action at this time.
0 commit comments