fix: correct decapsulate for repeated protocols and substring collisions - #124
fix: correct decapsulate for repeated protocols and substring collisions#124sumanjeet0012 wants to merge 1 commit into
Conversation
d6d2f2c to
84e2179
Compare
|
Thanks @sumanjeet0012 Full review here: AI PR Review: #124 — fix: correct decapsulate for repeated protocols and substring collisionsPR: #124 1. Summary of Changes
The PR replaces string-based suffix detection with component-by-component comparison via 2. Branch Sync Status and Merge ConflictsSync vs Merge test: Note: Rebasing or merging 3. Strengths
4. Issues FoundCriticalNone identified for the scenarios covered by #109 and the existing test suite. MajorMinor5. Security Review
6. Documentation and Examples
7. Newsfragment Requirement
8. Tests and Validation
Tests cover success paths and one failure path ( 9. Recommendations for Improvement
10. Questions for the Author
11. Overall Assessment
Recommendation: Approve direction after renaming the newsfragment and addressing empty-subaddress behavior (small follow-up). No maintainer comments on the PR yet; none required for this review pass. |
Fixes #109
Description
This pull request fixes a bug where
Multiaddr.decapsulate()produced incorrect results when the same protocol appears multiple times in the address, or when the decapsulation target is a substring of a protocol value. The implementation has been updated to compare addresses component-by-component usingbytes_iter()instead of performing a raw string search.Changes
Multiaddr.decapsulateinmultiaddr/multiaddr.pyto match components iteratively instead of usingstr.rindex().tests/test_multiaddr.pycontaining edge cases for:newsfragments/109.bugfix.