Skip to content

Escrow: describe the degenerate-offer checks the program now makes - #191

Merged
mikemaccana merged 1 commit into
mainfrom
claude/escrow-degenerate-offers
Sep 30, 2026
Merged

mikemaccana merged 1 commit into
mainfrom
claude/escrow-degenerate-offers

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

The Escrow chapter's "Degenerate offers" item said two checks "belong in any escrow headed to production", which described a flaw the companion program had. quicknode/solana-program-examples#169 has now merged and fixes it, so, following CLAUDE.md, the chapter describes the fix and names the tests:

  • make_offer() refuses an offer of zero tokens on either side with ZeroAmount. This is checked by test_make_offer_rejects_zero_offered_amount and test_make_offer_rejects_zero_wanted_amount.
  • An offer of a token for itself never reaches the handler. With one mint, the maker's token A and token B accounts are the same account, and Anchor refuses the same writable account twice with ConstraintDuplicateMutableAccount. test_make_offer_rejects_same_mint checks this.

Every name above exists in finance/escrow/anchor on the companion repository's main. npm run lint and npm run build-pdf pass.

This is independent of quicknode/solana-book#190, which doesn't touch this paragraph.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JGEoAUjMm7Evv69k46eNcn


Generated by Claude Code

quicknode/solana-program-examples#169 added them: make_offer() refuses a
zero amount on either side with ZeroAmount, and a same-token offer is
refused by Anchor's duplicate-writable-account check before the handler
runs. Name both and the tests that check them, in place of the paragraph
that said a production escrow should add them.

Claude-Session: https://claude.ai/code/session_01JGEoAUjMm7Evv69k46eNcn
@mikemaccana
mikemaccana merged commit 0c4f4bf into main Sep 30, 2026
1 check passed
mikemaccana pushed a commit that referenced this pull request Sep 30, 2026
Keeps this branch's abandoned-offer sentence and main's degenerate-offers
bullet from #191.

Claude-Session: https://claude.ai/code/session_01JGEoAUjMm7Evv69k46eNcn
@mikemaccana
mikemaccana deleted the claude/escrow-degenerate-offers branch October 13, 2026 00:23
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