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

Using mainnet hard fork gives Error: Missing required chain parameter: networkId #29

Open
sagefarrenholz opened this issue Jan 16, 2022 · 1 comment

Comments

@sagefarrenholz
Copy link

Issue:

Attempting to use mainnet hard fork of hardhat produces the error in title.

Reproduction:

  1. Set hardhat.config.ts FORK_MAINNET to true
  2. Run a script using hardhat run --network hardhat <script>
  3. Call ethers.getSigners()

Error emitting line of script:

const Signer = (await ethers.getSigners())[0];

Hack solution

I was able to get rid of the error by deleting / commenting out:

 //chainId: !forkingData ? 43112 : undefined, //Only specify a chainId if we are not forking

in hardhat.config.ts

Output:

$ npx hardhat run --network hardhat scripts/<script>
Error: Missing required chain parameter: networkId
    at Common.setChain (<base_path>/node_modules/@ethereumjs/common/src/index.ts:318:17)
    at new Common (<base_path>/node_modules/@ethereumjs/common/src/index.ts:286:30)
    at Function.forCustomChain (<base_path>/node_modules/@ethereumjs/common/src/index.ts:237:12)
    at Object.makeForkCommon (<base_path>/node_modules/hardhat/src/internal/hardhat-network/provider/utils/makeForkCommon.ts:6:17)
    at Function.create (<base_path>/node_modules/hardhat/src/internal/hardhat-network/provider/node.ts:157:22)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at HardhatNetworkProvider._init (<base_path>/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:232:28)
    at HardhatNetworkProvider._send (<base_path>/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:180:5)
    at HardhatNetworkProvider.request (<base_path>/node_modules/hardhat/src/internal/hardhat-network/provider/provider.ts:106:18)
    at EthersProviderWrapper.send (<base_path>/node_modules/@nomiclabs/hardhat-ethers/src/internal/ethers-provider-wrapper.ts:13:20)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@toshiSat
Copy link

I replaced mine to look like this and it's working chainId: !forkingData ? 43112 : 43114

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants