From 69af705d1032dff30f9bed5e4fea925935ed101c Mon Sep 17 00:00:00 2001 From: MathisGD Date: Sun, 12 Nov 2023 20:03:48 +0100 Subject: [PATCH 1/6] docs: document inflation attack --- src/interfaces/IMorpho.sol | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index 781a32f0a..918ba8a55 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -123,6 +123,8 @@ interface IMorphoBase { /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. + /// @dev For a market with less than 1e4 assets borrowed in total, a manipulation is possible to inflate the borrow + /// shares' price to the point where borrower can no longer interact with the market. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's From e5f3455597fd67093ad8a18fc708c2cf3000593b Mon Sep 17 00:00:00 2001 From: MathisGD Date: Mon, 13 Nov 2023 00:54:07 +0100 Subject: [PATCH 2/6] docs: improvements after review --- src/interfaces/IMorpho.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index 918ba8a55..cc91ad5ba 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -123,8 +123,8 @@ interface IMorphoBase { /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. - /// @dev For a market with less than 1e4 assets borrowed in total, a manipulation is possible to inflate the borrow - /// shares' price to the point where borrower can no longer interact with the market. + /// @dev The share price of a market with less than 1e4 assets borrowed can be increased by manipulations, to the + /// point where borrowing and repaying overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's From c570b014d37da0cbcd9cc2da48d040c9ccf854a8 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Mon, 13 Nov 2023 09:08:08 +0100 Subject: [PATCH 3/6] docs: improvements after review --- src/interfaces/IMorpho.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index cc91ad5ba..53de92edd 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -123,8 +123,8 @@ interface IMorphoBase { /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. - /// @dev The share price of a market with less than 1e4 assets borrowed can be increased by manipulations, to the - /// point where borrowing and repaying overflows. + /// @dev The share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to the + /// point where totalBorrowShares is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's From e0a1aa7ad3d0557fe9baaa2c271f6638c6d6a18b Mon Sep 17 00:00:00 2001 From: MathisGD <74971347+MathisGD@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:21:30 +0100 Subject: [PATCH 4/6] docs: minor improvement Co-authored-by: Romain Milon Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com> --- src/interfaces/IMorpho.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index 53de92edd..0a73c8e8f 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -123,8 +123,8 @@ interface IMorphoBase { /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. - /// @dev The share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to the - /// point where totalBorrowShares is very large and borrowing overflows. + /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to the + /// point where `totalBorrowShares` is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's From 011f77c86fdf50c8c6003204539c286143591e74 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Mon, 13 Nov 2023 15:24:04 +0100 Subject: [PATCH 5/6] chore: fmt --- src/interfaces/IMorpho.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index 0a73c8e8f..561e5a8f6 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -123,7 +123,8 @@ interface IMorphoBase { /// `liquidate` from being used under certain market conditions. /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. - /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to the + /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to + /// the /// point where `totalBorrowShares` is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; From c88ff83e77b5f66988ffd65efc69c8f51e7b9a26 Mon Sep 17 00:00:00 2001 From: MathisGD <74971347+MathisGD@users.noreply.github.com> Date: Mon, 13 Nov 2023 15:42:27 +0100 Subject: [PATCH 6/6] docs: minor improvement Co-authored-by: Quentin Garchery Signed-off-by: MathisGD <74971347+MathisGD@users.noreply.github.com> --- src/interfaces/IMorpho.sol | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/interfaces/IMorpho.sol b/src/interfaces/IMorpho.sol index 561e5a8f6..1200d624f 100644 --- a/src/interfaces/IMorpho.sol +++ b/src/interfaces/IMorpho.sol @@ -124,8 +124,7 @@ interface IMorphoBase { /// - A very high price returned by the oracle can make the computation of `maxBorrow` in `_isHealthy` overflow, or /// the computation of `assetsRepaid` in `liquidate` overflow. /// @dev The borrow share price of a market with less than 1e4 assets borrowed can be decreased by manipulations, to - /// the - /// point where `totalBorrowShares` is very large and borrowing overflows. + /// the point where `totalBorrowShares` is very large and borrowing overflows. function createMarket(MarketParams memory marketParams) external; /// @notice Supplies `assets` or `shares` on behalf of `onBehalf`, optionally calling back the caller's