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 9 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.77 KB (+0.17% 🔺) 1.8 s (+0.17% 🔺) 692 ms (+20.65% 🔺) 2.5 s
Waku Simple Light Node 137.06 KB (+0.18% 🔺) 2.8 s (+0.18% 🔺) 881 ms (+5.52% 🔺) 3.7 s
ECIES encryption 22.88 KB (0%) 458 ms (0%) 355 ms (+223.86% 🔺) 812 ms
Symmetric encryption 22.37 KB (0%) 448 ms (0%) 309 ms (-24.85% 🔽) 756 ms
DNS discovery 70.54 KB (0%) 1.5 s (0%) 516 ms (-6.21% 🔽) 2 s
Peer Exchange discovery 71.82 KB (0%) 1.5 s (0%) 380 ms (-38.89% 🔽) 1.9 s
Local Peer Cache Discovery 65.17 KB (0%) 1.4 s (0%) 529 ms (-14.54% 🔽) 1.9 s
Privacy preserving protocols 76.23 KB (+0.09% 🔺) 1.6 s (+0.09% 🔺) 757 ms (+5.68% 🔺) 2.3 s
Waku Filter 81.02 KB (+0.05% 🔺) 1.7 s (+0.05% 🔺) 479 ms (-15.42% 🔽) 2.1 s
Waku LightPush 75.73 KB (+0.02% 🔺) 1.6 s (+0.02% 🔺) 547 ms (-35.36% 🔽) 2.1 s
History retrieval protocols 77.71 KB (+0.11% 🔺) 1.6 s (+0.11% 🔺) 615 ms (+5.92% 🔺) 2.2 s
Deterministic Message Hashing 7.39 KB (0%) 148 ms (0%) 112 ms (-3.98% 🔽) 260 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
@@ -11,6 +13,7 @@ import {
IPeersByDiscoveryEvents,
IRelay,
KeepAliveOptions,
MultiaddrStr,
Copy link
Collaborator

Choose a reason for hiding this comment

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

there should be a type for it in multiaddr package

@@ -28,6 +28,10 @@ export type IBaseProtocolSDK = {
readonly numPeersToUse: number;
};

type StoreProtocolOptions = {
peer: string;
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 make it peers in the following PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We only use one peer for Store, unlike LightPush and Filter. When use getPeers() within Store, we still only use the 0th index from the array of peers returned.
peers: string[] would be applicable to LightPush and Filter

});
}

const store = wakuStore(this.connectionManager, peerIdStr);
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is wrong, peerIdStr does nothing here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It is used to initialise Store with the protocol to use since we need to get the peer when we send a store request. Changed the peerIdStrToUse to options: Partial<StoreProtocolOptions>

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