Skip to content

Block deposits at the asset floor when live LPs exist - #311

Merged
clement-ux merged 4 commits into
mainfrom
clement/fix-live-lp-asset-floor
Jul 22, 2026
Merged

Block deposits at the asset floor when live LPs exist#311
clement-ux merged 4 commits into
mainfrom
clement/fix-live-lp-asset-floor

Conversation

@clement-ux

@clement-ux clement-ux commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • block deposits at the native-liquidity floor when live LP shares still exist
  • preserve the initial-deposit path when dead shares are the entire supply and no senior liabilities exist
  • add regression coverage for a real asset loss with zero accrued fees and zero reserved withdrawals
  • align the Ethena and Lido invariant deposit guards with the new insolvency condition
  • harden Lido invariant handlers so mutated calldata remains ABI-decodable and strict mode runs with zero handler reverts

Security impact

A real market loss can reduce total assets to the MIN_LIQUIDITY floor without creating fees or reserved withdrawals. Before this change, a new depositor could mint most of the share supply at the floor price and capture a later recovery that belongs to existing LPs.

This is a follow-up to #288: that PR covered fee-driven insolvency, while this PR covers the separate asset-loss case.

Invariant harness

The Lido handlers accept full-word uint256 seeds and bound or derive narrower values internally. This prevents corpus mutations from producing non-canonical bool or narrow-integer ABI words that revert in the Solidity ABI dispatcher before handler execution. The handlers also reject zero-input dust cases and safely normalize full-width seeds and uint128 price-liquidity limits.

Testing

  • Deposit tests: 16 passed, 0 failed
  • Full suite excluding invariants: 532 passed, 0 failed, 3 skipped
  • Ethena invariants with FOUNDRY_INVARIANT_FAIL_ON_REVERT=true: 256 runs, 12,800 calls, 0 reverts
  • Lido invariants with FOUNDRY_INVARIANT_FAIL_ON_REVERT=true: 256 runs, 12,800 calls, 0 reverts

@clement-ux clement-ux self-assigned this Jul 21, 2026
@clement-ux clement-ux added the Audit Fix Resolves findings from security audit. label Jul 21, 2026
naddison36
naddison36 previously approved these changes Jul 22, 2026

@naddison36 naddison36 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good find

@naddison36 naddison36 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

post merge approve

@clement-ux
clement-ux merged commit deee063 into main Jul 22, 2026
7 checks passed
@clement-ux
clement-ux deleted the clement/fix-live-lp-asset-floor branch July 22, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Audit Fix Resolves findings from security audit.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants