Skip to content

Commit

Permalink
fix: ensure price not changed by view functions
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Aug 28, 2024
1 parent 9aeb49f commit 91e6beb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions certora/specs/Health.spec
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ rule stayHealthyLiquidate(env e, MorphoHarness.MarketParams marketParams, addres
MorphoHarness.Id id = libId(marketParams);
address user;

priceChanged = false;
// Assume that the position is healthy before the interaction.
require isHealthy(marketParams, user);
uint256 debtSharesBefore = borrowShares(id, user);
Expand All @@ -96,9 +97,7 @@ rule stayHealthyLiquidate(env e, MorphoHarness.MarketParams marketParams, addres
// Assumption to ensure that no interest is accumulated.
require lastUpdate(id) == e.block.timestamp;

priceChanged = false;
liquidate(e, marketParams, borrower, seizedAssets, 0, data);
require !priceChanged;

// Safe require because of the invariant sumBorrowSharesCorrect.
require borrowShares(id, user) <= totalBorrowShares(id);
Expand All @@ -112,6 +111,7 @@ rule stayHealthyLiquidate(env e, MorphoHarness.MarketParams marketParams, addres
assert debtAssetsBefore >= summaryMulDivUp(debtSharesBefore, virtualTotalBorrowAssets(id), virtualTotalBorrowShares(id));

bool stillHealthy = isHealthy(marketParams, user);
require !priceChanged;
assert stillHealthy;
}

Expand Down

0 comments on commit 91e6beb

Please sign in to comment.