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(store): allow using a specific node #2192

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

danisharora099
Copy link
Collaborator

Problem

Users need the ability to specify the peers used for their apps, for different protocols. Specifically for Store: https://discord.com/channels/1110799176264056863/1290694275683582085/1291644836742565929

Solution

Provides the ability to pass a specific node multiaddr while node creation to be used for Store. Falls back to random nodes if not passed.

Notes

Contribution checklist:

  • covered by unit tests;
  • covered by e2e test;
  • add ! in title if breaks public API;

@danisharora099 danisharora099 requested a review from a team as a code owner October 24, 2024 14:27
Copy link

github-actions bot commented Oct 24, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 86.75 KB (+0.14% 🔺) 1.8 s (+0.14% 🔺) 2.7 s (-0.84% 🔽) 4.5 s
Waku Simple Light Node 137.13 KB (+0.23% 🔺) 2.8 s (+0.23% 🔺) 4.7 s (+34.43% 🔺) 7.4 s
ECIES encryption 22.88 KB (0%) 458 ms (0%) 1.3 s (+47.28% 🔺) 1.7 s
Symmetric encryption 22.37 KB (0%) 448 ms (0%) 1.3 s (-17.65% 🔽) 1.7 s
DNS discovery 70.54 KB (0%) 1.5 s (0%) 2.6 s (+4.51% 🔺) 4 s
Peer Exchange discovery 71.82 KB (0%) 1.5 s (0%) 2.3 s (-8.97% 🔽) 3.8 s
Local Peer Cache Discovery 65.17 KB (0%) 1.4 s (0%) 2.6 s (+24.64% 🔺) 3.9 s
Privacy preserving protocols 76.23 KB (+0.09% 🔺) 1.6 s (+0.09% 🔺) 3 s (-6.4% 🔽) 4.5 s
Waku Filter 81.02 KB (+0.05% 🔺) 1.7 s (+0.05% 🔺) 3.4 s (+6.39% 🔺) 5 s
Waku LightPush 75.73 KB (+0.02% 🔺) 1.6 s (+0.02% 🔺) 3.6 s (+66.75% 🔺) 5.1 s
History retrieval protocols 77.71 KB (+0.11% 🔺) 1.6 s (+0.11% 🔺) 2.5 s (+26.64% 🔺) 4.1 s
Deterministic Message Hashing 7.39 KB (0%) 148 ms (0%) 648 ms (+81.99% 🔺) 796 ms

@danisharora099 danisharora099 marked this pull request as draft December 2, 2024 08:07
@danisharora099 danisharora099 marked this pull request as ready for review December 16, 2024 15:02
let peerIdStr: PeerIdStr | undefined;
if (options.store?.peer) {
this.connectionManager
.dialPeer(options.store.peer, [StoreCodec])
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's not introduce this function and use

public async dial(

which does the same as I see

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good point - now that we have a dial function in the ConnectionManager, we should be proxying dials through that.
instead of doing libp2p.dial() on the Waku object, proxied it through the ConnectionManager.dialPeer() function: 7ad9acc

This also help clean up the string type for multiaddr as ConnectionManager.dialPeer() is now compliant with the MultiaddrInput type

@danisharora099 danisharora099 requested a review from weboko January 15, 2025 10:37
return peer;
} else {
// peer is of MultiaddrInput type
const ma = multiaddr(peer);
Copy link
Collaborator

Choose a reason for hiding this comment

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

q: can multiaddr throw?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, the class implementation can throw in several cases, mostly parsing of the multiaddr passed to it; why do you ask?

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.

feat: API allows usage of specific nodes for protocols
2 participants