Skip to content

Commit

Permalink
Merge pull request #1650 from skalenetwork/1612-manifest
Browse files Browse the repository at this point in the history
Fix failure during manifest setup
  • Loading branch information
DimaStebaev authored Jan 8, 2024
2 parents 2b7ef7d + 31c4710 commit 05c7edd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 6 additions & 4 deletions proxy/migrations/generateManifest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ethers } from "hardhat";
import { contracts, getContractKeyInAbiFile } from "./deploySchain";
import { networkNames } from "@openzeppelin/upgrades-core";
import { promises as fs } from "fs";
import {
getVersion,
Expand Down Expand Up @@ -134,14 +135,15 @@ export async function importAddresses(manifest: ManifestData, abi: {[ key in str

export async function manifestSetup(pathToManifest: string) {
const chainId = (await ethers.provider.getNetwork()).chainId;
const correctManifestPath = `.openzeppelin/unknown-${chainId}.json`;
const manifestName = networkNames[chainId] ?? `unknown-${chainId}`;
const correctManifestPath = `.openzeppelin/${manifestName}.json`;
if (pathToManifest === "" || pathToManifest === correctManifestPath) {
fs.access(correctManifestPath);
await fs.access(correctManifestPath);
console.log("Current Manifest file detected - will use this one");
return;
}
try {
fs.access(correctManifestPath);
await fs.access(correctManifestPath);
console.log("Current Manifest file detected - will remove it");
try {
await fs.unlink(correctManifestPath);
Expand All @@ -154,7 +156,7 @@ export async function manifestSetup(pathToManifest: string) {
console.log("No current Manifest file detected");
}
try {
fs.access( pathToManifest );
await fs.access( pathToManifest );
console.log("New Manifest file detected");
try {
await fs.copyFile( pathToManifest, correctManifestPath );
Expand Down
3 changes: 0 additions & 3 deletions proxy/migrations/upgradeMainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { promises as fs } from "fs";
import { AutoSubmitter, Upgrader } from "@skalenetwork/upgrade-tools";
import { SkaleABIFile } from "@skalenetwork/upgrade-tools/dist/src/types/SkaleABIFile";
import { contracts } from "./deployMainnet";
import { manifestSetup } from "./generateManifest";
import { MessageProxyForMainnet } from "../typechain";

class ImaMainnetUpgrader extends Upgrader {
Expand Down Expand Up @@ -65,8 +64,6 @@ async function getImaMainnetAbiAndAddress(): Promise<SkaleABIFile> {
}

async function main() {
const pathToManifest: string = process.env.MANIFEST || "";
await manifestSetup(pathToManifest);
const upgrader = new ImaMainnetUpgrader(
"1.5.0",
await getImaMainnetAbiAndAddress(),
Expand Down

0 comments on commit 05c7edd

Please sign in to comment.