Optimism 백서

Optimism

원문

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

of 3.2MB to 12.8MB of data to batch). Disable throttling by setting the lower threshold to `0`. The upper threshold sets the level where the maximum throttling intensity is reached. * Individual tx size throttling via `--throttle.tx-size-lower/upper-limit` (env var `OP_BATCHER_THROTTLE_TX_SIZE_LOWER/UPPER_LIMIT`): 150 and 20\_000. This is the limit on the estimated compressed size of a transaction when throttling is at maximum/minimum intensity respectively. * Block size throttling via `--throttle.block-size-lower/upper-limit` (env var `OP_BATCHER_THROTTLE_BLOCK_SIZE_LOWER/UPPER_LIMIT`): 2\_000 and 130\_000. This is the limit on the estimated compressed size of a block when throttling is at maximum/minimum intensity respectively. * Throttler controller type via `--throttle.controller-type` (env var `OP_BATCHER_THROTTLE_CONTROLLER_TYPE`): `quadratic` by default. This determines how transaction and block size limits are interpolated when throttling is at intermediate intensity. For full details, see the [readme](https://github.com/ethereum-optimism/optimism/blob/develop/op-batcher/readme.md). If the batcher at startup has throttling enabled and the sequencer's `op-reth` node to which it's talking doesn't have the `miner_setMaxDASize` RPC enabled, it will fail with an error message like: ``` lvl=warn msg="Served miner_setMaxDASize" reqid=1 duration=11.22µs err="the method miner_setMaxDASize does not exist/is not available" In this case, make sure the miner API namespace is enabled for the correct transport protocol (HTTP or WS), see next paragraph. ``` The `miner_setMaxDASize` RPC has to be enabled by adding the `miner` namespace to `op-reth`'s API flags: ``` --http.api=web3,debug,eth,txpool,net,miner --ws.api=web3,debug,eth,txpool,net,miner ``` It is recommended to add it to both HTTP and WS. ## Example configuration This is a basic example of a batcher configuration. Optimal batcher configuration is going to differ for each chain, however you can see some of the most important variables configured below: ``` OP_BATCHER_WAIT_NODE_SYNC: true OP_BATCHER_CHECK_RECENT_TXS_DEPTH: 5 OP_BATCHER_POLL_INTERVAL: "5s" OP_BATCHER_BATCH_TYPE: "1" # span OP_BATCHER_COMPRESSION_ALGO: brotli-10 OP_BATCHER_DATA_AVAILABILITY_TYPE: auto OP_BATCHER_MAX_CHANNEL_DURATION: "150" # up to 30 min to fill blobs OP_BATCHER_TARGET_NUM_FRAMES: "5" # 5 blobs, can go to 6 with Pectra activated on L1 OP_BATCHER_SUB_SAFETY_MARGIN: "300" # 1h safety margin to prevent seq window elapse OP_BATCHER_NUM_CONFIRMATIONS: "4" OP_BATCHER_NETWORK_TIMEOUT: "10s" OP_BATCHER_TXMGR_MIN_BASEFEE: "2.0" OP_BATCHER_TXMGR_MIN_TIP_CAP: "2.0" OP_BATCHER_TXMGR_FEE_LIMIT_MULTIPLIER: 16 # allow up to 4 doublings OP_BATCHER_MAX_PENDING_TX: "10" OP_BATCHER_RESUBMISSION_TIMEOUT: "180s" # wait 3 min before bumping fees OP_BATCHER_ACTIVE_SEQUENCER_CHECK_DURATION: 5s ``` Lower throughput chains, which aren't filling up channels before the `MAX_CHANNEL_DURATION` is hit, may save gas by increasing the `MAX_CHANNEL_DURATION`. See the [recommendations section](#set-your--op_batcher_max_channel_duration). # Chain Operator Configurations Source: https://docs.optimism.io/chain-operators/guides/configuration/getting-started Learn how to configure an OP Stack chain. OP Stack chains can be configured for the Chain Operator's needs. Each component of the stack has its own considerations. See the following for documentation for details on configuring each piece. <Steps> <Step title="Rollup Configuration"> Deploying your OP Stack contracts requires creating a deployment configuration JSON file. This defines the behavior of your network at its genesis. * **Important Notes:** * The Rollup Configuration sets parameters for the L1 smart contracts upon deployment. These parameters govern the behavior of your chain and are critical to its operation. * Be aware that many of these values cannot be changed after deployment or require a complex process to update. Carefully consider and validate all settings during configuration to avoid issues later. * [Rollup Deployment Configuration reference](/chain-operators/reference/rollup-deployment-configuration) </Step> <Step title="Batcher Configuration"> The batcher is the service that submits the L2 Sequencer data to L1, to make it available for verifiers. These configurations determine the batcher's behavior. * [Batcher Configuration Documentation](/chain-operators/guides/configuration/batcher) </Step> <Step title="Proposer Configuration"> The proposer is the service that submits the output roots to the L1. These configurations determine the proposer's behavior. * [Proposer Configuration Documentation](/chain-operators/guides/configuration/proposer) </Step> <Step title="Node Configuration"> The rollup node has a wide array of configurations for both the consensus and execution clients. * [Consensus Client Configuration](/node-operators/guides/configuration/consensus-clients) * [Execution Client Configuration](/node-operators/guides/configuration/execution-clients) </Step> </Steps> # How to configure challenger for your chain Source: https://docs.optimism.io/chain-operators/guides/configuration/op-challenger-config-guide Learn how to configure challenger for your OP Stack chain. This guide provides step-by-step instructions for setting up the configuration and monitoring options for `op-challenger`. The challenger is a critical fault proofs component that monitors dispute games and challenges invalid claims to protect your OP Stack chain. See the [op-challenger explainer](/op-stack/fault-proofs/challenger) for a general overview of this fault proofs feature. The challenger is responsible for: * Monitoring dispute games created by the fault proof system * Challenging invalid claims in dispute games * Defending valid state transitions * Resolving games when possible For the complete catalog of flags, environment variables, and defaults, see the [challenger configuration reference](/chain-operators/reference/challenger-configuration). <Warning> **From the Karst upgrade, `cannon-kona` is the respected fault-proof game type, replacing op-program.** Configure `op-challenger` with the `cannon-kona` trace type and a kona-client absolute prestate. A challenger still running the `cannon` / op-program trace type past Karst will not defend your chain. </Warning> <Warning> **op-geth has reached end-of-support (2026-05-31) and does not support the now-active Karst hardfork, so op-geth nodes can no longer follow the canonical chain.** Migrate to op-reth, the primary supported execution client. See the [op-geth deprecation notice](/notices/archive/op-geth-deprecation) for the full migration plan. </Warning> ## Prerequisites ### Essential requirements Before configuring your challenger, complete the following steps: <Steps> <Step title="Deploy OP Stack chain with fault proofs enabled"> * L1 contracts deployed with dispute game factory * Fault proof system active on your chain * Access to your chain's contract addresses * [Generate an absolute prestate](/chain-operators/tutorials/absolute-prestate#generating-the-absolute-prestate) for your network version - This is critical as the challenger will refuse to interact with games if it doesn't have the matching prestate </Step> <Step title="Set up required infrastructure access"> * L1 RPC endpoint (Ethereum, Sepolia, etc.) * L1 Beacon node endpoint (for blob access) * L2 archive node with debug API enabled * Rollup node (op-node) with historical data </Step> <Step title="Prepare configuration files"> * `rollup.json` - Rollup configuration file * `genesis-l2.json` - L2 genesis file * `<prestate-hash>.bin.gz` - The absolute prestate file generated in step 1 (`rust/kona/prestate-artifacts-cannon/<prestate-hash>.bin.gz`) </Step> </Steps> ### Software requirements * Git (for cloning repositories) * Go 1.21+ (if building from source) * Docker and Docker Compose (optional but recommended) * Access to a funded Ethereum account for challenger operations ### Finding the current stable releases To ensure you're using the latest compatible versions of OP Stack components, always check the official releases page: [OP Stack releases page](https://github.com/ethereum-optimism/optimism/releases) This guide is verified against the following versions: * **op-challenger** — `op-challenger/v1.9.4` (look for the latest `op-challenger/v*`). * **op-reth** — `v2.2.5` (look for the latest [op-reth release](https://github.com/ethereum-optimism/optimism/releases?q=op-reth)). op-reth is both the sequencer's execution client and the archive node the challenger reads withdrawal proofs from. * **kona-client** — the absolute prestate is built from a tagged `kona-client/v*` release (e.g. `kona-client/v1.6.0-rc.1`). Use the tag matching the prestate registered on your chain; for governance-approved upgrades the version is named in the upgrade notice. See the [kona-client prestate tutorial](/chain-operators/tutorials/kona-custom-prestate). Always check the release notes to ensure you're using compatible versions with your chain's deployment. Using the op-challenger and kona-client versions named in the upgrade notice (or the latest matching releases) is the supported path. ## Software installation For challenger deployment, you can either build from source (recommended for better control and debugging) or use Docker for a containerized setup. <Tabs> <Tab title="Build from source"> ### Build and configure Building from source gives you full control over the binaries and is the preferred approach for production deployments. **Clone and build op-challenger** ```bash theme={null} # Clone the optimism monorepo git clone https://github.com/ethereum-optimism/optimism.git cd optimism # Check out the latest release of op-challenger git checkout op-challenger/v1.9.4 # Generate the embedded superchain config bundle (initializes the # superchain-registry submodule; op-challenger embeds this file at compile time) just build-superchain-go # Install dependencies and build just op-challenger # Build the Cannon VM binary used to run dispute traces just cannon # Binaries will be available at ./op-challenger/bin/op-challenger # and ./cannon/bin/cannon ``` **Build kona-host** The challenger also needs `kona-host`, the pre-image oracle server for the `cannon-kona` game type. Build it from the kona-client release tag matching the absolute prestate registered on your chain (see [Finding the current stable releases](#finding-the-current-stable-releases)), so the server matches the `kona-client` build committed on chain: ```bash theme={null} # In a checkout of the tag your prestate was built from cd rust cargo build --release --bin kona-host # Binary will be available at ./rust/target/release/kona-host ``` ### Verify installation Check that you have properly installed the challenger component: ```bash theme={null} # Make sure you're in the optimism directory ./op-challenger/bin/op-challenger --help # You should see the challenger help output with available commands and flags ``` ## Configuration setup <Steps> <Step title="Organize your workspace"> After building the binaries, create your challenger working directory: ```bash theme={null} # Create challenger directory (this should be at the same level as optimism directory) mkdir challenger-node cd challenger-node # Create necessary subdirectories mkdir scripts mkdir challenger-data # Verify the optimism directory is accessible # Directory structure should look like: # /optimism/ (contains the built binaries) # /challenger-node/ (your working directory) ``` </Step> <Step title="Copy configuration files"> ```bash theme={null} # Copy configuration files to your challenger directory # Adjust paths based on your deployment setup cp /path/to/your/rollup.json . cp /path/to/your/genesis-l2.json . ``` </Step> <Step title="Set up environment variables"> You'll need to gather several pieces of information before creating your configuration. Here's where to get each value: **L1 network access:** * L1 RPC URL: Your L1 node endpoint (Infura, Alchemy, or self-hosted) * L1 Beacon URL: Beacon chain API endpoint for blob access **L2 network access:** * L2 RPC URL: Your op-reth archive node endpoint * Rollup RPC URL: Your op-node endpoint with historical data **Challenger wallet:** * Private key for challenger operations (must be funded) **Network configuration:** * Game factory address from your contract deployment * Network identifier (e.g., op-sepolia, op-mainnet, or custom) Copy and paste in your terminal, to create your env file. ```bash theme={null} # Create .env file with your actual values cat > .env << 'EOF' # L1 Configuration - Replace with your actual RPC URLs L1_RPC_URL=https://sepolia.infura.io/v3/YOUR_ACTUAL_INFURA_KEY # L2 Configuration - Replace with your actual node endpoints L2_RPC_URL=http://localhost:8545 ROLLUP_RPC_URL=http://localhost:8547 L1_BEACON=http://sepolia-cl-1:5051 # Wallet configuration - Choose either mnemonic + HD path OR private key MNEMONIC="test test test test test test test test test test test junk" HD_PATH="m/44'/60'/0'/0/0" # PRIVATE_KEY=0xYOUR_ACTUAL_PRIVATE_KEY # Alternative to mnemonic # Network configuration NETWORK=op-sepolia GAME_FACTORY_ADDRESS=0xYOUR_GAME_FACTORY_ADDRESS # Trace configuration (cannon-kona is the respected game type from the Karst upgrade) TRACE_TYPE=permissioned,cannon-kona # Data directory DATADIR=./challenger-data # Cannon VM binary (shared by cannon and cannon-kona; built from the optimism repo) CANNON_BIN=<PATH_TO_OPTIMISM_REPO>/cannon/bin/cannon # Configuration files CANNON_ROLLUP_CONFIG=<PATH_TO_YOUR_ROLLUP_CONFIG> CANNON_L2_GENESIS=<PATH_TO_YOUR_L2_GENESIS> # kona executable used as the pre-image oracle server, and the kona-client absolute prestate CANNON_KONA_SERVER=<PATH_TO_KONA_EXECUTABLE> CANNON_KONA_PRESTATE=<PATH_TO_YOUR_KONA_PRESTATE_FILE> EOF ``` **Important:** Replace ALL placeholder values (`YOUR_ACTUAL_*`) with your real configuration values. </Step> <Step title="Understanding key configuration flags"> <Accordion title="--l1-eth-rpc"> * This is the HTTP provider URL for a standard L1 node, can be a full node. `op-challenger` will be sending many requests, so chain operators need a node that is trusted and can easily handle many transactions. * Note: Challenger has a lot of money, and it will spend it if it needs to interact with games. That might risk not defending games or challenging games correctly, so chain operators should really trust the nodes being pointed at Challenger. </Accordion> <Accordion title="--l1-beacon"> * This is needed just to get blobs from. * In some instances, chain operators might need a blob archiver or L1 consensus node configured not to prune blobs: * If the chain is proposing regularly, a blob archiver isn't needed. There's only a small window in the blob retention period that games can be played. * If the chain doesn't post a valid output root in 18 days, then a blob archiver running a challenge game is needed. If the actor gets pushed to the bottom of the game, it could lose if it's the only one protecting the chain. </Accordion> <Accordion title="--l2-eth-rpc"> * This needs to be an `op-reth` archive node, with `debug` enabled. * Technically doesn't need to go to bedrock, but needs to have access to the start of any game that is still in progress. * The withdrawal-proof data the challenger reads via `eth_getProof` is served by op-reth's historical-proofs store. Enable it with `--proofs-history`, set a persistent `--proofs-history.storage-path`, and size `--proofs-history.window` to cover the dispute game window (≥ 28 days). On permissioned chains, `--rpc.eth-proof-window` bounds how far back `eth_getProof` will serve. See [Running op-reth with historical proofs](/node-operators/tutorials/reth-historical-proofs). * **Seed the proofs storage once before starting the node with `--proofs-history`**, or op-reth refuses to start (the `proofs-history` ExEx panics with `Proofs storage not initialized`). With the node stopped, run `op-reth proofs init --chain <chain-or-genesis> --datadir <reth-datadir> --proofs-history.storage-path <proofs-db-path>`. It snapshots the chain's current state to seed the sidecar; the ExEx then indexes forward as the node syncs. Initialize at (or near) genesis so the whole fault-proof window is covered — a node seeded at the current tip only serves proofs for blocks after that point. * On op-reth v2.6.x and earlier, also pass `--proofs-history.storage-version v2` to both `op-reth node` and `op-reth proofs init`; those releases default to the deprecated v1 format. </Accordion> <Accordion title="--rollup-rpc"> * This needs to be an `op-node` archive node because challenger needs access to output roots from back when the games start. See below for important configuration details: 1. Safe Head Database (SafeDB) Configuration for op-node: * The `op-node` behind the `op-conductor` must have the SafeDB enabled to ensure it is not stateless. * To enable SafeDB, set the `--safedb.path` value in your configuration. This specifies the file path used to persist safe head update data. * Example Configuration: ```bash theme={null} --safedb.path <path-to-safe-head-db> # Replace <path-to-safe-head-db> with your actual path ``` <Info> If this path is not set, the SafeDB feature will be disabled. </Info> <Warning> **Never restore the SafeDB from a snapshot.** The SafeDB records the safe head as derived from L1, and a snapshot may not reflect the actual on-chain derivation state. If the SafeDB is out of sync with L1, `op-challenger` will act on an incorrect safe head and may incorrectly attack valid outputs. `op-challenger` cannot detect this condition — the data it receives appears normal. If you suspect the SafeDB was restored from a snapshot or is otherwise corrupted, delete it and resync from a snapshot that is at least 30 days old — `op-node` does not backfill the SafeDB, so it will only populate it going forward from that point. A 30-day-old snapshot provides enough history to cover the 28-day dispute game window. </Warning> 2. Ensuring Historical Data Availability: * Both `op-node` and `op-reth` must have data from the start of the games to maintain network consistency and allow nodes to reference historical state and transactions. * For `op-node`: Configure it to maintain a sufficient history of blockchain data locally or use an archive node. * For `op-reth`: Similarly, configure to store or access historical data. * Example Configuration: ```bash theme={null} op-node \ --rollup-rpc <op-node-archive-node-url> \ --safedb.path <path-to-safe-head-db> ``` <Info> Replace `<op-node-archive-node-url>` with the URL of your archive node and `<path-to-safe-head-db>` with the desired path for storing SafeDB data. </Info> </Accordion> <Accordion title="--private-key"> * Chain operators must specify a private key or use something else (like `op-signer`). * This uses the same transaction manager arguments as `op-node` , batcher, and proposer, so chain operators can choose one of the following options: * a mnemonic * a private key * `op-signer` endpoints </Accordion> <Accordion title="--network"> * This identifies the L2 network `op-challenger` is running for, e.g., `op-sepolia` or `op-mainnet`. * When using the `--network` flag, the `--game-factory-address` will be automatically pulled from the [`superchain-registry`](https://github.com/ethereum-optimism/superchain-registry/blob/main/chainList.json). * When the trace is generated, challenger needs the rollup config and the L2 genesis file. Both files are automatically loaded when a registry `--network` is used, but custom networks must specify both the L2 genesis and ro
프로젝트로 돌아가기