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

refactor(test): decouple integration test solidity pragma #40

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 4 additions & 52 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
out
key: forge-${{ github.ref_name }}

test-local:
test:
needs: build-no-ir

name: Local tests
name: Tests
runs-on: ubuntu-latest

strategy:
Expand Down Expand Up @@ -105,59 +105,11 @@ jobs:

- uses: ./.github/actions/install-cache

- name: Run local tests in ${{ matrix.type }} mode
run: yarn test:forge:local
- name: Run tests in ${{ matrix.type }} mode
run: yarn test:forge
env:
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }}
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }}
FOUNDRY_INVARIANT_RUNS: ${{ matrix.invariant-runs }}
FOUNDRY_INVARIANT_DEPTH: ${{ matrix.invariant-depth }}
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}

test-mainnet:
needs: build-no-ir

name: Ethereum tests
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
type: ["slow", "fast"]
include:
- type: "slow"
fuzz-runs: 1024
max-test-rejects: 65536
invariant-runs: 64
invariant-depth: 1024
- type: "fast"
fuzz-runs: 256
max-test-rejects: 65536
invariant-runs: 16
invariant-depth: 256

steps:
- name: Generate a token
id: generate-token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ steps.generate-token.outputs.token }}
submodules: recursive

- uses: ./.github/actions/install-cache

- name: Run mainnet tests in ${{ matrix.type }} mode
run: yarn test:forge:mainnet
env:
ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }}
FOUNDRY_FUZZ_RUNS: ${{ matrix.fuzz-runs }}
FOUNDRY_FUZZ_MAX_TEST_REJECTS: ${{ matrix.max-test-rejects }}
FOUNDRY_INVARIANT_RUNS: ${{ matrix.invariant-runs }}
FOUNDRY_INVARIANT_DEPTH: ${{ matrix.invariant-depth }}
FOUNDRY_FUZZ_SEED: 0x${{ github.event.pull_request.base.sha || github.sha }}
2 changes: 1 addition & 1 deletion contracts/SupplyVault.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.19;
pragma solidity 0.8.21;

import {IMorphoMarketParams} from "./interfaces/IMorphoMarketParams.sol";
import {MarketAllocation, Pending, ISupplyVault} from "./interfaces/ISupplyVault.sol";
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@
"scripts": {
"prepare": "husky install",
"postinstall": "forge install",
"build:ts": "yarn build:hardhat && tsc --build ./tsconfig.build.json",
"build:ts": "tsc --build ./tsconfig.build.json",
"build:forge": "FOUNDRY_PROFILE=build forge build",
"build:hardhat": "npx hardhat compile",
"build:blue": "cd lib/morpho-blue/ && yarn build:forge && cd ../..",
"typecheck": "tsc --noEmit",
"test:forge": "yarn build:blue && FOUNDRY_PROFILE=test forge test",
"test:forge:local": "FOUNDRY_MATCH_CONTRACT=LocalTest yarn test:forge",
"test:forge:mainnet": "FOUNDRY_MATCH_CONTRACT=EthereumTest yarn test:forge",
"test:hardhat": "yarn build:blue && npx hardhat test",
"lint": "yarn lint:forge && yarn lint:ts",
"lint:ts": "prettier --check src test/hardhat",
Expand Down
126 changes: 0 additions & 126 deletions test/forge/BaseTest.sol

This file was deleted.

2 changes: 1 addition & 1 deletion test/forge/MarketTest.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import "./BaseTest.sol";
import "./helpers/BaseTest.sol";

contract MarketTest is BaseTest {
using MarketParamsLib for MarketParams;
Expand Down
2 changes: 1 addition & 1 deletion test/forge/RoleTest.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import "./BaseTest.sol";
import "./helpers/BaseTest.sol";

contract RoleTest is BaseTest {
using MarketParamsLib for MarketParams;
Expand Down
3 changes: 2 additions & 1 deletion test/forge/TimelockTest.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import "./BaseTest.sol";
import "./helpers/BaseTest.sol";

contract TimelockTest is BaseTest {
function testSubmitPendingTimelock(uint256 timelock) public {
Expand Down
Loading