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

Fix manifest error when connecting to an Anvil dev network #950

Merged
merged 6 commits into from
Dec 21, 2023

Conversation

ericglau
Copy link
Member

@ericglau ericglau commented Dec 20, 2023

When handling network manifest files, we use the RPC method hardhat_metadata to determine if the connected network is a Hardhat development network, in which case we write the manifest to the temp dir instead of .openzeppelin.

Furthermore, if this method has a forkedNetwork field in its response, we treat this as a network fork and make a copy of the origin networks's manifest file, so that we can write to it for the fork without affecting the original version.

In recent versions of Anvil, Anvil also supports the hardhat_metadata RPC method, but has "forkedNetwork": null in its response as seen here.

This PR does two things:

  1. Try calling anvil_metadata to determine if Anvil, and if so, use anvil for the manifest file prefix to more accurately reflect the network type.
  2. Check if forkedNetwork is null or undefined, in which case we determine that it is not a network fork.

Fixes #943

@ericglau ericglau requested a review from a team December 20, 2023 18:53
Copy link
Member

@ernestognw ernestognw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ericglau :shipit:

packages/core/src/manifest.ts Outdated Show resolved Hide resolved
@ericglau ericglau merged commit e869b1c into OpenZeppelin:master Dec 21, 2023
9 checks passed
@ericglau ericglau deleted the anvilForkedNetwork branch December 21, 2023 01:05
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

Successfully merging this pull request may close these issues.

Cannot read properties of null (reading 'chainId')
2 participants