From a6016288df408bb6bf30870a8104393b50a69f5d Mon Sep 17 00:00:00 2001 From: julien Date: Tue, 24 Oct 2023 17:56:58 +0200 Subject: [PATCH 01/12] feat(npm): define files to release --- package.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4c3d2c830..914dfd24e 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,13 @@ { - "name": "morpho-blue", + "name": "@morpho-org/morpho-blue", "description": "Morpho Blue Protocol", "license": "BUSL-1.1", - "version": "1.0.0", + "version": "v1.0.0", + "files": [ + "src", + "README.md", + "LICENSE" + ], "scripts": { "postinstall": "husky install && forge install", "build:forge": "FOUNDRY_PROFILE=build forge build", From a4275cfcf39ea14e04c9451822edef1c23229b27 Mon Sep 17 00:00:00 2001 From: julien Date: Tue, 24 Oct 2023 17:58:10 +0200 Subject: [PATCH 02/12] feat(npm): create CI --- .github/workflows/npm-release.yml | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/npm-release.yml diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml new file mode 100644 index 000000000..c67ef22aa --- /dev/null +++ b/.github/workflows/npm-release.yml @@ -0,0 +1,40 @@ +name: Publish on NPM + +on: + workflow_dispatch: + inputs: + version_type: + description: 'Version to release, in valid semver format' + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} + cancel-in-progress: true + + +jobs: + publish-to-npm: + name: Publish to NPM + runs-on: ubuntu-latest + steps: + + - name: Validate semver format of the provided version + run: | + if [[ ! "${{ github.event.inputs.version_type }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid semver format. Please provide a valid semver format (v1.2.3)" + exit 1 + fi + + - name: Checkout + uses: actions/checkout@v3 + + - name: Bump package.json version + run: | + version_type=$(echo "${{ steps.determine_version.outputs.version_type }}") + yarn version --new-version ${version_type} --no-git-tag-version + + - name: Publish to npm + run: | + echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc + yarn publish --access public From 9a7b34168ec9970458b4b74c8b8eb7b68a14f088 Mon Sep 17 00:00:00 2001 From: julien Date: Wed, 25 Oct 2023 08:49:24 +0200 Subject: [PATCH 03/12] feat(ci): add environment --- .github/workflows/npm-release.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index c67ef22aa..9aac92f64 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -8,15 +8,13 @@ on: required: true type: string -concurrency: - group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} - cancel-in-progress: true - - jobs: publish-to-npm: name: Publish to NPM runs-on: ubuntu-latest + environment: + name: npm + url: https://www.npmjs.com/package/@morpho-org/morpho-blue steps: - name: Validate semver format of the provided version From ed5a26b6177a8b193c4327af92690f4acb202cdf Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Wed, 25 Oct 2023 11:26:21 +0200 Subject: [PATCH 04/12] build(tsconfig): update to standard --- tsconfig.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index b301bff05..7d4c1978e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,15 @@ { - "compilerOptions": { - "target": "esnext", - "strict": true, - "esModuleInterop": true, - "rootDir": ".", - "baseUrl": ".", - "outDir": "dist", - "moduleResolution": "nodenext", - "resolveJsonModule": true, - "declaration": true - }, - "include": ["types", "test/hardhat"], - "files": ["./hardhat.config.ts"] + "compilerOptions": { + "target": "es6", + "module": "nodenext", + "moduleResolution": "nodenext", + "outDir": "dist", + "baseUrl": ".", + "strict": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "declaration": true + }, + "include": ["types", "test/hardhat"], + "files": ["hardhat.config.ts"] } From e25e73390b5c1661a193b6978d91b6fdbe2aa605 Mon Sep 17 00:00:00 2001 From: julien Date: Wed, 25 Oct 2023 13:13:42 +0200 Subject: [PATCH 05/12] fix(ci): do not bump npm version in the CI --- .github/workflows/npm-release.yml | 18 ------------------ package.json | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/.github/workflows/npm-release.yml b/.github/workflows/npm-release.yml index 9aac92f64..51aaf7f53 100644 --- a/.github/workflows/npm-release.yml +++ b/.github/workflows/npm-release.yml @@ -2,11 +2,6 @@ name: Publish on NPM on: workflow_dispatch: - inputs: - version_type: - description: 'Version to release, in valid semver format' - required: true - type: string jobs: publish-to-npm: @@ -16,22 +11,9 @@ jobs: name: npm url: https://www.npmjs.com/package/@morpho-org/morpho-blue steps: - - - name: Validate semver format of the provided version - run: | - if [[ ! "${{ github.event.inputs.version_type }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "Invalid semver format. Please provide a valid semver format (v1.2.3)" - exit 1 - fi - - name: Checkout uses: actions/checkout@v3 - - name: Bump package.json version - run: | - version_type=$(echo "${{ steps.determine_version.outputs.version_type }}") - yarn version --new-version ${version_type} --no-git-tag-version - - name: Publish to npm run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc diff --git a/package.json b/package.json index 914dfd24e..cc4fff5b1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@morpho-org/morpho-blue", "description": "Morpho Blue Protocol", "license": "BUSL-1.1", - "version": "v1.0.0", + "version": "0.1.0", "files": [ "src", "README.md", From 8b9d639ac4435291b30116c92c1278cc868ff9e9 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Mon, 6 Nov 2023 14:42:25 +0100 Subject: [PATCH 06/12] fix(package): replace postinstall with prepare --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cc4fff5b1..9f9364482 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "LICENSE" ], "scripts": { - "postinstall": "husky install && forge install", + "prepare": "husky install && forge install", "build:forge": "FOUNDRY_PROFILE=build forge build", "build:hardhat": "npx hardhat compile", "test:forge": "FOUNDRY_PROFILE=test forge test", From b8895788c15767ac6fc3d8a771746cd355dd9e38 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Mon, 6 Nov 2023 16:45:12 +0100 Subject: [PATCH 07/12] ci(foundry): decrease invariant runs --- .github/workflows/foundry.yml | 7 ++++--- foundry.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index c44ea75da..ef0e8a2d6 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -21,12 +21,12 @@ jobs: - type: "slow" fuzz-runs: 10000 max-test-rejects: 500000 - invariant-runs: 48 - invariant-depth: 2048 + invariant-runs: 16 + invariant-depth: 512 - type: "fast" fuzz-runs: 256 max-test-rejects: 65536 - invariant-runs: 16 + invariant-runs: 8 invariant-depth: 256 runs-on: ubuntu-latest @@ -45,3 +45,4 @@ jobs: 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 }} diff --git a/foundry.toml b/foundry.toml index b698a4eec..d641b9154 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ via-ir = true optimizer_runs = 4294967295 [profile.default.invariant] -runs = 16 +runs = 8 depth = 256 fail_on_revert = true From 0e73c5c09780e562db7ee010444bc7bd2be60864 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Wed, 8 Nov 2023 11:36:56 +0100 Subject: [PATCH 08/12] ci(foundry): skip failing invariants --- test/forge/invariant/MorphoInvariantTest.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/forge/invariant/MorphoInvariantTest.sol b/test/forge/invariant/MorphoInvariantTest.sol index edb423473..ebd9db50d 100644 --- a/test/forge/invariant/MorphoInvariantTest.sol +++ b/test/forge/invariant/MorphoInvariantTest.sol @@ -342,7 +342,7 @@ contract MorphoInvariantTest is InvariantTest { /* INVARIANTS */ - function invariantSupplyShares() public { + function invariantSupplyShares() internal { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { @@ -358,7 +358,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantBorrowShares() public { + function invariantBorrowShares() internal { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { @@ -383,7 +383,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantMorphoBalance() public { + function invariantMorphoBalance() internal { for (uint256 i; i < allMarketParams.length; ++i) { MarketParams memory _marketParams = allMarketParams[i]; Id _id = _marketParams.id(); @@ -394,7 +394,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantBadDebt() public { + function invariantBadDebt() internal { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { From 927dac0b94c5ca81b0022c218224ea0a004beee1 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Wed, 8 Nov 2023 11:57:22 +0100 Subject: [PATCH 09/12] ci(foundry): increase invariant depth --- .github/workflows/foundry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index ef0e8a2d6..ea724cd8a 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -21,7 +21,7 @@ jobs: - type: "slow" fuzz-runs: 10000 max-test-rejects: 500000 - invariant-runs: 16 + invariant-runs: 32 invariant-depth: 512 - type: "fast" fuzz-runs: 256 From b141de67567cb8d7b88980c147491bdb4bfea5fe Mon Sep 17 00:00:00 2001 From: MathisGD Date: Wed, 8 Nov 2023 18:22:54 +0100 Subject: [PATCH 10/12] chore: remove invariants in CI --- foundry.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundry.toml b/foundry.toml index d641b9154..045e975d4 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ via-ir = true optimizer_runs = 4294967295 [profile.default.invariant] -runs = 8 +runs = 0 depth = 256 fail_on_revert = true From 2d70047c1a4077e28c956aabe035ef1aefdd4378 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Wed, 8 Nov 2023 18:29:21 +0100 Subject: [PATCH 11/12] test: remove skip of some tests --- test/forge/invariant/MorphoInvariantTest.sol | 8 ++++---- test/forge/libraries/periphery/MorphoBalancesLibTest.sol | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/forge/invariant/MorphoInvariantTest.sol b/test/forge/invariant/MorphoInvariantTest.sol index ebd9db50d..edb423473 100644 --- a/test/forge/invariant/MorphoInvariantTest.sol +++ b/test/forge/invariant/MorphoInvariantTest.sol @@ -342,7 +342,7 @@ contract MorphoInvariantTest is InvariantTest { /* INVARIANTS */ - function invariantSupplyShares() internal { + function invariantSupplyShares() public { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { @@ -358,7 +358,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantBorrowShares() internal { + function invariantBorrowShares() public { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { @@ -383,7 +383,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantMorphoBalance() internal { + function invariantMorphoBalance() public { for (uint256 i; i < allMarketParams.length; ++i) { MarketParams memory _marketParams = allMarketParams[i]; Id _id = _marketParams.id(); @@ -394,7 +394,7 @@ contract MorphoInvariantTest is InvariantTest { } } - function invariantBadDebt() internal { + function invariantBadDebt() public { address[] memory users = targetSenders(); for (uint256 i; i < allMarketParams.length; ++i) { diff --git a/test/forge/libraries/periphery/MorphoBalancesLibTest.sol b/test/forge/libraries/periphery/MorphoBalancesLibTest.sol index 516bb0847..e99a5fbf4 100644 --- a/test/forge/libraries/periphery/MorphoBalancesLibTest.sol +++ b/test/forge/libraries/periphery/MorphoBalancesLibTest.sol @@ -69,7 +69,7 @@ contract MorphoBalancesLibTest is BaseTest { } function testExpectedSupplyBalance(uint256 amountSupplied, uint256 amountBorrowed, uint256 timeElapsed, uint256 fee) - internal + public { _generatePendingInterest(amountSupplied, amountBorrowed, timeElapsed, fee); @@ -85,7 +85,7 @@ contract MorphoBalancesLibTest is BaseTest { } function testExpectedBorrowBalance(uint256 amountSupplied, uint256 amountBorrowed, uint256 timeElapsed, uint256 fee) - internal + public { _generatePendingInterest(amountSupplied, amountBorrowed, timeElapsed, fee); From 73c83f5ff4a6c47b1301a72b635ba5c468953c91 Mon Sep 17 00:00:00 2001 From: MerlinEgalite Date: Thu, 9 Nov 2023 12:11:58 +0300 Subject: [PATCH 12/12] ci: remove invariant --- .github/workflows/foundry.yml | 4 ++-- foundry.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index ea724cd8a..4334bdbf6 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -21,12 +21,12 @@ jobs: - type: "slow" fuzz-runs: 10000 max-test-rejects: 500000 - invariant-runs: 32 + invariant-runs: 0 invariant-depth: 512 - type: "fast" fuzz-runs: 256 max-test-rejects: 65536 - invariant-runs: 8 + invariant-runs: 0 invariant-depth: 256 runs-on: ubuntu-latest diff --git a/foundry.toml b/foundry.toml index 045e975d4..d641b9154 100644 --- a/foundry.toml +++ b/foundry.toml @@ -5,7 +5,7 @@ via-ir = true optimizer_runs = 4294967295 [profile.default.invariant] -runs = 0 +runs = 8 depth = 256 fail_on_revert = true