docs(bond): spec cancel_action handling for WaitingTakerBond status#730
Conversation
The Phase 1.5 spec at §6.5.1 widens the take handlers to accept orders in either `Pending` or `WaitingTakerBond`, but never makes the same widening explicit for `cancel_action`. Without it, a cancel issued during the bond window (between take and bond lock) would fall through `cancel_action_generic`'s status match and hit the default `_ => NotAllowedByStatus` arm — a silent regression vs. Phase 1, where both the maker self-cancel and the taker self-cancel work because the order is still in `Pending`. Add an explicit bullet to §6.5.1 calling out: - The `Status::Pending` guard in `cancel_action_generic` widens to `Pending | WaitingTakerBond`. The cooperative-cancel logic for `WaitingPayment` / `WaitingBuyerInvoice` does NOT apply — the trade flow has not started, so it is exactly the Pending shape. - Inside that branch the existing two-route logic (maker self-cancel via `cancel_pending_order_from_maker`; taker self-cancel via `cancel_order_by_taker`) stays unchanged. The bond release hook is already wired into both paths from Phase 1; only the status guard moves. Add three §6.5.3 tests to lock the contract down: - Taker self-cancel during `WaitingTakerBond` returns `Ok` and transitions the order back to `Pending` (NIP-33 stayed `pending` throughout, observers see no change). - Maker self-cancel during `WaitingTakerBond` runs `cancel_pending_order_from_maker`, releases the prospective taker's bond, and publishes `s = canceled`. - A third-party pubkey (neither maker nor a bonded taker) gets `IsNotYourOrder` — the wider status guard must not weaken authorisation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ 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 |
Summary
Closes a latent gap in the Phase 1.5 spec. §6.5.1 already widens the take handlers to accept orders in either `Pending` or `WaitingTakerBond`, but the equivalent change for `cancel_action` was never spelled out. Without it, a cancel issued during the bond window (between take and bond lock) would fall through `cancel_action_generic`'s status match and hit the default `_ => NotAllowedByStatus` arm — a silent regression vs. Phase 1, where both the maker self-cancel and the taker self-cancel work today because the order is still in `Pending`.
The two flows that would break:
Both work today because Phase 1 keeps the order in `Pending`. After Phase 1.5 flips the DB status to `WaitingTakerBond`, neither would work without the spec'd widening.
Changes
Test plan
🤖 Generated with Claude Code