From a601b0f7be7ba8889734985526713c00b4c5474a Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 18:15:04 +0200 Subject: [PATCH 01/13] test: create and use virtual testnet --- config/ethereum-mainnet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ethereum-mainnet.json b/config/ethereum-mainnet.json index a49833f5..fdab89bf 100644 --- a/config/ethereum-mainnet.json +++ b/config/ethereum-mainnet.json @@ -1,6 +1,6 @@ { "chainId": 1, - "rpcAlias": "mainnet", + "rpcAlias": "https://virtual.mainnet.eu.rpc.tenderly.co/0fdfd01a-70fd-4d9b-b777-ceec2be2333a", "forkBlockNumber": 0, "addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e", "morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa", From a0511f60d1115746a779ac2b59d08f56490a9e4f Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 18:39:59 +0200 Subject: [PATCH 02/13] test: check revision --- test/helpers/ForkTest.sol | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/helpers/ForkTest.sol b/test/helpers/ForkTest.sol index b74bb926..53850ff4 100644 --- a/test/helpers/ForkTest.sol +++ b/test/helpers/ForkTest.sol @@ -274,4 +274,11 @@ contract ForkTest is BaseTest, Configured { function _randomLsdNative(uint256 seed) internal view returns (address) { return lsdNatives[seed % lsdNatives.length]; } + + function testPoolRevision() public view { + (bool success, bytes memory data) = address(pool).staticcall(abi.encodeWithSignature("POOL_REVISION()", hex"")); + uint256 fetchedRevision = abi.decode(data, (uint256)); + assertTrue(success, "pool revision failed"); + assertEq(fetchedRevision, 9, "wrong revision"); + } } From 4fed6367e98712f637ffdab0d6c9ca8754644439 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 18:53:18 +0200 Subject: [PATCH 03/13] refactor: move pool revision test --- test/helpers/ForkTest.sol | 7 ------- test/integration/TestIntegrationMorphoGetters.sol | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/helpers/ForkTest.sol b/test/helpers/ForkTest.sol index 53850ff4..b74bb926 100644 --- a/test/helpers/ForkTest.sol +++ b/test/helpers/ForkTest.sol @@ -274,11 +274,4 @@ contract ForkTest is BaseTest, Configured { function _randomLsdNative(uint256 seed) internal view returns (address) { return lsdNatives[seed % lsdNatives.length]; } - - function testPoolRevision() public view { - (bool success, bytes memory data) = address(pool).staticcall(abi.encodeWithSignature("POOL_REVISION()", hex"")); - uint256 fetchedRevision = abi.decode(data, (uint256)); - assertTrue(success, "pool revision failed"); - assertEq(fetchedRevision, 9, "wrong revision"); - } } diff --git a/test/integration/TestIntegrationMorphoGetters.sol b/test/integration/TestIntegrationMorphoGetters.sol index a80d700f..fa751077 100644 --- a/test/integration/TestIntegrationMorphoGetters.sol +++ b/test/integration/TestIntegrationMorphoGetters.sol @@ -100,4 +100,11 @@ contract TestIntegrationMorphoGetters is IntegrationTest { uint256 premiumToProtocol = pool.FLASHLOAN_PREMIUM_TOTAL(); assertEq(premiumToProtocol, premiumTotal, "all premium goes to protocol"); } + + function testPoolRevision() public view { + (bool success, bytes memory data) = address(pool).staticcall(abi.encodeWithSignature("POOL_REVISION()", hex"")); + uint256 fetchedRevision = abi.decode(data, (uint256)); + assertTrue(success, "pool revision failed"); + assertEq(fetchedRevision, 9, "wrong revision"); + } } From 3d5a804dea0fc2ceb3b4c1e8fe9c1aaa3d903018 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 19:01:01 +0200 Subject: [PATCH 04/13] fix: setup proper rpc with payload executed --- config/ethereum-mainnet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ethereum-mainnet.json b/config/ethereum-mainnet.json index fdab89bf..0672decb 100644 --- a/config/ethereum-mainnet.json +++ b/config/ethereum-mainnet.json @@ -1,6 +1,6 @@ { "chainId": 1, - "rpcAlias": "https://virtual.mainnet.eu.rpc.tenderly.co/0fdfd01a-70fd-4d9b-b777-ceec2be2333a", + "rpcAlias": "https://virtual.mainnet.eu.rpc.tenderly.co/eec068de-e13d-4185-b442-eec8a7ac5a45", "forkBlockNumber": 0, "addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e", "morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa", From 3b9bf1d3071bf9bcb3bfce0aaf5470104730e4b1 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 19:15:09 +0200 Subject: [PATCH 05/13] fix: use cancun evm version --- foundry.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index f9eff6ea..4bde07e1 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,7 +4,7 @@ sizes = true libs = ["node_modules", "lib"] fs_permissions = [{ access = "read", path = "./config/" }] gas_limit = "18446744073709551615" -evm_version = "shanghai" +evm_version = "cancun" optimizer = true optimizer_runs = 200 From 070978f7af632f742430d0f2990aa1012d3d2b3b Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 19:35:26 +0200 Subject: [PATCH 06/13] fix: increase some deltas by 1 --- test/integration/TestIntegrationBorrow.sol | 4 ++-- test/integration/TestIntegrationPoolLib.sol | 6 +++--- test/integration/TestIntegrationRepay.sol | 8 ++++---- test/integration/TestIntegrationSupply.sol | 4 ++-- test/integration/TestIntegrationWithdraw.sol | 2 +- test/internal/TestInternalMorphoInternal.sol | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/test/integration/TestIntegrationBorrow.sol b/test/integration/TestIntegrationBorrow.sol index 3a41014d..9636abf9 100644 --- a/test/integration/TestIntegrationBorrow.sol +++ b/test/integration/TestIntegrationBorrow.sol @@ -46,7 +46,7 @@ contract TestIntegrationBorrow is IntegrationTest { assertApproxEqDust(morpho.borrowBalance(market.underlying, onBehalf), amount, "borrow != amount"); // Assert Morpho's position on pool. - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 2, "morphoVariableBorrow != amount"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 3, "morphoVariableBorrow != amount"); // Assert receiver's underlying balance. assertEq( @@ -97,7 +97,7 @@ contract TestIntegrationBorrow is IntegrationTest { ); // Assert Morpho's position on pool. - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); // Assert receiver's underlying balance. assertEq( diff --git a/test/integration/TestIntegrationPoolLib.sol b/test/integration/TestIntegrationPoolLib.sol index 4cf182fc..616e670e 100644 --- a/test/integration/TestIntegrationPoolLib.sol +++ b/test/integration/TestIntegrationPoolLib.sol @@ -38,7 +38,7 @@ contract TestIntegrationPoolLibSupply is TestIntegrationPoolLib { pool.supplyToPool(dai, amount, pool.getReserveNormalizedIncome(dai)); assertEq(ERC20(dai).balanceOf(address(this)) + amount, balanceBefore, "balance"); - assertApproxEqAbs(ERC20(aDai).balanceOf(address(this)), aBalanceBefore + amount, 1, "aBalance"); + assertApproxEqAbs(ERC20(aDai).balanceOf(address(this)), aBalanceBefore + amount, 2, "aBalance"); } } @@ -59,7 +59,7 @@ contract TestIntegrationPoolLibBorrow is TestIntegrationPoolLib { pool.borrowFromPool(dai, amount / 2); assertEq(ERC20(dai).balanceOf(address(this)), balanceBefore + amount / 2, "balance"); - assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)), vBalanceBefore + amount / 2, 1, "vBalance"); + assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)), vBalanceBefore + amount / 2, 2, "vBalance"); } } @@ -83,7 +83,7 @@ contract TestIntegrationPoolLibRepay is TestIntegrationPoolLib { pool.repayToPool(dai, vDai, amount / 4); assertEq(ERC20(dai).balanceOf(address(this)) + amount / 4, balanceBefore, "balance"); - assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)) + amount / 4, vBalanceBefore, 1, "vBalance"); + assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)) + amount / 4, vBalanceBefore, 2, "vBalance"); } } diff --git a/test/integration/TestIntegrationRepay.sol b/test/integration/TestIntegrationRepay.sol index 295af66a..c4e8854e 100644 --- a/test/integration/TestIntegrationRepay.sol +++ b/test/integration/TestIntegrationRepay.sol @@ -71,7 +71,7 @@ contract TestIntegrationRepay is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 2, "morphoSupply != morphoSupplyBefore" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxEqAbs( @@ -154,7 +154,7 @@ contract TestIntegrationRepay is IntegrationTest { 3, "morphoSupply != morphoSupplyBefore + promoted" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxLeAbs( @@ -238,7 +238,7 @@ contract TestIntegrationRepay is IntegrationTest { 1, "morphoSupply != morphoSupplyBefore + supplyGapBefore" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0"); assertApproxEqDust(_supplyGap(market), 0, "supplyGapAfter != 0"); // Assert user's underlying balance. @@ -325,7 +325,7 @@ contract TestIntegrationRepay is IntegrationTest { assertApproxEqAbs( morphoSupply, test.morphoSupplyBefore + test.borrowed, 2, "morphoSupply != morphoSupplyBefore + borrowed" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxEqAbs( diff --git a/test/integration/TestIntegrationSupply.sol b/test/integration/TestIntegrationSupply.sol index 41178b3b..fd699ab5 100644 --- a/test/integration/TestIntegrationSupply.sol +++ b/test/integration/TestIntegrationSupply.sol @@ -105,7 +105,7 @@ contract TestIntegrationSupply is IntegrationTest { assertApproxGeAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 3, "morphoSupplyAfter != morphoSupplyBefore" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxEqAbs( @@ -212,7 +212,7 @@ contract TestIntegrationSupply is IntegrationTest { test = _assertSupplyPool(market, amount, onBehalf, test); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 1, "morphoVariableBorrow != amount"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 2, "morphoVariableBorrow != amount"); _assertMarketAccountingZero(test.morphoMarket); } diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index 0b0aa435..6cf492f2 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -74,7 +74,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 2, "morphoSupply != morphoSupplyBefore" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); // Assert receiver's underlying balance. assertApproxEqAbs( diff --git a/test/internal/TestInternalMorphoInternal.sol b/test/internal/TestInternalMorphoInternal.sol index 8abf8812..bbf2b483 100644 --- a/test/internal/TestInternalMorphoInternal.sol +++ b/test/internal/TestInternalMorphoInternal.sol @@ -161,7 +161,7 @@ contract TestInternalMorphoInternal is InternalTest { assertApproxEqAbs( variableDebtTokenBalanceBefore + expectedAmount, ERC20(market.variableDebtToken).balanceOf(address(this)), - 1, + 2, "variable debt token balance" ); assertEq(deltas.supply.scaledDelta, newExpectedSupplyDelta, "supply delta"); From 3f0d1b28158919f0505ca5becc675c4a12da170d Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 19:42:46 +0200 Subject: [PATCH 07/13] fix: more delta increase --- test/integration/TestIntegrationWithdraw.sol | 2 +- test/internal/TestInternalMorphoInternal.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index 6cf492f2..d53bccd4 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -363,7 +363,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 1, "morphoSupply != morphoSupplyBefore" ); - assertApproxEqAbs(morphoVariableBorrow, test.supplied, 2, "morphoVariableBorrow != supplied"); + assertApproxEqAbs(morphoVariableBorrow, test.supplied, 3, "morphoVariableBorrow != supplied"); // Assert user's underlying balance. assertApproxLeAbs( diff --git a/test/internal/TestInternalMorphoInternal.sol b/test/internal/TestInternalMorphoInternal.sol index bbf2b483..e27d8be0 100644 --- a/test/internal/TestInternalMorphoInternal.sol +++ b/test/internal/TestInternalMorphoInternal.sol @@ -156,7 +156,7 @@ contract TestInternalMorphoInternal is InternalTest { this.increaseP2PDeltasTest(underlying, amount); assertApproxEqAbs( - aTokenBalanceBefore + expectedAmount, ERC20(market.aToken).balanceOf(address(this)), 1, "aToken balance" + aTokenBalanceBefore + expectedAmount, ERC20(market.aToken).balanceOf(address(this)), 2, "aToken balance" ); assertApproxEqAbs( variableDebtTokenBalanceBefore + expectedAmount, From 760ba6596d3a6bf4dc93eb91fb970b84763ed23d Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 23:39:12 +0200 Subject: [PATCH 08/13] fix: delta variable borrow to 4 --- test/integration/TestIntegrationWithdraw.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index d53bccd4..2417e067 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -263,7 +263,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 1, "morphoSupply != morphoSupplyBefore" ); - assertApproxGeAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); + assertApproxGeAbs(market.variableBorrowOf(address(morpho)), 0, 4, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxLeAbs( From b4e66e2c1dd9d7969fba00108b27cc5265e1a38d Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 5 Aug 2025 23:55:04 +0200 Subject: [PATCH 09/13] fix: one more rounding delta --- src/PositionsManager.sol | 3 +++ test/integration/TestIntegrationLiquidate.sol | 12 ++++++++++++ test/integration/TestIntegrationWithdraw.sol | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/PositionsManager.sol b/src/PositionsManager.sol index 42b76216..00d8a4a2 100644 --- a/src/PositionsManager.sol +++ b/src/PositionsManager.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.17; +import "forge-std/console.sol"; import {IPool} from "@aave-v3-core/interfaces/IPool.sol"; import {IPositionsManager} from "./interfaces/IPositionsManager.sol"; @@ -260,7 +261,9 @@ contract PositionsManager is IPositionsManager, PositionsManagerInternal { ); _pool.repayToPool(underlyingBorrowed, _market[underlyingBorrowed].variableDebtToken, repayVars.toRepay); + console.log("before supply"); _pool.supplyToPool(underlyingBorrowed, repayVars.toSupply, borrowIndexes.supply.poolIndex); + console.log("after supply"); _pool.withdrawFromPool(underlyingCollateral, _market[underlyingCollateral].aToken, vars.seized); ERC20(underlyingCollateral).safeTransfer(liquidator, vars.seized); diff --git a/test/integration/TestIntegrationLiquidate.sol b/test/integration/TestIntegrationLiquidate.sol index ebfdc86e..86edd3a1 100644 --- a/test/integration/TestIntegrationLiquidate.sol +++ b/test/integration/TestIntegrationLiquidate.sol @@ -183,6 +183,18 @@ contract TestIntegrationLiquidate is IntegrationTest { user.liquidate(borrowedMarket.underlying, collateralMarket.underlying, borrower, toRepay); } + function testSimple() public { + testFullLiquidateUnhealthyUserWhenSentinelDisallowsButHealthFactorVeryLow( + 148781269303923, + 37144597616483937449086105006138368083, + 0x3eDA3Fd76DF776Ac2B7dAA807f67E98A84B0337e, + 0, + 19890, + 149277332045977176825554090418223558553869621238539350701936287769979, + 6953 + ); + } + function testFullLiquidateUnhealthyUserWhenSentinelDisallowsButHealthFactorVeryLow( uint256 collateralSeed, uint256 borrowableSeed, diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index 2417e067..46e85b56 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -379,7 +379,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( test.morphoMarket.deltas.borrow.scaledDelta.rayMul(test.indexes.borrow.poolIndex), morphoVariableBorrow, - 2, + 3, "borrowDelta != morphoVariableBorrow" ); assertApproxEqAbs( From 28978afa5a04cdfac7fbb5f754fa976df80ac9c7 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Wed, 6 Aug 2025 10:35:01 +0200 Subject: [PATCH 10/13] chore: remove debugging traces --- src/PositionsManager.sol | 3 --- test/integration/TestIntegrationLiquidate.sol | 12 ------------ 2 files changed, 15 deletions(-) diff --git a/src/PositionsManager.sol b/src/PositionsManager.sol index 00d8a4a2..42b76216 100644 --- a/src/PositionsManager.sol +++ b/src/PositionsManager.sol @@ -1,7 +1,6 @@ // SPDX-License-Identifier: AGPL-3.0-only pragma solidity ^0.8.17; -import "forge-std/console.sol"; import {IPool} from "@aave-v3-core/interfaces/IPool.sol"; import {IPositionsManager} from "./interfaces/IPositionsManager.sol"; @@ -261,9 +260,7 @@ contract PositionsManager is IPositionsManager, PositionsManagerInternal { ); _pool.repayToPool(underlyingBorrowed, _market[underlyingBorrowed].variableDebtToken, repayVars.toRepay); - console.log("before supply"); _pool.supplyToPool(underlyingBorrowed, repayVars.toSupply, borrowIndexes.supply.poolIndex); - console.log("after supply"); _pool.withdrawFromPool(underlyingCollateral, _market[underlyingCollateral].aToken, vars.seized); ERC20(underlyingCollateral).safeTransfer(liquidator, vars.seized); diff --git a/test/integration/TestIntegrationLiquidate.sol b/test/integration/TestIntegrationLiquidate.sol index 86edd3a1..ebfdc86e 100644 --- a/test/integration/TestIntegrationLiquidate.sol +++ b/test/integration/TestIntegrationLiquidate.sol @@ -183,18 +183,6 @@ contract TestIntegrationLiquidate is IntegrationTest { user.liquidate(borrowedMarket.underlying, collateralMarket.underlying, borrower, toRepay); } - function testSimple() public { - testFullLiquidateUnhealthyUserWhenSentinelDisallowsButHealthFactorVeryLow( - 148781269303923, - 37144597616483937449086105006138368083, - 0x3eDA3Fd76DF776Ac2B7dAA807f67E98A84B0337e, - 0, - 19890, - 149277332045977176825554090418223558553869621238539350701936287769979, - 6953 - ); - } - function testFullLiquidateUnhealthyUserWhenSentinelDisallowsButHealthFactorVeryLow( uint256 collateralSeed, uint256 borrowableSeed, From 627c3cbeabc6e4bb5e0e3ae3bfe0ae3759fdf4c4 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Wed, 6 Aug 2025 11:47:45 +0200 Subject: [PATCH 11/13] fix: few more deltas --- test/integration/TestIntegrationSupply.sol | 4 ++-- test/integration/TestIntegrationWithdraw.sol | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/integration/TestIntegrationSupply.sol b/test/integration/TestIntegrationSupply.sol index fd699ab5..8d8742c1 100644 --- a/test/integration/TestIntegrationSupply.sol +++ b/test/integration/TestIntegrationSupply.sol @@ -52,7 +52,7 @@ contract TestIntegrationSupply is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore + amount, - 1, + 2, "morphoSupply != morphoSupplyBefore + amount" ); @@ -105,7 +105,7 @@ contract TestIntegrationSupply is IntegrationTest { assertApproxGeAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 3, "morphoSupplyAfter != morphoSupplyBefore" ); - assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0"); + assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 4, "morphoVariableBorrow != 0"); // Assert user's underlying balance. assertApproxEqAbs( diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index 46e85b56..c4a795a3 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -363,7 +363,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( market.supplyOf(address(morpho)), test.morphoSupplyBefore, 1, "morphoSupply != morphoSupplyBefore" ); - assertApproxEqAbs(morphoVariableBorrow, test.supplied, 3, "morphoVariableBorrow != supplied"); + assertApproxEqAbs(morphoVariableBorrow, test.supplied, 4, "morphoVariableBorrow != supplied"); // Assert user's underlying balance. assertApproxLeAbs( From 66dbc3a71031034d12329d54c018f923d3408593 Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Wed, 6 Aug 2025 17:26:47 +0200 Subject: [PATCH 12/13] fix: delta variable borrow --- test/integration/TestIntegrationWithdraw.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/TestIntegrationWithdraw.sol b/test/integration/TestIntegrationWithdraw.sol index c4a795a3..7e21bdde 100644 --- a/test/integration/TestIntegrationWithdraw.sol +++ b/test/integration/TestIntegrationWithdraw.sol @@ -379,7 +379,7 @@ contract TestIntegrationWithdraw is IntegrationTest { assertApproxEqAbs( test.morphoMarket.deltas.borrow.scaledDelta.rayMul(test.indexes.borrow.poolIndex), morphoVariableBorrow, - 3, + 4, "borrowDelta != morphoVariableBorrow" ); assertApproxEqAbs( From d6d346dee6467f8cd10306129257996e41edd45a Mon Sep 17 00:00:00 2001 From: Quentin Garchery Date: Tue, 7 Oct 2025 13:09:09 +0200 Subject: [PATCH 13/13] chore: move back to main RPC --- config/ethereum-mainnet.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ethereum-mainnet.json b/config/ethereum-mainnet.json index 0672decb..a49833f5 100644 --- a/config/ethereum-mainnet.json +++ b/config/ethereum-mainnet.json @@ -1,6 +1,6 @@ { "chainId": 1, - "rpcAlias": "https://virtual.mainnet.eu.rpc.tenderly.co/eec068de-e13d-4185-b442-eec8a7ac5a45", + "rpcAlias": "mainnet", "forkBlockNumber": 0, "addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e", "morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa",