In this track: Advanced security reasoning
advanced · 4 MIN READ

Donation and inflation attacks

Unsolicited assets can change share-conversion ratios in some vault designs.

LET’S PICTURE IT

Adding goods to a pool without adding ownership tickets can change the price of each ticket.

SEE IT FOR YOURSELF
The same native ether amount shown as ETH, Gwei and WeiETH1× 1 billionGWEI1000000000× 1 billionWEI1000000000000000000

1 ETH = 1000000000 Gwei = 1000000000000000000 Wei.

Same value · different units · native ether only

Separate assets and shares

A share-based vault converts between an asset balance and a share supply. The formula and rounding determine how a new deposit becomes shares.

Inspect direct balance influence

If unsolicited transfers affect the conversion denominator, an actor can change the ratio without minting corresponding shares. Small supplies can make rounding effects especially important.

Check zero-share outcomes

A deposit that rounds to zero shares can lose value under an unsafe design. The complete economics depend on the formula, costs and defenses, not merely the existence of a donation.

Review established mitigations

Virtual offsets, minimum-output constraints and accounting choices address different parts of the problem. Test the exact implementation rather than assuming every vault shares one vulnerability.

Work through the boundary

naive conversion: shares = floor(deposit × supply / assets)
if supply = 1, assets = 101, deposit = 100
computed shares = 0

Toy rounding example, not a complete profitable attack model.

A simplified local review scenario. The example establishes a question to test, not a guarantee of production safety.

QUICK CHECK · NO PRESSURE

Can a direct asset donation change a naive assets-per-share ratio?

Your progress stays in this browser.
Keep exploring the original referencedocs.openzeppelin.com ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.