bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 40쪽
8f",
"l1StandardBridgeImplAddress": "0x6abaa7b42b9a947047c01f41b9bcb8684427bf24",
"optimismMintableERC20FactoryImplAddress": "0xdd0b293b8789e9208481cee5a0c7e78f451d32bf",
"disputeGameFactoryImplAddress": "0xe7ab0c07ee92aae31f213b23a132a155f5c2c7cc",
"anchorStateRegistryImplAddress": "0xda4f46fad0e38d763c56da62c4bc1e9428624893",
"superchainConfigImplAddress": "0xdaf60e3c5ef116810779719da88410cce847c2a4"
}
```
# Custom Deployments
Source: https://docs.optimism.io/chain-operators/tools/op-deployer/usage/custom-deployments
Learn how to manage custom deployments with OP Deployer.
While OP Deployer was designed primarily for use with chains that are governed by Optimism, it also supports managing
custom deployments. This is particularly common for RaaS providers, whose customers often request deployments with
custom L1s (or L2s, in the case of L3s) or governance. This guide will walk you through the process of managing these
chains using OP Deployer.
<Warning>
Chains deployed in this way are not subject to Optimism Governance. They may be running customized or unaudited
code. Use at your own risk.
</Warning>
## Bootstrapping
The first step to deploying a custom OP Stack is to bootstrap it onto an L1. This process will:
* Deploy shared management contracts like `SuperchainConfig` and `SuperchainVersions`.
* Deploy contract implementations that will be shared among all OP Chains in this deployment.
* Set up ownership so that you can control the deployment.
You will use the [`bootstrap`](/chain-operators/tools/op-deployer/usage/bootstrap) family of commands on `op-deployer` to do this.
### Bootstrap Shared Contracts
Every OP Chain belongs to a logical deployment group. This group consists of a set of shared contracts that control the behavior
of a group of OP Chains. This includes:
* Pausing bridges
* Signaling which protocol versions are required and recommended
You can deploy a new set of shared contracts for each OP Chain, or you can deploy them once and share across multiple OP Chains.
The choice is up to the deployer. Note that you **cannot** share a set of shared contracts across multiple L1s.
To begin, bootstrap the shared contracts onto your chosen L1 with the following command:
```shell theme={null}
op-deployer bootstrap superchain \
--l1-rpc-url="<rpc url>" \
--private-key="<contract deployer private key>" \
--artifacts-locator="<locator>" \
--outfile="<path to outfile>" \
--superchain-proxy-admin-owner="<role address>" \
--guardian="<role address>"
```
This will output a JSON file containing the addresses of the relevant contracts. Keep track of this file, as you will
need it in subsequent steps.
We recommend the following these best practices when bootstrapping:
1. Use Gnosis SAFEs for ownership roles like `guardian` and `superchain-proxy-admin-owner`. The owner **must** be a
smart contract to support future upgrades, so a SAFE is a sensible default.
2. Use a regular EOA as the deployer. It will not have any control over the deployment once the deployment completes.
3. Use a standard contracts tag (e.g. `tag://op-contracts/v2.0.0`). This will make upgrading easier.
### Bootstrapping Implementations
The smart contracts for an OP Chain are deployed using a factory that points to a set of predeployed implementations.
You must deploy the factory and the implementations every time you deploy to a new L1 and whenever new smart
contract versions are released. Implementations are deployed using `CREATE2`, so addresses may be reused if they
already exist on the L1.
<Warning>
You may need to use different versions of OP Deployer depending on which contracts version you are deploying. See the
[releases guide](/chain-operators/tools/op-deployer/reference/releases) for more information on picking the right release.
</Warning>
To deploy the implementations, use the following command:
```shell theme={null}
op-deployer bootstrap implementations \
--artifacts-locator="<locator, should be the same as the one used in bootstrap superchain>" \
--l1-rpc-url="<rpc url>" \
--outfile="<path to outfile>" \
--mips-version="2" \
--private-key="<contract deployer private key>" \
--superchain-config-proxy="<address output from bootstrap superchain>" \
--upgrade-controller="<superchain-proxy-admin-owner used in bootstrap superchain>"
```
Similar to the `bootstrap superchain` command, this will output a JSON file containing the addresses of the relevant
contracts. Again, keep track of this file.
The most important address in the implementations file is the OPCM, or OP Contracts Manager. This contract is the
factory that will deploy all the OP Chains belonging to this deployment group. It is also responsible for upgrading between
different contracts versions. Please keep the following **very important** invariants in mind with the OPCM:
* There is a one-to-one mapping between each OPCM, and contracts version.
* Each OPCM is associated with **exactly one** deployment group. This means that you **must** deploy a new OPCM using the
`bootstrap implementations` command for each new deployment group you manage.
## Deploying
After bootstrapping the contracts and implementations, you can deploy your L2 chains with the `apply` command. You
will need to specify a `configType` of `standard-overrides` and set the `opcmAddress` field in your intent to the
address of the OPCM above. **Make sure you call the right OPCM.** Failing to call the right OPCM might lead to
deploying incorrect contract versions, or associating your chain with the wrong deployment.
<Warning>
Make sure that you use the same `l1ContractsLocator` and `l2ContractsLocator` as the ones used in the bootstrap
commands. Otherwise, you may run into deployment errors.
</Warning>
See the following config for an example:
```toml theme={null}
configType = "standard-overrides"
l1ChainID = 11155420
opcmAddress = "0x..."
l1ContractsLocator = "tag://..." # must match the one used in bootstrap
l2ContractsLocator = "tag://..."
[[chains]]
# Chain configs...
```
Once `apply` completes successfully, you can use the `inspect` family of commands to download your chain's L2
genesis and rollup config files.
## Upgrading
<Warning>
The `op-deployer upgrade` command supports upgrades up to `op-contracts/v5.0.0` only. It does **not** support
upgrading from `op-contracts/v5.0.0` to `op-contracts/v6.0.0`. For upgrades beyond v5.0.0, use
[superchain-ops](/chain-operators/tutorials/l1-contract-upgrades/superchain-ops-guide) or interact with the
OPCM directly. See the [notice](/notices/archive/op-deployer-upgrade-deprecation) for details.
</Warning>
# Init Command
Source: https://docs.optimism.io/chain-operators/tools/op-deployer/usage/init
Learn how to initialize intent and state files for your OP Stack deployment.
The `init` command is used to create a new intent and state file in the specified directory. This command is the
starting point of each new deployment.
## Usage
The `init` command is used like this:
```shell theme={null}
op-deployer init \
--l1-chain-id <chain ID of your L1> \
--l2-chain-ids <comma separated list of chain IDs for your L2s> \
--outdir <directory to write the intent and state files> \
--intent-type <standard/custom/standard-overrides>
```
You should then see the following files appear in your output directory:
```
outdir
├── intent.toml
└── state.json
```
The `intent.toml` file is where you specify the configuration for your deployment. The `state.json` file is where OP
Deployer will output the current state of the deployment after each stage of the deployment.
## Intent File
Your intent should look something like this:
```toml theme={null}
configType = "standard"
l1ChainID = 11155420
fundDevAccounts = false
useInterop = false
l1ContractsLocator = "tag://op-contracts/v1.8.0-rc.4"
l2ContractsLocator = "tag://op-contracts/v1.7.0-beta.1+l2-contracts"
[superchainRoles]
proxyAdminOwner = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570"
guardian = "0xeAAA3fd0358F476c86C26AE77B7b89a069730570"
[[chains]]
id = "0x0000000000000000000000000000000000000000000000000000000000002390"
baseFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
l1FeeVaultRecipient = "0x0000000000000000000000000000000000000000"
sequencerFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
operatorFeeVaultRecipient = "0x0000000000000000000000000000000000000000"
eip1559DenominatorCanyon = 250
eip1559Denominator = 50
eip1559Elasticity = 6
[chains.roles]
l1ProxyAdminOwner = "0x0000000000000000000000000000000000000000"
l2ProxyAdminOwner = "0x0000000000000000000000000000000000000000"
systemConfigOwner = "0x0000000000000000000000000000000000000000"
unsafeBlockSigner = "0x0000000000000000000000000000000000000000"
batcher = "0x0000000000000000000000000000000000000000"
proposer = "0x0000000000000000000000000000000000000000"
challenger = "0x0000000000000000000000000000000000000000"
```
<Warning>
Before you can use your intent file for a deployment, you will need to update all zero values to whatever is
appropriate for your chain. For dev environments, it is ok to use all EOAs/hot-wallets.
</Warning>
## Production Setup
In production environments, you should use a more secure setup with cold-wallet multisigs (e.g. Gnosis Safes) for the following:
* `baseFeeVaultRecipient`
* `l1FeeVaultRecipient`
* `sequencerFeeVaultRecipient`
* `operatorFeeVaultRecipient`
* `l1ProxyAdminOwner`
* `l2ProxyAdminOwner`
* `systemConfigOwner`
HSMs (hardware security modules) are recommended for the following hot-wallets:
* `unsafeBlockSigner`
* `batcher`
* `proposer`
* `challenger`
# Release Workflows
Source: https://docs.optimism.io/chain-operators/tools/op-deployer/usage/release-workflows
Learn how to backport fixes onto earlier OP Deployer versions and add support for new contract versions.
<Note>
This page is for people developing OP Deployer itself. If you only need to pick the right OP Deployer release
for your contract version, see the [releases reference](/chain-operators/tools/op-deployer/reference/releases).
</Note>
## Backport a Fix to an Earlier Version
From time to time, we may backport bugfixes from develop onto earlier versions of OP Deployer. The process for this is
as follows:
1. If one doesn't exist already, make a new branch for the version lineage you're patching (e.g. `v0.2.x`). This branch
should be protected (not deletable) and should be based on the latest release of that lineage. The branch should be
named as follows:
`backports/op-deployer/<lineage, i.e. v0.2.0>`.
2. Open a PR with the backport against that branch. Be sure to reference the original commit in the backport.
3. Make and push a new tag on that lineage.
Example for backporting fix(es) from `develop` to create a new release `op-deployer/v0.2.1`:
```
git checkout -b backports/op-deployer/v0.2.0 op-deployer/v0.2.0
git push origin backports/op-deployer/v0.2.0
git checkout -b fixes/deployer-v0.2.0 backports/op-deployer/v0.2.0
git cherry-pick <commit-hash>
git push origin fixes/deployer-v0.2.0
1. open pr from fixes/deployer-v0.2.0 targeting backports/op-deployer/v0.2.0
2. merge the pr
3. push a new tag for op-deployer/v0.2.1 on backports/op-deployer/v0.2.0 branch (goreleaser will create the release)
```
## Add Support for a New Contract Version
Adding support for a new contract version is a multi-step process. Here's a high-level overview. For the sake of
simplicity we will assume you are adding support for a new `rc` release.
### Step 1: Add Support on Develop
First, you need to add support for the new contract version on the `develop` branch. This means ensuring that the
deployment pipeline supports whatever changes are required for the new version. Typically, this means passing in new
deployment variables, and responding to ABI changes in the Solidity scripts/OPCM.
### Step 2: Add the Published Artifacts
Run the following from the root of the monorepo:
```bash theme={null}
cd packages/contracts-bedrock
just clean
just build
bash scripts/ops/calculate-checksum.sh
# copy the outputted checksum
cd ../../op-deployer
just calculate-artifacts-hash <checksum>
```
This will calculate the checksum of your artifacts as well as the hash of the artifacts tarball. OP Deployer uses
these values to download and verify tagged contract locators.
Now, update `standard/standard.go` with these values so that the new artifacts tarball can be downloaded:
```go theme={null}
// Add a new const for your release
const ContractsVXTag = "op-contracts/vX.Y.Z"
var taggedReleases = map[string]TaggedRelease{
// Other releases...
ContractsVXTag: {
ArtifactsHash: common.HexToHash("<the artifacts hash>"),
ContentHash: common.HexToHash("<the checksum>"),
},
}
// Update the L1/L2 versions accordingly
func IsSupportedL1Version(tag string) bool {
return tag == ContractsVXTag
}
```
### Step 3: Update the SR With the New Release
Add the new RC to the [standard versions](https://github.com/ethereum-optimism/superchain-registry/tree/main/validation/standard) in the superchain-registry.
### Step 4: Update the Validation Package
The SR is pulled into OP Deployer via the `validation` package. Update it by running the following command from the
root of the monorepo:
```shell theme={null}
go get -u github.com/ethereum-optimism/superchain-registry/validation@<SR commit SHA>
```
That should be it!
# Verify Command
Source: https://docs.optimism.io/chain-operators/tools/op-deployer/usage/verify
Learn how to verify deployed contract source code on block explorers.
Once you have deployed contracts via [`bootstrap`](/chain-operators/tools/op-deployer/usage/bootstrap) or [`apply`](/chain-operators/tools/op-deployer/usage/apply), you can use the `verify` command to verify the source code on block explorers like Etherscan or Blockscout. The command uses the `forge verify-contract` binary, which automatically handles constructor argument detection and source code verification.
## Usage
You can call the `verify` command like this:
```shell theme={null}
op-deployer verify \
--l1-rpc-url <l1 rpc url> \
--input-file <filepath to input .json or state.json file> \
--verifier-api-key <your api key> \
--artifacts-locator <l1 forge-artifacts locator> \
--verifier etherscan
```
For Blockscout verification (uses default URLs for mainnet/sepolia, no API key required):
```shell theme={null}
op-deployer verify \
--l1-rpc-url <l1 rpc url> \
--input-file <filepath to input .json or state.json file> \
--artifacts-locator <l1 forge-artifacts locator> \
--verifier blockscout
```
For custom block explorer verification (Etherscan v2-compatible, API key may be required):
```shell theme={null}
op-deployer verify \
--l1-rpc-url <l1 rpc url> \
--input-file <filepath to input .json or state.json file> \
--artifacts-locator <l1 forge-artifacts locator> \
--verifier custom \
--verifier-url <custom etherscan v2 compatible api url>
```
## CLI Arguments
### `--l1-rpc-url`
Defines the RPC URL of the L1 chain to deploy to (currently only supports mainnet and sepolia).
### `--input-file`
The full filepath to the input file. This can be either:
* A simple JSON file with contract name/address pairs (output from `bootstrap superchain|implementations`)
* A complete `state.json` file (output from `apply`)
The verifier automatically detects the file format and extracts all contracts. Unless the `--contract-name` flag is passed, all contracts in the input file will be verified.
Example:
```json theme={null}
{
"opcmAddress": "0x437d303c20ea12e0edba02478127b12cbad54626",
"opcmContractsContainerAddress": "0xf89d7ce62fc3a18354b37b045017d585f7e332ab",
"opcmGameTypeAdderAddress": "0x9aa4b6c0575e978dbe6d6bc31b7e4403ea8bd81d",
"opcmDeployerAddress": "0x535388c15294dc77a287430926aba5ba5fe6016a",
"opcmUpgraderAddress": "0x68a7a93750eb56dd043f5baa41022306e6cd50fa",
"delayedWETHImplAddress": "0x33ddc90167c923651e5aef8b14bc197f3e8e7b56",
"optimismPortalImplAddress": "0x54b75cb6f44e36768912e070cd9cb995fc887e6c",
"ethLockboxImplAddress": "0x05484deeb3067a5332960ca77a5f5603df878ced",
"preimageOracleSingletonAddress": "0xfbcd4b365f97cb020208b5875ceaf6de76ec068b",
"mipsSingletonAddress": "0xcc50288ad0d79278397785607ed675292dce37b1",
"systemConfigImplAddress": "0xfb24aa6d99824b2c526768e97b23694aa3fe31d6",
"l1CrossDomainMessengerImplAddress": "0x957c0bf84fe541efe46b020a6797fb1fb2eaa6ac",
"l1ERC721BridgeImplAddress": "0x62786d16978436f5d85404735a28b9eb237e63d0",
"l1StandardBridgeImplAddress": "0x6c9b377c00ec7e6755aec402cd1cfff34fa75728",
"optimismMintableERC20FactoryImplAddress": "0x3842175f3af499c27593c772c0765f862b909b93",
"disputeGameFactoryImplAddress": "0x70ed1725abb48e96be9f610811e33ed8a0fa97f9",
"anchorStateRegistryImplAddress": "0xce2206af314e5ed99b48239559bdf8a47b7524d4",
"superchainConfigImplAddress": "0x77008cdc99fb1cf559ac33ca3a67a4a2f04cc5ef"
}
```
### `--contract-name` (optional)
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.
### `--artifacts-locator`
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).
### `--verifier`
The block explorer(s) to use for verification. Supports multiple verifiers separated by commas.
Options:
* `etherscan` (default): Uses Etherscan for mainnet/sepolia
* `blockscout`: Uses default Blockscout URLs for mainnet/sepolia
* `custom`: For custom Etherscan v2-compatible instances (requires `--verifier-url`)
Examples:
* Single verifier: `--verifier etherscan`
* Multiple verifiers: `--verifier etherscan,blockscout` (verifies on both)
### `--verifier-url`
The verifier API URL. Usage varies by verifier type:
* `etherscan`: Ignored (automatically determined from chain ID)
* `blockscout`: Optional (defaults to standard Blockscout URLs for mainnet/sepolia)
* `custom`: Required. Example: `https://etherscanv2.compat-api.example.com/api`
## Output
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.
```sh theme={null}
INFO [03-05|15:56:55.900] Formatting etherscan verify request name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
INFO [03-05|15:56:55.900] Opening artifact path=Proxy.sol/Proxy.json name=superchainConfigProxyAddress
INFO [03-05|15:56:55.905] contractName name=src/universal/Proxy.sol:Proxy
INFO [03-05|15:56:55.905] Extracting constructor args from initcode address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A argSlots=1
INFO [03-05|15:56:56.087] Contract creation tx hash txHash=0x71b377ccc11304afc32e1016c4828a34010a0d3d81701c7164fb19525ba4fbc4
INFO [03-05|15:56:56.494] Successfully extracted constructor args address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
INFO [03-05|15:56:56.683] Verification request submitted name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
INFO [03-05|15:57:02.035] Verification complete name=superchainConfigProxyAddress address=0x805fc6750ec23bdD58f7BBd6ce073649134C638A
INFO [03-05|15:57:07.971] --- COMPLETE ---
INFO [03-05|15:57:07.971] final results numVerified=2 numSkipped=1 numFailed=0
```
## Automatic Verification
You can automatically verify contracts after deployment by using the `--verify` flag with `apply` or `bootstrap` commands:
```shell theme={null}
op-deployer apply \
--workdir ./.deployer \
--l1-rpc-url <l1 rpc url> \
--private-key <deployer private key> \
--verify \
--verifier-api-key <your api key>
```
This will verify all deployed contracts at the end of the deployment process.
### Multi-Verifier Deployment
You can verify on multiple block explorers simu프로젝트로 돌아가기