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(filter)!: new simpler filter API #2092

Merged
merged 7 commits into from
Aug 5, 2024

Conversation

danisharora099
Copy link
Collaborator

Problem

Based on the Reliability Epic, we want:

As a developer, I want a simple API to register hooks to process messages on one or several content topics

This also ties in with #2022, where Filter API is hard-to-understand, and involves multiple steps:

const { error, subscription } = await node.filter.createSubscription(shardInfoOrPubsubTopic);
const results = await subscription.subscribe([decoder], callback);

Solution

Based on the fact that decoder has information about the pubsubTopic as well as contentTopic, we can use decoders to fetch information about both the topics, and API can be condenses into:

const { error, subscription, results } = await node.filter.subscribe([decoder], callback);

Notes

Contribution checklist:

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

Copy link

github-actions bot commented Jul 31, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 119.36 KB (+0.14% 🔺) 2.4 s (+0.14% 🔺) 20.1 s (-26.1% 🔽) 22.5 s
Waku Simple Light Node 184.21 KB (+0.03% 🔺) 3.7 s (+0.03% 🔺) 17.8 s (-13.67% 🔽) 21.5 s
ECIES encryption 23.16 KB (+0.07% 🔺) 464 ms (+0.07% 🔺) 4.8 s (+43.03% 🔺) 5.3 s
Symmetric encryption 22.61 KB (+0.06% 🔺) 453 ms (+0.06% 🔺) 5.9 s (+74.14% 🔺) 6.3 s
DNS discovery 72.6 KB (+0.12% 🔺) 1.5 s (+0.12% 🔺) 12.1 s (-20.92% 🔽) 13.5 s
Peer Exchange discovery 74.49 KB (-0.04% 🔽) 1.5 s (-0.04% 🔽) 7.7 s (-61.83% 🔽) 9.2 s
Local Peer Cache Discovery 67.8 KB (+0.05% 🔺) 1.4 s (+0.05% 🔺) 9.9 s (-17.37% 🔽) 11.3 s
Privacy preserving protocols 38.91 KB (+0.1% 🔺) 779 ms (+0.1% 🔺) 7.1 s (-1.5% 🔽) 7.9 s
Waku Filter 113.78 KB (-0.01% 🔽) 2.3 s (-0.01% 🔽) 17 s (+25.39% 🔺) 19.3 s
Waku LightPush 111.66 KB (+0.01% 🔺) 2.3 s (+0.01% 🔺) 12.7 s (-37.55% 🔽) 15 s
History retrieval protocols 112.08 KB (-0.15% 🔽) 2.3 s (-0.15% 🔽) 19.1 s (+15.25% 🔺) 21.3 s
Deterministic Message Hashing 7.35 KB (+0.38% 🔺) 147 ms (+0.38% 🔺) 2.6 s (+13.42% 🔺) 2.7 s

@danisharora099 danisharora099 merged commit fdd9dc4 into master Aug 5, 2024
11 checks passed
@danisharora099 danisharora099 deleted the feat/filter-api-refactor branch August 5, 2024 10:23
@weboko weboko mentioned this pull request Aug 6, 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: remove filter.subscribe() dependency on IReceiver
2 participants