num%fix!: match reference implementation in overloading, parsing, rounding and block proof checks, partially delegate Arith256 to bitcoin-internals - #54
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (13)
💤 Files with no reviewable changes (4)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe ChangesNumeric primitives
Priority: ⬇️ Low Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to This change moves Arith256 onto the shared U256 type and adds lossy hex parsing and block-proof APIs, with tests for each. No concrete defect has been identified. Before merging, confirm that the author's clippy and test command passes, because it covers the upstream formatting and hex-reader behavior. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The examined validation checks remain intact, and permissive parsing is introduced as an explicit opt-in API rather than replacing strict parsing. No introduced security failure was demonstrated. External callers and the full path from network input to validation remain insufficiently established. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 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 |
|
Note This pull request has no conflicts! 🎊 🎉 🎊 |
`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
`git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space`
|
@coderabbitai review |
✅ Action performedReview finished.
|
Additional Information
Courtesy of rust-bitcoin#6715,
bitcoin-internals0.7 has madeU256reachable when historically it was not in public scope (source). This historic reason was why thedash-numcrate came into existence instead of benefiting from upstream types.But now that is no longer a blocker, we can effectively prune the majority of our
Arith256implementation by simply delegating torust-bitcoin's implementation, pruning code ownership and the test suite to only sections where we deviate fromrust-bitcoindue to ourno_stdand panic-free mandates.As
Arith256aims to match Dash Core in behaviour where feasible, downstream consumer preparation identified deviations that have since been remedied.To pin the expected behaviour, a new corpus has been introduced,
arith256.json5, with C++ test programs used to generate the vectors using Dash Corev24.0.0-rc.1and vectors that failed before the fixes were applied were retained in the corpus to avoid bloating the corpus with trivially passing vectors (i.e. the corpus is a subset of the generated values).Division where the divisor is zero returns zero instead of panicking. To detect a zero-divisor instead of silently returning zero, use
checked_div().Breaking Changes
See changelog.
How Has This Been Tested?
Checklist