JoinColony / colonyNetwork

Colony Network smart contracts
https://colony.io/
GNU General Public License v3.0
437 stars 106 forks source link

Debugging `deployOldUpgradableVersions.js` #1281

Open kronosapiens opened 1 month ago

kronosapiens commented 1 month ago

After cloning a fresh network repo, the pesky build errors surrounding deployOldUpgradableVersions have re-appeared. I'm creating an issue here to keep better track of things, as I expect this file will periodically break over time.

kronosapiens commented 1 month ago

Issue:

Network version glwss4 doesnt exist, attempting to generate
Cloning the network...
OperationalError: Command failed: cd colonyNetwork-glwss4 && npm install node@14.18.2

npm error Error: Cannot find module 'node-bin-darwin-arm64/package.json'

It seems that for M1/M2 MacBook Pros, only node 16+ can be installed through npm (see StackOverflow issue). Am currently investigating alternatives ways of installing node@14.

Solution:

Moving to nvm seems to work, but requires re-sourcing on every call to exec:

const nodeVersion = fs.readFileSync(`colonyNetwork-${versionTag}/.nvmrc`).toString().trim();
const cmdBase = `cd colonyNetwork-${versionTag} && source $HOME/.nvm/nvm.sh && nvm use ${nodeVersion}`;

Addressed in #1282

kronosapiens commented 2 weeks ago

New issue -- I'm trying to add a new function for IMWSS:

module.exports.deployColonyVersionIMWSS = (colonyNetwork) => {
  return module.exports.deployOldColonyVersion(
    "Colony",
    "IMetaColony",
    [
      // eslint-disable-next-line max-len
      "Colony,ColonyDomains,ColonyExpenditure,ColonyFunding,ColonyRewards,ColonyRoles,ContractRecovery,ColonyArbitraryTransaction",
    ],
    "imwss",
    colonyNetwork,
  );
};

It runs up until deployViaHardhat and then hangs indefinitely. This is the command being executed:

Deploying upgradable version via hardhat...
cd colonyNetwork-imwss && . $HOME/.nvm/nvm.sh && nvm install 16 && nvm use 16 && INTERFACE_NAME=IMetaColony IMPLEMENTATION_NAMES=Colony,ColonyDomains,ColonyExpenditure,ColonyFunding,ColonyRewards,ColonyRoles,ContractRecovery,ColonyArbitraryTransaction npx hardhat run ./scripts/setupOldUpgradeableVersionHardhat.js --network development

It seems like it's hanging on const res = await implementations[idx].new(); which suggests that perhaps the artifacts are not being made globally available correctly. I'm not sure why that would all of a sudden become an issue in setupOldUpgradeableVersionHardhat.