keep-frost-net: split KfpMessage::validate into per-variant validators#824
Conversation
|
Warning Review limit reached
Next review available in: 58 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: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
KfpMessage::validatewas a 552-linematchcarrying the wire-validation checks (size caps, index bounds, charset/prefix checks, derivation-path rules, xpub parsing, etc.) for every message variant inline. This splits each variant's checks into its own validator.Changes
validate_<variant>(p: &<Variant>Payload) -> Result<(), &'static str>(28 of them).validate(552 → 33 lines) is now a dispatchmatchreturning each validator's result, with_ => Ok(())for the variants that carry no checks (SignatureComplete,DuressBeacon,Ping,Pong).Every resulting function is under 100 lines (largest:
validate_psbt_proposeat 80).Behavior
Pure code motion. Every check, threshold constant, error string, and helper call (
decode_pcr_values,is_valid_fingerprint,Xpub::parse, the nonce-ref/sentinel logic, etc.) is unchanged. The_ => Ok(())catch-all preserves the original_ => {}+ trailingOk(())behavior for the four variants that were already validation-free;RefreshRound1andRefreshRound2, which DO carry checks, are dispatched explicitly (not folded into the catch-all).Verification
cargo clippy -p keep-frost-net --all-targets: clean.--features testing --test multinode_test): 40 passed.