Skip to content

Commit

Permalink
Merge pull request #880 from morpho-org/test/aave-v3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD authored Oct 20, 2024
2 parents 328a4ce + f1fe940 commit 2c92c69
Show file tree
Hide file tree
Showing 48 changed files with 724 additions and 300 deletions.
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
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths:
- .github/actions/**
- .github/workflows/**
- config/**
- lib/**
- src/**
- test/**
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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,
"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"

[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

0 comments on commit 2c92c69

Please sign in to comment.