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

PIBD segment p2p messages #3496

Merged
merged 7 commits into from
Nov 25, 2020
Merged

Conversation

jaspervdm
Copy link
Contributor

@jaspervdm jaspervdm commented Nov 22, 2020

This PR introduces the new p2p messages as defined in this RFC. Only merge after #3482 and #3492.
Until then we use a placeholder Segmenter that just panics on usage.

  • Enforce segment height limits
  • Rebase once 3482 is merged
  • Switch to BitmapSegment in place of Segment<BitmapChunk> in OutputBitmapSegment responses

@jaspervdm jaspervdm added this to the 5.0.0 milestone Nov 23, 2020
@antiochp
Copy link
Member

#3482 is now merged.

@antiochp
Copy link
Member

👀

Comment on lines +374 to +378
Message::OutputBitmapSegment(_)
| Message::OutputSegment(_)
| Message::RangeProofSegment(_)
| Message::KernelSegment(_) => Consumed::None,

Copy link
Member

Choose a reason for hiding this comment

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

This is just a /dev/null placeholder for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, nodes receiving segments just ignore them.

hash: Hash,
id: SegmentIdentifier,
) -> Result<Segment<TxKernel>, chain::Error> {
if id.height < 9 || id.height > 13 {
Copy link
Member

Choose a reason for hiding this comment

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

We should pull these min and max heights out into const so its easier to see them all together.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@antiochp antiochp left a comment

Choose a reason for hiding this comment

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

Looks good. 👍
Minor comment about the min/max values.

@@ -46,6 +46,12 @@ use crate::util::OneTime;
use chrono::prelude::*;
use chrono::Duration;
use rand::prelude::*;
use std::ops::Range;

const KERNEL_SEGMENT_HEIGHT_RANGE: Range<u8> = 9..14;
Copy link
Member

Choose a reason for hiding this comment

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

Nice. Didn't think of using ranges here. 👍

@jaspervdm jaspervdm merged commit 96afc76 into mimblewimble:master Nov 25, 2020
@jaspervdm jaspervdm deleted the segment_messages branch November 26, 2020 17:58
@antiochp antiochp mentioned this pull request Nov 26, 2020
bayk added a commit to mwcproject/mwc-node that referenced this pull request Jun 11, 2024
* Define PIBD segment p2p messages

* Respond to segment requests

* Use specialized (de)ser for output bitmap segments

* Allowed segment height ranges in const
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