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

Why "Nothing to compile" ? #5733

Open
entin-hun opened this issue Sep 9, 2024 · 1 comment
Open

Why "Nothing to compile" ? #5733

entin-hun opened this issue Sep 9, 2024 · 1 comment
Assignees
Labels
status:needs-decision We need to make a decision about this

Comments

@entin-hun
Copy link

entin-hun commented Sep 9, 2024

Version of Hardhat

2.22.10

What happened?

  1. in the ./contracts dir, I've saved the .sol
  2. in the ./ignition/modules, I've saved x.js and ran it with npx hardhat ignition deploy ./ignition/modules/x.js --network y . It returned:

Nothing to compile
IgnitionError: IGN702: Module validation failed with reason: Invalid artifact given.
Error in plugin hardhat-ignition: Module validation failed. Check the stack trace above to identify the issue and its source code location.

  1. so I've put x.sol 's version into the hardhat.config.ts , should I reload something to be recognized?
const config: HardhatUserConfig = {
  solidity: {
    compilers: [
      {
        version: "0.8.11",
        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
          },
        },
      },
  1. then I ran:
    npx hardhat clean --global
    npx hardhat compile , returned Nothing to compile so I've repeated with yarn, same message.

Screenshot 2024-09-09 at 15 40 13

Minimal reproduction steps

e.g. following Ignition quickstart with this config:

import { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-verify";
import "@nomicfoundation/hardhat-ignition";
import "@foundry-rs/hardhat-forge";

const config: HardhatUserConfig = {
  solidity: {
    compilers: [
      {
        version: "0.8.26",
        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
          },
          evmVersion: "paris", // Optional: You can specify the EVM version if needed
        },
      },
      {
        version: "0.8.11",
        settings: {
          optimizer: {
            enabled: true,
            runs: 200,
          },
        },
      },
      // You can add more compilers here if you need to support multiple versions
    ],
  },
  networks: {
    'gnosis-chiado-testnet': {
      url: 'https://rpc.chiadochain.net'
    },
  },
  etherscan: {
    apiKey: {
      'gnosis-chiado-testnet': 'empty'
    },
    customChains: [
      {
        network: "gnosis-chiado-testnet",
        chainId: 10200,
        urls: {
          apiURL: "https://gnosis-chiado.blockscout.com/api",
          browserURL: "https://gnosis-chiado.blockscout.com"
        }
      }
    ]
  },
  sourcify: {
    enabled: true,
    // Optional: specify a different Sourcify server
    apiUrl: "https://sourcify.dev/server",
    // Optional: specify a different Sourcify repository
    browserUrl: "https://repo.sourcify.dev",
  }
};

export default config;

I try to deploy Split.sol in contracts with this .js:

const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
const { ethers, Network } = require("ethers");

module.exports = buildModule("Split", (m) => {
    // Load the deployer wallet from private key
    const deployerPrivateKey = process.env.OWNER_PRIVATE_KEY;
    if (!deployerPrivateKey) {
        throw new Error("Please set your OWNER_PRIVATE_KEY in the .env file");
    }
    const provider = process.env.JSON_RPC_PROVIDER;
    const deployer = new ethers.Wallet(deployerPrivateKey, provider);
    // Specify custom gas price and gas limit settings for the deployment
    const customGasPrice = 50000000000;
    const customGasLimit = 1000000;

    const split = m.contract("Split", {
        from: deployer.address, gasPrice: customGasPrice, gasLimit: customGasLimit
    });

  return { split };
});

Search terms

No response

@iosh
Copy link
Contributor

iosh commented Sep 13, 2024

Hi, I used your configuration and run npx hardhat compile. I get an error "Error: Must compile with ast" which is caused by @foundry-rs/hardhat-forge. This issue has been fixed in https://github.com/foundry-rs/hardhat/pull/114, but a new version of the npm package has not been released yet.

If I remove the import "@foundry-rs/hardhat-forge"; line from hardhat.config.ts, then I am able to compile the contract.

@kanej kanej added status:needs-decision We need to make a decision about this and removed status:triaging labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-decision We need to make a decision about this
Projects
Status: Backlog
Development

No branches or pull requests

3 participants