NomicFoundation / hardhat-ignition

Hardhat Ignition is a declarative deployment system that enables you to deploy your smart contracts without navigating the mechanics of the deployment process.
https://hardhat.org/ignition
MIT License
106 stars 23 forks source link

Support hardhat/console logging during deployment and m.call txns #787

Open mdcoon opened 3 months ago

mdcoon commented 3 months ago

Describe the feature

First, you guys are doing a fantastic job with ignition. It's far superior to deploy scripts of the past. So thank you for that!

It would be very useful in debugging deployment issues if I can view hardhat's solidity console.log output. An example is trying to do an m.call to set a proxy implementation and not being able to debug why it fails. For example, I can disable parts of the code to make the deployment succeed but I can not see any of the logs I put in place to debug the values of certain fields during m.call. Having console.logging would help a lot in this situation. Thanks!

Search terms

console hardhat logging

fvictorio commented 2 months ago

Can confirm, although I don't know what would be the best way to handle this in Ignition's UI. Perhaps a list of "console.log"s at the end of a batch, similar to what the Hardhat node output does at the end of a block.

@mdcoon a sort of workaround is to run the deployment from a script instead of using the ignition deploy task. So for example, instead of doing:

npx hardhat ignition deploy ignition/modules/DeployAll.module.ts

you can write and run a script like this:

import { ignition } from "hardhat"
import DeployAllModule from "../ignition/modules/DeployAll.module.ts"

async function main() {
  await ignition.deploy(DeployAllModule)
}

main()
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

and you'll get the console.log outputs.