Skip to content

fix(invariants): account for market share price rounding - #318

Merged
naddison36 merged 1 commit into
mainfrom
clement/fix-lido-invariant-share-price-rounding
Jul 23, 2026
Merged

fix(invariants): account for market share price rounding#318
naddison36 merged 1 commit into
mainfrom
clement/fix-lido-invariant-share-price-rounding

Conversation

@clement-ux

Copy link
Copy Markdown
Collaborator

Summary

  • Derive the additional share-price tolerance from the ERC-4626 market rounding loss tracked during the current handler call.
  • Preserve the existing 2 wei split-operation tolerance without allowing previously tracked losses to mask later share-price decreases.
  • Add a regression test reproducing the 3 wei loss found by the LidoARM invariant CI.

Context

The LidoARM invariant run failed when setActiveMarket deposited all ARM WETH into the active ERC-4626 market. The minted market shares converted back to 3 wei fewer assets. trackWethMarketRounding already recognized and recorded this as a valid one-market-share rounding loss, but ensureSharePriceNotDecreased still had a fixed 2 wei limit and reverted with SHARE_PRICE_DECREASED.

The modifier now snapshots the cumulative tracked loss before the handler, uses only the per-call delta, and converts that asset loss to share-price units with full-precision ceiling division.

Testing

  • forge fmt --check
  • forge build
  • Targeted market-rounding regression tests: 2 passed
  • Full local LidoARM suite: 10 passed, including 12,800 calls per invariant
  • Exact failing fuzz seed replayed twice at CI depth 100: 14,000 runs and 1,400,000 calls per replay, with 0 reverts. The original failure occurred at run 13,906.

@naddison36
naddison36 merged commit 43aeb0c into main Jul 23, 2026
7 checks passed
@naddison36
naddison36 deleted the clement/fix-lido-invariant-share-price-rounding branch July 23, 2026 08:11
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.

2 participants