Repository navigation
Lending locks shares too: a supplier can raise a reserve's size by borrowing from it - #168
Merged
Merged
Conversation
…rrowing from it The Lending and Borrowing chapter said the donation attack fails because available_liquidity is the source of truth, and the Adversary chapter listed ignoring donations as the lending market's only defense. Both held only against a donation. A reserve's size also counts the interest its borrowers owe, and a supplier may borrow from their own reserve: one minor unit of rounded-up interest lifts a lone share above one unit, and the rounding on the attacker's own deposits and redemptions does the rest. The companion repository now withholds MINIMUM_SHARES from each reserve's first deposit and counts them in every conversion (quicknode/solana-program-examples#155), and the chapters follow. - Lending and Borrowing: Maria makes each reserve's first deposit, the share formula counts the withheld 1,000, the solvency invariant says what the shares are a claim on, and the failure mode is rewritten around inflating_shares_through_own_borrow_does_not_pay and its numbers. Three leftovers from the wall-clock accrual change are corrected: interest compounds on every refresh rather than by the slot, the scale keeps a second's interest from truncating, and the tests move the clock rather than warping slots. - The Adversary: the lending reserve is the second example of a recorded size its own users can raise, and the lending market does both defenses, as the perpetual futures pool does. - WRITING-PLAN: Maria's opening deposits join the list of steps awaiting a figure. Claude-Session: https://claude.ai/code/session_013vsKb7K4wGqggas2vtABoF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge after quicknode/solana-program-examples#155. This PR names
MINIMUM_SHARES,inflating_shares_through_own_borrow_does_not_payandsole_supplier_leaves_the_minimum_behind, which exist only on that PR's branch until it merges.What was untrue
lending.md, failure modes: "The donation attack fails becauseavailable_liquidity, not the vault balance, is the source of truth." The donation does fail, but the sentence implied the reserve was safe from share inflation, and it wasn't. A reserve's size also counts the interest its borrowers owe, and a supplier may borrow from their own reserve.lending.md, first deposit: "The first deposit into a reserve mints shares one-to-one." After Refine prose for clarity and consistency across chapters #155 it withholds 1,000 shares.lending.md, wall-clock leftovers: three statements Reorganize reader guidance by audience and skill level #151 made untrue:Changes
Checks
npm run lintis clean.node scripts/check-figure-geometry.mjsis clean across 99 figures.npm run build-pdfwrites the PDF.🤖 Generated with Claude Code
https://claude.ai/code/session_013vsKb7K4wGqggas2vtABoF
Generated by Claude Code