Skip to content

Lending: the share-inflation attack needs a zero reserve factor - #280

Open
mikemaccana wants to merge 1 commit into
mainfrom
claude/peaceful-ptolemy-oh26c8-lending-inflation
Open

mikemaccana wants to merge 1 commit into
mainfrom
claude/peaceful-ptolemy-oh26c8-lending-inflation

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Merge after quicknode/solana-program-examples#212. This PR describes the test as that PR changes it.

What changes

The Lending chapter's share-inflation bullet said a second of interest makes the attacker's one unit of shares "worth two". That is only true in a reserve with no reserve factor. The program rounds its fee up, so a nonzero reserve factor takes the whole one-unit interest and the share price does not move.

inflating_shares_through_own_borrow_does_not_pay used the default 10% reserve factor, so it passed without the attack running. quicknode/solana-program-examples#212 changes it to:

  • run on a reserve with no reserve factor
  • assert that the share price rises after the borrow and again after the round trips

This PR changes three sentences in building-financial-products-in-solana/lending.md so the chapter says:

  • why the attack needs a zero reserve factor
  • that the test runs it on such a reserve
  • what the test now asserts

Testing

  • npm run lint passes.
  • npm run build-pdf-digital builds the book.

Generated by Claude Code

A reserve factor rounds its fee up and takes the attacker's one minor unit of
interest, so the share price only rises in a reserve with no reserve factor.
inflating_shares_through_own_borrow_does_not_pay now runs on such a reserve and
checks that the share price rises (quicknode/solana-program-examples#212).

Claude-Session: https://claude.ai/code/session_01GZHin6BQpAqf7j2ucSZWkx
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