Skip to content

Hardhat ethers does not correctly instantiate a provider with the OVM #935

@shanefontaine

Description

@shanefontaine

Describe the bug
Using Hardhat's built-in ethers object does not correctly instantiate a provider using the OVM. Because of this, you cannot perform tasks like deploying a contract.

This only happens when ovm: true is set in hardhat.config.js.

To Reproduce

  1. Clone this forked repo of the optimism-tutorial
  2. Follow the README instructions to run the deployment
  3. Observe that the deployment does not work and produces the following error Error: could not detect network (event="noNetwork", code=NETWORK_ERROR, version=providers/5.1.2)
  4. In deploy/ERC20.deploy.js, comment out lines 11-12 (Hardhat ethers instantiation) and comment in lines 6-8 (native ethers instantiation).
  5. Run the deployment again and observe that the contract gets deployed.

Expected behavior
I would expect the Hardhat ethers implementation to work the same as the native ethers implementation when deploying a contract.

System Specs:
All relevant packages are in the forked repo.

Additional context
Another way to verify that the provider is not working correctly is by inserting await ethers.provider.ready and observing that the script execution never passes that line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugsS-confirmedStatus: A confirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions