Skip to content

Commit

Permalink
fix(pg): add user logs for commit subtask
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman committed Nov 22, 2022
1 parent 8b81504 commit ae89911
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-games-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/plugins': patch
---

Add user logs for the commit subtask
11 changes: 1 addition & 10 deletions packages/plugins/src/hardhat/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ export const deployChugSplashConfig = async (
)
}

// The spinner interferes with Hardhat's compilation logs, so we only display this message if
// compilation is being skipped.
if (noCompile) {
spinner.start('Getting the deployment info...')
}

// Get the bundle ID without publishing anything to IPFS.
const { bundleId, bundle, configUri, canonicalConfig } =
await chugsplashCommitSubtask(
Expand All @@ -135,14 +129,11 @@ export const deployChugSplashConfig = async (
ipfsUrl,
commitToIpfs: false,
noCompile,
spinner,
},
hre
)

if (noCompile) {
spinner.succeed('Loaded the deployment info.')
}

spinner.start('Checking status of the deployment...')

const ChugSplashManager = getChugSplashManager(
Expand Down
31 changes: 19 additions & 12 deletions packages/plugins/src/hardhat/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ export const chugsplashProposeTask = async (
await deployChugSplashPredeploys(provider, provider.getSigner())

const parsedConfig = loadParsedChugSplashConfig(configPath)
const projectName = parsedConfig.options.projectName

if (
(await isProjectRegistered(signer, parsedConfig.options.projectName)) ===
Expand All @@ -302,12 +301,6 @@ export const chugsplashProposeTask = async (

spinner.succeed('ChugSplash is ready to go.')

// The spinner interferes with Hardhat's compilation logs, so we only display this message if
// compilation is being skipped.
if (noCompile) {
spinner.start(`Committing ${projectName}... on ${hre.network.name}.`)
}

// Get the bundle info by calling the commit subtask locally (i.e. without publishing the
// bundle to IPFS). This allows us to ensure that the bundle state is empty before we submit
// it to IPFS.
Expand All @@ -317,14 +310,11 @@ export const chugsplashProposeTask = async (
ipfsUrl,
commitToIpfs: false,
noCompile,
spinner,
},
hre
)

if (noCompile) {
spinner.succeed(`Committed ${projectName} on ${hre.network.name}.`)
}

spinner.start('Proposing the project...')

const bundleState: ChugSplashBundleState = await ChugSplashManager.bundles(
Expand Down Expand Up @@ -535,6 +525,7 @@ export const chugsplashCommitSubtask = async (
ipfsUrl: string
commitToIpfs: boolean
noCompile: boolean
spinner?: ora.Ora
},
hre
): Promise<{
Expand All @@ -543,12 +534,20 @@ export const chugsplashCommitSubtask = async (
bundleId: string
canonicalConfig: CanonicalChugSplashConfig
}> => {
const { parsedConfig, ipfsUrl, commitToIpfs, noCompile } = args
const { parsedConfig, ipfsUrl, commitToIpfs, noCompile, spinner } = args

if (!noCompile) {
await cleanThenCompile(hre)
}

if (spinner) {
commitToIpfs
? spinner.start(
`Committing ${parsedConfig.options.projectName} on ${hre.network.name}.`
)
: spinner.start('Loading the deployment info...')
}

let configSourceNames = Object.values(parsedConfig.contracts)
.map((contractConfig) => contractConfig.contract)
.map((name) => getContractArtifact(name).sourceName)
Expand Down Expand Up @@ -644,6 +643,14 @@ IPFS_API_KEY_SECRET: ...
configUri
)

if (spinner) {
commitToIpfs
? spinner.succeed(
`Committed ${parsedConfig.options.projectName} on ${hre.network.name}.`
)
: spinner.succeed('Loaded the deployment info.')
}

return { bundle, configUri, bundleId, canonicalConfig }
}

Expand Down

0 comments on commit ae89911

Please sign in to comment.