Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failure during manifest setup #1650

Merged
merged 3 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading