Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test fixes post Aave3.2 #880

Merged
merged 55 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
db1c408
test: quick fixes to run v3.2 tests
QGarchery Oct 9, 2024
c270f26
fix: deal AAVE
QGarchery Oct 10, 2024
da7cd2f
chore: re-add AAVE
QGarchery Oct 10, 2024
f55417a
fix: changes to pool configurator
QGarchery Oct 10, 2024
f13147c
fix: bound in deposit correct amount
QGarchery Oct 10, 2024
2bde7ef
test: passing at 17M
MathisGD Oct 10, 2024
69db311
test: fix max aave balance
MathisGD Oct 12, 2024
a8c9ca4
test: don't call stableDebtToken
MathisGD Oct 12, 2024
ba92e8d
test: fix some more tests
MathisGD Oct 12, 2024
7094ffd
test: fix liquidity rounding issue
MathisGD Oct 13, 2024
616086b
fix: deal AAVE
QGarchery Oct 13, 2024
0c6d3ed
fix: warnings on pure/view functions
QGarchery Oct 13, 2024
952e646
fix: all view/pure visibility
QGarchery Oct 13, 2024
2c4fc43
chore: revert workflow change
QGarchery Oct 13, 2024
cc750d8
test: fix 2 rewards tests
MathisGD Oct 13, 2024
83f3fdf
test: remove aave token
MathisGD Oct 14, 2024
dfc02f2
test: higher rounding tolerance in testShouldWithdrawAllCollateral
MathisGD Oct 14, 2024
2754f2e
fix: bound deal for AAVE token
QGarchery Oct 14, 2024
c4d5bbc
chore: add back AAVE
QGarchery Oct 14, 2024
36700ce
test: fix invariantBalanceOf, morpho receiver of borrow
MathisGD Oct 14, 2024
be7d1f9
fix: underflow rewards computation
QGarchery Oct 14, 2024
b57d0f8
refactor: show failures in integration tests
QGarchery Oct 14, 2024
1520745
fix: end distribution, and reward list increase
QGarchery Oct 14, 2024
0d88a9a
fix: indexes in the unclaimed array
QGarchery Oct 14, 2024
dbce870
test: fix invariantCannotBorrowOverLtv
MathisGD Oct 14, 2024
c2a345e
Merge remote-tracking branch 'origin/test/aave-v3.2' into test/aave-v3.2
MathisGD Oct 14, 2024
af1a74c
chore: bump action versions
QGarchery Oct 14, 2024
e84eb4a
Merge pull request #885 from morpho-org/test/update-ci-dependencies
QGarchery Oct 14, 2024
4388b5b
fix: diminish block bounds
QGarchery Oct 14, 2024
9573434
fix: reduce timestamp in testSupplyWithPermit2
QGarchery Oct 14, 2024
4bf072c
fix: don't use USDT blacklisted addresses
QGarchery Oct 14, 2024
81fd1a5
chore: reduce number of fuzz runs
QGarchery Oct 15, 2024
0bcfdd7
chore: update CI to avoid cache failures
QGarchery Oct 15, 2024
30a9f53
chore: bump storage check version
QGarchery Oct 15, 2024
ef92f6e
chore: reduce runs on CI too
QGarchery Oct 15, 2024
e090c05
chore: really reduce runs on CI too
QGarchery Oct 15, 2024
7c1da30
chore: move IPoolConfigurator for now
QGarchery Oct 15, 2024
df5f6c9
fix: promote routine can round at every step
QGarchery Oct 15, 2024
6199e7f
test: change naming reward token
MathisGD Oct 15, 2024
7dbda1f
test: fix config issue
MathisGD Oct 16, 2024
b067cfe
fix: gas-report should be integration
QGarchery Oct 16, 2024
26139db
feat: revert fixes on source
MathisGD Oct 16, 2024
d180882
Merge remote-tracking branch 'origin/test/aave-v3.2' into test/aave-v3.2
MathisGD Oct 16, 2024
def2b56
refactor: only test added rewards
QGarchery Oct 16, 2024
ea781de
test: testShouldWithdrawAllP2PSupplyWhenDemotedZero
MathisGD Oct 16, 2024
18eedaf
Merge remote-tracking branch 'origin/test/aave-v3.2' into test/aave-v3.2
MathisGD Oct 16, 2024
39dc3a2
test: fix testShouldWithdrawP2PSupplyWhenBorrowCapExceededWithIdleSupply
MathisGD Oct 16, 2024
991e055
test: fuzz amount in testShouldWithdrawP2PSupplyWhenBorrowCapExceeded…
MathisGD Oct 17, 2024
4682aab
fix: assert promoter balances
QGarchery Oct 17, 2024
d8e86e9
fix: test withdraw idle amount
QGarchery Oct 17, 2024
adbad34
chore: evm build version paris
QGarchery Oct 17, 2024
dde9f1d
refactor: more view functions
QGarchery Oct 17, 2024
4b95237
test: bounds on WETH gateway
QGarchery Oct 17, 2024
fb7a3ba
chore: remove useless test struct
QGarchery Oct 17, 2024
f1fe940
chore: config change now triggers a CI run
QGarchery Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ runs:
using: composite

steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
Expand All @@ -15,7 +15,7 @@ runs:
version: nightly

- name: Restore forge compilation cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/forge-fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/forge-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ on:
internal-fuzz-runs:
description: The number of fuzz rounds to perform for each fuzzing unit test.
required: false
default: 64
default: 32
type: number
integration-fuzz-runs:
description: The number of fuzz rounds to perform for each fuzzing unit test.
required: false
default: 64
default: 32
type: number
invariant-runs:
description: The number of runs to perform for invariant tests.
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -72,7 +72,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -82,12 +82,12 @@ jobs:
run: forge build

- name: Save forge compilation cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
cache
out
key: forge-${{ github.ref_name }}
key: forge-${{ github.ref_name }}-${{ github.run_id }}

storage-check:
needs: build-no-ir
Expand All @@ -96,14 +96,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: ./.github/actions/install

- name: Check Morpho storage layout
uses: Rubilmax/foundry-storage-check@v3.4
uses: Rubilmax/foundry-storage-check@v3.7
with:
contract: src/Morpho.sol:Morpho
rpcUrl: wss://eth-mainnet.g.alchemy.com/v2/${{ secrets.ALCHEMY_KEY }}
Expand All @@ -117,7 +117,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -138,7 +138,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -159,7 +159,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down Expand Up @@ -187,7 +187,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand All @@ -214,7 +214,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
uses: ./.github/workflows/forge-test.yml
with:
network: ethereum-mainnet
internal-fuzz-runs: 128
integration-fuzz-runs: 128
invariant-depth: 1024
internal-fuzz-runs: 64
integration-fuzz-runs: 64
invariant-depth: 512
secrets: inherit
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
branch = v1.5.2
branch = 4f57c59f066a03d13de8c65bb34fca8247f5fcb2
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/Rari-Capital/solmate
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ install:
forge install

contracts:
FOUNDRY_TEST=/dev/null FOUNDRY_SCRIPT=/dev/null forge build --via-ir --extra-output-files irOptimized --sizes --force
FOUNDRY_PROFILE=build FOUNDRY_TEST=/dev/null FOUNDRY_SCRIPT=/dev/null forge build --via-ir --extra-output-files irOptimized --sizes --force


test-invariant:
Expand Down Expand Up @@ -80,7 +80,7 @@ lcov-html:
genhtml lcov.info -o coverage

gas-report:
forge test --match-contract TestIntegration --gas-report
@FORGE_GAS_REPORT=true make test-integration

deploy-emode-%:
FOUNDRY_TEST=/dev/null forge script script/$*/EthEModeDeploy.s.sol:EthEModeDeploy --via-ir --broadcast --slow -vvvvv --rpc-url mainnet --ledger
Expand Down
19 changes: 10 additions & 9 deletions config/ConfigLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ library ConfigLib {
string internal constant MORPHO_DAO_PATH = "$.morphoDao";
string internal constant MORPHO_ETH_PATH = "$.morphoEth";

function getAddress(Config storage config, string memory key) internal returns (address) {
function getAddress(Config storage config, string memory key) internal view returns (address) {
return config.json.readAddress(string.concat("$.", key));
}

function getAddressArray(Config storage config, string[] memory keys)
internal
view
returns (address[] memory addresses)
{
addresses = new address[](keys.length);
Expand All @@ -35,35 +36,35 @@ library ConfigLib {
}
}

function getChainId(Config storage config) internal returns (uint256) {
function getChainId(Config storage config) internal view returns (uint256) {
return config.json.readUint(CHAIN_ID_PATH);
}

function getRpcAlias(Config storage config) internal returns (string memory) {
function getRpcAlias(Config storage config) internal view returns (string memory) {
return config.json.readString(RPC_ALIAS_PATH);
}

function getForkBlockNumber(Config storage config) internal returns (uint256) {
function getForkBlockNumber(Config storage config) internal view returns (uint256) {
return config.json.readUint(FORK_BLOCK_NUMBER_PATH);
}

function getAddressesProvider(Config storage config) internal returns (address) {
function getAddressesProvider(Config storage config) internal view returns (address) {
return config.json.readAddress(ADDRESSES_PROVIDER_PATH);
}

function getMorphoDao(Config storage config) internal returns (address) {
function getMorphoDao(Config storage config) internal view returns (address) {
return config.json.readAddress(MORPHO_DAO_PATH);
}

function getMorphoEth(Config storage config) internal returns (address) {
function getMorphoEth(Config storage config) internal view returns (address) {
return config.json.readAddress(MORPHO_ETH_PATH);
}

function getWrappedNative(Config storage config) internal returns (address) {
function getWrappedNative(Config storage config) internal view returns (address) {
return getAddress(config, config.json.readString(WRAPPED_NATIVE_PATH));
}

function getLsdNatives(Config storage config) internal returns (address[] memory) {
function getLsdNatives(Config storage config) internal view returns (address[] memory) {
return getAddressArray(config, config.json.readStringArray(LSD_NATIVES_PATH));
}
}
34 changes: 16 additions & 18 deletions config/avalanche-mainnet.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
{
"chainId": 43114,
"rpcAlias": "avalanche",
"forkBlockNumber": 24800000,
"addressesProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
"morphoDao": "0x0000000000000000000000000000000000000000",
"DAI": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
"USDC": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
"USDT": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
"AAVE": "0x63a72806098Bd3D9520cC43356dD78afe5D386D9",
"LINK": "0x5947BB275c521040051D82396192181b413227A3",
"WAVAX": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
"WBTC": "0x50b7545627a5162F82A992c33b87aDc75187B218",
"WETH": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
"sAVAX": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE",
"wrappedNative": "WAVAX",
"lsdNatives": [
"sAVAX"
]
"chainId": 43114,
"rpcAlias": "avalanche",
"forkBlockNumber": 24800000,
"addressesProvider": "0xa97684ead0e402dC232d5A977953DF7ECBaB3CDb",
"morphoDao": "0x0000000000000000000000000000000000000000",
"DAI": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
"USDC": "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
"USDT": "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
"AAVE": "0x63a72806098Bd3D9520cC43356dD78afe5D386D9",
"LINK": "0x5947BB275c521040051D82396192181b413227A3",
"WAVAX": "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
"WBTC": "0x50b7545627a5162F82A992c33b87aDc75187B218",
"WETH": "0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",
"sAVAX": "0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE",
"wrappedNative": "WAVAX",
"lsdNatives": ["sAVAX"]
}
40 changes: 18 additions & 22 deletions config/ethereum-mainnet.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
{
"chainId": 1,
"rpcAlias": "mainnet",
"forkBlockNumber": 16841312,
QGarchery marked this conversation as resolved.
Show resolved Hide resolved
"addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e",
"morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa",
"morphoEth": "0x33333aea097c193e66081E930c33020272b33333",
"DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"AAVE": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"LINK": "0x514910771AF9Ca656af840dff83E8264EcF986CA",
"WBTC": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"wstETH": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704",
"rETH": "0xae78736Cd615f374D3085123A210448E74Fc6393",
"wrappedNative": "WETH",
"lsdNatives": [
"wstETH",
"cbETH",
"rETH"
]
"chainId": 1,
"rpcAlias": "mainnet",
"forkBlockNumber": 0,
"addressesProvider": "0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e",
"morphoDao": "0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa",
"morphoEth": "0x33333aea097c193e66081E930c33020272b33333",
"DAI": "0x6B175474E89094C44Da98b954EedeAC495271d0F",
"USDC": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"AAVE": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"LINK": "0x514910771AF9Ca656af840dff83E8264EcF986CA",
"WBTC": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",
"WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"wstETH": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"cbETH": "0xBe9895146f7AF43049ca1c1AE358B0541Ea49704",
"rETH": "0xae78736Cd615f374D3085123A210448E74Fc6393",
"wrappedNative": "WETH",
"lsdNatives": ["wstETH", "cbETH", "rETH"]
}
5 changes: 5 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ names = true
sizes = true
libs = ["node_modules", "lib"]
fs_permissions = [{ access = "read", path = "./config/"}]
gas_limit = "18446744073709551615" # 2^64 - 1, to remove the gas limit
evm_version = "shanghai"
QGarchery marked this conversation as resolved.
Show resolved Hide resolved

[profile.build]
evm_version = "paris"

[fuzz]
runs = 32
Expand Down
2 changes: 1 addition & 1 deletion script/eth-mainnet/EthEModeDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ contract EthEModeDeploy is Script, Test, Configured {
morpho.setIsBorrowPaused(wbtc, true);
}

function _checkAssertions() internal {
function _checkAssertions() internal view {
assertEq(pool.getUserEMode(address(morpho)), E_MODE_CATEGORY_ID);

assertFalse(morpho.market(weth).pauseStatuses.isSupplyPaused);
Expand Down
2 changes: 1 addition & 1 deletion script/eth-mainnet/PauseFlags.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ contract PauseFlags is Script, Test, Configured {
MORPHO.setIsP2PDisabled(wbtc, true);
}

function _checkAssertions() internal {
function _checkAssertions() internal view {
assertTrue(MORPHO.market(wstEth).pauseStatuses.isRepayPaused);
assertTrue(MORPHO.market(dai).pauseStatuses.isRepayPaused);
assertTrue(MORPHO.market(usdc).pauseStatuses.isRepayPaused);
Expand Down
2 changes: 1 addition & 1 deletion script/eth-mainnet/TransferOwnership.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract TransferOwnership is Script, Test, Configured {
ProxyAdmin(CURRENT_PROXY_ADMIN).changeProxyAdmin(TransparentUpgradeableProxy(payable(MORPHO)), DAO_PROXY_ADMIN);
}

function _checkAssertions() internal {
function _checkAssertions() internal view {
assertEq(Ownable2StepUpgradeable(MORPHO).owner(), MORPHO_DAO);
assertEq(
ProxyAdmin(DAO_PROXY_ADMIN).getProxyAdmin(TransparentUpgradeableProxy(payable(MORPHO))), DAO_PROXY_ADMIN
Expand Down
Loading
Loading