Skip to content

Specifying the hardhat network name inside the Hardhat config "shadows" the default hardhat network #5931

@Wodann

Description

@Wodann

Version of Hardhat

3.0.0-next.15

What happened?

When modifying the hardhat.config.ts file, it was reporting an error with an unclear error message:
image

To receive a more detailed error message, we were recommended to run a hardhat3 command, as it would provide more detailed error information.

It turns out that this doesn't work when you are using the network name hardhat.

When you change the name to hardhat2, the following error information is reported when you run hardhat3 --version:

Error HHE15: Invalid config:
        * Config error in config.networks.hardhat2.type: Invalid discriminator value. Expected 'http' | 'edr'

Minimal reproduction steps

  1. Modify the default Hardhat config to include a network named hardhat:
  networks: {
    hardhat: {
      forkConfig: {
        jsonRpcUrl: "https://eth-mainnet.g.alchemy.com/v2/<api_key>",
      }
    },
  }
  1. Run hardhat3 test
  2. No error is reported, even though the config is invalid

Search terms

No response

Metadata

Metadata

Assignees

Labels

v-nextA Hardhat v3 development task

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions