primitives%feat(types): add new RFC predicates and use in is_reachable(), sync is_routable() with consensus definition#17
Conversation
|
Warning Review limit reached
Next review available in: 46 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a From<[u8; 4]> conversion for AddrV1 to build IPv4-mapped addresses, reworks NetAddr's is_routable() exclusion logic and RFC classification helpers, introduces a new is_reachable() method, overhauls related tests, and fixes hex-prefix handling in a solver sample script. ChangesNetAddr Classification Rework
Solver Sample Hex Parsing Fix
Sequence Diagram(s)Not applicable — changes are classification logic and a script fix, without multi-component interaction flows. Compact Metadata: 3 files changed across a Rust primitives package and a JS sample script; no exported entity signatures removed. Related Issues: None specified. Related PRs: None specified. Suggested Labels: rust, primitives, networking, tests, javascript Suggested Reviewers: None specified. Poem: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Warning This pull request may have conflicts, please coordinate with the authors of these pull requests. Potential conflicts |
{Array,Encode}Buf to limit avoidable heap allocs, add PoW check, add RFCs, is_reachable(), sync is_routable()is_reachable(), sync is_routable() with consensus definition
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkgs/primitives/src/types/netaddr.rs`:
- Around line 469-499: `is_reachable` currently treats Tor/I2P/CJDNS as
reachable because it falls through for non-IPv4/IPv6 addresses, which conflicts
with the public-internet contract. Update `NetAddr::is_reachable` to explicitly
exclude privacy/overlay networks (or, if that behavior is intended, adjust the
rustdoc and tests accordingly) so `is_routable` does not imply public
reachability for those address types.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 173a9c7b-43b1-426e-b2f4-f9cdd3252ad9
📒 Files selected for processing (3)
contrib/samples/solver/index.jspkgs/primitives/src/types/addrv1.rspkgs/primitives/src/types/netaddr.rs
Additional Information
Depends on sdk%lint: add git filter helper script, introduce new semgrep rules, port secret-holding
Debugrestriction, unknown value preservation rule from CodeQL #15Dependency for sdk%feat(test): introduce
bsdk-utilwithbspcheckverb to validate againstblockchain.datlinearized chains #13A bug in base-sdk#10 that prevents the solver demo from working correctly with default-populated values due to missing stripping of the
0xprefix has been addressed.is_routable()had two divergences from Dash Core'sCNetAddr::IsRoutable()(source).Both deviations have been corrected.
is_reachable()has been introduced for non-consensus paths as a superset ofis_routable()as a stricter filter that additionally excludes multicast, reserved, IPv4-mapped/translated IPv6, and other translation and discard ranges.This function is not consensus-stable and may evolve with changing internet standards.
Test helpers have been migrated from mock
NetAddradapters to realAddrV1instances constructed viaFromStr.Breaking Changes
None expected.
How Has This Been Tested?
Checklist