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(cli): fix verify with sourcify for dependencies #2750

Merged
merged 12 commits into from
Apr 27, 2024
Merged

Conversation

yonadaa
Copy link
Contributor

@yonadaa yonadaa commented Apr 26, 2024

mud verify attempts to verify external contracts (InitModule, World, etc.) by changing the working directory to the relevant dependency (eg. cd node_module@latticexyz/world) and running forge verify-contract.

However these dependencies on NPM are incomplete, causing issues when attempting to compile the source files:

  1. Without solidity-files-cache.json, Forge cannot locate the contract by name alone (eg. World), and requires the full path. We fix this by publishing the cache on NPM.
  2. The sub-dependencies of each dependency are not installed, so for example, if world.sol imports schema-type, world.sol cannot be compiled. We fix this by running npm install in each dependency during verification.

@yonadaa yonadaa requested review from alvrs and holic as code owners April 26, 2024 17:49
Copy link

changeset-bot bot commented Apr 26, 2024

🦋 Changeset detected

Latest commit: 55c8f21

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@latticexyz/cli Patch
mock-game-contracts Patch
@latticexyz/abi-ts Patch
@latticexyz/block-logs-stream Patch
@latticexyz/common Patch
@latticexyz/config Patch
create-mud Patch
@latticexyz/dev-tools Patch
@latticexyz/faucet Patch
@latticexyz/gas-report Patch
@latticexyz/protocol-parser Patch
@latticexyz/query Patch
@latticexyz/react Patch
@latticexyz/recs Patch
@latticexyz/schema-type Patch
@latticexyz/services Patch
solhint-config-mud Patch
solhint-plugin-mud Patch
@latticexyz/store-indexer Patch
@latticexyz/store-sync Patch
@latticexyz/store Patch
@latticexyz/utils Patch
@latticexyz/world-modules Patch
@latticexyz/world Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

packages/cli/src/verify.ts Outdated Show resolved Hide resolved
@holic holic changed the title fix(cli): install dependencies in verify, include solidity-files-cache.json and foundry.toml npm fix(cli): fix verify with sourcify for dependencies Apr 26, 2024
// If the verifier is Sourcify, attempt to verify MUD core contracts
// There are path issues with verifying Blockscout and Etherscan
if (verifier === "sourcify") {
// Install subdependencies so contracts can compile
Copy link
Member

@holic holic Apr 26, 2024

Choose a reason for hiding this comment

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

it's less about compiling and more about the dependent files existing in node_modules right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, the files have to exist in node_modules to be compiled

holic
holic previously approved these changes Apr 26, 2024
@holic holic merged commit b4eb795 into main Apr 27, 2024
12 checks passed
@holic holic deleted the not-npmignore-cache branch April 27, 2024 15:02
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.

2 participants