Skip to content

Conversation

tysonclugg
Copy link

@tysonclugg tysonclugg commented Apr 16, 2025

Required since things like libp2p/js-libp2p#2717 landed which no longer exports FloodSub from @libp2p/floodsub.

@tysonclugg tysonclugg requested a review from a team as a code owner April 16, 2025 04:22
@tysonclugg tysonclugg changed the title chore: Use floodsub factory method chore: Migrate to using factory methods Apr 16, 2025
achingbrain
achingbrain previously approved these changes Jun 3, 2025
@achingbrain
Copy link
Collaborator

I think you need to update the lockfile.

@achingbrain
Copy link
Collaborator

@tysonclugg can you regenerate the lockfile to fix the CI failures?

Required since libp2p/js-libp2p#2717 landed which
no longer exports `FloodSub` from `@libp2p/floodsub`.
Use the `gossipsub` factory to resolve this error:
```
npm run test

> @chainsafe/[email protected] pretest
> npm run build

> @chainsafe/[email protected] build
> aegir build

[14:34:08] tsc [started]
test/utils/create-pubsub.ts:53:22 - error TS2351: This expression is not constructable.
  Not all constituents of type '((init?: FloodSubInit | undefined) => (components: FloodSubComponents) => PubSub<PubSubEvents>) | typeof GossipSub' are constructable.
    Type '(init?: FloodSubInit | undefined) => (components: FloodSubComponents) => PubSub<PubSubEvents>' has no construct signatures.

53   const pubsub = new Ctor(components, opts.init) as GossipSub
                        ~~~~

Found 1 error in test/utils/create-pubsub.ts:53
```
Resolves errors like below from running `pnpm install`:
```
test/utils/create-pubsub.ts:7:10 - error TS2724: '"@libp2p/peer-store"' has no exported member named 'PersistentPeerStore'. Did you mean 'persistentPeerStore'?

7 import { PersistentPeerStore } from '@libp2p/peer-store'
           ~~~~~~~~~~~~~~~~~~~

  node_modules/.pnpm/@libp2p[email protected]/node_modules/@libp2p/peer-store/dist/src/index.d.ts:46:25
    46 export declare function persistentPeerStore(components: PersistentPeerStoreComponents, init?: PersistentPeerStoreInit): PeerStore;
                               ~~~~~~~~~~~~~~~~~~~
    'persistentPeerStore' is declared here.
```
@tysonclugg tysonclugg force-pushed the chore/floodsub-factory branch from 730133e to 4f0257f Compare August 17, 2025 22:56
@tysonclugg
Copy link
Author

@achingbrain Tests passing locally, ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants