Skip to content

Commit d73bcf8

Browse files
authored
Move constants out of core (#1340)
1 parent ab2fc55 commit d73bcf8

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

packages/core/src/constants/index.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export * as Relay from "./relay.js";
2-
31
/**
42
* DefaultPubSubTopic is the default gossipsub topic to use for Waku.
53
*/

packages/core/src/lib/keep_alive_manager.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import type { IRelay } from "@waku/interfaces";
33
import debug from "debug";
44
import type { Libp2p } from "libp2p";
55

6-
import { RelayPingContentTopic } from "../constants/relay.js";
76
import { createEncoder } from "../index.js";
87

8+
export const RelayPingContentTopic = "/relay-ping/1/ping/null";
99
const log = debug("waku:keep-alive");
1010

1111
export interface KeepAliveOptions {

packages/core/src/constants/relay.ts packages/relay/src/constants.ts

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ export const minute = 60 * second;
66
*/
77
export const RelayCodecs = ["/vac/waku/relay/2.0.0"];
88

9-
export const RelayPingContentTopic = "/relay-ping/1/ping/null";
10-
119
/**
1210
* RelayGossipFactor affects how many peers we will emit gossip to at each heartbeat.
1311
* We will send gossip to RelayGossipFactor * (total number of non-mesh peers), or

packages/relay/src/index.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types";
99
import type { Libp2p } from "@libp2p/interface-libp2p";
1010
import type { PubSub } from "@libp2p/interface-pubsub";
1111
import { sha256 } from "@noble/hashes/sha256";
12-
import {
13-
DefaultPubSubTopic,
14-
Relay as RelayConstants,
15-
} from "@waku/core/constants";
12+
import { DefaultPubSubTopic } from "@waku/core/constants";
1613
import type {
1714
ActiveSubscriptions,
1815
Callback,
@@ -27,6 +24,7 @@ import type {
2724
import { groupByContentTopic } from "@waku/utils";
2825
import debug from "debug";
2926

27+
import { RelayCodecs } from "./constants.js";
3028
import { messageValidator } from "./message_validator.js";
3129
import { TopicOnlyDecoder } from "./topic_only_message.js";
3230

@@ -48,7 +46,7 @@ class Relay implements IRelay {
4846
private readonly pubSubTopic: string;
4947
private defaultDecoder: IDecoder<IDecodedMessage>;
5048

51-
public static multicodec: string = RelayConstants.RelayCodecs[0];
49+
public static multicodec: string = RelayCodecs[0];
5250
public readonly gossipSub: GossipSub;
5351

5452
/**
@@ -236,7 +234,7 @@ export function wakuGossipSub(
236234
fallbackToFloodsub: false,
237235
};
238236
const pubsub = new GossipSub(components, init);
239-
pubsub.multicodecs = RelayConstants.RelayCodecs;
237+
pubsub.multicodecs = RelayCodecs;
240238
return pubsub;
241239
};
242240
}

0 commit comments

Comments
 (0)