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

feat!: @waku/relay #1316

merged 21 commits into from
May 11, 2023

Conversation

danisharora099
Copy link
Collaborator

@danisharora099 danisharora099 commented Apr 27, 2023

Problem

#1151

Solution

Moves relay functionality into a separate package of the monorepo

Notes

@@ -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.

@github-actions
Copy link

github-actions bot commented Apr 27, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku core 28.78 KB (-76.44% 🔽) 576 ms (-76.44% 🔽) 658 ms (-25.27% 🔽) 1.3 s
Waku default setup 313.34 KB (-20.63% 🔽) 6.3 s (-20.63% 🔽) 2.2 s (+63.5% 🔺) 8.5 s
ECIES encryption 28.04 KB (+0.05% 🔺) 561 ms (+0.05% 🔺) 381 ms (-26.55% 🔽) 942 ms
Symmetric encryption 28.04 KB (+0.05% 🔺) 561 ms (+0.05% 🔺) 384 ms (+65.91% 🔺) 945 ms
DNS discovery 108.22 KB (-0.02% 🔽) 2.2 s (-0.02% 🔽) 611 ms (-48.96% 🔽) 2.8 s
Privacy preserving protocols 130.48 KB (+9.63% 🔺) 2.7 s (+9.63% 🔺) 1.1 s (+19.38% 🔺) 3.7 s
Light protocols 29.81 KB (-75.35% 🔽) 597 ms (-75.35% 🔽) 414 ms (-55.27% 🔽) 1.1 s
History retrieval protocols 29.66 KB (-75.48% 🔽) 594 ms (-75.48% 🔽) 450 ms (-45.05% 🔽) 1.1 s
Deterministic Message Hashing 5.78 KB (0%) 116 ms (0%) 149 ms (+30.24% 🔺) 265 ms

@danisharora099 danisharora099 marked this pull request as ready for review May 2, 2023 05:12
Copy link
Collaborator

@weboko weboko left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Collaborator

@fryorcraken fryorcraken left a comment

Choose a reason for hiding this comment

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

I don't really agree with some constant move. We don't want waku utils to become a dumping ground. Will provide a second review shortly.

@@ -74,7 +74,6 @@
"node": ">=16"
},
"dependencies": {
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

@fryorcraken fryorcraken left a comment

Choose a reason for hiding this comment

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

I see some of the constant location as a potential issue/tech debt and would prefer to have it sorted with this PR.

"fast-check": "^3.8.1"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^24.1.0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would expect to see the @libp2p/interface-pubsub dependency here,no?

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.

Correct, weird as the check/build did not fail. Encountered something similar the other day as well.
Worth opening an issue? We wrote a fix for this, correct?

(could be cool: https://github.com/depcheck/depcheck)

cc @weboko

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's indeed strange, I've been tracking that issue and checking similar scenarios that were caught by the eslint rule.
Added an issue with some description - #1337

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just make it constants.ts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.

I had created a folder constants to future-proof in case we want to add more constant files in the future. But if a case like this arises, we can create the folder then :)

}
},
"typesVersions": {
"*": {
"lib/*": [
"dist/lib/*"
],
"constants/*": [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason why is constants out of the lib dir?

I said move it in the lib dir. We can remove the lib dir if it bothers you.

Copy link
Collaborator Author

@danisharora099 danisharora099 May 11, 2023

Choose a reason for hiding this comment

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

imo @waku/core/constants made it easier to read/import compared to importing directly from @waku/core
And @waku/core/lib/constants is a bigger import path and intuitively constants don't feel right to import from lib

I have removed it as a separate export path, and exporting directly out of @waku/core -- we can change this in the future if necessary :)

@@ -51,6 +51,7 @@
"@chainsafe/libp2p-noise": "^11.0.0",
"@libp2p/mplex": "^7.1.1",
"@libp2p/websockets": "^5.0.3",
"@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.

@danisharora099 danisharora099 changed the title feat: @waku/relay feat!: @waku/relay May 11, 2023
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.

Extract Waku Relay from @waku/core
3 participants