Skip to content

Commit

Permalink
fix(cli): wipe should not try to find the package in ipfs (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
saeta-eth authored Oct 17, 2024
1 parent 2d67795 commit 2a0a23b
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,28 @@ export async function build({

const dump = writeScript ? await createWriteScript(runtime, writeScript, writeScriptFormat) : null;

log(bold('Checking for existing package...'));
let oldDeployData: DeploymentInfo | null = null;
if (upgradeFrom) {
oldDeployData = await runtime.readDeploy(upgradeFrom, runtime.chainId);
if (!oldDeployData) {
throw new Error(`Deployment ${upgradeFrom} (${chainId}) not found`);
}
} else if (def) {
const oldDeployHash = await findUpgradeFromPackage(
runtime.registry,
runtime.provider,
packageReference,
runtime.chainId,
def.getDeployers()
);
if (oldDeployHash) {
log(green(bold('Found deployment state via on-chain store', oldDeployHash)));
oldDeployData = (await runtime.readBlob(oldDeployHash)) as DeploymentInfo;

if (!wipe) {
log(bold('Checking for existing package...'));

if (upgradeFrom) {
oldDeployData = await runtime.readDeploy(upgradeFrom, runtime.chainId);
if (!oldDeployData) {
throw new Error(`Deployment ${upgradeFrom} (Chain ID: ${chainId}) not found`);
}
} else if (def) {
const oldDeployHash = await findUpgradeFromPackage(
runtime.registry,
runtime.provider,
packageReference,
runtime.chainId,
def.getDeployers()
);
if (oldDeployHash) {
log(green(bold(`Found deployment state via on-chain store: ${oldDeployHash}`)));
oldDeployData = (await runtime.readBlob(oldDeployHash)) as DeploymentInfo;
}
}
}

Expand All @@ -180,10 +184,7 @@ export async function build({
log(gray(` ${fullPackageRef} (Chain ID: ${chainId}) found`));
if (!wipe) {
await runtime.restoreMisc(oldDeployData.miscUrl);

if (!pkgInfo) {
pkgInfo = oldDeployData.meta;
}
pkgInfo = pkgInfo || oldDeployData.meta;
}
} else {
log(gray('Starting fresh build...'));
Expand Down

0 comments on commit 2a0a23b

Please sign in to comment.