Skip to content

WIP Prevent zero shares being deposited#229

Draft
naddison36 wants to merge 2 commits into
nicka/withdraw-on-swapfrom
nicka/zero-deposit
Draft

WIP Prevent zero shares being deposited#229
naddison36 wants to merge 2 commits into
nicka/withdraw-on-swapfrom
nicka/zero-deposit

Conversation

@naddison36
Copy link
Copy Markdown
Collaborator

@naddison36 naddison36 commented May 14, 2026

Summary

  • Revert LP deposits that would mint zero shares.
  • Add a regression test covering the rounding case where convertToShares(assets) returns 0.

Details

convertToShares() rounds down, so if totalAssets() is slightly greater than totalSupply(), a very small deposit can transfer liquidity assets while minting zero LP shares. _deposit() now checks the computed share amount before transferring assets and reverts with ARM: zero shares when the deposit would mint nothing.

Testing

  • forge test --match-path test/unit/OriginARM/Deposit.sol

Contract Sizes

forge build --sizes reports:

Contract Runtime Size Runtime Margin
EthenaARM 24,021 bytes 555 bytes
EtherFiARM 24,636 bytes -60 bytes
LidoARM 24,544 bytes 32 bytes
OriginARM 23,692 bytes 884 bytes

EtherFiARM is currently 60 bytes over the EIP-170 runtime size limit, so forge build --sizes exits with a size-limit error.

@naddison36 naddison36 marked this pull request as draft May 14, 2026 10:32
@naddison36 naddison36 changed the title Prevent zero shares being deposited WIP Prevent zero shares being deposited May 14, 2026
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