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!: protocols filter peers per shard #1756

Merged
merged 17 commits into from
Jan 19, 2024

Conversation

danisharora099
Copy link
Collaborator

@danisharora099 danisharora099 commented Dec 14, 2023

Problem

The getPeers functionality for BaseProtocol currently only picked peers according to the protocol found and thus not taking account if the node is part of TWN, and runs on a shard.

Solution

This PR also filters on the basis of the shard a particular node is part of, if they support sharding.

Notes

There is a requirement to wait for ~50/100ms after a peer:connect event is fired as the Metadata Protocol is an async operation for which we need to wait to populate shard info, or disconnect if shard info is incorrect.

This, along with fixes for the CI tests & some improvements are part of: #1759

Followup:

@danisharora099 danisharora099 requested a review from a team as a code owner December 14, 2023 13:38
Copy link

github-actions bot commented Dec 14, 2023

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku core 32.59 KB (-44.24% 🔽) 652 ms (-44.24% 🔽) 399 ms (-36.21% 🔽) 1.1 s
Waku Simple Light Node 298.42 KB (-0.11% 🔽) 6 s (-0.11% 🔽) 1.9 s (+21.23% 🔺) 7.9 s
ECIES encryption 31.97 KB (0%) 640 ms (0%) 618 ms (-34.65% 🔽) 1.3 s
Symmetric encryption 31.96 KB (0%) 640 ms (0%) 597 ms (-24.22% 🔽) 1.3 s
DNS discovery 106.77 KB (+0.14% 🔺) 2.2 s (+0.14% 🔺) 1.8 s (+57.33% 🔺) 3.9 s
Privacy preserving protocols 145 KB (0%) 2.9 s (0%) 1.5 s (-19.25% 🔽) 4.4 s
Light protocols 30.15 KB (-46.04% 🔽) 603 ms (-46.04% 🔽) 600 ms (+13.04% 🔺) 1.3 s
History retrieval protocols 29.04 KB (-46.94% 🔽) 581 ms (-46.94% 🔽) 554 ms (-15.88% 🔽) 1.2 s
Deterministic Message Hashing 5.92 KB (0%) 119 ms (0%) 145 ms (-18.03% 🔽) 263 ms

@weboko
Copy link
Collaborator

weboko commented Jan 8, 2024

@danisharora099 there are some conflicts, is it ok to review with them?

@danisharora099
Copy link
Collaborator Author

=

@danisharora099 there are some conflicts, is it ok to review with them?

Yes! However, I've resolved the conflicts now :)


While reviewing per commit would have been ideal, the commits from the PR got lost in a rebase/force-push I did, can't retrieve them through reflog either.
Apologies for hassle! For context, this PR also contains some already some reviewed work from #1759

Thank you!

packages/utils/src/libp2p/index.ts Outdated Show resolved Hide resolved
packages/core/src/lib/filterPeers.ts Outdated Show resolved Hide resolved
packages/core/src/lib/base_protocol.ts Outdated Show resolved Hide resolved
packages/utils/package.json Outdated Show resolved Hide resolved
@danisharora099 danisharora099 changed the title feat: protocols filter peers per shard feat!: protocols filter peers per shard Jan 11, 2024
@danisharora099 danisharora099 merged commit 477c2a5 into master Jan 19, 2024
9 of 11 checks passed
@danisharora099 danisharora099 deleted the feat/shard-peer-selection branch January 19, 2024 15:12
@weboko weboko mentioned this pull request Mar 4, 2024
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.

None yet

3 participants