Skip to content

feat(filter): reliability monitor as a separate class to handle reliability logic #2127

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

Closed
wants to merge 8 commits into from

Conversation

danisharora099
Copy link
Collaborator

@danisharora099 danisharora099 commented Sep 10, 2024

Problem

Based on #2075, the logic to detect messages that were missed from the Filter protocol were being detected inside of the Filter SDK implementation. This leads to a tight couple of primary objective of FilterSDK, and reliability goals.

This obstacle also extends to adding further actions that might be taken with additional protocols such as Store pings, and LightPush retries for certain messages.

Solution

Decouple reliability logic into a new ReliabilityMonitor class.

Notes

Contribution checklist:

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

Copy link

github-actions bot commented Sep 10, 2024

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 83.06 KB (+0.11% 🔺) 1.7 s (+0.11% 🔺) 16.9 s (+38.03% 🔺) 18.6 s
Waku Simple Light Node 134.88 KB (+0.03% 🔺) 2.7 s (+0.03% 🔺) 19.4 s (+24.13% 🔺) 22.1 s
ECIES encryption 22.94 KB (0%) 459 ms (0%) 4.7 s (+20.57% 🔺) 5.1 s
Symmetric encryption 22.39 KB (0%) 448 ms (0%) 5.5 s (+15.58% 🔺) 6 s
DNS discovery 72.28 KB (0%) 1.5 s (0%) 10.1 s (+27.97% 🔺) 11.6 s
Peer Exchange discovery 73.79 KB (0%) 1.5 s (0%) 10.9 s (+6.56% 🔺) 12.4 s
Local Peer Cache Discovery 67.63 KB (0%) 1.4 s (0%) 13 s (+53.1% 🔺) 14.4 s
Privacy preserving protocols 74.74 KB (-0.09% 🔽) 1.5 s (-0.09% 🔽) 14.8 s (-13.47% 🔽) 16.3 s
Waku Filter 78.27 KB (+0.27% 🔺) 1.6 s (+0.27% 🔺) 12.3 s (-11.94% 🔽) 13.9 s
Waku LightPush 75.53 KB (-0.08% 🔽) 1.6 s (-0.08% 🔽) 10.8 s (-24.09% 🔽) 12.3 s
History retrieval protocols 75.89 KB (-0.1% 🔽) 1.6 s (-0.1% 🔽) 14 s (+26.33% 🔺) 15.5 s
Deterministic Message Hashing 7.38 KB (0%) 148 ms (0%) 1.6 s (+14.87% 🔺) 1.7 s

@danisharora099 danisharora099 changed the title temp feat(filter): reliability monitor as a separate class to handle reliability logic Sep 10, 2024
@danisharora099 danisharora099 marked this pull request as ready for review September 10, 2024 13:14
@danisharora099 danisharora099 requested a review from a team September 10, 2024 17:26
toAsyncIterator
} from "@waku/utils";

import { BaseProtocolSDK } from "../base_protocol";
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't forget to add .js otherwise it will break

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right! Probably should add some eslint check for this 😅
Thanks for the catch :P

@@ -115,6 +116,7 @@ export class WakuNode implements Waku {
if (protocolsEnabled.filter) {
const filter = wakuFilter(this.connectionManager);
this.filter = filter(libp2p);
new MessageReliabilityManager(this.filter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should keep a reference to it somewhere
let's do the same as with protocols

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, absolutely - that's correct to point out. However, if we store it in a variable, as we currently don't use the variable, typescript complains

public readonly protocol: FilterCore;
private readonly _connectionManager: ConnectionManager;

public activeSubscriptions = new Map<PubsubTopic, SubscriptionManager>();
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to make it public only because of the monitor?

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, indeed!
this is why I suggest to follow up with masking a lot of these things behind one public/consumer facing interface

@danisharora099
Copy link
Collaborator Author

Moving to draft in favor of #2117 instead

@danisharora099 danisharora099 marked this pull request as draft September 12, 2024 06:43
@danisharora099
Copy link
Collaborator Author

closing in favor of #2117

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: message verification and retry
2 participants