Repository navigation
primitives%fix: read a BIP155 IPv6 address in fc00::/8 as IPv6 - #110
Conversation
Network 2 starting with 0xfc was read as CJDNS and written back as network 6. It now stays IPv6 when read, in the check and from text, and in one group still duplicates a CJDNS address with its bytes.
|
No actionable comments were generated in the recent review.
|
|
Note This pull request has no conflicts! 🎊 🎉 🎊 |
|
✅ Final review complete — no blockers (commit f984c73) · triage: low |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Verified the complete diff at head 310c7d4 against the cited Dash Core revisions and surrounding address consumers. The network-preservation fix and distinct within-group versus cross-group duplicate rules match the reference implementation; neither supplied in-scope suggestion identifies an actionable issue. Validation was static only, and current PR checks confirm all applicable checks succeeded, with none pending or failing.
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The diff makes a small, well-contained correction to address classification and duplicate comparison with focused regression tests, rather than a large or intricate change despite touching peer-facing deserialization. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— rust-quality (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 100% left, weekly 56% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- NetInfo checks do not enforce Core's chain-dependent routability requirement — At Dash Core revision 8163290aa0307ed4bc2fc0ba15b78c20d61dfa88, ExtNetInfo::ValidateService in src/evo/netinfo.cpp:448-458 rejects non-routable services when RequireRoutableExternalIP() is enabled. In contrast, pkgs/primitives/src/types/netinfo.rs:261-270 checks address validity and ports without chain context, so its success does not establish mainnet acceptance—for example, an IPv6 fd00::1 service passes these SDK checks but fails Core's routability requirement. This is a concrete, pre-existing validation limitation, not a defect introduced by preserving BIP155 network identity.
- Follow-up: Track a separate clarification or chain-aware validation API, with mainnet-versus-regtest reference vectors, so callers can distinguish context-free checks from full provider-service acceptance.
Text in fc00::/8 reads as CJDNS, as before, while the wire read keeps network 2 as IPv6. The serde form keeps either network.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Independently reviewed the complete diff at f984c73 and found no actionable in-scope defects: network preservation, tagged serde representations, and within-group versus across-group duplicate handling match the relevant Dash Core semantics. Verification was static only; no builds or tests were run locally. Current CI reports successful lint, stable-platform builds, and applicable MSRV checks, with the x86_64 Windows cross-build still pending and no failed checks.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.1-sol(effort low) — The change is a small, contained correction to address decoding and validation with focused regression tests, not a large or intricate change despite touching peer-facing deserialization. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— rust-quality (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 99% left, weekly 99% left; passed overgemini-3.8-flash-high(antigravity quota lookup failed) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- AddrV2::decode does not reclassify INTERNAL/TORV2/IPV4-in-IPv6 network-2 addresses as Core does — Verified as a separate, pre-existing decoder-parity difference. Dash Core's netaddress.h:454-481 recognizes the internal prefix and invalidates IPv4/TorV2 embeddings, while both the SDK base and head retain those bytes as IPv6. Those prefixes are outside fc00::/8 and their behavior is unchanged by removing the fc-prefix conversion; NIEntry also retains its existing explicit rejection of these embeddings. Correcting this PR's network-2 fc00 behavior does not require expanding it into a general address-normalization change.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
* [d91c63a] sdk%test: check special-transaction vectors against allowed refusals (pasta) * [f0c656d] primitives%fix!: refuse special-use addresses in network info (pasta) Description: ````` ## Motivation The reference implementation refuses a network info service whose address is in a special-use range, local addresses among them, except on regtest. The network info checks accepted such addresses. They now refuse them with `NIError::SpecialUse` on every network, as asked in #110 (comment). The regtest allowance aids debugging in the reference implementation and is not mirrored here. ## Additional Information | Description | Notes | Reference implementation | | ----------- | ----- | ------------------------ | | Refuse special-use addresses | A service is refused for an IPv4 address in 0/8, 127/8 or the RFC 1918, 2544, 3927, 5737 or 6598 ranges, or an IPv6 address that is ::1 or in the RFC 4193, 4843, 4862 or 7343 ranges. This covers the legacy and the extended network info, using the existing `NetAddr` classification. Tor, I2P, CJDNS and domain entries are unaffected. | [legacy service](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/evo/netinfo.cpp#L294-L295), [extended service](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/evo/netinfo.cpp#L456-L457), [special-use ranges](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/netaddress.cpp#L464-L471), [local addresses](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/netaddress.cpp#L400-L411) | | On every network | The reference implementation accepts these addresses on regtest alone. The check takes no network and refuses them on all of them. | [regtest allowance](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/chainparams.cpp#L899) | | Order of the checks | The range is checked before the service port rules, so a special-use service with a refused port now fails for its range, as in the reference implementation. A zero port is still refused before the range, as it was before this change: both orders refuse the same inputs, and only the reported error differs. | [extended service](https://github.com/dashpay/dash/blob/8163290aa0307ed4bc2fc0ba15b78c20d61dfa88/src/evo/netinfo.cpp#L449-L473) | | IPv6 in fc00::/8 | Since #110 a BIP155 IPv6 address in fc00::/8 reads as IPv6. It is in the RFC 4193 range, so it is now refused. A CJDNS address with the same bytes is unaffected. | | | Regtest vectors are allowed refusals | The ProRegTx and ProUpServTx vectors from regtest carry services on local addresses, so their tests allow the check to refuse them with `SpecialUse` (`check_sptx_except` in `dash-dev`, which takes the allowed errors). Tests that read a payload's fields or verify its signature decode it without the check (`decode_sptx`). The fixture that the rule tests edit moves its service to a public address first, so each edit stays the only failure. | | | Breaking | `NIError` gains `SpecialUse`. | | 🤖 Generated with [Claude Code](https://claude.com/claude-code) `````
Takes dashpay#100 dashpay#88 dashpay#108 dashpay#107 dashpay#111 dashpay#110 dashpay#112 dashpay#115 dashpay#114 dashpay#101. ChainSetup keeps the DEC-1043 policy fields; the BS11 BLS wrappers, i64 TxOut values and MAX_SER_SIZE payload bound stay for Core parity.
Motivation
AddrV2::decoderead a BIP155 address of network 2 (IPv6) whose first byte is0xfcasAddrV2::Cjdns, so it was written back with network 6, as different bytes. The reference implementation keeps such an address IPv6. Only network 6 is CJDNS. A net info entry in a provider transaction, read in the same format, keeps it IPv6 too.Additional Information
AddrV2::decodegivesIpv6for network 2, so an address is written back with the network it was read with. ACjdnsaddress is read from network 6 only.AddrV2::checkno longer refuses anIpv6address in fc00::/8. ACjdnsaddress still needs the0xfcprefix."[fc00::1]"still parses asCjdns. AnIpv6address in fc00::/8 displays as the same text, so it does not read back from its text. The serde form tags the network, so JSON and CBOR keep either address as it was.Ipv6and aCjdnsaddress with the same bytes count as one address, as their text is the same. Before this change both were read asCjdns, so the group was already refused. Across groups, entries are compared with their network, so the two are not a duplicate there.The new net info vector comes from the reference implementation at v24.0.0-rc.4 (0e7382df80), the revision the corpus names, with the corpus's own program for that section. The program reproduces the other 27 vectors of the section unchanged.
Breaking Changes
No API change. For an address in fc00::/8 read with network 2,
decodenow givesIpv6where it gaveCjdns, andcheckaccepts it. Text in fc00::/8 still parses asCjdns. A net info group holding it and aCjdnsaddress with the same bytes is still refused as a duplicate. In two groups, on the same port, the two are no longer a duplicate, as in the reference implementation.How Has This Been Tested?
Ipv6andCjdnsfor an address in fc00::/8, a net info entry, a net info and a whole provider registration payload, which then writes network 2 or 6 respectively.cargo test -p dash-primitives -p dash-p2p-core --all-featurespasses, andcargo clippy --workspace --all-features --all-targetsis clean with-D warnings.just test lint fuzz::test, CodeQL included) is green.Checklist
comments and concerns without said assistance. I assume authorship of the code submitted.
Agent disclosure
Code, commit messages and this description were generated with Claude Code using Claude Opus 5.5, running autonomously as an agent on behalf of the author. The change was reviewed by a Claude Code agent using Opus 5.5.
🤖 Generated with Claude Code