Skip to content

Commit 1ef70a7

Browse files
bitwiseguymslipper
andauthored
op-deployer: add documentation for verify command (#14745)
* op-deployer: add documentation for verify command * Update op-deployer/book/src/user-guide/verify.md * Update verify.md --------- Co-authored-by: Matthew Slipper <[email protected]>
1 parent dc0842e commit 1ef70a7

File tree

3 files changed

+89
-3
lines changed

3 files changed

+89
-3
lines changed

op-deployer/book/src/SUMMARY.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
- [Installation](user-guide/installation.md)
88
- [Usage](user-guide/usage.md)
9+
- [bootstrap](user-guide/bootstrap.md)
910
- [init](user-guide/init.md)
1011
- [apply](user-guide/apply.md)
11-
- [bootstrap](user-guide/bootstrap.md)
12+
- [verify](user-guide/verify.md)
1213
- [Known Limitations](user-guide/known-limitations.md)
1314

1415
# Reference Guide

op-deployer/book/src/user-guide/usage.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ Deployer, you can use `op-deployer help` to view the available commands.
77

88
This following sections provide in-depth information on the different commands available.
99

10+
- [`op-deployer bootstrap`][bootstrap]: Deploys shared contract instances for use with future invocations of OP Deployer.
1011
- [`op-deployer init`][init]: Initializes a new intent and state file.
1112
- [`op-deployer apply`][apply]: Deploys a new OP Chain based on the supplied intent.
12-
- `op-deployer bootstrap`: Deploys shared contract instances for use with future invocations of OP Deployer.
13+
- [`op-deployer verify`][verify]: Verifies the source code of deployed contracts on Etherscan.
1314

15+
[bootstrap]: bootstrap.md
1416
[init]: init.md
15-
[apply]: apply.md
17+
[apply]: apply.md
18+
[verify]: verify.md
+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# The Verify Command
2+
3+
Once you have deployed contracts via [bootstrap][bootstrap], you can use the `verify` command to verify the source code on Etherscan. Constructor args used in the verification request are extracted automatically from contract initcode via the tx that created the contract.
4+
5+
[bootstrap]: bootstrap.md
6+
7+
You can call the `verify` command like this:
8+
9+
```shell
10+
op-deployer verify \
11+
--l1-rpc-url <l1 rpc url> \
12+
--input-file <filepath to input .json file> \
13+
--etherscan-api-key <your free etherscan api key> \
14+
--artifacts-locator <l1 forge-artifacts locator>
15+
```
16+
17+
## CLI Args
18+
19+
### `--l1-rpc-url`
20+
21+
Defines the RPC URL of the L1 chain to deploy to (currently only supports mainnet and sepolia).
22+
23+
### `--input-file`
24+
25+
The full filepath to the input .json file. This file should be a key/value store where the key is a contract name and the value is the contract address. The output of the `bootstrap superchain|implementations` commands is a good example of this format, and those output files can be fed directly into `verify`. Unless the `--contract-name` flag is passed, all contracts in the input file will be verified.
26+
27+
{
28+
"Opcm": "0x3a1f523a4bc09cd344a2745a108bb0398288094f",
29+
"OpcmContractsContainer": "0x660aeaac7508258f622cfdc489c16c864b4d8629",
30+
"OpcmGameTypeAdder": "0xc9060f6283b78e1feebfd1993cb6350b5626f115",
31+
"OpcmDeployer": "0x88e39ea5cfe6c4d450305eec5fd90dd1fba87f45",
32+
"OpcmUpgrader": "0xbf098a12edcf99f8e6db258b7ac567a1fd020f4b",
33+
"DelayedWETHImpl": "0x5e40b9231b86984b5150507046e354dbfbed3d9e",
34+
"OptimismPortalImpl": "0xb443da3e07052204a02d630a8933dac05a0d6fb4",
35+
"PreimageOracleSingleton": "0x1fb8cdfc6831fc866ed9c51af8817da5c287add3",
36+
"MipsSingleton": "0xf027f4a985560fb13324e943edf55ad6f1d15dc1",
37+
"SystemConfigImpl": "0x340f923e5c7cbb2171146f64169ec9d5a9ffe647",
38+
"L1CrossDomainMessengerImpl": "0x5d5a095665886119693f0b41d8dfee78da033e8b",
39+
"L1ERC721BridgeImpl": "0x7ae1d3bd877a4c5ca257404ce26be93a02c98013",
40+
"L1StandardBridgeImpl": "0x0b09ba359a106c9ea3b181cbc5f394570c7d2a7a",
41+
"OptimismMintableERC20FactoryImpl": "0x5493f4677a186f64805fe7317d6993ba4863988f",
42+
"DisputeGameFactoryImpl": "0x4bba758f006ef09402ef31724203f316ab74e4a0",
43+
"AnchorStateRegistryImpl": "0x7b465370bb7a333f99edd19599eb7fb1c2d3f8d2",
44+
"SuperchainConfigImpl": "0x4da82a327773965b8d4d85fa3db8249b387458e7",
45+
"ProtocolVersionsImpl": "0x37e15e4d6dffa9e5e320ee1ec036922e563cb76c"
46+
}
47+
48+
### `--contract-name` (optional)
49+
50+
Specifies a single contract name, matching a contract key within the input file, to verify. If not provided, all contracts in the input file will be verified.
51+
52+
### `--artifacts-locator`
53+
54+
The locator to forge-artifacts containing the output of the `forge build` command (i.e. compiled bytecode and solidity source code). This can be a local path (with a `file://` prefix), remote URL (with a `http://` or `https://` prefix), or standard contracts tag (with a `tag://op-contracts/v` prefix).
55+
56+
## Output
57+
58+
Output logs will be printed to the console and look something like the following. If the final results show `numFailed=0`, all contracts were verified successfully.
59+
```sh
60+
INFO [03-05|15:56:55.900] Formatting etherscan verify request name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
61+
INFO [03-05|15:56:55.900] Opening artifact path=Proxy.sol/Proxy.json name=superchainConfigProxyAddress
62+
INFO [03-05|15:56:55.905] contractName name=src/universal/Proxy.sol:Proxy
63+
INFO [03-05|15:56:55.905] Extracting constructor args from initcode address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A argSlots=1
64+
INFO [03-05|15:56:56.087] Contract creation tx hash txHash=0x71b377ccc11304afc32e1016c4828a34010a0d3d81701c7164fb19525ba4fbc4
65+
INFO [03-05|15:56:56.494] Successfully extracted constructor args address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
66+
INFO [03-05|15:56:56.683] Verification request submitted name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
67+
INFO [03-05|15:57:02.035] Verification complete name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
68+
INFO [03-05|15:57:02.208] Formatting etherscan verify request name=protocolVersionsImplAddress address=0x658812BEb9bF6286D03fBF1B5B936e1af490b768
69+
INFO [03-05|15:57:02.208] Opening artifact path=ProtocolVersions.sol/ProtocolVersions.json name=protocolVersionsImplAddress
70+
INFO [03-05|15:57:02.215] contractName name=src/L1/ProtocolVersions.sol:ProtocolVersions
71+
INFO [03-05|15:57:02.418] Verification request submitted name=protocolVersionsImplAddress address=0x658812BEb9bF6286D03fBF1B5B936e1af490b768
72+
INFO [03-05|15:57:07.789] Verification complete name=protocolVersionsImplAddress address=0x658812BEb9bF6286D03fBF1B5B936e1af490b768
73+
INFO [03-05|15:57:07.971] Contract is already verified name=protocolVersionsProxyAddress address=0x17C64430Fa08475D41801Dfe36bAFeE9667c6fA7
74+
INFO [03-05|15:57:07.971] --- COMPLETE ---
75+
INFO [03-05|15:57:07.971] final results numVerified=4 numSkipped=1 numFailed=0
76+
```
77+
78+
## Known Limitations
79+
80+
- Does not currently work for contracts in the `opchain` bundle (deployed via `op-deployer apply`) that have constructor args. Those constructors args cannot be extracted from the deployment `tx.Data()` since `OPContractsManager.deploy()` uses factory pattern with CREATE2 to deploy those contracts.
81+
82+
- Currently only supports etherscan block explorers. Blockscout support is planned but not yet implemented.

0 commit comments

Comments
 (0)