docs: document pay-bond-invoice action and waiting-taker-bond status#43
Conversation
Add a dedicated page for Action::PayBondInvoice (wire name pay-bond-invoice) covering payload shape, direction, trigger, expected client behaviour, follow-up flows, and the waiting-taker-bond order sub-state with its in/out transitions. Wire the new page into SUMMARY, add a message suggestion entry, call out the optional bond step in the take-buy and take-sell flows (including the seller-as-taker case where one user pays two hold invoices in sequence), and stub the upcoming bond-related tags in the Mostro instance status event so client devs can anticipate the parser change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughThis PR adds comprehensive documentation for Mostro's anti-abuse bond payment system. It introduces a new ChangesAnti-abuse Bond Feature Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Reframe waiting-taker-bond so it is consistent with NIP-69's four-bucket wire model: the published NIP-33 order event keeps s=pending while the bond is outstanding, and waiting-taker-bond only appears in the SmallOrder echo of DM payloads. Document the bond-race outcome (Action::Canceled when another taker locks first) in cancel.md and the re-takeability invariant in order_event.md so clients do not hide pending orders during a local take. Tighten the backwards-compatibility note to point at mostro-core deserialization, and fix the "return to pending" wording in the message suggestions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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/other_events.md`:
- Line 206: The documentation currently presents `waiting-taker-bond` as a
public order status; change the text to state explicitly that
`waiting-taker-bond` is a daemon-internal/DM-payload state (e.g., echoed in
SmallOrder.status for internal use) and not part of the public NIP-69 wire
status, which should remain `pending`; also clarify that `pay-bond-invoice` is
an internal action tied to that DM payload and that clients must still treat
missing bond tags as "behaviour unknown" and surface a clear error if they
receive a `pay-bond-invoice` for a take they cannot handle.
🪄 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: c80f0b85-c036-4814-a379-b577a926157e
📒 Files selected for processing (8)
src/SUMMARY.mdsrc/cancel.mdsrc/message_suggestions_for_actions.mdsrc/order_event.mdsrc/other_events.mdsrc/pay_bond_invoice.mdsrc/take_buy.mdsrc/take_sell.md
|
|
||
| A future Mostro release will publish bond-related tags in this event so clients can detect bond-enabled nodes ahead of a take. The tag set is still being finalized; at minimum it will include a `bond` tag with the value `enabled` or `disabled`. Additional tags describing the bond size policy (percentage, floor) may be added. | ||
|
|
||
| Clients that take orders on a node advertising `bond` `enabled` should be prepared to handle the [`pay-bond-invoice`](./pay_bond_invoice.md) action and the `waiting-taker-bond` order status. Until this tag is finalized and shipped, clients should treat the absence of bond tags as "behaviour unknown" and surface a clear error if the node sends `pay-bond-invoice` to a take they cannot handle. |
There was a problem hiding this comment.
Clarify waiting-taker-bond as daemon-internal, not public wire status.
Line 206 currently reads like waiting-taker-bond is a regular order status. To avoid client parser mistakes, call it out explicitly as DM-payload/internal state (e.g., SmallOrder.status echo), while public NIP-69 stays pending.
Suggested wording
-Clients that take orders on a node advertising `bond` `enabled` should be prepared to handle the [`pay-bond-invoice`](./pay_bond_invoice.md) action and the `waiting-taker-bond` order status. Until this tag is finalized and shipped, clients should treat the absence of bond tags as "behaviour unknown" and surface a clear error if the node sends `pay-bond-invoice` to a take they cannot handle.
+Clients that take orders on a node advertising `bond` `enabled` should be prepared to handle the [`pay-bond-invoice`](./pay_bond_invoice.md) action and the daemon-internal `waiting-taker-bond` state echoed in DM payloads (the public NIP-69 status remains `pending`). Until this tag is finalized and shipped, clients should treat the absence of bond tags as "behaviour unknown" and surface a clear error if the node sends `pay-bond-invoice` to a take they cannot handle.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| Clients that take orders on a node advertising `bond` `enabled` should be prepared to handle the [`pay-bond-invoice`](./pay_bond_invoice.md) action and the `waiting-taker-bond` order status. Until this tag is finalized and shipped, clients should treat the absence of bond tags as "behaviour unknown" and surface a clear error if the node sends `pay-bond-invoice` to a take they cannot handle. | |
| Clients that take orders on a node advertising `bond` `enabled` should be prepared to handle the [`pay-bond-invoice`](./pay_bond_invoice.md) action and the daemon-internal `waiting-taker-bond` state echoed in DM payloads (the public NIP-69 status remains `pending`). Until this tag is finalized and shipped, clients should treat the absence of bond tags as "behaviour unknown" and surface a clear error if the node sends `pay-bond-invoice` to a take they cannot handle. |
🤖 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/other_events.md` at line 206, The documentation currently presents
`waiting-taker-bond` as a public order status; change the text to state
explicitly that `waiting-taker-bond` is a daemon-internal/DM-payload state
(e.g., echoed in SmallOrder.status for internal use) and not part of the public
NIP-69 wire status, which should remain `pending`; also clarify that
`pay-bond-invoice` is an internal action tied to that DM payload and that
clients must still treat missing bond tags as "behaviour unknown" and surface a
clear error if they receive a `pay-bond-invoice` for a take they cannot handle.
Summary
src/pay_bond_invoice.mddocumentingAction::PayBondInvoice(wire namepay-bond-invoice) — payload shape (same aspay-invoice), direction, trigger, expected client behaviour, per-take-direction follow-up flow, thewaiting-taker-bondsub-state with in/out transitions, failure modes, and backwards compatibility notes.take_buy.mdandtake_sell.md, with a prominent warning for the seller-as-taker case — the one flow where a single user pays two hold invoices in sequence on the same order (pay-bond-invoicethenpay-invoice).pay-bond-invoiceentry tomessage_suggestions_for_actions.mdworded to make the bond-vs-escrow distinction explicit.other_events.md) so client devs can anticipate thebondenabled/disabledparser change.SUMMARY.md.Context
Companion to the anti-abuse bond rollout in
MostroP2P/mostro(parent issue #711). Phase 1.5 introduces theAction::PayBondInvoiceandStatus::WaitingTakerBondenum variants inmostro-core; without these docs, clients that only know aboutpay-invoicewould silently ignore the new action and takes would time out with no useful error to the user.Naming note: the action is
pay-bond-invoice, notadd-bond-invoice— this matchespay-invoice's direction (Mostro → user). Earlier working notes usedAddBondInvoice; the canonical name isPayBondInvoice/pay-bond-invoice.Test plan
mdbook serve/just serve) and verify the new page is reachable from the sidebar between "Take range buy order" and "Seller pays hold invoice".pay_bond_invoice.md↔take_buy.md,take_sell.md,other_events.md,admin_settle_order.md,admin_cancel_order.md,order_event.md.take_buy.mdfor clarity — this is the most error-prone path for client implementers.🤖 Generated with Claude Code
Summary by CodeRabbit