Skip to content

Commit

Permalink
fix: bootstrapping with default pubsub topic (#2031)
Browse files Browse the repository at this point in the history
* fix: bootstrapping into default pubsub topic

* chore: update tests

* chore: update TODO with GH issue

* chore: rename fleets

* feat: use TWN fleets, or wakuv2.prod if DefaultPubsubTopic

* chore: update imports for enrtree
  • Loading branch information
danisharora099 authored Jun 6, 2024
1 parent c5302fd commit 16e9116
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
11 changes: 9 additions & 2 deletions packages/discovery/src/dns/constants.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import type { NodeCapabilityCount } from "@waku/interfaces";

/**
* The ENR tree for the different fleets.
* SANDBOX and TEST fleets are for The Waku Network.
* DEPRECATED_DEFAULT_PUBSUB is the fleet of nodes supporting the now deprecated DefaultPubsubTopic.
*/
export const enrTree = {
TEST: "enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im",
SANDBOX:
"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im"
"enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im",
TEST: "enrtree://AOGYWMBYOUIMOENHXCHILPKY3ZRFEULMFI4DOM442QSZ73TT2A7VI@test.waku.nodes.status.im",
DEPRECATED_DEFAULT_PUBSUB:
"enrtree://ANEDLO25QVUGJOUTQFRYKWX6P4Z4GKVESBMHML7DZ6YK4LGS5FC5O@prod.wakuv2.nodes.status.im"
};

export const DEFAULT_BOOTSTRAP_TAG_NAME = "bootstrap";
Expand Down
14 changes: 12 additions & 2 deletions packages/sdk/src/utils/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
wakuLocalPeerCacheDiscovery,
wakuPeerExchangeDiscovery
} from "@waku/discovery";
import { type Libp2pComponents, PubsubTopic } from "@waku/interfaces";
import {
DefaultPubsubTopic,
type Libp2pComponents,
PubsubTopic
} from "@waku/interfaces";

const DEFAULT_NODE_REQUIREMENTS = {
lightPush: 1,
Expand All @@ -16,10 +20,16 @@ const DEFAULT_NODE_REQUIREMENTS = {
export function defaultPeerDiscoveries(
pubsubTopics: PubsubTopic[]
): ((components: Libp2pComponents) => PeerDiscovery)[] {
const isDefaultPubsubTopic = pubsubTopics.includes(DefaultPubsubTopic);
const dnsEnrTrees = isDefaultPubsubTopic
? [enrTree["DEPRECATED_DEFAULT_PUBSUB"]]
: [enrTree["SANDBOX"], enrTree["TEST"]];

const discoveries = [
wakuDnsDiscovery([enrTree["SANDBOX"]], DEFAULT_NODE_REQUIREMENTS),
wakuDnsDiscovery(dnsEnrTrees, DEFAULT_NODE_REQUIREMENTS),
wakuLocalPeerCacheDiscovery(),
wakuPeerExchangeDiscovery(pubsubTopics)
];

return discoveries;
}

0 comments on commit 16e9116

Please sign in to comment.