-
Couldn't load subscription status.
- Fork 290
RaptorCast: Modular packet assembly #2377
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a modular packet assembly system for RaptorCast, introducing structured chunk assignment and UDP message serialization. The implementation adds support for different broadcast types (broadcast, stake-based, and unicast) with configurable redundancy and packet layouts.
Key changes:
- Introduces a modular chunk assignment system with three assigner types
- Implements packet layout management with merkle tree support and cryptographic signatures
- Adds UDP message serialization with grouping by destination and priority
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| monad-raptorcast/src/packet/assigner.rs | Implements chunk assignment strategies for broadcast, stake-based, and unicast distribution |
| monad-raptorcast/src/packet.rs | Core packet assembly logic with cryptographic signing, merkle tree generation, and UDP serialization |
| monad-raptorcast/src/lib.rs | Adds packet module to library exports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
72d6cb8 to
797534c
Compare
43922a1 to
eab84f5
Compare
eab84f5 to
38da74e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
04142a1 to
df65d60
Compare
5f86e57 to
4d8d0af
Compare
Implemented! The last Note that the streaming mode is only validly defined for certain "serialization modes". For example, the round-robin mode would be unavailable for the streaming because it would be impossible to implement round-robin on small batches. |
thats unfortunate, i had a hunch that it should be possible by caching signature and outputting first chunk early, but i might be completely wrong. i am also reviewing a change in general, will approve later in a day |
4d8d0af to
f3f2ae6
Compare
f3f2ae6 to
b37ec60
Compare
| priority: Option<u8>, | ||
| } | ||
|
|
||
| let mut messages: HashMap<GroupKey, BytesMut> = HashMap::new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original implementation was deterministic or it was using hash map as well like this? what it was using for order if it was deterministic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
original implementation was deterministic because it relies on the chunks assigned to be in a specific order so that each recipients' chunks are always adjacent. the new framework allows more versatile chunk assignment algorithms by lifting this restraint. therefore the order of recipients outputted from the round-robin serializer would not be the same as the original order. but the round-robin property is inaffected, and for each recipient, their received packets are still in the correct order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just wanted to be sure that we don't break some implicit order assumption, that wasn't well documented.
like for example ordering them by stake-weight
| } | ||
|
|
||
| // Each recipient get their own queue of chunks. | ||
| let mut queues: Vec<VecDeque<Chunk<PT>>> = buckets.into_values().collect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it converts to vec from hashmap for order? would it make a difference if it was stored in btree and then iteration below is on btree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I used vec mainly for the ability of going through it over repeatedly while deleting recipients with empty queues. retain_mut is perfect for this purpose. it should be able to do the same on btreemap with its retain method. however, i expect using btreemap to allocating more than hashmap/vec approach due to its lack of with_capacity constructor, also i expect hashmap/vec to perform better generally due to cache efficiency. that said, those are my speculations and i can benchmark both versions.
9e7916b to
b9bca99
Compare
4dfd671 to
a242d42
Compare
a242d42 to
a08b279
Compare
Design doc: https://www.notion.so/Modular-packet-assembly-28075b0ba8408067b8f9ecf9092d56d4
Benchmark result:
Full Benchmark Logs
How it's tested:
udp::build_messagefunction, which itself is extensively tested inudp.rs