Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: @waku/relay #1316

Merged
merged 21 commits into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
00145ec
move constants & core's func to @waku/utils
danisharora099 Apr 27, 2023
39667ed
setup @waku/relay
danisharora099 Apr 27, 2023
cd9a482
use @waku/relay for create
danisharora099 Apr 27, 2023
dff2c45
address: principal review
danisharora099 Apr 27, 2023
5bcbcea
fix: size-limit
danisharora099 Apr 27, 2023
c593ce6
Merge branch 'master' into feat/relay-package
danisharora099 May 2, 2023
76df4cb
Merge branch 'master' into feat/relay-package
danisharora099 May 4, 2023
522c161
move all constants to @waku/core
danisharora099 May 9, 2023
9222587
move TopicOnlyDecoder to relay
danisharora099 May 9, 2023
8646f7c
merge: master
danisharora099 May 9, 2023
4b0ce8b
Merge branch 'master' of github.com:waku-org/js-waku into feat/relay-…
danisharora099 May 9, 2023
ab2fc55
fix: tests
danisharora099 May 9, 2023
d73bcf8
Move constants out of core (#1340)
fryorcraken May 10, 2023
3021783
Merge branch 'master' of github.com:waku-org/js-waku into feat/relay-…
danisharora099 May 10, 2023
907e30c
update package.lock
danisharora099 May 10, 2023
6e7a0f6
change constants folder into a ts file
danisharora099 May 11, 2023
41ffc35
use dependency version as * instead of version number
danisharora099 May 11, 2023
0266041
Merge branch 'master' into feat/relay-package
danisharora099 May 11, 2023
74b53e6
add constants import from @waku/core
danisharora099 May 11, 2023
a61a5ca
Merge branch 'master' of github.com:waku-org/js-waku into feat/relay-…
danisharora099 May 11, 2023
5f33dbb
add empty changelog file for relay
danisharora099 May 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
979 changes: 644 additions & 335 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"packages/interfaces",
"packages/enr",
"packages/core",
"packages/relay",
"packages/peer-exchange",
"packages/dns-discovery",
"packages/message-encryption",
Expand Down
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"node": ">=16"
},
"dependencies": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removes libp2p-gossipsub dependency from core

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you double check whether any other dependency can be removed such as @libp2p/interface-pubsub?

Copy link
Collaborator Author

@danisharora099 danisharora099 May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

We could possibly use something like https://github.com/depcheck/depcheck to achieve receiving updates on unused dependency errors.

"@chainsafe/libp2p-gossipsub": "^6.1.0",
"@noble/hashes": "^1.3.0",
"@waku/interfaces": "0.0.11",
"@waku/proto": "0.0.4",
Expand Down
10 changes: 2 additions & 8 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { DefaultPubSubTopic } from "./lib/constants.js";
export { DefaultPubSubTopic } from "@waku/utils/constants";
export { DefaultUserAgent } from "./lib/waku.js";

export { createEncoder, createDecoder } from "./lib/message/version_0.js";
Expand All @@ -7,6 +7,7 @@ export type {
Decoder,
DecodedMessage,
} from "./lib/message/version_0.js";
export { TopicOnlyDecoder } from "./lib/message/topic_only_message.js";
export * as message from "./lib/message/index.js";

export * as waku from "./lib/waku.js";
Expand All @@ -18,13 +19,6 @@ export { wakuFilter } from "./lib/filter/index.js";
export * as waku_light_push from "./lib/light_push/index.js";
export { wakuLightPush, LightPushCodec } from "./lib/light_push/index.js";

export * as waku_relay from "./lib/relay/index.js";
export {
wakuRelay,
RelayCreateOptions,
wakuGossipSub,
} from "./lib/relay/index.js";

export * as waku_store from "./lib/store/index.js";
export {
PageDirection,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/filter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import type {
ProtocolOptions,
} from "@waku/interfaces";
import { WakuMessage as WakuMessageProto } from "@waku/proto";
import { groupByContentTopic } from "@waku/utils";
import { DefaultPubSubTopic } from "@waku/utils/constants";
import debug from "debug";
import all from "it-all";
import * as lp from "it-length-prefixed";
import { pipe } from "it-pipe";

import { BaseProtocol } from "../base_protocol.js";
import { DefaultPubSubTopic } from "../constants.js";
import { groupByContentTopic } from "../group_by.js";
import { toProtoMessage } from "../to_proto_message.js";

import { ContentFilter, FilterRpc } from "./filter_rpc.js";
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/lib/keep_alive_manager.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import type { PeerId } from "@libp2p/interface-peer-id";
import type { IRelay } from "@waku/interfaces";
import { RelayPingContentTopic } from "@waku/utils/constants";
import debug from "debug";
import type { Libp2p } from "libp2p";

import { createEncoder } from "../index.js";

import { RelayPingContentTopic } from "./relay/constants.js";

const log = debug("waku:keep-alive");

export interface KeepAliveOptions {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/light_push/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import type {
SendResult,
} from "@waku/interfaces";
import { PushResponse } from "@waku/proto";
import { DefaultPubSubTopic } from "@waku/utils/constants";
import debug from "debug";
import all from "it-all";
import * as lp from "it-length-prefixed";
import { pipe } from "it-pipe";
import { Uint8ArrayList } from "uint8arraylist";

import { BaseProtocol } from "../base_protocol.js";
import { DefaultPubSubTopic } from "../constants.js";

import { PushRpc } from "./push_rpc.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import {
import { proto_store as proto } from "@waku/proto";
import { isDefined } from "@waku/utils";
import { concat, utf8ToBytes } from "@waku/utils/bytes";
import { DefaultPubSubTopic } from "@waku/utils/constants";
import debug from "debug";
import all from "it-all";
import * as lp from "it-length-prefixed";
import { pipe } from "it-pipe";
import { Uint8ArrayList } from "uint8arraylist";

import { BaseProtocol } from "../base_protocol.js";
import { DefaultPubSubTopic } from "../constants.js";
import { toProtoMessage } from "../to_proto_message.js";

import { HistoryRpc, PageDirection, Params } from "./history_rpc.js";
Expand Down
1 change: 1 addition & 0 deletions packages/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"@libp2p/websockets": "^5.0.3",
"@waku/core": "0.0.16",
"@waku/dns-discovery": "0.0.10",
"@waku/relay": "^0.0.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weboko didn't we say we would keep * for packages in the mono repo? I can see the other package have a specified version too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have addressed this as part of this PR: 41ffc35

I'm curious if we could possibly make this change automatically part of the pre-commit hook maybe

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did some digging; tracking here: #1346

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fryorcraken , right now we have a mix: some are using asterisk and some version.

Honestly I can't remember on what we settled but it seems to me now we agreed that version will be changed / maintained by release-please to specific version instead of asterisk - last release.

@danisharora099 I believe the task is not needed except if we want to define versions to private packages, I think they won't be changed automatically by the release CI. That can be done manually it seems.

"libp2p": "^0.42.2"
},
"devDependencies": {
Expand Down
4 changes: 1 addition & 3 deletions packages/create/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ import { webSockets } from "@libp2p/websockets";
import { all as filterAll } from "@libp2p/websockets/filters";
import {
DefaultUserAgent,
RelayCreateOptions,
wakuFilter,
wakuGossipSub,
wakuLightPush,
WakuNode,
WakuOptions,
wakuRelay,
wakuStore,
} from "@waku/core";
import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";
Expand All @@ -23,6 +20,7 @@ import type {
ProtocolCreateOptions,
RelayNode,
} from "@waku/interfaces";
import { RelayCreateOptions, wakuGossipSub, wakuRelay } from "@waku/relay";
import { createLibp2p, Libp2pOptions } from "libp2p";

import type { Libp2pComponents } from "./libp2p_components.js";
Expand Down
6 changes: 6 additions & 0 deletions packages/relay/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
parserOptions: {
tsconfigRootDir: __dirname,
project: "./tsconfig.dev.json",
},
};
11 changes: 11 additions & 0 deletions packages/relay/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts",
"require": ["ts-node/register", "isomorphic-fetch"],
"loader": "ts-node/esm",
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
],
"exit": true
}
Loading