diff --git a/hardhat.config.js b/hardhat.config.js index 7ff1ee740..60e78d91c 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -145,7 +145,7 @@ module.exports = { solidity: { compilers: [ { - version: "0.8.18", + version: "0.8.9", settings: { optimizer: { enabled: true, @@ -157,7 +157,7 @@ module.exports = { }, }, { - version: "0.8.9", + version: "0.8.18", settings: { optimizer: { enabled: true, diff --git a/scripts/migrations/migrate_2.2.1.js b/scripts/migrations/migrate_2.2.1.js index 0ebbce5e8..a51701af4 100644 --- a/scripts/migrations/migrate_2.2.1.js +++ b/scripts/migrations/migrate_2.2.1.js @@ -5,7 +5,6 @@ const ethers = hre.ethers; const network = hre.network.name; const { getStateModifyingFunctionsHashes } = require("../../scripts/util/diamond-utils.js"); const tag = "v2.2.1"; -const version = "2.2.1"; const config = { addOrUpgrade: [ @@ -35,11 +34,6 @@ async function migrate(env) { throw new Error("Local changes found. Please stash them before upgrading"); } - if (env != "upgrade-test") { - console.log("Installing dependencies"); - shell.exec(`npm install`); - } - const { chainId } = await ethers.provider.getNetwork(); const contractsFile = readContracts(chainId, network, env); @@ -47,11 +41,6 @@ async function migrate(env) { throw new Error("Current contract version must be 2.2.0"); } - let contracts = contractsFile?.contracts; - - // Get addresses of currently deployed contracts - const protocolAddress = contracts.find((c) => c.name === "ProtocolDiamond")?.address; - // Checking old version contracts to get selectors to remove console.log("Checking out contracts on version 2.2.0"); shell.exec(`rm -rf contracts/*`); @@ -61,6 +50,11 @@ async function migrate(env) { await hre.run("clean"); await hre.run("compile"); + let contracts = contractsFile?.contracts; + + // Get addresses of currently deployed contracts + const protocolAddress = contracts.find((c) => c.name === "ProtocolDiamond")?.address; + const getFunctionHashesClosure = getStateModifyingFunctionsHashes( ["SellerHandlerFacet", "OrchestrationHandlerFacet1"], undefined, @@ -73,6 +67,9 @@ async function migrate(env) { shell.exec(`rm -rf contracts/*`); shell.exec(`git checkout ${tag} contracts`); + console.log("Installing dependencies"); + shell.exec(`npm install`); + console.log("Compiling contracts"); await hre.run("clean"); await hre.run("compile"); @@ -81,7 +78,7 @@ async function migrate(env) { await hre.run("upgrade-facets", { env, facetConfig: JSON.stringify(config), - newVersion: version, + newVersion: tag, }); const selectorsToAdd = await getFunctionHashesClosure(); diff --git a/test/upgrade/00_config.js b/test/upgrade/00_config.js index 52583ccb8..edbcce0e5 100644 --- a/test/upgrade/00_config.js +++ b/test/upgrade/00_config.js @@ -211,7 +211,6 @@ const tagsByVersion = { "2.2.1": { oldVersion: "v2.2.0", newVersion: "v2.2.1", - deployScript: "v2.2.0", }, }; diff --git a/test/util/upgrade.js b/test/util/upgrade.js index 8577e1d7c..5d9c2ac1d 100644 --- a/test/util/upgrade.js +++ b/test/util/upgrade.js @@ -92,8 +92,6 @@ async function deploySuite(deployer, newVersion) { shell.exec(`git checkout ${scriptsTag} scripts`); } - shell.exec(`npx hardhat compile`); - const isOldOZVersion = ["v2.0", "v2.1", "v2.2"].some((v) => tag.startsWith(v)); if (isOldOZVersion) { // Temporary install old OZ contracts @@ -1826,8 +1824,9 @@ async function getVoucherContractState({ bosonVouchers, exchanges, sellers, buye } function revertState() { - shell.exec(`git checkout HEAD`); - shell.exec(`git reset HEAD`); + shell.exec(`rm -rf contracts/* scripts/*`); + shell.exec(`git checkout HEAD contracts scripts`); + shell.exec(`git reset HEAD contracts scripts`); } async function getDisputeResolver(accountHandler, value, { getBy }) {