Skip to content

Conversation

@clement-ux
Copy link
Contributor

@clement-ux clement-ux commented Nov 17, 2025

Description

  • Add invariant campaign for EthenaARM.
  • Add agnostic fuzzer setup for EthenaARM.
  • Support Foundry and Medusa Fuzzer.
  • Improve CI to support Medusa Fuzzer + split invariant repo runs.
  • Increase fuzzing runs + depth when running on CI. Runs/depth prev: 256/500; new 1000/1000.

Invariants

Here is a list of all invariants tested:

// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                           ✦✦✦ SWAP PROPERTIES ✦✦✦                            ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// [x] Invariant A: USDe  balance == ∑swapIn - ∑swapOut
//                                   + ∑userDeposit - ∑userWithdraw
//                                   + ∑marketWithdraw - ∑marketDeposit
//                                   + ∑baseRedeem - ∑feesCollected
// [x] Invariant B: sUSDe balance == (∑swapIn - ∑swapOut) - ∑baseRedeem
//
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                            ✦✦✦ LP PROPERTIES ✦✦✦                             ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// [x] Invariant C: ∑shares > 0 due to initial deposit
// [x] Invariant D: totalShares == ∑userShares + deadShares
// [x] Invariant E: previewRedeem(∑shares) == totalAssets
// [x] Invariant F: withdrawsQueued == ∑requestRedeem.amount
// [x] Invariant G: withdrawsQueued >= withdrawsClaimed
// [x] Invariant H: withdrawsQueued == ∑request.assets
// [x] Invariant I: withdrawsClaimed == ∑claimRedeem.amount
// [x] Invariant J: ∀ requestId, request.queued >= request.assets
// [x] Invariant K: ∑feesCollected == feeCollector.balance
//
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                         ✦✦✦ LIQUIDITY MANAGEMENT ✦✦✦                         ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// [x] Invariant L: liquidityAmountInCooldown == ∑unstaker.underlyingAmount
// [x] Invariant M: nextUnstakerIndex < MAX_UNSTAKERS
// [x] Invariant N: ∀ unstaker, usde.balanceOf(unstaker) == 0 && susde.balanceOf(unstaker) == 0
//
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                              ✦✦✦ AFTER ALL ✦✦✦                               ║
// ╚══════════════════════════════════════════════════════════════════════════════╝
// [x] sUSDe in ARM == 0
// [x] Morpho shares in ARM == 0
// [x] ∀ user, usde.balanceOf(user) >= totalMinted - 1e1
//
// ╔══════════════════════════════════════════════════════════════════════════════╗
// ║                                   ✦✦✦  ✦✦✦                                   ║
// ╚══════════════════════════════════════════════════════════════════════════════╝

@clement-ux clement-ux changed the title Ethena ARM - Invariant Testing [Ethena ARM] - Invariant Testing Nov 19, 2025
@clement-ux clement-ux force-pushed the clement/ethena-invariant-tests branch from 5e7362d to edc31b0 Compare November 24, 2025 14:23
clement-ux and others added 13 commits November 24, 2025 15:29
…ndry profiles for improved testing parameters
* wip

* Add crytic-export directory to .gitignore for improved build cleanliness

* Disable assertion testing and update property test prefix in medusa.json

* Refactor code structure for improved readability and maintainability

* Update .gitignore to ignore the crytic-export directory instead of its contents

* Rename FuzzerFoundry_EthenaARM file

* Refactor EthenaARM contracts to use state variables for label availability and update medusa.json for improved assertion testing configurations

* Update invariant profile settings for reduced runs and depth

* restore default values

* remove crytic export

* improve tests

* try something

* try again

* add medusa ci

* skip fuzzer during contract compilation

* try again

* add previous work
@clement-ux clement-ux marked this pull request as ready for review November 25, 2025 12:53
Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

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

Awesome work

@naddison36 naddison36 merged commit ac59272 into nicka/ethena Nov 25, 2025
8 checks passed
@naddison36 naddison36 deleted the clement/ethena-invariant-tests branch November 25, 2025 22:15
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.

3 participants