ChainSafe / js-libp2p-gossipsub

TypeScript implementation of Gossipsub
Apache License 2.0
145 stars 43 forks source link

TypeError when setting direct peers in @chainsafe/libp2p-gossipsub with new libp2p peerStore structure #427

Open kostysh opened 1 year ago

kostysh commented 1 year ago

I an using @chainsafe/libp2p-gossipsub version 7.0.0 and libp2p version 0.45.0 on Linux, node.js v18.

Steps to reproduce:

  1. Define directPeers in the libp2p options object.
  2. Start libp2p node with @chainsafe/libp2p-gossipsub protocol.
  3. Observe the following error:
TypeError: Cannot read properties of undefined (reading 'add')
    at file:///.../node_modules/@chainsafe/libp2p-gossipsub/src/index.ts:549:53

Details: The error occurs during the try to set direct peer addresses in the addressBook (https://github.com/ChainSafe/js-libp2p-gossipsub/blob/f62859b346474ff3e29d59e31449b15d60e054d6/src/index.ts#L553). It seems that the new version of the libp2p has a different peerStore structure.

maschad commented 1 year ago

Sorry for the inconvenience 😓 but libp2p 0.45.0 introduced some breaking changes which have been addressed in #425 , so the gossipsub 8.0.0 release should include this fix.