From 76fa45e8ba527407c8ed9c403034fe113e75c8b0 Mon Sep 17 00:00:00 2001 From: Antonio Jose Lopez Morillo Date: Fri, 2 Feb 2024 18:28:01 -0300 Subject: [PATCH 1/2] Solidity bump to 8.20 --- contracts/Autopay.sol | 2 +- contracts/QueryDataStorage.sol | 2 +- contracts/interfaces/IERC20.sol | 2 +- contracts/interfaces/IQueryDataStorage.sol | 2 +- contracts/testing/AutopayMock.sol | 2 +- contracts/testing/FetchPlayground.sol | 2 +- contracts/testing/TestToken.sol | 2 +- contracts/testing/TipAndReport.sol | 2 +- hardhat.config.js | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/Autopay.sol b/contracts/Autopay.sol index 60f97c3..574c493 100644 --- a/contracts/Autopay.sol +++ b/contracts/Autopay.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; //TODO fix import paths import {UsingFetchUpgradeReady} from "usingfetch/contracts/UsingFetchUpgradeReady.sol"; diff --git a/contracts/QueryDataStorage.sol b/contracts/QueryDataStorage.sol index a4c98a4..53bdf16 100644 --- a/contracts/QueryDataStorage.sol +++ b/contracts/QueryDataStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; /** @author Fetch Inc. diff --git a/contracts/interfaces/IERC20.sol b/contracts/interfaces/IERC20.sol index 91d765e..9973911 100644 --- a/contracts/interfaces/IERC20.sol +++ b/contracts/interfaces/IERC20.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; interface IERC20 { function transfer(address _to, uint256 _amount) external returns(bool); diff --git a/contracts/interfaces/IQueryDataStorage.sol b/contracts/interfaces/IQueryDataStorage.sol index 360573e..15b4784 100644 --- a/contracts/interfaces/IQueryDataStorage.sol +++ b/contracts/interfaces/IQueryDataStorage.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IQueryDataStorage { function storeData(bytes memory _queryData) external; diff --git a/contracts/testing/AutopayMock.sol b/contracts/testing/AutopayMock.sol index 1bc0e6c..5542276 100644 --- a/contracts/testing/AutopayMock.sol +++ b/contracts/testing/AutopayMock.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; import "../Autopay.sol"; diff --git a/contracts/testing/FetchPlayground.sol b/contracts/testing/FetchPlayground.sol index 06a52b0..fb32e3d 100644 --- a/contracts/testing/FetchPlayground.sol +++ b/contracts/testing/FetchPlayground.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; contract FetchPlayground { // Events diff --git a/contracts/testing/TestToken.sol b/contracts/testing/TestToken.sol index 1e942b0..ecd58fc 100644 --- a/contracts/testing/TestToken.sol +++ b/contracts/testing/TestToken.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; diff --git a/contracts/testing/TipAndReport.sol b/contracts/testing/TipAndReport.sol index ab649a7..67d9b64 100644 --- a/contracts/testing/TipAndReport.sol +++ b/contracts/testing/TipAndReport.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.8.3; +pragma solidity 0.8.20; import "../Autopay.sol"; import "./FetchPlayground.sol"; diff --git a/hardhat.config.js b/hardhat.config.js index d9513c6..3569b6a 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -15,7 +15,7 @@ require("dotenv").config(); solidity: { compilers: [ { - version: "0.8.3", + version: "0.8.20", settings: { optimizer: { enabled: true, From 068d1d63c3d65e8aa408d10dc586c75722aac494 Mon Sep 17 00:00:00 2001 From: dsm-ll Date: Fri, 8 Mar 2024 13:39:27 -0300 Subject: [PATCH 2/2] fix Arithmetic operation under or overflow test --- test/functionTests-FetchAutopay.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/functionTests-FetchAutopay.js b/test/functionTests-FetchAutopay.js index 08c5938..482444a 100644 --- a/test/functionTests-FetchAutopay.js +++ b/test/functionTests-FetchAutopay.js @@ -162,7 +162,15 @@ describe("Autopay - function tests", () => { assert.include(result.message, "must be sending an amount"); // require(IERC20(_feed.fetch).transferFrom(msg.sender,address(this),_amount),"ERC20: transfer amount exceeds balance"); result = await h.expectThrowMessage(autopay.fundFeed(bytesId, ETH_QUERY_ID, h.toWei("1000300"))); - assert.include(result.message, "Arithmetic operation underflowed or overflowed outside of an unchecked block") // real message returned + + const acceptableMessages = [ + "Arithmetic operation underflowed or overflowed outside of an unchecked block", + "Arithmetic operation overflowed outside of an unchecked block", + "Arithmetic operation underflowed outside of an unchecked block" + ]; + + const isAcceptableMessage = acceptableMessages.some(message => result.message.includes(message)); + assert.isTrue(isAcceptableMessage, 'Expected one of the acceptable messages'); //VARIABLE UPDATES // _feed.balance += _amount; dataFeedDetails = await autopay.getDataFeed(bytesId);