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(sds): add message channel with buffers and send/receive logic #2261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

adklempner
Copy link
Member

@adklempner adklempner commented Feb 11, 2025

This commit creates the class for an SDS message channel, including
buffers for outgoing and incoming messages. Adds logic for sending
messages, receiving messages, delivering messages, and reviewing
acknowledgement status of messages. Also adds byte serialization
for bloom filters.

Problem / Description

We need to implement the library for SDS in browser based on the specification.

Solution

This commit implements and adds unit tests for everything in the specification up to and including Review ACK Status: https://rfc.vac.dev/vac/raw/sds/#review-ack-status

Notes


Checklist

  • Code changes are covered by unit tests.
  • Code changes are covered by e2e tests, if applicable.
  • Dogfooding has been performed, if feasible.
  • A test version has been published, if required.
  • All CI checks pass successfully.

@adklempner adklempner force-pushed the feat/sds-participant-state branch from 1752c2c to e78c0a8 Compare February 11, 2025 21:27
Copy link

github-actions bot commented Feb 11, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 84.84 KB (+0.14% 🔺) 1.7 s (+0.14% 🔺) 1.9 s (-30.44% 🔽) 3.6 s
Waku Simple Light Node 135.96 KB (+0.2% 🔺) 2.8 s (+0.2% 🔺) 2.9 s (-0.95% 🔽) 5.6 s
ECIES encryption 22.96 KB (+0.67% 🔺) 460 ms (+0.67% 🔺) 682 ms (+13.73% 🔺) 1.2 s
Symmetric encryption 22.34 KB (+0.51% 🔺) 447 ms (+0.51% 🔺) 686 ms (-39.41% 🔽) 1.2 s
DNS discovery 70.93 KB (+0.17% 🔺) 1.5 s (+0.17% 🔺) 1.5 s (+7.72% 🔺) 2.9 s
Peer Exchange discovery 71.95 KB (+0.34% 🔺) 1.5 s (+0.34% 🔺) 1.7 s (-12.8% 🔽) 3.2 s
Local Peer Cache Discovery 65.51 KB (+0.18% 🔺) 1.4 s (+0.18% 🔺) 1.5 s (-6.31% 🔽) 2.8 s
Privacy preserving protocols 76.71 KB (+0.24% 🔺) 1.6 s (+0.24% 🔺) 2.2 s (+170.95% 🔺) 3.8 s
Waku Filter 78.27 KB (+0.24% 🔺) 1.6 s (+0.24% 🔺) 1.9 s (+39.75% 🔺) 3.5 s
Waku LightPush 75.52 KB (+0.29% 🔺) 1.6 s (+0.29% 🔺) 1.7 s (+44.86% 🔺) 3.2 s
History retrieval protocols 75.9 KB (+0.24% 🔺) 1.6 s (+0.24% 🔺) 2.2 s (+171.37% 🔺) 3.7 s
Deterministic Message Hashing 7.33 KB (0%) 147 ms (0%) 651 ms (+295.74% 🔺) 797 ms

@adklempner adklempner force-pushed the feat/sds-participant-state branch 2 times, most recently from ba4aa1e to 935e2d1 Compare February 13, 2025 22:15
@adklempner adklempner changed the title feat(sds): add message buffers and send/receive logic feat(sds): add message channel with buffers and send/receive logic Feb 13, 2025
This commit creates the class for an SDS message channel, including
buffers for outgoing and incoming messages. Adds logic for sending
messages, receiving messages, delivering messages, and reviewing
acknowledgement status of messages. Also adds byte serialization
for bloom filters.
@adklempner adklempner force-pushed the feat/sds-participant-state branch from 935e2d1 to 5f6ca97 Compare February 13, 2025 22:19
@adklempner adklempner marked this pull request as ready for review February 13, 2025 22:24
@adklempner adklempner requested a review from a team as a code owner February 13, 2025 22:24
@adklempner adklempner requested a review from shash256 February 13, 2025 22:35
}

// TODO: this should be determined based on the bloom filter parameters and number of hashes
private getAcknowledgementCount(): number {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: private should be after public


const DEFAULT_CAUSAL_HISTORY_SIZE = 2;

export class MessageChannel {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this class intended to be used by consumers? if so, can you generate js doc comments for public methods?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's likely there will be a ParticipantState class that holds one or more of these, but either way I will add some docs to the public methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants