Repository navigation
Share inflation: the minimum is counted in both divisors, and tracked state is not enough - #162
Merged
Merged
Conversation
… state is not enough The companion repository's token swap minted later deposits against the bare LP supply while withdrawals divided by supply plus the floor, and its perpetual futures divided by the bare supply both ways, so the withheld 1,000 shares locked nothing. Both now count the minimum in every share divisor (quicknode/solana-program-examples, branch claude/sleepy-faraday-o7pmq1), and the chapters follow. - Constant-Product AMM: Alice's deposit and withdrawal name the same divisor, and the inflation-attack bullet states the price of the attack (a donation of about 101 times the victim's deposit, 100/101 of it lost to the floor), why the floor must be in both divisors, and the test that runs it. - Perpetual Futures: pricing shares against liquidity stops a vault donation, but a provider who is also the only trader can grow liquidity with their own funding payments. Carol's paragraph and the failure mode now say so, and what the locked minimum does about it, with the test's numbers. - The Adversary: recording the pool's size ignores donations only while nothing else the attacker controls can raise the recorded figure, and the perpetual futures pool is the example. Claude-Session: https://claude.ai/code/session_01HagqhpPNqcywT37qqgnFey
mikemaccana
force-pushed
the
claude/sleepy-faraday-o7pmq1
branch
from
September 23, 2026 00:21
811a3b7 to
1598200
Compare
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.
Depends on quicknode/solana-program-examples#152. Merge that first. This PR names two tests that exist only on that branch,
test_donation_cannot_round_a_later_deposit_to_zeroandtest_inflating_liquidity_through_own_trades_does_not_pay, and describes the behavior it ships.Two first-deposit defenses in the companion repository did not work the way the book said:
liquidityand take part of the next deposit. Against the old program the attacker spent about 1,000 USDC and withdrew about 1,500.The companion PR counts the minimum in every share divisor, and these chapters follow it.
liquiditystops a vault donation but not a provider's own funding payments, and gives the test's numbers.Rebased onto current
main, where the Adversary section and Carol's paragraph had been rewritten.main's text is kept, with these additions merged into it.npm run lint,node scripts/check-figure-geometry.mjsandnpm run build-pdfall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01HagqhpPNqcywT37qqgnFey