Tenderly / tenderly-cli

CLI tool for Smart Contract error tracking, monitoring and alerting.
https://tenderly.co
GNU General Public License v3.0
522 stars 137 forks source link

Couldn't read Hardhat config file #139

Open alexanderattar opened 1 year ago

alexanderattar commented 1 year ago

Hello,

I have been trying to get Tenderly setup locally in a project to be able to push up the contracts and verify for debugging purposes, but have not been successful due to receiving the error Couldn't read Hardhat config file with any variation of config even when taking out more complex aspects of our project's config and trying the simplest config file I can think of. Running the command tenderly contracts push --debug I get the full error output below:

✗ tenderly contracts push --debug
Setting up your project...
Trying OpenZeppelin config path: networks.js
couldn't read new OpenzeppelinConfig config file
Trying buidler config path: buidler.config.js
couldn't read new Buidler config file
Trying hardhat config path: hardhat.config.js
unable to fetch config
 Couldn't read Hardhat config file
Trying hardhat ts config path: hardhat.config.ts
Making request
Got response with body
Analyzing Hardhat configuration...
Trying Hardhat config path: /Users/alexander/Development/holograph/workspace/protocol/hardhat.config.js
Trying Hardhat config path: /Users/alexander/Development/holograph/workspace/protocol/hardhat.config.ts
unable to upload contracts: unable to fetch config: cannot evaluate hardhat.config.ts, tried path: /Users/alexander/Development/holograph/workspace/protocol/hardhat.config.ts, error: exit status 1, output: {
  resolvedConfig: {
    solidity: { compilers: [Array], overrides: {} },
    defaultNetwork: 'sepolia',
    networks: {
      hardhat: [Object],
      localhost: [Object],
      sepolia: [Object],
      tenderly: {}
    },
    paths: {
      root: '/Users/alexander/Development/holograph/workspace/protocol',
      configFile: '/Users/alexander/Development/holograph/workspace/protocol/hardhat.config.ts',
      sources: '/Users/alexander/Development/holograph/workspace/protocol/contracts',
      cache: '/Users/alexander/Development/holograph/workspace/protocol/cache',
      artifacts: '/Users/alexander/Development/holograph/workspace/protocol/artifacts',
      tests: '/Users/alexander/Development/holograph/workspace/protocol/test'
    },
    mocha: { timeout: 40000 }
  },
  userConfig: {
    solidity: '0.8.13',
    defaultNetwork: 'sepolia',
    networks: { sepolia: [Object] }
  }
}
[eval]:20
        var jsonConfig = JSON.stringify(config, (key, value) => {
                              ^

TypeError: Do not know how to serialize a BigInt
    at JSON.stringify (<anonymous>)
    at [eval]:20:25
    at Script.runInThisContext (node:vm:129:12)
    at Object.runInThisContext (node:vm:305:38)
    at node:internal/process/execution:76:19
    at [eval]-wrapper:6:22
    at evalScript (node:internal/process/execution:75:60)
    at node:internal/main/eval_string:27:3

Couldn't read Hardhat config file

I have tried even with making the config file as simple as possible with the code below:

require('@tenderly/hardhat-tenderly');

export default {
  solidity: '0.8.13',
  defaultNetwork: 'sepolia',
  networks: {
    sepolia: {
      url: `https://eth-sepolia.g.alchemy.com/v2/MY_API_KEY`,
    },
  },
};

Am I missing something simple or is this a weird bug? Here are my dependencies for context unless there is a known issue:

  "dependencies": {
    "@ethersproject/abstract-provider": "^5.7.0",
    "@ethersproject/bignumber": "^5.7.0",
    "@ethersproject/bytes": "^5.7.0",
    "@ethersproject/providers": "^5.7.2",
    "@ethersproject/units": "^5.7.0",
    "@holographxyz/environment": "0.1.10",
    "@holographxyz/hardhat-deploy-holographed": "^0.0.5",
    "@holographxyz/hardhat-holograph-contract-builder": "^0.0.4",
    "@holographxyz/holograph-genesis": "^0.0.1",
    "@holographxyz/networks": "0.1.15",
    "chai-ethers": "^0.0.1",
    "ganache": "^7.2.0",
    "hardhat-preprocessor": "^0.1.5",
    "path": "^0.12.7",
    "super-cold-storage-signer": "^0.0.4",
    "truffle-hdwallet-provider": "^1.0.17",
    "web3": "^1.7.0",
    "zksync-web3": "^0.4.0"
  },
  "devDependencies": {
    "@nomicfoundation/hardhat-foundry": "^1.0.0",
    "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
    "@nomiclabs/hardhat-etherscan": "^3.1.0",
    "@nomiclabs/hardhat-waffle": "^2.0.1",
    "@openzeppelin/contracts": "^4.8.1",
    "@openzeppelin/contracts-upgradeable": "^4.8.1",
    "@tenderly/hardhat-tenderly": "^1.6.1",
    "@typechain/ethers-v5": "^9.0.0",
    "@typechain/hardhat": "^4.0.0",
    "@types/chai": "^4.3.0",
    "@types/data-urls": "^2.0.1",
    "@types/mocha": "^9.1.0",
    "@types/node": "^17.0.21",
    "@typescript-eslint/parser": "^5.42.1",
    "chai": "^4.3.6",
    "data-urls": "^3.0.0",
    "dotenv": "^10.0.0",
    "erc721a-upgradeable": "^4.2.3",
    "eslint": "^8.27.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-config-standard": "^17.0.0",
    "eslint-plugin-import": "^2.27.0",
    "eslint-plugin-mocha": "^10.1.0",
    "eslint-plugin-prettier": "^4.2.1",
    "ethereum-waffle": "^3.4.0",
    "ethers": "^5.5.4",
    "ganache-cli": "^6.12.2",
    "hardhat": "^2.6.3",
    "hardhat-gas-reporter": "^1.0.4",
    "husky": "^8.0.0",
    "prettier": "^2.6.2",
    "prettier-plugin-solidity": "^1.0.0-beta.13",
    "solhint": "^3.3.7",
    "solhint-plugin-prettier": "^0.0.5",
    "ts-node": "^10.1.0",
    "typechain": "^7.0.0",
    "typescript": "^4.3.5"
  }

Thanks in advance for any help!