Optimism 백서

Optimism

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 51쪽

on games can be created, but every game proxy that already existed on those factories at migration time continues to function. Each game's implementation, `AnchorStateRegistry`, and `DelayedWETH` references were captured as immutable arguments on the proxy when it was created, so the cleared factory pointer does not affect resolution. Bond claims through `FaultDisputeGame.claimCredit` flow into the same `DelayedWETH` the bonds were posted into, independent of the portal or the new shared factory. Concretely: * The two per-chain `op-challenger` instances continue to play retired games to `DEFENDER_WINS` or `CHALLENGER_WINS` and schedule bond claims as games finalize. * Bond claims succeed without operator intervention. Chain A's retired games claim through chain A's `DelayedWETH` (which is also the one used by the new shared games); chain B's retired games claim through chain B's `DelayedWETH`, which is otherwise unused after migration. * The two per-chain `op-dispute-mon` instances keep observing those games. The per-game-type metric `op_dispute_mon_games{game_type="super-cannon-kona"}` and the equivalent for `super-permissioned` should monotonically decrease toward zero across the drain window. * `op-challenger`'s default `--game-window` is 28 days, sized to cover up to 16 days of game play plus a seven-day `DelayedWETH` withdrawal delay plus a five-day buffer. Do not shrink it on the per-chain instances; doing so risks dropping games before their bonds are claimable. Pick a still-in-flight pre-migration game and watch it through to resolution and bond claim: ```bash theme={null} cast call <gameProxy> 'status()(uint8)' --rpc-url $L1_RPC # 0 = IN_PROGRESS, 1 = CHALLENGER_WINS, 2 = DEFENDER_WINS cast call <gameProxy> 'resolvedAt()(uint64)' --rpc-url $L1_RPC # Non-zero once the game has resolved. ``` Once a game is resolved and the `DelayedWETH` finality window has elapsed, the challenger schedules `claimCredit`. Confirm bonds reach the configured claimant by watching the `op_challenger_bonds_total` metric on the per-chain instance, alongside `op_challenger_claim_failures_total` staying flat. ## Verify After the Migration Run these checks once the new proposer is stable. * **Confirm the shared `op-challenger` is defending super-root games.** The challenger does not break metrics down by game type, so verify by way of the startup log (every configured trace type, including `super-cannon-kona` and `super-permissioned`, must be listed as registered) and by ongoing logs (no scheduler or game-poll errors as super games appear on the shared factory). The aggregate `op_challenger_tracked_games{status="in_progress"}` becomes non-zero as super games are created and remains non-zero while games are in progress. * **Confirm the shared `op-dispute-mon` reports super-root games.** On the shared instance, `op_dispute_mon_games{game_type="super-cannon-kona"}` and `op_dispute_mon_games{game_type="super-permissioned"}` are non-zero once games are created. `op_dispute_mon_failed_games` stays near zero; a non-zero value typically points at missing `--supernode-rpc` or supernode unavailability. * **Confirm new pre-migration games cannot be created.** Optionally call `DisputeGameFactory.create` with one of the cleared game types on either per-chain factory and confirm it reverts. * **Watch for the first super-game finalization.** The first anchor update typically lands roughly seven days after the first super-root game is created (game duration plus `DISPUTE_GAME_FINALITY_DELAY_SECONDS`). Do not block the rollout on this—schedule a follow-up to re-run `getAnchorRoot()` after that window and confirm it returns the new game's claim instead of the starting anchor. ## Tear Down After the Drain A per-chain instance is safe to retire when its `op_dispute_mon_games{game_type="super-cannon-kona"}` and `op_dispute_mon_games{game_type="super-permissioned"}` have been zero for at least one full `--game-window` (default 28 days) and `op_challenger_tracked_games{status="in_progress"}` on the matching per-chain `op-challenger` is zero with bond-claim metrics stable. For each chain when both conditions hold, stop the per-chain `op-challenger` and `op-dispute-mon` instances. Once both chains are drained, the steady-state operational footprint is one `op-proposer`, one `op-challenger`, and one `op-dispute-mon`, all pointed at the shared factory and a single supernode that derives both chains. ## Operational Cautions After Migration After migration, both chains share one `ETHLockbox`, one `AnchorStateRegistry`, and one pause identifier. Most mistakes in this section come from treating a shared contract as if it still belonged to one chain. Nothing on-chain blocks them, so walk through them with everyone who operates either chain. ### Pause the Set Through the Shared Lockbox The set now has a single pause identifier: the shared lockbox address, `$SHARED_LOCKBOX`. Pausing it halts both chains. The old identifiers still accept a pause. Calling `pause` with either chain's old `OptimismPortal2` or old `ETHLockbox` address still emits `Paused`, but nothing is really paused. Point the Guardian's tooling at `$SHARED_LOCKBOX` before you need it. A pause expires on its own. After that, `paused` reads `false`, but calling `pause` on the same identifier reverts with `SuperchainConfig_AlreadyPaused`. Call `extend` to pause it again. ### Guardian Actions Reach Both Chains `updateRetirementTimestamp`, `setRespectedGameType`, and `blacklistDisputeGame` on `$SHARED_ASR` apply to both chains at once. The retired per-chain registries still take the same calls from the same Guardian. The calls succeed and change nothing for live withdrawals. During an incident, check the address before you sign. ### Do Not Call `migrateToSharedDisputeGame` by Hand Nothing on-chain retires the old contracts. Each chain's old `ETHLockbox` still authorizes its portal, so a manual `OptimismPortal2.migrateToSharedDisputeGame` call that points a portal back at its old lockbox and `<oldASR_chainX>` passes every check. The chain leaves the set, but its ETH stays in the shared lockbox, where the other chain can still withdraw it. The chain's withdrawals now draw from its empty old lockbox and revert with `ETHLockbox_InsufficientBalance`. It also can't prove new withdrawals, because its old `AnchorStateRegistry` points at a factory with no game implementations. ### Upgrade Both Chains Together Both chains run on the same shared contracts, so they upgrade as a pair. Once the shared contracts are on a newer release, running an older OPCM on either chain fails with `OPContractsManagerUtils_DowngradeNotAllowed`. Upgrading one chain also reconfigures the other. `upgrade` registers every game type on the shared `DisputeGameFactory` again from that upgrade's `disputeGameConfigs`. So a task scoped to one chain sets the implementations, prestates, bonds, and respected game type for the whole set. Follow three rules when authoring an upgrade task: * Read each member's `disputeGameConfigs` from the shared factory and copy them. **Never write them per chain.** * Don't decide whether `SUPER_CANNON_KONA` is enabled by checking for a `CANNON_KONA` implementation on the factory. A shared factory never has `CANNON_KONA`, so with `startingRespectedGameType = 5` that check disables the set's permissionless game for both chains. * After upgrading both chains, run the `StandardValidator` against each one, not only the chain the task named, and confirm both pass. ### Treat INTEROP and the ProxyAdmin Owner as Fixed `Features.INTEROP` can't be turned off, and `SystemConfig.setFeature` reverts if you try. That closes the obvious way out of a set. It also means a chain whose `INTEROP` was enabled by hand before migration needs an administrative upgrade to clear the dev flag before it can be migrated. Both chains also need the same `ProxyAdmin` owner. `ETHLockbox.authorizePortal`, `ETHLockbox.migrateLiquidity`, and upgrades that touch the shared contracts all check that the owner is shared. If you change the owner on one chain, those calls revert for that chain until the owners match again. ## Next Steps * Plan the full interop activation milestone—`migrate` joins the chains under a shared dispute game, but turning on cross-chain messaging is a separate step. See [Interop Explainer](/op-stack/interop/explainer) when you are ready. * Schedule a follow-up to verify the anchor advances on the first super-game finalization, roughly seven days after the new proposer's first proposal. Re-run `cast call $SHARED_ASR 'getAnchorRoot()(bytes32,uint256)' --rpc-url $L1_RPC` and confirm it returns the new game's claim. # Migrating to permissionless fault proofs on OP Stack Source: https://docs.optimism.io/chain-operators/tutorials/migrating-permissionless Migrate your OP Stack chain from permissioned to permissionless fault proofs: configure the dispute components, deploy the contracts with OPCM, test the off-chain agents, and switch the respected game type. This guide shows you how to transition your OP Stack chain from permissioned to permissionless fault proofs. It walks chain operators through the four migration phases: configuring the dispute components, deploying the smart contracts with OPCM, testing the off-chain agents, and switching the respected game type. ## Overview The OP Stack architecture uses Fault Proofs to ensure the validity of withdrawals from L2 to L1. Transitioning from permissioned to permissionless proofs represents a significant security upgrade, allowing any participant to propose and challenge state output roots. Permissioned games previously relied on a single trusted validator, this is typically the proposer which is configured in the PermissionedDisputeGame, and is usually the network's only sequencer. This migration involves several key components: * Configuring security-critical dispute [monitoring services](/chain-operators/tools/chain-monitoring) * Deploying and configuring smart contracts using [op-deployer](/chain-operators/tools/op-deployer/overview) * Testing the new system before activation * Setting the respected game type to permissionless fault proofs, specifically using the [`FaultDisputeGame`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/dispute/FaultDisputeGame.sol) ## Prerequisites Before beginning this transition, your chain should: * Be running a standard OP Stack implementation * It's recommended to use the latest contracts version, minimum required [**v5.0.0**](https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv5.0.0). * Be operating with the required infrastructure services including [`op-challenger`](/op-stack/fault-proofs/challenger) and [`op-dispute-mon`](/chain-operators/tools/chain-monitoring#dispute-mon). ## Migration steps The process of migrating from permissioned to permissionless fault proofs involves four main phases: configuring off-chain dispute components, deploying the necessary smart contracts, testing the system thoroughly, and finally switching the chain to use permissionless proofs. Each step builds on the previous one to ensure a smooth and secure transition. Let's begin with configuring the dispute components that will interact with the new permissionless game. ## 1. Configure the dispute components The `op-challenger` and `op-dispute-mon` services are critical security components that participate in the dispute game process to challenge invalid proposals and monitor active games. ### Upgrade to the latest `op-challenger` Upgrade to the [latest release](https://github.com/ethereum-optimism/optimism/releases), which contains important improvements to simplify the upgrade process. You can use the official Docker image for reliability and ease of deployment: ```bash theme={null} # Pull a specific stable release version docker pull us-docker.pkg.dev/oplabs-tools-artifacts/images/op-challenger:<latest_version> ``` Then run the image, for example: ```bash theme={null} # Run with all required flags docker run -d --name op-challenger \ -e OP_CHALLENGER_GAME_TYPES=permissioned,cannon-kona \ -e OP_CHALLENGER_PRESTATES_URL=<YOUR_PRESTATES_URL> \ -e OP_CHALLENGER_L1_ETH_RPC=<YOUR_L1_RPC_URL> \ -e OP_CHALLENGER_GAME_FACTORY_ADDRESS=<YOUR_DISPUTE_GAME_FACTORY> \ -e OP_CHALLENGER_PRIVATE_KEY=<YOUR_PRIVATE_KEY_OR_USE_WALLET_SIGNER> \ -e OP_CHALLENGER_NETWORK=<YOUR_NETWORK> \ -v /path/to/local/prestates:/prestates \ us-docker.pkg.dev/oplabs-tools-artifacts/images/op-challenger:latest # Replace all placeholder values with your actual configuration ``` Replace `<YOUR_PRESTATES_URL>` with your actual prestates URL. If your deployment requires building from source, you can alternatively use: ```bash theme={null} git clone https://github.com/ethereum-optimism/optimism -b op-challenger/<latest_version> --recurse-submodules cd optimism make op-challenger ``` ### Update network configuration Configure `op-challenger` to load your chain configuration. Even if your chain is not included in the [superchain-registry](/op-stack/protocol/superchain-registry), you can specify a custom configuration: ```bash theme={null} # For chains in the registry --network <chain-name> # For chains not in the registry, provide a path to your rollup configuration - `rollup.json` - Your rollup configuration - `genesis-l2.json` - Your L2 genesis file ``` ### Enable the cannon-kona game type From the Karst upgrade, `cannon-kona` (the kona-client program run inside the Cannon VM) is the respected permissionless game type, replacing op-program. Configure `op-challenger` to support both permissioned and permissionless games by setting: ```bash theme={null} --game-types permissioned,cannon-kona ``` Or by setting the environment variable: ```bash theme={null} OP_CHALLENGER_GAME_TYPES=permissioned,cannon-kona ``` ### Configure prestates access Replace the `--cannon-kona-prestate` flag with `--prestates-url`, which points to a source containing all required prestates: ```bash theme={null} --prestates-url <URL_TO_PRESTATES_DIRECTORY> ``` The URL can use `http`, `https`, or `file` protocols. Each prestate should be named as `<PRESTATE_HASH>.bin.gz`. ### Building required prestates for chains not in the superchain-registry You'll need a new absolute prestate to register with the `FaultDisputeGame` and `PermissionedDisputeGame` (see [Section 2](#2-deploy-and-configure-smart-contracts-using-opcm)). <Info> The initial prestate used for permissioned games doesn't include the necessary chain configuration for the Fault Proof System. The assumption is that the chain operator, the single permissioned actor, will not challenge their own games. So the absolute prestate on the initial `PermissionedDisputeGame` will never be used. When deploying a new chain, you must first deploy the L1 contracts and then generate the chain genesis file and rollup configuration files. These are inputs to the creation of the absolute prestate and this circular dependency is the reason chains cannot be deployed directly to the permissionless Fault Proof System. </Info> For chains not in the superchain-registry, you need to build custom prestates with your chain's configuration: Build the kona-client absolute prestate with `just reproducible-prestate-kona` (see the [absolute prestate tutorial](/chain-operators/tutorials/absolute-prestate)). The artifacts are written to: * `rust/kona/prestate-artifacts-cannon/prestate-proof.json` — the proof file; its `pre` field is the absolute prestate hash (`jq -r .pre ...`) * `rust/kona/prestate-artifacts-cannon/<PRESTATE_HASH>.bin.gz` — the preimage file `op-challenger` loads <Info> Register the kona-client absolute prestate with your `FaultDisputeGame` and `PermissionedDisputeGame`. The challenger refuses to interact with games whose on-chain absolute prestate doesn't match the one it has, so the hash must match exactly. </Info> ### Ensure sufficient funds for bonds Bonds are required for both permissioned and permissionless games. However, with permissioned games, you typically don't post claims regularly, making bond requirements less noticeable. In contrast, the challenger in permissionless games will frequently need to post bonds with each claim it makes. Therefore, ensure your challenger has sufficient funds available. As a general guideline: * Maintain a minimum balance of 50 ETH * Have access to a large pool of ETH for potential attack scenarios * Implement monitoring to ensure sufficient funds are always available ### Ensure there is disk space for the challenger to use `op-challenger`, particularly in permissionless mode, should have access to disk. About 50GB is enough to cover a couple of `invalid_ games`. Though the storage requirements will increase if the challenger needs to respond to more invalid dispute games. Nominally, the challenger does not use disk space as long as there aren’t any invalid proposals being made. One way to gain more confidence that the op-challenger was configured correctly is to operate the op-challenger in “runner” mode. Using the same op-challenger configuration, invoke the `op-challenger run-trace --run cannon-kona` subcommand. This will run op-challenger in a mode where it runs the kona-client program in a Cannon VM on live L2 blocks to ensure those were configured correctly. This command runs forever, checking every couple of L2 blocks. But it suffices to let it run until it has completed one loop and kill it. Wait you see `Successfully verified output root` in the logs before shutting it down. Any errors indicate a misconfiguration. ### Set up `op-dispute-mon` Ensure `op-dispute-mon` is properly configured by following the [steps](/chain-operators/tools/chain-monitoring#dispute-mon) in the documentation. ## 2. Deploy and configure smart contracts using OPCM This section requires privileged actions by the `ProxyAdminOwner` and the `Guardian` role. ### Understanding ProxyAdmin Owner and Guardian roles This migration requires actions by privileged roles in your system: * The **ProxyAdmin Owner** has the authority to upgrade proxy contracts. * The **Guardian** has emergency powers like pausing withdrawals and changing the respected game type. For detailed information about privileged roles and their security implications, refer to the [privileged roles documentation](/op-stack/protocol/privileged-roles). ### Adding the PermissionlessDisputeGame to a chain To enable the permissionless dispute game, call the `upgrade()` function on the `OPContractsManagerV2` (OPCM) contract with the appropriate `DisputeGameConfig` entries. This is typically done via `op-deployer manage add-game-type-v2`. The upgrade will: 1. Register the `FaultDisputeGame` implementation on the `DisputeGameFactory` with the correct game arguments (absolute prestate, VM, anchor state registry, delayed WETH, chain ID). 2. Set the initial bond for the new game type. See a high‐level implementation from this [docs](/chain-operators/tutorials/dispute-games) or [this superchain-ops template](https://github.com/ethereum-optimism/superchain-ops/blob/main/src/template/AddGameTypeTemplate.sol). ## 3. Testing off-chain agents After you've set the permissionless `FaultDisputeContract` implementations on the `DisputeGameFactory` and before you set the respected game type to it (game type 0), you can test `op-challenger` and `op-dispute-mon` to ensure they are working correctly with permissionless games. There are a number of useful `op-challenger` subcommands that can be used for testing, particularly `list-games`, `list-claims` and `create-game`. See the [README](https://github.com/ethereum-optimism/optimism/tree/develop/op-challenger#subcommands) and `op-challenger --help` output for further details. The two tests below are basic sanity tests: ### Test defending valid proposals Create a valid proposal using the permissionless game type `0`: 1.
프로젝트로 돌아가기