feat: parse anti-abuse bond policy from kind-38385 info event#198
feat: parse anti-abuse bond policy from kind-38385 info event#198AndreaDiazCorreia wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 44 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 (2)
Walkthrough
ChangesAnti-abuse bond parsing
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce750e25bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Requesting changes: the bond parameters are still parsed even when bondPolicy is unsupported or disabled. The spec says the six parameter fields should be non-null only when the policy is enabled, so this can surface contradictory state (bondPolicy = disabled with live bond values). Please gate the parameter parsing on bond_enabled == true or explicitly null them out for non-enabled policies.
…rity - Only parse bond parameters when bondPolicy == BondPolicy.enabled, ensuring disabled/unsupported nodes never expose bond values even if tags are present - Add enabledTagsWith() test helper to simplify bond parameter test setup - Improve inline comments: remove redundant parser function docs, clarify empty-string handling and parameter gating logic - Reformat long parameter assignments for consistency - Add test coverage verifying disabled/unsupported nodes expose null bond
Closes #190. Part of the anti-abuse bond epic #145.
What
Parses and validates the anti-abuse bond policy advertised by a Mostro node in its kind-38385 info event, exposing it on
MostroInstancefor the rest of the app to consume. Parsing only — no UI (the About-screen display is tracked in #196).Changes
BondPolicyenum (unsupported/disabled/enabled) so the app can tell "feature off" apart from a legacy daemon, plus aBondApplyToenum (take/make/both).MostroInstance(bondPolicydefaults tounsupported; the six parameters are nullable and meaningful only when the policy isenabled).MostroInstance.fromTagswith defensive sanitization:bond_enabled=""is treated as missing (unsupported), notdisabled, preserving the three-state semantics.bond_enabledvalues fall back tounsupported.bond_amount_pctandbond_slash_node_share_pctin[0.0, 1.0],bond_base_amount_sats>= 0,bond_payout_claim_window_days> 0; out-of-range or unparseable values yieldnull.Tests
flutter analyzeclean; existing non-bond parsing is unaffected.Parity reference
Client-side behavior mirrors v1 (
MostroP2P/mobiledocs/architecture/ANTI_ABUSE_BOND.mdsection 2).Summary by CodeRabbit
New Features
Bug Fixes
Tests