feat: bump mostro-core to 0.11.0 and handle anti-abuse bond flow#166
Conversation
The Mostro daemon now ships the taker's anti-abuse bond hold-invoice as a separate Action::PayBondInvoice before the trade hold-invoice. With mostro-core 0.10 the variant was unknown, so the rumor failed to deserialize and takesell/takebuy responses surfaced as "Error serializing message" with no follow-up. Bumps mostro-core to 0.11.0 and wires the new Action::PayBondInvoice and Status::WaitingTakerBond variants into the DM parser/display so takers see the bond invoice and the trade continues to the existing PayInvoice flow afterwards. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThis PR updates Cargo.toml to mostro-core 0.11.0 and implements Action::PayBondInvoice support in the DM parser: new bond-invoice display helper, command-result handling that persists orders, status emoji mapping, and an action icon. ChangesPayment Bond Invoice Action Support
Possibly related PRs
Suggested reviewers
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/parser/dms.rs`:
- Around line 510-536: The Action::PayBondInvoice branch currently silently
returns Ok(()) when message.payload is not a PaymentRequest or when the inner
order is None, which hides protocol drift and drops state; update the
Action::PayBondInvoice handler so that if message.payload does not match
Payload::PaymentRequest you return an Err with a clear message (including the
unexpected payload variant), and if the PaymentRequest exists but order is None
you also return an Err indicating the missing order rather than Ok(()); keep
calling handle_pay_bond_invoice_display for the PaymentRequest case, then
proceed to require message.request_id and call save_order (as in the existing
save logic), returning propagated errors on save failures and only Ok(()) after
a successful save.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3b43b0e1-a715-4993-bfce-0050d2d74590
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
Cargo.tomlsrc/parser/dms.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac419c0da1
ℹ️ 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".
| if let Some(Payload::PaymentRequest(order, invoice, _)) = &message.payload { | ||
| handle_pay_bond_invoice_display(order, invoice); | ||
|
|
||
| if let Some(order) = order { |
There was a problem hiding this comment.
Return error when bond invoice payload has no order
Action::PayBondInvoice silently returns Ok(()) when Payload::PaymentRequest carries order = None, while the analogous Action::PayInvoice path treats missing order data as an error. Because this branch is where the taken order is persisted with trade keys, a null order here leaves the CLI without a saved order context and the command appears successful even though follow-up workflow state was not recorded.
Useful? React with 👍 / 👎.
The PayBondInvoice arm in print_commands_results silently returned Ok(()) when the payload was not a PaymentRequest, and when the PaymentRequest carried order = None. Both paths skip save_order, so the CLI loses the order context the bond flow depends on while reporting success. Tighten the arm to return Err with the unexpected payload variant or the missing-order condition, and only return Ok(()) after save_order succeeds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
mostro-corefrom0.10.0to0.11.0.Action::PayBondInvoicevariant (Mostro → taker bond hold-invoice that lands right after aTakeBuy/TakeSell) — reuses thePayInvoicesave flow but renders a dedicated "🪙 Anti-Abuse Bond Invoice" block so the user can tell it apart from the trade hold-invoice that follows.Status::WaitingTakerBondorder status in the status-emoji map.Motivation
Reproducible on
mainagainst the current Mostro mainnet daemon:unwrap_messageinmostro-core 0.10decrypts the seal cleanly but then fails atserde_json::from_str::<(Message, Option<String>)>(...)because the daemon already ships the taker bond response (Action::PayBondInvoiceintroduced inmostro-core 0.11). Serde can't deserialize an unknown enum variant →ServiceError::MessageSerializationError. The CLI swallowed the event and timed out.Test plan
cargo buildcargo clippy --all-targets --all-features -- -D warningscargo test --libcargo fmt --all -- --checkmcli takesell -o <id>against the current Mostro daemon and confirm the bond invoice prints and the order persists.🤖 Generated with Claude Code
Summary by CodeRabbit