-
Notifications
You must be signed in to change notification settings - Fork 202
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
docs(cli/verify): initial version #2744
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6e356e3
docs(cli/verify): initial version
qbzzt 415c96b
Fixed indentation
qbzzt 46cecd0
typo
qbzzt 67163b2
Moved a few words around
qbzzt 47ca984
WIP
qbzzt 896b301
Now with a Blockscout example
qbzzt 8aef859
removed etherscan
qbzzt 9169fb2
tiny fix
qbzzt 8bd0907
docs(cli/verify): initial version
qbzzt 3b85abf
Apply suggestions from code review
qbzzt 212830b
WIP
qbzzt f3dae65
Add note about doing verification immediately after deployment
qbzzt f5fca5d
Merge branch 'main' into 240419-mud-verify
qbzzt 9d8876c
chore: default verifier
yonadaa 6009696
Add the limitation on Etherscan and Blockscout
qbzzt f01267f
Working
qbzzt 08d33dd
Update docs/pages/cli/verify.mdx
qbzzt 69c8656
typos
qbzzt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# mud verify | ||
|
||
This command uploads the source code for the deployed contracts to a public repository, such as a block explorer. | ||
The repository then compiles the source code and verifies that the compiled version is identical to what is deployed onchain. | ||
|
||
The best time to perform verification is immediately after [deployment](./deploy). | ||
Verification only works with the original source code, compiler options, and compiled artifacts. | ||
Otherwise, the generated bytecode is different and therefore verification fails. | ||
|
||
## Using the command | ||
|
||
1. If using Blockscout, you need to specify the API key: | ||
|
||
```sh copy | ||
export ETHERSCAN_API_KEY=<value goes here> | ||
``` | ||
|
||
1. Run the command. | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```sh copy | ||
pnpm mud verify --worldAddress <address here> --verifier <verifier> --rpc <RPC to the blockchain> | ||
``` | ||
|
||
These are the command line options you can specify on `mud verify`: | ||
|
||
| Option | Meaning | Type | Default value | | ||
| ---------------- | ------------------------------------------------------ | ------- | ---------------------------- | | ||
| `--worldAddress` | Verify the contracts of the World at the given address | string | none, error if unspecified | | ||
| `--configPath` | Path to the config file | string | `mud.config.ts` | | ||
| `--verifier` | The verifier to use (`sourcify`, or `blockscout`) | string | | | ||
yonadaa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| `--verifierUrl` | URL to use to access the verifier's API | string | depends on the verifier used | | ||
| `--profile` | The foundry profile to use | string | `local` | | ||
| `--srcDir` | Source directory | string | Foundry `src` directory | | ||
| `--version` | Show version number | boolean | `false` | | ||
|
||
Note that it takes block explorers some time to process new contracts. | ||
You should wait 5-10 minutes past deployment before you verify the contract on Etherscan and/or Blockscout. | ||
|
||
## Examples | ||
|
||
- To verify the world at that address on Holesky on [sourcify](https://sourcify.dev/): | ||
|
||
```sh | ||
WORLD_ADDRESS=0x816038e244ff78b86a5e7dec9bf281634fb6d2a2 | ||
pnpm mud verify --rpc https://ethereum-holesky.publicnode.com --worldAddress $WORLD_ADDRESS --verifier sourcify | ||
``` | ||
|
||
- To verify on Holesky on [Blockscout](https://www.blockscout.com/): | ||
qbzzt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```sh | ||
WORLD_ADDRESS=0x816038e244ff78b86a5e7dec9bf281634fb6d2a2 | ||
export ETHERSCAN_API_KEY= ** blockscout API key goes here ** | ||
pnpm mud verify --rpc https://ethereum-holesky.publicnode.com --worldAddress $WORLD_ADDRESS --verifier blockscout --verifier-url 'https://eth-holesky.blockscout.com/api?' | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
i actually think blockscout doesn't require an api key (but it might be that forge expects something to be provided as an an api key)
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.
no blockscout API key afaik, only need to provide an etherscan API key if you use
--verifier etherscan
or no--verifier
(forge defaults to etherscan)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.
We (@yonadaaa and me) decided not to document Etherscan verification at this time because neither of us managed to get it working.
If I understand https://docs.blockscout.com/for-users/api#api-keys correctly, it means that Blockscout will serve up to 50 calls without a key every second. Yours may or may not be one of them. But with an API key you get 10 calls a second for yourself.