Skip to content

chore: add check for dscore < dhi and bootstrap params#643

Merged
MarcoPolo merged 1 commit intolibp2p:masterfrom
dozyio:fix/d0-out-of-bounds-fix
Sep 15, 2025
Merged

chore: add check for dscore < dhi and bootstrap params#643
MarcoPolo merged 1 commit intolibp2p:masterfrom
dozyio:fix/d0-out-of-bounds-fix

Conversation

@dozyio
Copy link
Copy Markdown
Contributor

@dozyio dozyio commented Sep 7, 2025

Was getting an out-of-bounds panic when running as a bootstrapper (D=D_lo=D_hi=D_out=0) https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md#recommendations-for-network-operators.

Also added an early return to the new gossipsub validation to bootstrapper case.

@dozyio dozyio marked this pull request as ready for review September 7, 2025 16:33
@MarcoPolo
Copy link
Copy Markdown
Contributor

thanks!

@MarcoPolo
Copy link
Copy Markdown
Contributor

Thinking about this more, it's actually an error to set Dscore > Dhi. Dhi is our high watermark for peers in the mesh, and Dscore specifies how many high scoring peers are kept. By setting Dscore > Dhi you try to place keep more peers in your mesh than your hi watermark.

You probably want to set Dscore to 0 for the bootstrapper case.

Do you mind changing the validation to error if Dscore > Dhi?

@dozyio dozyio changed the title fix: out-of-bounds when Dhi is 0 chore: add check for dscore < dhi and bootstrap params Sep 13, 2025
@dozyio
Copy link
Copy Markdown
Contributor Author

dozyio commented Sep 13, 2025

Thanks Marco - yeah that makes sense. Removed the fix, added a few bits the validation.

and adjust validation for bootstrapper case
@MarcoPolo MarcoPolo force-pushed the fix/d0-out-of-bounds-fix branch from 78887ab to ef33e10 Compare September 15, 2025 17:28
@MarcoPolo MarcoPolo merged commit d3dc2c6 into libp2p:master Sep 15, 2025
7 checks passed
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