Skip to content

Commit

Permalink
Make short-circuiting old version deployments more robust to snapshot…
Browse files Browse the repository at this point in the history
…-reverts
  • Loading branch information
area committed Sep 23, 2024
1 parent c940c67 commit 661b817
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scripts/deployOldUpgradeableVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const contract = require("@truffle/contract");
const { web3GetCode, setStorageSlot } = require("../helpers/test-helper");
const { ROOT_ROLE, RECOVERY_ROLE, ADMINISTRATION_ROLE, ARCHITECTURE_ROLE, ADDRESS_ZERO } = require("../helpers/constants");

const colonyDeployed = {};
const colonyNetworkDeployed = {};
const deployedResolverAddresses = {};
let colonyDeployed = {};
let colonyNetworkDeployed = {};
let deployedResolverAddresses = {};

module.exports.deployOldExtensionVersion = async (contractName, interfaceName, implementationNames, versionTag, colonyNetwork) => {
if (versionTag.indexOf(" ") !== -1) {
Expand Down Expand Up @@ -108,6 +108,12 @@ module.exports.registerOldColonyVersion = async (colonyVersionResolverAddress, c
}
};

module.exports.resetAlreadyDeployedVersionTracking = async () => {
colonyDeployed = {};
colonyNetworkDeployed = {};
deployedResolverAddresses = {};
};

module.exports.deployOldColonyVersion = async (contractName, interfaceName, implementationNames, versionTag, colonyNetwork) => {
if (versionTag.indexOf(" ") !== -1) {
throw new Error("Version tag cannot contain spaces");
Expand Down
2 changes: 2 additions & 0 deletions test/truffle-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const ethers = require("ethers");
const { soliditySha3 } = require("web3-utils");
const truffleContract = require("@truffle/contract");
const createXABI = require("../lib/createx/artifacts/src/ICreateX.sol/ICreateX.json");
const { resetAlreadyDeployedVersionTracking } = require("../scripts/deployOldUpgradeableVersion");

let postFixtureSnapshotId;

Expand All @@ -82,6 +83,7 @@ const { getChainId, hardhatRevert, hardhatSnapshot, deployCreateXIfNeeded, isXda
module.exports = async () => {
if (postFixtureSnapshotId) {
await hardhatRevert(hre.network.provider, postFixtureSnapshotId);
await resetAlreadyDeployedVersionTracking();
postFixtureSnapshotId = await hardhatSnapshot(hre.network.provider);
return;
}
Expand Down

0 comments on commit 661b817

Please sign in to comment.