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!: deprecate named pubsub topics and use static/auto sharding #2097

Merged
merged 8 commits into from
Aug 12, 2024

Conversation

danisharora099
Copy link
Collaborator

@danisharora099 danisharora099 commented Aug 6, 2024

Problem

To configure pubsub topics on a Waku node, there have been three ways:

  • Named pubsub topics: specifying the pubsub topic as a string
  • Static sharding: specifying the cluster ID and shards to use
  • Auto sharding: simply specifying the content topics based on the correct format (and optionally cluster ID), to derive the relevant shards

Based on #1690, we want to deprecate support for named pubsub topics, and only allow configuration using Static Sharding and Auto Sharding.

Solution

  • Remove support for named pubsub topics
  • Only allow Static Sharding or Auto Sharding on the API: NetworkConfig: StaticSharding | AutoSharding
  • Default NetworkConfig to The Waku Network: clusterId: 1, shards: [0,1,2,3,4,5,6,7]

Notes

  • Removes ApplicationInfo as a type, and only relies on ContentTopicInfo and ShardInfo
    • ApplicationInfo should be specified as a string to be used as a param in NetworkConfig
    • ContentTopicInfo and ShardInfo are also represented as AutoSharding and StaticSharding respectively
  • NetworkConfig is only used as a type for consumer-facing API, NetworkConfig is thus translated into relevant pubsub topics, based on the type, and thereafter used as a string[] representing pubsub topics throughout the codebase as planned.
  • Resolves feat: Deprecate Named Sharding and Update Lightpush Client API #1690

Contribution checklist:

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

simplify network config type, all protocols use pubsub topic internally
@danisharora099 danisharora099 changed the title Feat/deprecate named sharding feat!: deprecate named sharding Aug 6, 2024
Copy link

github-actions bot commented Aug 6, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 118.79 KB (-0.12% 🔽) 2.4 s (-0.12% 🔽) 20.6 s (+41.6% 🔺) 22.9 s
Waku Simple Light Node 184.03 KB (+0.07% 🔺) 3.7 s (+0.07% 🔺) 19.6 s (-4.31% 🔽) 23.3 s
ECIES encryption 22.9 KB (0%) 458 ms (0%) 5 s (+9.53% 🔺) 5.5 s
Symmetric encryption 22.35 KB (0%) 448 ms (0%) 5.3 s (+31.38% 🔺) 5.8 s
DNS discovery 72.22 KB (-0.01% 🔽) 1.5 s (-0.01% 🔽) 5.8 s (-16.29% 🔽) 7.2 s
Peer Exchange discovery 73.75 KB (-0.62% 🔽) 1.5 s (-0.62% 🔽) 10.6 s (-13.62% 🔽) 12.1 s
Local Peer Cache Discovery 67.46 KB (0%) 1.4 s (0%) 13 s (+85.1% 🔺) 14.4 s
Privacy preserving protocols 38.62 KB (0%) 773 ms (0%) 6.4 s (-3.54% 🔽) 7.2 s
Waku Filter 113.35 KB (+0.01% 🔺) 2.3 s (+0.01% 🔺) 12.2 s (+44.3% 🔺) 14.5 s
Waku LightPush 110.75 KB (-0.58% 🔽) 2.3 s (-0.58% 🔽) 13.6 s (-1.69% 🔽) 15.8 s
History retrieval protocols 111.34 KB (-0.4% 🔽) 2.3 s (-0.4% 🔽) 15.1 s (+31.38% 🔺) 17.3 s
Deterministic Message Hashing 7.34 KB (0%) 147 ms (0%) 1.8 s (-16.99% 🔽) 1.9 s

@danisharora099 danisharora099 changed the title feat!: deprecate named sharding feat!: deprecate named sharding and use Static/Auto Sharding Aug 10, 2024
@danisharora099 danisharora099 changed the title feat!: deprecate named sharding and use Static/Auto Sharding feat!: deprecate named pubsub topics and use static/auto sharding Aug 10, 2024
@danisharora099 danisharora099 marked this pull request as ready for review August 10, 2024 12:51
@danisharora099 danisharora099 requested a review from a team as a code owner August 10, 2024 12:51
@@ -45,7 +41,9 @@ class Metadata extends BaseProtocol implements IMetadata {
* Make a metadata query to a peer
*/
public async query(peerId: PeerId): Promise<MetadataQueryResult> {
const request = proto_metadata.WakuMetadataRequest.encode(this.shardInfo);
const request = proto_metadata.WakuMetadataRequest.encode(
pubsubTopicsToShardInfo(this.pubsubTopics)
Copy link
Member

Choose a reason for hiding this comment

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

nit: if this.pubsubTopics is not expected to change, then we can probably just create the shard info during construction and store it as another class variable

Copy link
Collaborator Author

@danisharora099 danisharora099 Aug 12, 2024

Choose a reason for hiding this comment

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

i like where you're coming from; however apart from this place, shard info is not passed anywhere else so why introduce another variable? 🤔

@danisharora099 danisharora099 merged commit 5ce36c8 into master Aug 12, 2024
10 of 11 checks passed
@danisharora099 danisharora099 deleted the feat/deprecate-named-sharding branch August 12, 2024 23:53
@weboko weboko mentioned this pull request Aug 13, 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.

feat: Deprecate Named Sharding and Update Lightpush Client API
2 participants