diff --git a/.github/workflows/certora.yml b/.github/workflows/certora.yml index 87c24b282..ff5e30e51 100644 --- a/.github/workflows/certora.yml +++ b/.github/workflows/certora.yml @@ -13,9 +13,8 @@ jobs: steps: - uses: actions/checkout@v3 - - - name: Install submodules - run: git submodule update --init --recursive + with: + submodules: recursive - name: Install python uses: actions/setup-python@v4 @@ -23,18 +22,18 @@ jobs: python-version: "3.10" - name: Install certora - run: pip install certora-cli + run: pip install certora-cli-beta - name: Install solc run: | - wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux + wget https://github.com/ethereum/solidity/releases/download/v0.8.21/solc-static-linux chmod +x solc-static-linux - sudo mv solc-static-linux /usr/local/bin/solc8.19 + sudo mv solc-static-linux /usr/local/bin/solc8.21 - name: Verify rule ${{ matrix.script }} run: | echo "key length" ${#CERTORAKEY} - bash certora/scripts/${{ matrix.script }} --solc solc8.19 + bash certora/scripts/${{ matrix.script }} --solc solc8.21 env: CERTORAKEY: ${{ secrets.CERTORAKEY }} diff --git a/certora/harness/MorphoHarness.sol b/certora/harness/MorphoHarness.sol index 1a0f1fe40..6114bcd7c 100644 --- a/certora/harness/MorphoHarness.sol +++ b/certora/harness/MorphoHarness.sol @@ -1,4 +1,4 @@ -pragma solidity 0.8.19; +pragma solidity 0.8.21; import "../../src/Morpho.sol"; import "../../src/libraries/SharesMathLib.sol"; diff --git a/certora/specs/Blue.spec b/certora/specs/Blue.spec index ca5681e5d..69e5408d5 100644 --- a/certora/specs/Blue.spec +++ b/certora/specs/Blue.spec @@ -19,9 +19,8 @@ methods { function getMarketId(MorphoHarness.Market) external returns MorphoHarness.Id envfree; - // Temporary workaround a bug that requires to have address instead of an interface in the signature - function SafeTransferLib.tmpSafeTransfer(address token, address to, uint256 value) internal => summarySafeTransferFrom(token, currentContract, to, value); - function SafeTransferLib.tmpSafeTransferFrom(address token, address from, address to, uint256 value) internal => summarySafeTransferFrom(token, from, to, value); + function SafeTransferLib.safeTransfer(address token, address to, uint256 value) internal => summarySafeTransferFrom(token, currentContract, to, value); + function SafeTransferLib.safeTransferFrom(address token, address from, address to, uint256 value) internal => summarySafeTransferFrom(token, from, to, value); } ghost mapping(MorphoHarness.Id => mathint) sumSupplyShares diff --git a/hardhat.config.ts b/hardhat.config.ts index c0136c1e2..d0e7619f0 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -32,7 +32,7 @@ const config: HardhatUserConfig = { solidity: { compilers: [ { - version: "0.8.19", + version: "0.8.21", settings: { optimizer: { enabled: true, diff --git a/src/Morpho.sol b/src/Morpho.sol index 92ff843a8..d1118f53d 100644 --- a/src/Morpho.sol +++ b/src/Morpho.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: UNLICENSED -pragma solidity 0.8.19; +pragma solidity 0.8.21; import {Id, IMorpho, Market, Authorization, Signature} from "./interfaces/IMorpho.sol"; import {IFlashLender} from "./interfaces/IFlashLender.sol"; diff --git a/src/libraries/SafeTransferLib.sol b/src/libraries/SafeTransferLib.sol index 8b968374d..cfb7c2ab9 100644 --- a/src/libraries/SafeTransferLib.sol +++ b/src/libraries/SafeTransferLib.sol @@ -11,29 +11,20 @@ import {IERC20} from "../interfaces/IERC20.sol"; /// @notice Library to manage tokens not fully ERC20 compliant: /// not returning a boolean for `transfer` and `transferFrom` functions. library SafeTransferLib { - function tmpSafeTransfer(address token, address to, uint256 value) internal { - (bool success, bytes memory returndata) = - address(token).call(abi.encodeCall(IERC20(token).transfer, (to, value))); + function safeTransfer(IERC20 token, address to, uint256 value) internal { + (bool success, bytes memory returndata) = address(token).call(abi.encodeCall(token.transfer, (to, value))); require( success && address(token).code.length > 0 && (returndata.length == 0 || abi.decode(returndata, (bool))), ErrorsLib.TRANSFER_FAILED ); } - function tmpSafeTransferFrom(address token, address from, address to, uint256 value) internal { + function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { (bool success, bytes memory returndata) = - address(token).call(abi.encodeCall(IERC20(token).transferFrom, (from, to, value))); + address(token).call(abi.encodeCall(token.transferFrom, (from, to, value))); require( success && address(token).code.length > 0 && (returndata.length == 0 || abi.decode(returndata, (bool))), ErrorsLib.TRANSFER_FROM_FAILED ); } - - function safeTransfer(IERC20 token, address to, uint256 value) internal { - tmpSafeTransfer(address(token), to, value); - } - - function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { - tmpSafeTransferFrom(address(token), from, to, value); - } }