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: create default shard info, update tests #2085

Merged
merged 7 commits into from
Jul 25, 2024

Conversation

weboko
Copy link
Collaborator

@weboko weboko commented Jul 24, 2024

Problem

Named sharding is deprecated.
We need to comply

Solution

  • Keep pubsubTopic parameter as a fallback for consumers of the library that do not use The Waku Network or static sharding;
  • Provide DefaultShardInfo as a fallback that is configured for The Waku Network all shards;
  • Remove old DefaultPubsubTopic;

Notes

@weboko weboko requested a review from a team as a code owner July 24, 2024 22:27
@weboko weboko changed the title feat: create feat: create default shard info, update tests Jul 24, 2024
@@ -228,6 +228,7 @@ export function contentTopicsByPubsubTopic(
*/
export function determinePubsubTopic(
contentTopic: string,
// TODO: make it accept ShardInfo
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To follow up: #2086

Copy link

github-actions bot commented Jul 24, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 118.95 KB (+0.14% 🔺) 2.4 s (+0.14% 🔺) 12.5 s (-1.8% 🔽) 14.8 s
Waku Simple Light Node 183.69 KB (-0.17% 🔽) 3.7 s (-0.17% 🔽) 19.6 s (+11.04% 🔺) 23.3 s
ECIES encryption 23.12 KB (0%) 463 ms (0%) 8.1 s (+107.83% 🔺) 8.5 s
Symmetric encryption 22.6 KB (+0.12% 🔺) 452 ms (+0.12% 🔺) 4.2 s (-29.95% 🔽) 4.7 s
DNS discovery 72.49 KB (0%) 1.5 s (0%) 8.7 s (-6.98% 🔽) 10.1 s
Peer Exchange discovery 74.22 KB (0%) 1.5 s (0%) 5.7 s (-41.27% 🔽) 7.2 s
Local Peer Cache Discovery 67.68 KB (0%) 1.4 s (0%) 11.5 s (+36.32% 🔺) 12.9 s
Privacy preserving protocols 38.9 KB (+0.1% 🔺) 778 ms (+0.1% 🔺) 5 s (+21.84% 🔺) 5.8 s
Waku Filter 113.31 KB (0%) 2.3 s (0%) 9.7 s (-24% 🔽) 11.9 s
Waku LightPush 111.31 KB (0%) 2.3 s (0%) 11.2 s (-11.5% 🔽) 13.4 s
History retrieval protocols 111.81 KB (0%) 2.3 s (0%) 15.2 s (+0.78% 🔺) 17.5 s
Deterministic Message Hashing 7.29 KB (0%) 146 ms (0%) 1.8 s (+122.26% 🔺) 2 s

@weboko weboko changed the title feat: create default shard info, update tests feat: create default shard info, update tests Jul 24, 2024
@weboko weboko changed the base branch from master to chore-deprecating-named-sharding July 24, 2024 23:20
Copy link
Collaborator

@danisharora099 danisharora099 left a comment

Choose a reason for hiding this comment

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

LGTM

Approving to unblock - however a few comments I think should be addressed before we merge this

*
* You cannot add or remove pubsub topics after initialization of the node.
*/
pubsubTopics?: PubsubTopic[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd vote to remove this completely as well. We are assuming that developers might still want to use named sharding, but a complete deprecation looks like the right step ahead.

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 was also thinking the same - but I changed my mind when recalled scenarios of some of our consumers that do not use any of our fleets, not to mention TWN.

So we need to continue providing support for pubsubTopics in order to allow them soft transition (or for some not to use our fleets at all).

Comment on lines +141 to +149
if (!options.shardInfo) {
options.shardInfo = DefaultShardInfo;
}

const shardInfo = options.shardInfo
? ensureShardingConfigured(options.shardInfo)
: undefined;

options.pubsubTopics = shardInfo?.pubsubTopics ??
options.pubsubTopics ?? [DefaultPubsubTopic];
options.pubsubTopics = options.pubsubTopics ?? shardInfo?.pubsubTopics;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here in case shardInfo exists, we have redundancy updating shardInfo as well as pubsubTopic with same information. Comment above about complete deprecation of this property looks like the clean direction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good point but I don't think we should get rid of pubsubTopics for internal use because we:

  • have tight coupling to it in our code base;
  • libp2p itself uses it a lot;
  • it's native to gossipSub so anyway we face the need to refer to it one way or another;

packages/tests/tests/wait_for_remote_peer.node.spec.ts Outdated Show resolved Hide resolved
@weboko weboko merged commit 4c74446 into chore-deprecating-named-sharding Jul 25, 2024
10 checks passed
@weboko weboko deleted the weboko/test-pubsub branch July 25, 2024 22:05
weboko added a commit that referenced this pull request Jul 25, 2024
…2083)

* changing default pubsub topic to its static sharding version

* keeping RFC's Waku Message test vectors

* reverting change in changelog

* setting pubsub topic when creating nwaku node

* adding shardInfo to runMultipleNodes call

* adding shardInfo to runMultipleNodes call in lightpush tests

* add pubsub topics to nwaku.start

* get rid of it.only that remained

* fixing compliance tests

* setting clusterId to 0

* removing unnecessary fix

* adding shardInfo when creating nodes

* fixing wait for remote peer tests

* fixing peer exchange test

* refactor

* removing unnecessary variable

* feat: create default shard info, update tests (#2085)

* feat: create default shard info, update tests

* add link

* fix tests

* remoe only

* up tests

* up test

---------

Co-authored-by: Sasha <[email protected]>
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.

2 participants