@libp2p/gossipsub 16.0.0 → 16.0.1

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.
@@ -1,5 +1,5 @@
1
1
  import Denque from 'denque';
2
- import { TimeCacheDuration } from '../constants.js';
2
+ import { TimeCacheDuration } from "../constants.js";
3
3
  export var DeliveryRecordStatus;
4
4
  (function (DeliveryRecordStatus) {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { InvalidPeerScoreParamsError } from '../errors.js';
1
+ import { InvalidPeerScoreParamsError } from "../errors.js";
2
2
  export const defaultPeerScoreParams = {
3
3
  topics: {},
4
4
  topicScoreCap: 10.0,
@@ -1,4 +1,4 @@
1
- import { InvalidPeerScoreThresholdsError } from '../errors.js';
1
+ import { InvalidPeerScoreThresholdsError } from "../errors.js";
2
2
  export const defaultPeerScoreThresholds = {
3
3
  gossipThreshold: -10,
4
4
  publishThreshold: -50,
@@ -1,11 +1,11 @@
1
- import { RejectReason } from '../types.js';
2
- import { MapDef } from '../utils/set.js';
1
+ import { RejectReason } from '../types.ts';
2
+ import { MapDef } from '../utils/set.ts';
3
3
  import { computeScore } from './compute-score.ts';
4
4
  import { MessageDeliveries } from './message-deliveries.ts';
5
- import type { MsgIdStr, PeerIdStr, TopicStr } from '../types.js';
5
+ import type { MsgIdStr, PeerIdStr, TopicStr } from '../types.ts';
6
6
  import type { PeerScoreParams } from './peer-score-params.ts';
7
7
  import type { PeerStats } from './peer-stats.ts';
8
- import type { Metrics, ScorePenalty } from '../metrics.js';
8
+ import type { Metrics, ScorePenalty } from '../metrics.ts';
9
9
  import type { ComponentLogger } from '@libp2p/interface';
10
10
  interface PeerScoreOpts {
11
11
  /**
@@ -1,5 +1,5 @@
1
- import { RejectReason } from '../types.js';
2
- import { MapDef } from '../utils/set.js';
1
+ import { RejectReason } from "../types.js";
2
+ import { MapDef } from "../utils/set.js";
3
3
  import { computeScore } from "./compute-score.js";
4
4
  import { MessageDeliveries, DeliveryRecordStatus } from "./message-deliveries.js";
5
5
  import { validatePeerScoreParams } from "./peer-score-params.js";
@@ -1,4 +1,4 @@
1
- import type { TopicStr } from '../types.js';
1
+ import type { TopicStr } from '../types.ts';
2
2
  export interface PeerStats {
3
3
  /** true if the peer is currently connected */
4
4
  connected: boolean;
@@ -1,9 +1,9 @@
1
1
  import { StrictSign, StrictNoSign } from '../index.ts';
2
- import { RPC } from '../message/rpc.js';
3
- import { ValidateError } from '../types.js';
2
+ import { RPC } from '../message/rpc.ts';
3
+ import { ValidateError } from '../types.ts';
4
4
  import type { Message } from '../index.ts';
5
- import type { PublishConfig, TopicStr } from '../types.js';
6
- export declare const SignPrefix: Uint8Array<ArrayBufferLike>;
5
+ import type { PublishConfig, TopicStr } from '../types.ts';
6
+ export declare const SignPrefix: Uint8Array<ArrayBuffer>;
7
7
  export interface RawMessageAndMessage {
8
8
  raw: RPC.Message;
9
9
  msg: Message;
@@ -1 +1 @@
1
- {"version":3,"file":"buildRawMessage.d.ts","sourceRoot":"","sources":["../../../src/utils/buildRawMessage.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AACvC,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAG1D,eAAO,MAAM,UAAU,6BAAyC,CAAA;AAgBhE,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb;AAED,wBAAsB,eAAe,CACnC,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,QAAQ,EACf,YAAY,EAAE,UAAU,EACxB,eAAe,EAAE,UAAU,GAC1B,OAAO,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C,eAAe,EAAE,OAAO,YAAY,GAAG,OAAO,UAAU,EACxD,GAAG,EAAE,GAAG,CAAC,OAAO,GACf,OAAO,CAAC,gBAAgB,CAAC,CAqF3B"}
@@ -5,8 +5,8 @@ import { concat as uint8ArrayConcat } from 'uint8arrays/concat';
5
5
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
6
6
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
7
7
  import { StrictSign, StrictNoSign } from "../index.js";
8
- import { RPC } from '../message/rpc.js';
9
- import { PublishConfigType, ValidateError } from '../types.js';
8
+ import { RPC } from "../message/rpc.js";
9
+ import { PublishConfigType, ValidateError } from "../types.js";
10
10
  export const SignPrefix = uint8ArrayFromString('libp2p-pubsub:');
11
11
  // Monotonic seqno counter seeded from the wall clock in nanoseconds, matching
12
12
  // go-libp2p-pubsub and rust-libp2p. The pubsub spec requires a "linearly
@@ -1,4 +1,4 @@
1
- import type { RPC } from '../message/rpc.js';
1
+ import type { RPC } from '../message/rpc.ts';
2
2
  /**
3
3
  * Create a gossipsub RPC object
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { Message } from '../index.js';
1
+ import type { Message } from '../index.ts';
2
2
  import type { PublicKey } from '@libp2p/interface';
3
3
  /**
4
4
  * Generate a message id, based on the `key` and `seqno`
@@ -1,5 +1,5 @@
1
1
  import { StrictSign, StrictNoSign } from '../index.ts';
2
- import type { PublishConfig } from '../types.js';
2
+ import type { PublishConfig } from '../types.ts';
3
3
  import type { PeerId, PrivateKey } from '@libp2p/interface';
4
4
  /**
5
5
  * Prepare a PublishConfig object from a PeerId.
@@ -1,6 +1,6 @@
1
1
  import { publicKeyToProtobuf } from '@libp2p/crypto/keys';
2
2
  import { StrictSign, StrictNoSign } from "../index.js";
3
- import { PublishConfigType } from '../types.js';
3
+ import { PublishConfigType } from "../types.js";
4
4
  /**
5
5
  * Prepare a PublishConfig object from a PeerId.
6
6
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/gossipsub",
3
- "version": "16.0.0",
3
+ "version": "16.0.1",
4
4
  "description": "A typescript implementation of gossipsub",
5
5
  "files": [
6
6
  "src",
@@ -52,8 +52,8 @@
52
52
  "release": "aegir release --no-types",
53
53
  "build": "aegir build",
54
54
  "generate": "protons ./src/message/rpc.proto",
55
- "benchmark": "yarn benchmark:files test/benchmark/**/*.test.ts",
56
- "benchmark:files": "NODE_OPTIONS='--max-old-space-size=4096 --loader=ts-node/esm' benchmark --config .benchrc.yaml --defaultBranch master",
55
+ "benchmark": "npm run benchmark:files -- 'dist/test/benchmark/**/*.test.js' -- --exit",
56
+ "benchmark:files": "NODE_OPTIONS='--max-old-space-size=4096' aegir test -t node --timeout 0 -f",
57
57
  "test": "aegir test -f dist/test/*.spec.js",
58
58
  "test:node": "aegir test -t node -f dist/test/*.spec.js -f dist/test/unit/*.spec.js -f dist/test/e2e/*.spec.js",
59
59
  "test:chrome": "aegir test -f dist/test/*.spec.js -t browser",
@@ -79,31 +79,32 @@
79
79
  },
80
80
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/gossipsub#readme",
81
81
  "dependencies": {
82
- "@libp2p/crypto": "^5.1.18",
83
- "@libp2p/interface": "^3.2.2",
84
- "@libp2p/interface-internal": "^3.1.5",
85
- "@libp2p/peer-id": "^6.0.9",
86
- "@libp2p/utils": "^7.2.1",
87
- "@multiformats/multiaddr": "^13.0.1",
82
+ "@libp2p/crypto": "^5.1.19",
83
+ "@libp2p/interface": "^3.2.3",
84
+ "@libp2p/interface-internal": "^3.1.6",
85
+ "@libp2p/peer-id": "^6.0.10",
86
+ "@libp2p/utils": "^7.2.2",
87
+ "@multiformats/multiaddr": "^13.0.3",
88
88
  "denque": "^2.1.0",
89
89
  "it-length-prefixed": "^10.0.1",
90
90
  "it-pipe": "^3.0.1",
91
91
  "it-pushable": "^3.2.3",
92
- "multiformats": "^13.0.1",
92
+ "multiformats": "^14.0.0",
93
93
  "protons-runtime": "^6.0.1",
94
94
  "uint8arraylist": "^2.4.8",
95
- "uint8arrays": "^5.0.1"
95
+ "uint8arrays": "^6.1.1"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@chainsafe/as-sha256": "^1.2.0",
99
- "@dapplion/benchmark": "^1.0.0",
100
- "@libp2p/floodsub": "^11.0.22",
101
- "@libp2p/logger": "^6.2.7",
102
- "@libp2p/peer-store": "^12.0.20",
99
+ "@libp2p/floodsub": "^11.0.23",
100
+ "@libp2p/logger": "^6.2.8",
101
+ "@libp2p/peer-store": "^12.0.21",
102
+ "@types/benchmark": "^2.1.5",
103
103
  "@types/node": "^22.18.1",
104
104
  "@types/sinon": "^21.0.1",
105
105
  "abortable-iterator": "^5.1.0",
106
- "aegir": "^47.0.21",
106
+ "aegir": "^48.0.11",
107
+ "benchmark": "^2.1.4",
107
108
  "datastore-core": "^11.0.1",
108
109
  "delay": "^7.0.0",
109
110
  "it-all": "^3.0.6",
@@ -1,5 +1,5 @@
1
1
  import Denque from 'denque'
2
- import { TimeCacheDuration } from '../constants.js'
2
+ import { TimeCacheDuration } from '../constants.ts'
3
3
 
4
4
  export enum DeliveryRecordStatus {
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { InvalidPeerScoreParamsError } from '../errors.js'
1
+ import { InvalidPeerScoreParamsError } from '../errors.ts'
2
2
 
3
3
  // This file defines PeerScoreParams and TopicScoreParams interfaces
4
4
  // as well as constructors, default constructors, and validation functions
@@ -1,4 +1,4 @@
1
- import { InvalidPeerScoreThresholdsError } from '../errors.js'
1
+ import { InvalidPeerScoreThresholdsError } from '../errors.ts'
2
2
 
3
3
  // This file defines PeerScoreThresholds interface
4
4
  // as well as a constructor, default constructor, and validation function
@@ -1,12 +1,12 @@
1
- import { RejectReason } from '../types.js'
2
- import { MapDef } from '../utils/set.js'
1
+ import { RejectReason } from '../types.ts'
2
+ import { MapDef } from '../utils/set.ts'
3
3
  import { computeScore } from './compute-score.ts'
4
4
  import { MessageDeliveries, DeliveryRecordStatus } from './message-deliveries.ts'
5
5
  import { validatePeerScoreParams } from './peer-score-params.ts'
6
- import type { MsgIdStr, PeerIdStr, TopicStr, IPStr } from '../types.js'
6
+ import type { MsgIdStr, PeerIdStr, TopicStr, IPStr } from '../types.ts'
7
7
  import type { PeerScoreParams } from './peer-score-params.ts'
8
8
  import type { PeerStats, TopicStats } from './peer-stats.ts'
9
- import type { Metrics, ScorePenalty } from '../metrics.js'
9
+ import type { Metrics, ScorePenalty } from '../metrics.ts'
10
10
  import type { ComponentLogger, Logger } from '@libp2p/interface'
11
11
 
12
12
  interface PeerScoreOpts {
@@ -1,4 +1,4 @@
1
- import type { TopicStr } from '../types.js'
1
+ import type { TopicStr } from '../types.ts'
2
2
 
3
3
  export interface PeerStats {
4
4
  /** true if the peer is currently connected */
@@ -5,10 +5,10 @@ import { concat as uint8ArrayConcat } from 'uint8arrays/concat'
5
5
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
6
6
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
7
7
  import { StrictSign, StrictNoSign } from '../index.ts'
8
- import { RPC } from '../message/rpc.js'
9
- import { PublishConfigType, ValidateError } from '../types.js'
8
+ import { RPC } from '../message/rpc.ts'
9
+ import { PublishConfigType, ValidateError } from '../types.ts'
10
10
  import type { Message } from '../index.ts'
11
- import type { PublishConfig, TopicStr } from '../types.js'
11
+ import type { PublishConfig, TopicStr } from '../types.ts'
12
12
  import type { PublicKey, PeerId } from '@libp2p/interface'
13
13
 
14
14
  export const SignPrefix = uint8ArrayFromString('libp2p-pubsub:')
@@ -1,4 +1,4 @@
1
- import type { RPC } from '../message/rpc.js'
1
+ import type { RPC } from '../message/rpc.ts'
2
2
 
3
3
  /**
4
4
  * Create a gossipsub RPC object
@@ -1,7 +1,7 @@
1
1
  import { publicKeyToProtobuf } from '@libp2p/crypto/keys'
2
2
  import { sha256 } from 'multiformats/hashes/sha2'
3
3
  import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'
4
- import type { Message } from '../index.js'
4
+ import type { Message } from '../index.ts'
5
5
  import type { PublicKey } from '@libp2p/interface'
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import { publicKeyToProtobuf } from '@libp2p/crypto/keys'
2
2
  import { StrictSign, StrictNoSign } from '../index.ts'
3
- import { PublishConfigType } from '../types.js'
4
- import type { PublishConfig } from '../types.js'
3
+ import { PublishConfigType } from '../types.ts'
4
+ import type { PublishConfig } from '../types.ts'
5
5
  import type { PeerId, PrivateKey } from '@libp2p/interface'
6
6
 
7
7
  /**