-
Notifications
You must be signed in to change notification settings - Fork 265
Migrating to permissionless fault proofs on OP Stack #1539
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
64bdd4e
initial commit
krofax 08f54cf
fix lint issues
krofax afce829
fix headers
krofax 8f433da
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
krofax 5359d94
Mentioned OPCM and prestates
krofax 6bd9fd8
moved to the right section
krofax 70816d5
updated the paths
krofax 8911fef
fix broken link
krofax 3579aee
added breadcrumb nav
krofax 87c2fd2
updated statements
krofax 973b544
update text
krofax d7162f8
Add new line
krofax ebc1293
update steps
krofax 6e89dab
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax f8022ba
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax e8d4ef8
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 328fa67
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 23bc0c9
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 9990668
updated the contents
krofax 9180872
pull suggested commits
krofax 7c58e9e
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
krofax 62a7b8c
remove boilerplate codes
krofax 4c959c7
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax b76bd6c
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax cd25921
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 3849a38
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax dffe511
updated content
krofax 7147bed
pull suggestions
krofax b374f73
Auto-fix: Update breadcrumbs, spelling dictionary and other automated…
krofax 8fedf6a
add some todos
krofax 685bc04
remove boilerplate code
krofax b8cdec4
updated the content
krofax 9ca4334
update content
krofax e60f450
moved a content up
krofax 696e64d
updated the prestate config
krofax 1bb7e4f
add instruction ti use docker
krofax 0517668
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax c750657
remove todo
krofax bd6e0d8
remove typo
krofax b44af8d
fix conflict
krofax 741b1e3
remove the version
krofax 2af3aea
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax d90abf7
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 013b0e0
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 35906c1
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax d4eacf6
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax bde1268
updated content
krofax 9c92870
update names
krofax 91f709a
updated docs
krofax 5146039
updated the docs
krofax 09bb92b
fix link path
krofax 81bfe0d
Todo to update next steps
krofax f0e73a9
Update migrating-permissionless.mdx
krofax 918df6b
revert changes
krofax 68ec344
Update pages/operators/chain-operators/tutorials/migrating-permission…
krofax 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 hidden or 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 hidden or 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
307 changes: 307 additions & 0 deletions
307
pages/operators/chain-operators/tutorials/migrating-permissionless.mdx
This file contains hidden or 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,307 @@ | ||
--- | ||
title: Migrating to permissionless fault proofs on OP Stack | ||
description: A high-level guide for transitioning from permissioned to permissionless fault proofs on an OP Stack. | ||
lang: en-US | ||
content_type: tutorial | ||
topic: migrating to permissionless fault proofs on OP Stack | ||
personas: | ||
- chain-operator | ||
categories: | ||
- testnet | ||
- local-devnet | ||
- chain-deployment | ||
- docker | ||
- chain-configuration | ||
- chain-operation | ||
- node-management | ||
is_imported_content: 'false' | ||
--- | ||
|
||
# Migrating to permissionless fault proofs on OP Stack | ||
|
||
This guide provides a high-level overview for chain operators looking to transition their OP Stack from permissioned to permissionless fault proofs. It's designed to be accessible for technical decision makers while providing sufficient detail for implementation teams. | ||
|
||
## Overview | ||
|
||
The OP Stack architecture uses fault proofs to ensure the validity of transactions processed on Layer 2. Transitioning from permissioned to permissionless proofs represents a significant security upgrade, allowing any participant to challenge invalid state transitions rather than relying on a limited set of trusted validators. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This migration involves several key components: | ||
|
||
* Configuring security-critical dispute [monitoring services](/operators/chain-operators/tools/chain-monitoring) | ||
* Deploying and configuring smart contracts using [OPCM](/stack/opcm) | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* Testing the new system before activation | ||
* Switching the chain to use the new permissionless system | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Prerequisites | ||
|
||
Before beginning this transition, your chain should: | ||
|
||
* Be running a standard OP Stack implementation | ||
* Be operating with the recommended infrastructure services including [`op-challenger`](/stack/fault-proofs/challenger) and [`op-dispute-mon`](/operators/chain-operators/tools/chain-monitoring#dispute-mon) | ||
|
||
## 1. Configure the dispute monitoring stack | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The `op-challenger` and `op-dispute-mon` services are critical security components that participate in the dispute game process to challenge invalid proposals. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Upgrade to the latest `op-challenger` | ||
|
||
Upgrade to `version 1.3.3` or [later](https://github.com/ethereum-optimism/optimism/releases), which contains important improvements to simplify the upgrade process. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
# Example upgrade command (implementation may vary based on your deployment) | ||
git clone https://github.com/ethereum-optimism/optimism -b op-challenger/v1.3.3 --recurse-submodules | ||
cd optimism | ||
make op-challenger | ||
``` | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Update network configuration | ||
|
||
Configure `op-challenger` to load your chain configuration. Even if your chain is not included in the superchain-registry, you can specify a custom configuration: | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
# For chains in the registry | ||
--network <chain-name> | ||
|
||
# For chains not in the registry, provide a path to your configuration | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
--network-config /path/to/your/network-config.json | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
### Enable cannon trace type | ||
|
||
Configure `op-challenger` to support both permissioned and permissionless games by setting: | ||
|
||
```bash | ||
--trace-type permissioned,cannon | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
Or by setting the environment variable: | ||
|
||
``` | ||
OP_CHALLENGER_TRACE_TYPE=permissioned,cannon | ||
``` | ||
|
||
### Configure prestates access | ||
|
||
Replace the `--cannon-prestate` flag with `--prestates-url`, which points to a source containing all required prestates: | ||
sbvegan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```bash | ||
--prestates-url <URL_TO_PRESTATES_DIRECTORY> | ||
``` | ||
|
||
The URL can use `http`, `https`, or `file` protocols. Each prestate should be named as `<PRESTATE_HASH>.json` or `<PRESTATE_HASH>.bin.gz`. | ||
sbvegan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Building required prestates for chains not in the Superchain Registry | ||
|
||
You'll need at least two prestates: | ||
|
||
1. The prestate used for permissioned games | ||
2. The prestate matching the `faultGameAbsolutePrestate` configuration | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
For chains not in the Superchain Registry, you need to build custom prestates with your chain's configuration: | ||
|
||
```bash | ||
git clone https://github.com/ethereum-optimism/optimism --recurse-submodules | ||
cd optimism | ||
|
||
# To build a specific prestate (e.g., for op-program/v1.3.1) | ||
git checkout op-program/v1.3.1 | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
make reproducible-prestate | ||
|
||
# Generate the prestate with your chain's specific configuration | ||
./op-program/bin/op-program \ | ||
--l2.genesis /path/to/your/l2-genesis.json \ | ||
--rollup.config /path/to/your/rollup-config.json \ | ||
--network.l2chainid <YOUR_L2_CHAIN_ID> \ | ||
--exec.prestate | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``` | ||
|
||
The prestate will be generated at `op-program/bin/prestate.json` (or `prestate.bin.gz` for newer versions). | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Ensure sufficient funds for bonds | ||
|
||
Unlike with permissioned games, the challenger will need to post bonds with each claim it makes. 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 | ||
|
||
### Set up `op-dispute-mon` | ||
|
||
Ensure `op-dispute-mon` is properly configured according to these [steps](/operators/chain-operators/tools/chain-monitoring#dispute-mon) | ||
|
||
## 2. Deploy and configure smart contracts using OPCM | ||
|
||
This section requires privileged actions by the `ProxyAdminOwner` and may involve the `Guardian` role depending on your security setup. | ||
|
||
### Using OPCM for deployment | ||
|
||
OPCM is the recommended tool for safely managing OP Stack upgrades: | ||
|
||
```bash | ||
# Install OPCM | ||
git clone https://github.com/ethereum-optimism/op-chain-manager.git | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cd op-chain-manager | ||
npm install | ||
|
||
# Configure OPCM with your chain's information | ||
cp config.example.json config.json | ||
# Edit config.json with your chain's specific addresses and parameters | ||
``` | ||
|
||
### Set game implementations | ||
|
||
Using OPCM, execute the following smart contract changes: | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
1. Call `setImplementation` on the `DisputeGameFactoryProxy` to: | ||
|
||
* Set the implementation for the new permissionless `FaultDisputeGame` (game type `0`) | ||
* Upgrade the permissioned game to the new `PermissionedDisputeGameAddress` (game type `1`) with the updated absolute prestate | ||
|
||
```bash | ||
# Using OPCM to manage the upgrades | ||
npx opcm upgrade dispute-game-factory \ | ||
--permissionless-impl <NEW_PERMISSIONLESS_IMPL_ADDR> \ | ||
--permissioned-impl <NEW_PERMISSIONED_IMPL_ADDR> \ | ||
--absolute-prestate <PRESTATE_HASH> | ||
``` | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
2. Upgrade the `AnchorStateRegistryProxy`: | ||
|
||
* First upgrade to point to the `StorageSetter` contract and clear the initialized flag | ||
* Then upgrade back to the `AnchorStateRegistry` implementation | ||
* Call `initialize` with the anchor state for the new game type | ||
|
||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
```bash | ||
# First upgrade to the StorageSetter to clear initialization flag | ||
npx opcm upgrade anchor-registry \ | ||
--implementation <STORAGE_SETTER_ADDR> \ | ||
--skip-initialize | ||
|
||
# Then upgrade back to the proper implementation | ||
npx opcm upgrade anchor-registry \ | ||
--implementation <ANCHOR_REGISTRY_IMPL_ADDR> | ||
|
||
# Initialize with the correct anchor state | ||
npx opcm initialize anchor-registry \ | ||
--game-type 0 \ | ||
--anchor-state <ANCHOR_STATE_FOR_GAME_TYPE_0> | ||
``` | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
3. Initialize bond amounts for each game type to exactly 0.08 ETH: | ||
```bash | ||
# Set bond amounts for both game types | ||
npx opcm set-bond-amount \ | ||
--game-type 0 \ | ||
--bond-amount 0.08ether | ||
|
||
npx opcm set-bond-amount \ | ||
--game-type 1 \ | ||
--bond-amount 0.08ether | ||
``` | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
The anchor state for permissionless games should match the current anchor state for permissioned games at the time of migration. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Understanding ProxyAdmin Owner and Guardian roles | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
This migration requires actions by privileged roles in your system: | ||
|
||
* The **ProxyAdmin Owner** has the authority to upgrade contracts and is typically controlled by a secure multisig. This role will execute most of the contract upgrades described in this guide. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
* The **Guardian** has emergency powers like pausing withdrawals but more limited capabilities than the ProxyAdmin Owner. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
For detailed information about privileged roles and their security implications, refer to the [privileged roles documentation](/superchain/privileged-roles). | ||
|
||
## 3. Testing off-chain agents | ||
|
||
Before enabling permissionless proofs for withdrawals, thoroughly test your off-chain monitoring services. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Test defending valid proposals | ||
|
||
Create a valid proposal using the permissionless game type `0`: | ||
|
||
1. Ensure the proposal is from a block at or before the `safe` head: | ||
```bash | ||
cast block --rpc-url <OP_GETH_ENDPOINT> safe | ||
``` | ||
|
||
2. Get a valid output root: | ||
```bash | ||
cast rpc --rpc-url <OP_NODE_ENDPOINT> optimism_outputAtBlock \ | ||
$(cast 2h <BLOCK_NUMBER>) | jq -r .outputRoot | ||
``` | ||
|
||
3. Create a test game: | ||
```bash | ||
./op-challenger/bin/op-challenger create-game \ | ||
--l1-eth-rpc=<L1_RPC_ENDPOINT> \ | ||
--game-factory-address <DISPUTE_GAME_FACTORY_ADDR> \ | ||
--l2-block-num <BLOCK_NUMBER> \ | ||
--output-root <OUTPUT_ROOT> \ | ||
<SIGNER_OPTIONS> | ||
``` | ||
|
||
4. Verify: | ||
* `op-challenger` logs a message showing the game is in progress | ||
* `op-challenger` doesn't post a counter claim (as this is a valid proposal) | ||
* `dispute-mon` includes the new game with `status="agree_defender_ahead"` | ||
|
||
### Test countering invalid claims | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Post an invalid counter claim to the valid proposal created above: | ||
|
||
```bash | ||
./op-challenger/bin/op-challenger move \ | ||
--l1-eth-rpc <L1_RPC_ENDPOINT> \ | ||
--game-address <GAME_ADDR> \ | ||
--attack \ | ||
--parent-index 0 \ | ||
--claim 0x0000000000000000000000000000000000000000000000000000000000000000 \ | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<SIGNER_OPTIONS> | ||
``` | ||
|
||
Verify that `op-challenger` posts a counter-claim to the invalid claim. You can view claims using: | ||
|
||
```bash | ||
./op-challenger/bin/op-challenger list-claims \ | ||
--l1-eth-rpc <L1_RPC_ENDPOINT> \ | ||
--game-address <GAME_ADDR> | ||
``` | ||
|
||
There should be 3 claims in the game after this test. | ||
|
||
## 4. Switch to permissionless proofs | ||
|
||
After completing all previous steps and verifying their successful operation: | ||
|
||
1. Set the `respectedGameType` on the `OptimismPortal` to `CANNON` (game type `0`) using OPCM: | ||
```bash | ||
npx opcm set-respected-game-type \ | ||
--game-type 0 | ||
``` | ||
|
||
2. Configure `op-proposer` to create proposals using the permissionless `cannon` game type: | ||
|
||
```bash | ||
# Change from game-type 1 to 0 | ||
--game-type 0 | ||
``` | ||
|
||
Or via environment variable: | ||
|
||
``` | ||
OP_PROPOSER_GAME_TYPE=0 | ||
``` | ||
|
||
## Next steps | ||
|
||
* [Optimism Fault Proof Documentation](/operators/chain-operators/tools/op-challenger) | ||
* [Privileged Roles Documentation](/superchain/privileged-roles) | ||
* [L2Beat OP Mainnet Upgrades](https://l2beat.com/scaling/projects/op-mainnet#upgrades-and-governance) | ||
* [op-challenger GitHub](https://github.com/ethereum-optimism/optimism/tree/develop/op-challenger) | ||
* [op-dispute-mon GitHub](https://github.com/ethereum-optimism/optimism/tree/develop/op-dispute-mon) | ||
|
||
## Conclusion | ||
|
||
Transitioning to permissionless proofs represents a significant security improvement for your OP Stack chain. This transition decentralizes the validation process, allowing any participant to challenge invalid state transitions rather than relying on a limited set of trusted validators. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
By following this guide, you'll be able to safely configure and test your system before making the final switch to permissionless proofs. Remember to thoroughly test each service before proceeding to the next step, and ensure that your security monitoring is properly configured to track the health of the system after the transition. | ||
krofax marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 |
---|---|---|
|
@@ -264,7 +264,6 @@ offchain | |
opchaina | ||
opchainb | ||
OPCM | ||
opcm | ||
Openfort | ||
oplabs | ||
opnode's | ||
|
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.
Uh oh!
There was an error while loading. Please reload this page.