chore: constrain ticket quality in mpool - #7361
Conversation
WalkthroughMessage pool ticket-quality inputs are sanitized before probability and message-selection decisions. Approximate floating-point comparison now handles NaN safely. Tests cover extreme, out-of-range, and non-finite values. ChangesMessage pool numeric safety
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/message_pool/msg_chain.rs (1)
609-614: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winGuard the tolerance check for non-finite operands.
approx_cmp(f64::INFINITY, 1.0)returnsEqualhere because the epsilon check runs beforetotal_cmp, so±∞can compare equal to finite values and break antisymmetry in chain ordering. Require both operands to be finite before applying the tolerance check, and extend the regression test to assert the ordering for(+∞, 1.0),(1.0, +∞), and(+∞, -∞).🤖 Prompt for 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. In `@src/message_pool/msg_chain.rs` around lines 609 - 614, Update approx_cmp so the epsilon-based equality check runs only when both operands are finite; otherwise use total_cmp to preserve correct ordering for infinities. Extend the regression test to assert ordering for (+∞, 1.0), (1.0, +∞), and (+∞, -∞).
🤖 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.
Outside diff comments:
In `@src/message_pool/msg_chain.rs`:
- Around line 609-614: Update approx_cmp so the epsilon-based equality check
runs only when both operands are finite; otherwise use total_cmp to preserve
correct ordering for infinities. Extend the regression test to assert ordering
for (+∞, 1.0), (1.0, +∞), and (+∞, -∞).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e2e0c1e7-b1b0-44c6-ae45-518e7cc6fccc
📒 Files selected for processing (3)
src/message_pool/block_prob.rssrc/message_pool/msg_chain.rssrc/message_pool/msgpool/selection.rs
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
filecoin-project/lotus(manual)
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 11 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes
Other information and links
Change checklist
Outside contributions
Summary by CodeRabbit
Bug Fixes
Tests