@libp2p/gossipsub 17.1.1-5cb617ae2 → 17.1.1-fb139d1c8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ message RPC {
6
6
  optional ControlMessage control = 3;
7
7
 
8
8
  message SubOpts {
9
- optional bool subscribe = 1; // subscribe or unsubcribe
9
+ optional bool subscribe = 1; // subscribe or unsubscribe
10
10
  optional string topic = 2;
11
11
  }
12
12
 
package/src/metrics.ts CHANGED
@@ -60,7 +60,7 @@ export interface MetricsRegister {
60
60
  }
61
61
 
62
62
  export enum InclusionReason {
63
- /** Peer was a fanaout peer. */
63
+ /** Peer was a fanout peer. */
64
64
  Fanout = 'fanout',
65
65
  /** Included from random selection. */
66
66
  Random = 'random',
@@ -29,7 +29,7 @@ export interface PeerScoreParams {
29
29
  * is the square of the difference, ie (PeersInSameIP - IPColocationThreshold)^2.
30
30
  * If the number of peers in the same IP is less than the threshold, then the value is 0.
31
31
  * The weight of the parameter MUST be negative, unless you want to disable for testing.
32
- * Note: In order to simulate many IPs in a managable manner when testing, you can set the weight to 0
32
+ * Note: In order to simulate many IPs in a manageable manner when testing, you can set the weight to 0
33
33
  * thus disabling the IP colocation penalty.
34
34
  */
35
35
  IPColocationFactorWeight: number
@@ -266,7 +266,7 @@ export function validateTopicScoreParams (p: TopicScoreParams): void {
266
266
 
267
267
  // check P2
268
268
  if (p.firstMessageDeliveriesWeight < 0) {
269
- throw new InvalidPeerScoreParamsError('invallid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)')
269
+ throw new InvalidPeerScoreParamsError('invalid FirstMessageDeliveriesWeight; must be positive (or 0 to disable)')
270
270
  }
271
271
  if (
272
272
  p.firstMessageDeliveriesWeight !== 0 &&
@@ -6,7 +6,7 @@ import { InvalidPeerScoreThresholdsError } from '../errors.ts'
6
6
 
7
7
  export interface PeerScoreThresholds {
8
8
  /**
9
- * gossipThreshold is the score threshold below which gossip propagation is supressed;
9
+ * gossipThreshold is the score threshold below which gossip propagation is suppressed;
10
10
  * should be negative.
11
11
  */
12
12
  gossipThreshold: number
@@ -18,7 +18,7 @@ export interface PeerScoreThresholds {
18
18
  publishThreshold: number
19
19
 
20
20
  /**
21
- * graylistThreshold is the score threshold below which message processing is supressed altogether,
21
+ * graylistThreshold is the score threshold below which message processing is suppressed altogether,
22
22
  * implementing an effective graylist according to peer score; should be negative and <= PublisThreshold.
23
23
  */
24
24
  graylistThreshold: number
@@ -11,7 +11,7 @@ import type { ComponentLogger, Logger } from '@libp2p/interface'
11
11
 
12
12
  interface PeerScoreOpts {
13
13
  /**
14
- * Miliseconds to cache computed score per peer
14
+ * Milliseconds to cache computed score per peer
15
15
  */
16
16
  scoreCacheValidityMs: number
17
17
 
@@ -21,7 +21,7 @@ interface PeerScoreOpts {
21
21
  interface ScoreCacheEntry {
22
22
  /** The cached score */
23
23
  score: number
24
- /** Unix timestamp in miliseconds, the time after which the cached score for a peer is no longer valid */
24
+ /** Unix timestamp in milliseconds, the time after which the cached score for a peer is no longer valid */
25
25
  cacheUntil: number
26
26
  }
27
27
 
package/src/tracer.ts CHANGED
@@ -131,7 +131,7 @@ export class IWantTracer {
131
131
  this.trackMessage(msgIdStr)
132
132
 
133
133
  // A message got rejected, so we can stop tracking promises and let the score penalty apply.
134
- // With the expection of obvious invalid messages
134
+ // With the exception of obvious invalid messages
135
135
  switch (reason) {
136
136
  case RejectReason.Error:
137
137
  return
@@ -101,13 +101,13 @@ export async function validateToRawMessage (
101
101
  msg: RPC.Message
102
102
  ): Promise<ValidationResult> {
103
103
  // If strict-sign, verify all
104
- // If anonymous (no-sign), ensure no preven
104
+ // If anonymous (no-sign), ensure no signature, key, from or seqno is present
105
105
 
106
106
  switch (signaturePolicy) {
107
107
  case StrictNoSign:
108
108
  if (msg.signature != null) { return { valid: false, error: ValidateError.SignaturePresent } }
109
109
  if (msg.seqno != null) { return { valid: false, error: ValidateError.SeqnoPresent } }
110
- if (msg.key != null) { return { valid: false, error: ValidateError.FromPresent } }
110
+ if (msg.from != null || msg.key != null) { return { valid: false, error: ValidateError.FromPresent } }
111
111
 
112
112
  return { valid: true, message: { type: 'unsigned', topic: msg.topic, data: msg.data ?? new Uint8Array(0) } }
113
113