-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Support Sourcify in hardhat-verify
#7600
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
Support Sourcify in hardhat-verify
#7600
Conversation
🦋 Changeset detectedLatest commit: eea2a4a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Sourcify support to the hardhat-verify plugin, enabling contract verification through the Sourcify service alongside existing Etherscan and Blockscout providers.
Key changes:
- Implements a new
Sourcifyclass that integrates with the Sourcify API for contract verification - Adds optional
--creation-tx-hashparameter to improve verification accuracy with Sourcify - Modifies the
VerificationProviderinterface to acceptCompilerInputobjects instead of stringified JSON
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| v-next/hardhat-verify/src/internal/sourcify.ts | New Sourcify provider implementation with API integration |
| v-next/hardhat-verify/src/internal/sourcify.types.ts | Type definitions for Sourcify API responses |
| v-next/hardhat-verify/src/internal/verification.ts | Updates to support Sourcify provider and creation transaction hash |
| v-next/hardhat-verify/src/internal/types.ts | Interface changes to accept CompilerInput and optional parameters |
| v-next/hardhat-verify/src/type-extensions.ts | Configuration type extensions for Sourcify |
| v-next/hardhat-verify/src/internal/hook-handlers/config.ts | Configuration resolver for Sourcify settings |
| v-next/hardhat-verify/src/internal/tasks/verify/sourcify/task-action.ts | Task action implementation for Sourcify verification |
| v-next/hardhat-verify/src/internal/tasks/verify/utils.ts | Updated task argument descriptions |
| v-next/hardhat-verify/src/internal/tasks/verify/types.ts | Made constructorArgs optional and added creationTxHash |
| v-next/hardhat-verify/src/internal/tasks/verify/task-action.ts | Added Sourcify to enabled providers list |
| v-next/hardhat-verify/src/internal/etherscan.ts | Updated to use CompilerInput instead of stringified source code |
| v-next/hardhat-verify/src/internal/blockscout.ts | Updated to use CompilerInput instead of stringified source code |
| v-next/hardhat-verify/src/index.ts | Registered Sourcify task in plugin |
| v-next/hardhat-utils/src/request.ts | Added throwOnError option to RequestOptions |
| v-next/hardhat-utils/src/internal/request.ts | Implemented throwOnError parameter handling |
| v-next/hardhat-verify/test/sourcify.ts | Comprehensive test suite for Sourcify functionality |
| v-next/hardhat-verify/test/etherscan.ts | Updated tests for CompilerInput changes |
| v-next/hardhat-verify/test/blockscout.ts | Updated tests for CompilerInput changes |
| v-next/hardhat-verify/test/tasks/verify/task-action.ts | Added Sourcify to verification provider tests |
| v-next/hardhat-verify/test/hook-handlers/config.ts | Added Sourcify configuration tests |
| v-next/hardhat-verify/README.md | Updated documentation to mention Sourcify |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @manuelwedler, thanks a lot for the PR! I did a first pass and left some comments.
368bc4e to
3d77f53
Compare
|
Btw, I added two additional changes: With a recent update of the Sourcify server, it is now possible to reach the repo ui via redirect from the API. Therefore, I added a change to remove the repo URL from the configuration. This reduces the configuration overhead a bit. I also added a commit to show a link to the job info page of the Sourcify UI in case the verification fails. The page provides more info to the user for debugging why the verification fails. See for example: https://verify.sourcify.dev/jobs/75d1a316-dd30-4fb1-a889-e6427e3d3211 |
3d77f53 to
84cc2b4
Compare
|
Thanks, @manuelwedler! I’ll do another pass to fix any minor details I find along with the tests. After that, we’re good to go. Regarding:
Is this also available for custom Sourcify instances like https://sourcify-api-monad.blockvision.org/health |
|
I updated the issue description to point to the new website's PR. |
Not yet I suppose. We are currently in contact with all custom instances we know of because some still only run the legacy API. Eventually, they should have these endpoints. The redirects are implemented inside the server code, such that it should only be a matter of upgrading to the newest server package/image. |
Instead target the repo UI via the server redirect
…tatusResponse` interface
…specific type safety
244bcce to
6307578
Compare
|
Thanks for finalizing the PR! |
Closes #6885
Related documentation change: NomicFoundation/hardhat-website#116
Changes
Sourcifyclass which implements theVerificationProvider--creation-tx-hashoption to the verify task, which can optionally be provided by the user to more easily get a creation matchverifyfunction of theVerificationProviderinterface, because the Sourcify API expects the non-stringified version of the compiler input.Example