You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In lending_pool/src/lib.rs, calc_shares_to_mint gives the first depositor a 1:1 allocation against read_pool_balance (the live token balance), and the share price is derived from that balance in get_share_price/calc_assets_to_redeem. A first depositor can mint 1 share, then donate tokens directly to the contract to inflate share price, so a later depositor's amount * total_shares / total_assets_before rounds down to 0 shares (rejected) or far fewer shares than deposited, letting the attacker redeem the victim's principal. No minimum-liquidity burn or virtual-shares offset is present.
Acceptance criteria
Adopt a mitigation (e.g. burn a fixed MINIMUM_LIQUIDITY of shares on first deposit, or use virtual shares/assets offsets in calc_shares_to_mint and calc_assets_to_redeem)
calc_shares_to_mint reverts or rounds in the pool's favor so a donation cannot zero out a subsequent depositor's minted shares
Add a regression test where a first depositor donates tokens directly to the contract and a second honest deposit still mints fair shares and is fully redeemable
Document the chosen invariant near calc_shares_to_mint
This looks like something I can handle. I have already gone over the relevant files to understand how everything fits together. I will scope the work to exactly what is asked, test it locally, and raise a PR for review this week.
Activity
tosin-zoffun commentedon Jun 17, 2026
This looks like something I can handle. I have already gone over the relevant files to understand how everything fits together. I will scope the work to exactly what is asked, test it locally, and raise a PR for review this week.
grantfox-oss commentedon Jun 17, 2026
🦊 GrantFox — @tosin-zoffun has been assigned to this issue as part of the Official Campaign campaign!
Next steps:
Closes #1)Good luck! Track your progress on GrantFox.
fix(contracts): block first-depositor donation attack and accrue by l…
grantfox-oss commentedon Jun 20, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign campaign!
@tosin-zoffun's PR #33 was approved and merged by @ogazboiz.
🏆 @tosin-zoffun: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (48 total points). Track your full progress on GrantFox.
👏 Great work, @tosin-zoffun! Keep contributing to LabsCrypt.