* fix: add stop methods to protocols to prevent event listener leaks
* fix: add abort signal support for graceful store query cancellation
* fix: call protocol stop methods in WakuNode.stop()
* fix: improve QueryOnConnect cleanup and abort signal handling
* fix: improve MissingMessageRetriever cleanup with abort signal
* fix: add stopAllRetries method to RetryManager for proper cleanup
* fix: implement comprehensive ReliableChannel stop() with proper cleanup
* fix: add active query tracking to QueryOnConnect and await its stop()
* fix: add stop() to IRelayAPI and IStore interfaces, implement in SDK wrappers
* align with usual naming (isStarted)
* remove unnecessary `await`
* test: `stop()` is now async
* chore: use more concise syntax
---------
Co-authored-by: Levente Kiss <levente.kiss@solarpunk.buzz>
* feat: query on connect
Perform store time-range queries upon connecting to a store node.
Some heuristics are applied to ensure the store queries are not too frequent.
* make `maybeQuery` private
* query-on-connect: use index.ts only for re-export
* query-on-connect: update doc
* store connect evt: use enum instead of free strings for Waku event types
* store connect evt: more accurate enum name
* store connect evt: add store connect event on peer manager
* store connect evt: simplify logic statements
* store connect evt: test store connect
* store connect evt: export event types
* test: use enum
* Shorter name for waku events
* update local peer discovery, make it configurable for cache
* move to separate file
* up tests, remove local storage from tests
* pass local peer cache options
* add e2e tests
* add aditional e2e tests for local cache
* rename local-peer-cache into peer-cache
* update tests, ci
* prevent filterign ws addresses
Nodes returned by DNS Discovery are not guaranteed to be reachable.
Hence, setting an upfront limit based on sought capability does not provide
any guarantees that such capability should be reached.
The discovery's mechanism role is to find Waku 2 nodes. As many as possible.
It is then the role of the peer manager to decide:
- whether to attempt connecting to the node based on advertised capabilities
- retain connection to the node based on actual mounted protocols.
We still want to prevent infinite loops, hence the `maxGet` parameter.
Also, there was a dichotomy between code tested, and code actually used by libp2p peer discovery, now resolved.
# Conflicts:
# packages/discovery/src/dns/constants.ts
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
For an edge node, there is no such thing as a "pubsub topic configuration". An edge node should be able to operate for any possible shard, and it is a per-protocol matter (eg send message with light push).
A relay node do subscribe to shards, but in this case, even metadata protocol does not need to advertise them, this is already handled by gossipsub.
Only service node should advertise their shards via metadata protocol, which is out of scope for js-waku.
# Conflicts:
# packages/interfaces/src/connection_manager.ts
* add FF for auto recovery
* implement connection locking, connection maintenance, auto recovery, bootstrap connections maintenance and fix bootstrap peers dropping
* add ut for peer manager changes
* implement UT for Connection Limiter
* increase connection maintenance interval
* update e2e test
* make dialer use dial queue
* skip undiable peers
* cover new cases in tests
* expose dialer config at connection manager
* update tests with new config
* add more tests
* feat: implement shard retrieval for store and improve set store peers usage
* remove log
* remove only, improve condition
* implement smarter way to retrieve peers
* up tests
* update mock
* address nits, add target to eslint, revert to es2022
* remove IBaseProtocol
* fix references, interfaces and integration
* fix ci
* up mock
* up lock
* add mock for local storage
* add missing prop, fix tests
* up lock
* create new filter api
* implement await on main methods on new Filter
* add info logs in new filter
* add logs to subscription impl
* remove lint supress
* add unit tests
* introduce E2E tests
* update e2e tests and add case for testing filter recovery after nwaku nodes replacement
* add new test cases for max limits and enable decoders as array on new filter
* fix edge case testing, correct test cases
* skip test
* update error message
* up text
* up text
* fix lint
* implement unsubscribeAll
* add js-dock to new filter
* add cspell
* implement TTL set for message history
* create retry manager
* update tests
* add retry manager tests, update peer manager
* fix start & merge with master
* return send to many logic
* add new error handling
* add sections to protocol errors
* fix check
* up test
* add waku.start in test
* fix check and test
* improve name
* up lock
* make ConnectionManager use ctor
* reform connection manager configurations
* remove log param from peerManager
* make PeerManager use only ConnectionManager, move getPeers to ConnectionManager, remove not needed code
* remove allPeers and connectedPeers from BaseProtocolCore, update tests, add getPeers for IWaku
* use only one peerManager from Waku object
* remove IBaseProtocolSDK and merge with PeerManager
* re-implement peerManager, remove ProtocolUseOptions
* remove not needed test, up lock
* update deps and lock
* remove old test for peerManager, fix check and spell
* rename to getConnectedPeers
* feat: improve filter subscriptions (#2193)
* add message cache to Filter
* remove WakuOptions and use only ProtocolCreateOptions
* move subscribe options to createLightNode Fitler protocol options
* rename SubscriptionManager to Subscription
* rename to CreateNodeOptions
* add warning
* feat: introduce subscription manager (#2202)
* feat: inroduce subscription manager
* fix: make pipeline succeed (#2238)
* fix test
* use hardcoded value
* update playwright
* fix test:browser
* up lock
* make peer retrieval probabilistic
* add comments
* up lightpush tests
* add tests for peer_manager, improve folder structure
* create named files for protocols
* create named files, simplify project structure
* remove only
* feat: API allows using specific nodes for protocol
* chore: dial provided now
* chore: store uses the node
* chore: update API
* chore: use protocol-level class for getting peer
* chore: use ConnectionManager for dial ops
* chore: address comments
* chore: fix type error
* chore: Waku.dial() proxies through ConnectionManager.dialPeer
* chore: fix dial
* chore: add ts-doc for dialPeer()
* chore: remove log
* chore: reduce ts-doc for an internal function
* chore: address comments
* chore: return types from connmanager.dialpeer()
* chore: reduce diff by not introducing breaking changes
* fix comment of default number of peers
* export default number of peers from base protocol sdk
* rename to light_push, move class to separate file
* move waitForRemotePeer to sdk package
* add todo to move waitForGossipSubPeerInMesh into @waku/relay
* clean up waitForRemotePeer, split metadata await from event and optimise, decouple from protocol implementations
* simplify and rename ILightPush interface
* use only connected peers in light push based on connections instead of peer renewal mechanism
* improve readability of result processing in light push
* fix check & update tests
* address tests, add new test cases, fix racing condition in StreamManager
* use libp2p.getPeers
* feat: confirm metadata and protocols needed in waitForRemotePeer
* rely on passed protocols and fallback to mounted
* add I prefix to Waku interface
* implement waku.connect method
* add docs to IWaku interface
* remove export and usage of waitForRemotePeer
* move wait for remote peer related to Realy out of @waku/sdk
* change tests to use new API
* fix linting
* update size limit
* rename .connect to .waitForPeer
* export waitForRemotePeer and mark as deprecated
* feat: add mocha tests to @waku/sdk and cover waitForRemotePeer (#2163)
* feat: add mocha tests to @waku/sdk and cover waitForRemotePeer
* add waitForRemote UTs
* remove junk
* feat: expose peerId and protocols from WakuNode (#2166)
* chore: expose peerId and protocols from WakuNode
* remove unused method
* move to private method
* rename to waitForPeers
* up test
* fix comment of default number of peers
* export default number of peers from base protocol sdk
* rename to light_push, move class to separate file
* move waitForRemotePeer to sdk package
* add todo to move waitForGossipSubPeerInMesh into @waku/relay
* clean up waitForRemotePeer, split metadata await from event and optimise, decouple from protocol implementations
* simplify and rename ILightPush interface
* use only connected peers in light push based on connections instead of peer renewal mechanism
* improve readability of result processing in light push
* fix check & update tests
* address tests, add new test cases, fix racing condition in StreamManager
* use libp2p.getPeers
* feat: write proto
* chore: move store v2 to a subdir
* chore: update v3 proto
* feat: create custom RPC
* feat: implement storev3 core
* chore: set store v3 as default
* chore: move v2 related code
* chore: update v2 imports
* feat: add store-v3 sdk implementation
* fix: rebase
* chore: add ts-doc for store query request params
* chore: update tests for new API
* fix: use nanoseconds instead of millisecond for timerange
* chore: improve store
* chore: remove store v2
* chore: update tests
* chore: fix legacy imports & proto
* tests: remove manual reversal as its part of the API, update incorrect cursor error msg
* chore: update default page size
* chore: account for MAX_PAGE_SIZE from nwaku
* fix: test
* fix: sorting tests
* chore: rename IReceiver subscribe
* feat!: new `subscribe() API that only takes in decoders and callback
* chore: `to_async_iterator` uses new function name
* chore: make `createSubscription` private, and shorten error handling
* chore: update subscribe return type
* tests: use new API
* fix: tests
* feat: introduce HealthManager
* feat: make health accessible on Waku object
* feat: update health from protocols
* chore: add access modifiers to healthmanager
* feat: use a HealthManager singleton
* chore: add tests for Filter, LightPush and Store
* feat: add overall node health
* chore: update protocol health to consider Store protocol
* chore: setup generic test utils instead of using filter utils
* tests: add a health status matrix check from 0-3
* chore: increase timeout for failing tests in CI
tests pass locally without an increased timeout, but fail in CI
* chore: move name inference to HealthManager
* tests: abstract away node creation and teardown utils
* fix: import
* feat: validate messages for individual filter nodes & perform renewals
* chore: fix spell check
* chore: use a max threshold before peer renewal
* chore: switch from a validation cycle timer to adhoc validation
* chore: add test
* fix: test
* chore: address comments
* fix: renewal without a new peer available
* chore: validating messages should be non-blocking
* chore: minor improvements
* chore: rm only
* chore: fix test