Skip to content

feat: bump mostro-core to 0.11.0 and handle anti-abuse bond flow#166

Merged
grunch merged 2 commits into
mainfrom
migrate/mostro-core-0.11.0-pay-bond-invoice
May 11, 2026
Merged

feat: bump mostro-core to 0.11.0 and handle anti-abuse bond flow#166
grunch merged 2 commits into
mainfrom
migrate/mostro-core-0.11.0-pay-bond-invoice

Conversation

@grunch
Copy link
Copy Markdown
Member

@grunch grunch commented May 11, 2026

Summary

  • Bumps mostro-core from 0.10.0 to 0.11.0.
  • Handles the new Action::PayBondInvoice variant (Mostro → taker bond hold-invoice that lands right after a TakeBuy / TakeSell) — reuses the PayInvoice save flow but renders a dedicated "🪙 Anti-Abuse Bond Invoice" block so the user can tell it apart from the trade hold-invoice that follows.
  • Handles the new Status::WaitingTakerBond order status in the status-emoji map.

Motivation

Reproducible on main against the current Mostro mainnet daemon:

mcli takesell -o 2eb407ea-96f8-4fda-805f-eba71319afcf
...
Warning: could not unwrap gift wrap (event …): Error serializing message
No response received from Mostro

unwrap_message in mostro-core 0.10 decrypts the seal cleanly but then fails at serde_json::from_str::<(Message, Option<String>)>(...) because the daemon already ships the taker bond response (Action::PayBondInvoice introduced in mostro-core 0.11). Serde can't deserialize an unknown enum variant → ServiceError::MessageSerializationError. The CLI swallowed the event and timed out.

Test plan

  • cargo build
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --lib
  • cargo fmt --all -- --check
  • Manual: run mcli 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

  • New Features
    • Added Anti-Abuse Bond Invoice payment flow support with enhanced display formatting
    • Bond invoices now render with dedicated status indicators and visual distinctions
    • Direct messages show a dedicated action icon for bond invoice operations
    • Improved order handling and persistence for bond invoice transactions

Review Change Stack

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>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1ca640f5-71db-4040-98ce-bb48588fca7d

📥 Commits

Reviewing files that changed from the base of the PR and between ac419c0 and 130791f.

📒 Files selected for processing (1)
  • src/parser/dms.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/parser/dms.rs

Walkthrough

This 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.

Changes

Payment Bond Invoice Action Support

Layer / File(s) Summary
Dependency Update
Cargo.toml
mostro-core bumped from 0.10.0 to 0.11.0.
Invoice Display Helper
src/parser/dms.rs
New handle_pay_bond_invoice_display renders "Anti-Abuse Bond Invoice" section with optional order id, amount/fiat, and follow-up guidance.
Command Result Handler
src/parser/dms.rs
print_commands_results extended to handle Action::PayBondInvoice: validates Payload::PaymentRequest, displays bond invoice, extracts order/request id, and persists order via save_order with error handling.
Display Format Enhancements
src/parser/dms.rs
Added Status::WaitingTakerBond emoji mapping and assigned 🪙 icon to Action::PayBondInvoice in direct message rendering.

Possibly related PRs

  • MostroP2P/mostro-cli#146: Modifies src/parser/dms.rs DM rendering and command-result handling; related to display and payload formatting changes.
  • MostroP2P/mostro-cli#87: Also updates the mostro-core dependency version in Cargo.toml.

Suggested reviewers

  • Catrya

🐰 I nibbled through the invoice code with cheer,
A tiny coin icon now appears,
Orders saved, bond invoices shown,
Lightning hops where seeds were sown,
Hooray — payments clearer here! ✨

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the two main changes: bumping mostro-core to 0.11.0 and implementing handling for the anti-abuse bond invoice flow, which align perfectly with the file-level changes (Cargo.toml dependency update and PayBondInvoice action handling in dms.rs).
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch migrate/mostro-core-0.11.0-pay-bond-invoice

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 348b368 and ac419c0.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • Cargo.toml
  • src/parser/dms.rs

Comment thread src/parser/dms.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/parser/dms.rs Outdated
if let Some(Payload::PaymentRequest(order, invoice, _)) = &message.payload {
handle_pay_bond_invoice_display(order, invoice);

if let Some(order) = order {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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>
@grunch grunch merged commit 630d1fb into main May 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant