Skip to content

chore: update invariant tests#337

Merged
zhongeric merged 13 commits into
devfrom
chore/add-new-invariant
May 21, 2026
Merged

chore: update invariant tests#337
zhongeric merged 13 commits into
devfrom
chore/add-new-invariant

Conversation

@zhongeric
Copy link
Copy Markdown
Contributor

@zhongeric zhongeric commented May 14, 2026

Upgrade invariant tests:

  • fuzz deployment params based on seeded values
  • multi actor
  • prevent excessive discards of invariant runs
  • add new invariants

@zhongeric zhongeric changed the title chore: add clearing price max invariant chore: update invariant tests May 18, 2026
@zhongeric zhongeric marked this pull request as ready for review May 18, 2026 15:51
@zhongeric zhongeric requested a review from a team as a code owner May 18, 2026 15:51
zhongeric and others added 7 commits May 18, 2026 12:19
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@zhongeric zhongeric merged commit 4eebda8 into dev May 21, 2026
5 checks passed

// The invariant MAY be broken IF the clearingPrice was rounded up by one wei.
if (purchasableSupplyQ96X7 < remainingSupplyQ96X7) {
uint256 allowableBuffer = 1 * (sumDemandQ96 * ConstantsLib.MPS);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have trouble following why the buffer is dependent on the demand, if it is actually about the supply? This buffer seems extremely big and forgiving, which kind of defeats the purpose of the test.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's because clearingPrice can be rounded up, which would result in 1 * sumDemandQ96 overshoot

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