Optimism 백서

Optimism

원문

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

ltaneously: ```shell theme={null} op-deployer bootstrap superchain \ --l1-rpc-url <l1 rpc url> \ --private-key <deployer private key> \ --outfile ./superchain.json \ --superchain-proxy-admin-owner <owner address> \ --guardian <guardian address> \ --verify \ --verifier etherscan,blockscout \ --verifier-api-key <etherscan api key> ``` This will: 1. Deploy the shared contracts 2. Verify on Etherscan (using the API key) 3. Verify on Blockscout (no API key required) 4. Report combined results from both verifiers ## Supported Contract Bundles The verify command now supports all contract bundles: * **Shared** contracts (from `bootstrap superchain`) * **Implementations** contracts (from `bootstrap implementations`) * **OpChain** contracts (from `apply` - including all chain-specific contracts) When using a `state.json` file from `apply`, the verifier automatically extracts and verifies contracts from all deployment stages. ## Block Explorer Support The verification command supports both Etherscan and Blockscout block explorers through the forge binary, alongside any Etherscan v2 compatible APIs. # OP Interop Filter Source: https://docs.optimism.io/chain-operators/tools/op-interop-filter Learn how op-interop-filter validates interop executing messages so the execution layer can reject invalid cross-chain transactions before they reach the sequencer. <Info> OP Stack interop is in active development. op-interop-filter is the service chain operators will run to validate interop transactions for the execution layer, and the interfaces described here may continue to evolve as the rollout progresses. </Info> *op-interop-filter* is a lightweight service that validates interop executing messages so that an execution layer (EL) client — op-reth — can reject invalid cross-chain transactions before they reach the sequencer's transaction pool. It is the service a chain operator runs to answer the `interop_checkAccessList` RPC that the EL calls on every interop transaction. ## What op-interop-filter does An interop transaction carries an *access list* of references to initiating messages on other chains in the dependency set. For the transaction to be valid, every referenced initiating message must exist on its source chain at the safety level the executing chain requires. The EL cannot answer that question on its own. It calls a configured interop verification endpoint over JSON-RPC (`interop_checkAccessList`) and lets that service decide whether the transaction is admissible. op-interop-filter is one such service. It connects to the L2 RPCs of every chain in the dependency set, ingests their logs into a local database, and answers `interop_checkAccessList` against that database. When the answer is no — or when the filter has lost confidence in its own state — the EL rejects the transaction. ## How it fits into an interop deployment op-interop-filter sits between an interop chain's EL and the other chains in its dependency set. ```mermaid theme={null} graph LR classDef filter fill:#FFE classDef transparent fill:none,stroke:none EL["Execution layer<br/>(op-reth)"] Filter["op-interop-filter"] L2A["L2 RPC<br/>Chain A"] L2B["L2 RPC<br/>Chain B"] L2N["L2 RPC<br/>Chain N"] EL -- "interop_checkAccessList" --> Filter Filter --> L2A Filter --> L2B Filter --> L2N class Filter filter ``` The EL points at the filter through op-reth's `--rollup.interop-http` flag and calls the filter's `interop_checkAccessList` method to validate each interop transaction. This is a different job from what [op-supernode](/op-stack/interop/supernode) does. The supernode operates at the consensus layer (CL): it verifies that a block's cross-chain dependencies have been reproduced from L1, then promotes the block to *safe* through the chain's own CL. op-interop-filter works at transaction-admission time instead: it is the separate service the execution layer consults to decide whether an interop transaction may enter the pool in the first place. A chain operator running an interop chain runs both. ## Failsafe behavior op-interop-filter has a *failsafe* that, while active, rejects every `interop_checkAccessList` request with `ErrFailsafeEnabled`. The EL gates interop transactions on that check, so while failsafe is active no interop transactions are admitted. Regular transactions that carry no interop access-list entries are unaffected and keep flowing normally. Failsafe activates in one of two ways: * **Automatically**, when any chain ingester reports an error — a reorg, a database conflict, data corruption, or an invalid executing message — or when the cross-validator reports an error. * **Manually**, when an operator enables it over the admin RPC with `admin_setFailsafeEnabled`. How failsafe clears depends on why it triggered: * A **manual** failsafe clears when the operator calls `admin_setFailsafeEnabled` with `false`. * A **reorg-triggered** failsafe clears automatically only when `--reorg-recovery-enabled` is set: the filter rewinds each affected chain's logs database to its finalized block and clears the error. * Any failsafe that is neither manual nor auto-resolved — a reorg with `--reorg-recovery-enabled` off, a database conflict, data corruption, an invalid executing message, or a cross-validation failure — has no admin RPC to clear it. Recover by wiping the filter's data directory and restarting the service. Disabling the manual override with `admin_setFailsafeEnabled` does not clear an error-triggered failsafe; the underlying error has to be resolved first. ## Configuration op-interop-filter is configured via CLI flags or matching `OP_INTEROP_FILTER_*` environment variables. The full flag set is defined in [`op-interop-filter/flags/flags.go`](https://github.com/ethereum-optimism/optimism/blob/develop/op-interop-filter/flags/flags.go). ### Required flags | Flag | Description | | - | - | | `--l2-rpcs` | L2 RPC endpoints to connect to. The filter queries the chain ID from each endpoint and matches it against a loaded rollup config. | | `--networks` *or* `--rollup-configs` | At least one is required. `--networks` loads rollup configs by name from the superchain registry; `--rollup-configs` loads custom JSON files for dev or test chains. | ### Key optional flags | Flag | Default | Description | | - | - | - | | `--data-dir` | (temporary directory) | Directory for the LogsDB. Use a persistent path in production so backfill state survives restarts. | | `--backfill-duration` | `24h` | How far back to backfill on startup. | | `--message-expiry-window` | `168h` (7 days) | Messages older than this window are treated as expired. | | `--poll-interval` | `2s` | How often to poll L2 RPCs for new blocks. | | `--reorg-recovery-enabled` | off | If set, the filter automatically clears reorg-triggered failsafe by rewinding to finalized. | | `--admin.rpc.addr` | (disabled) | Bind address for the JWT-protected admin RPC. When set, `--admin.jwt-secret` is also required. | ### Use-with-caution flags Two flags are marked DANGEROUS in source and should only be used with a deliberate operational reason: | Flag | What it does | | - | - | | `--dangerously-enable-passthrough` | Lets every transaction through without interop filtering. Disables all executing-message validation. | | `--support-legacy-check-access-list-format` | Accepts `interop_checkAccessList` requests that omit the executing chain ID. Intended only for compatibility with legacy clients; access-list source-chain validation still runs. | ## RPC surface op-interop-filter exposes two HTTP RPC endpoints, configured separately. ### Public RPC Bound by `--rpc.addr` (default `0.0.0.0`) and `--rpc.port` (default `8545`). Exposes the methods an EL or other consumer needs: * `interop_checkAccessList` — validates an executing-message access list at a minimum safety level. This is the method the EL calls on every interop transaction. * `interop_getBlockHashByNumber` — returns the latest ingested block hash for a chain, or the hash at a specific height. * `admin_getFailsafeEnabled` — read-only check of whether failsafe is currently active. ### Admin RPC Disabled by default. Bound by `--admin.rpc.addr` and `--admin.rpc.port` (default `8546`), and protected by a JWT secret loaded from `--admin.jwt-secret`. The admin RPC exposes the operator-only controls: * `admin_setFailsafeEnabled` — manually enable or disable failsafe. * `admin_getFailsafeEnabled` — the authenticated read of the same state available on the public RPC. Admin RPC is intended for operator tooling and should not be exposed publicly. ## Where to go next * Read the [interop explainer](/op-stack/interop/explainer) for how cross-chain messaging and executing-message access lists work at the protocol level. * Read the [op-supernode page](/op-stack/interop/supernode) for the consensus-layer side of an interop deployment — block-safety promotion and the supernode topology. * Read [interop reorg awareness](/op-stack/interop/reorg) for how reorgs interact with cross-chain message safety. * For implementation detail, see the [op-interop-filter source](https://github.com/ethereum-optimism/optimism/tree/develop/op-interop-filter) in the monorepo. # OP Txproxy Source: https://docs.optimism.io/chain-operators/tools/op-txproxy A passthrough proxy service that can apply additional constraints on transactions prior to reaching the sequencer. A [passthrough proxy](https://github.com/ethereum-optimism/infra/tree/main/op-txproxy) for the execution engine endpoint. This proxy does not forward all RPC traffic and only exposes a specific set of methods. Operationally, the ingress router should only re-route requests for these specific methods. <Info> [proxyd](./proxyd) as an ingress router supports the mapping of specific methods to unique backends. </Info> ## Methods ### **eth\_sendRawTransactionConditional** To safely expose this endpoint publicly, additional stateless constraints are applied. These constraints help scale validation rules horizontally and preemptively reject conditional transactions before they reach the sequencer. Various metrics are emitted to guide necessary adjustments. #### Runtime shutoff This service can be configured with a flag or environment variable to reject conditional transactions without needing to interrupt the execution engine. This feature is useful for diagnosing issues. `--sendRawTxConditional.enabled (default: true) ($OP_TXPROXY_SENDRAWTXCONDITIONAL_ENABLED)` When disabled, requests will fail with the `-32003` (transaction rejected) json rpc error code with a message stating that the method is disabled. #### Rate limits Even though the op-geth implementation of this endpoint includes rate limits, it is instead applied here to terminate these requests early. `--sendRawTxConditional.ratelimit (default: 5000) ($OP_TXPROXY_SENDRAWTXCONDITIONAL_RATELIMIT)` #### Stateless validation * Conditional cost is below the max * Conditional values are valid (i.e min \< max) * Transaction targets are only 4337 Entrypoint contracts <Info> The motivating factor for this endpoint is to enable permissionless 4337 mempools, hence the restricted usage of this method to just [Entrypoint](https://github.com/eth-infinitism/account-abstraction/blob/develop/contracts/core/EntryPoint.sol) transactions. Please open up an issue if you'd like this restriction to be optional via configuration to broaden usage of this endpoint. </Info> When the request passes validation, it is passed through to the configured backend URL `--sendRawTxConditional.backend ($OP_TXPROXY_SENDRAWTXCONDITIONAL_BACKENDS)` <Info> Per the [specification](/op-stack/features/send-raw-transaction-conditional), conditional transactions are not gossiped between peers. Thus, if you use replicas in an active/passive sequencer setup, this request must be broadcasted to all replicas. [proxyd](./proxyd) as an egress router for this method supports this broadcasting functionality. </Info> ## How it works To start using `op-txproxy`, follow these steps: <Steps> <Step title="Build the binary or pull the Docker image"> 1. Run the following command to build the binary ```bash theme={null} make build ``` 2. This will build and output the binary under `/bin/op-txproxy`. The image for this binary is also available as a [docker artifact](https://us-docker.pkg.dev/oplabs-tools-artifacts/images/op-txproxy). </Step> <Step title="Configure"> The binary accepts configuration through CLI flags, which also settable via environment variables. Either set the flags explicitly when starting the binary or set the environment variables of the host starting the proxy. See [methods](#methods) on the configuration options available for each method. </Step> <Step title="Start"> start the service with the following command ```bash theme={null} op-txproxy // ... with flags if env variables are not set ``` </Step> </Steps> # Run proxyd Source: https://docs.optimism.io/chain-operators/tools/proxyd Learn how to build, configure, and run proxyd, the OP Stack RPC request router and proxy. `proxyd` is an important RPC request router and proxy used within the OP Stack infrastructure. It enables operators to efficiently route and manage RPC requests across multiple backend services, ensuring performance, fault tolerance, and security. ## Key features * RPC method whitelisting * Backend request routing * Automatic retries for failed backend requests * Consensus tracking (latest, safe, and finalized blocks) * Request/response rewriting to enforce consensus * Load balancing across backend services * Caching of immutable responses * Metrics for request latency, error rates, and backend health ## How it works To start using `proxyd`, follow these steps: <Steps> <Step title="**Build the binary**:"> * Run the following command to build the `proxyd` binary: ```bash theme={null} make proxyd ``` * This will build the `proxyd` binary. No additional dependencies are required. </Step> <Step title="**Configure `proxyd`**:"> * Create a configuration file to define your proxy backends and routing rules. * Refer to [example.config.toml](https://github.com/ethereum-optimism/infra/blob/main/proxyd/example.config.toml) for a full list of options with commentary. </Step> <Step title="**Start the service**:"> Once the configuration file is ready, start the `proxyd` service using the following command: ```bash theme={null} proxyd <path-to-config.toml> ``` </Step> </Steps> ## Consensus awareness Version 4.0.0 and later include consensus awareness to minimize chain reorganizations. Set `consensus_aware` to `true` in the configuration to enable: * Polling backends for consensus data (latest block, safe block, peer count, etc.). * Resolving consensus groups based on healthiest backends * Enforcing consensus state across client requests ## Caching and metrics ### Cacheable methods Certain immutable methods, such as `eth_chainId` and `eth_getBlockByHash`, can be cached using Redis to optimize performance. ### Metrics Extensive metrics are available to monitor request latency, error rates, backend health, and more. These can be configured via `metrics.port` and `metrics.host` in the configuration file. ## Next steps * Read about the [OP Stack chain architecture](/chain-operators/guides/management/network-architecture). * Find out how you can support [snap sync](/chain-operators/guides/features/snap-sync). on your chain. * Find out how you can utilize [blob space](/chain-operators/guides/features/blobs) to reduce the transaction fee cost on your chain. # Generating absolute prestate and preimage files Source: https://docs.optimism.io/chain-operators/tutorials/absolute-prestate Generate, verify, and configure the kona-client absolute prestate for permissionless fault proofs. # Overview The absolute prestate is the on-chain commitment to a specific build of `kona-client`. The matching preimage (a gzipped binary) is what `op-challenger` runs at dispute time. This guide is the minimal reproducer. <Info> As of [Upgrade 19](/notices/archive/upgrade-19), `CANNON_KONA` (game type `8`) is the respected game type for permissionless fault proofs. If your chain is not yet in the public Superchain Registry, follow [Generating a custom kona-client absolute prestate](/chain-operators/tutorials/kona-custom-prestate) instead. </Info> ## Prerequisites * [Docker](https://docs.docker.com/engine/install/) running * [`just`](https://github.com/casey/just) installed ## Generate and verify the prestate <Steps> <Step title="Check out the release tag"> ```bash theme={null} git clone https://github.com/ethereum-optimism/optimism.git cd optimism git checkout kona-node/v<VERSION> ``` </Step> <Step title="Build the prestate"> ```bash theme={null} just reproducible-prestate-kona ``` The build runs in Docker and writes artifacts to `rust/kona/prestate-artifacts-cannon/`. </Step> <Step title="Read and verify the hash"> ```bash theme={null} jq -r .pre rust/kona/prestate-artifacts-cannon/prestate-proof.json ``` Match the printed hash against the `cannon64-kona` entry for your release tag in [`standard-prestates.toml`](https://github.com/ethereum-optimism/superchain-registry/blob/main/validation/standard/standard-prestates.toml). A match confirms your build environment is honest. </Step> </Steps> ## Configure op-challenger Upload the hash-named file `rust/kona/prestate-artifacts-cannon/0x<HASH>.bin.gz` (produced by the build) to a location reachable by your `op-challenger` instances, then add the kona-specific env vars to your existing challenger config: ```bash theme={null} OP_CHALLENGER_TRACE_TYPE=cannon-kona,permissioned OP_CHALLENGER_CANNON_KONA_PRESTATES_URL=<HTTP_URL_PATH_TO_PRESTATES> ``` The challenger appends `/0x<hash>.bin.gz` to `*_PRESTATES_URL` to resolve the right binary per dispute. Your existing `OP_CHALLENGER_ROLLUP_CONFIG`, `OP_CHALLENGER_L2_GENESIS`, and `OP_CHALLENGER_GAME_FACTORY_ADDRESS` continue to apply unchanged. ## Next Steps * [Generating a custom kona-client absolute prestate](/chain-operators/tutorials/kona-custom-prestate) — for chains not yet in the Superchain Registry. * [Migrating to permissionless fault proofs](/chain-operators/tutorials/migrating-permissionless). * [Fault proofs explainer](/op-stack/fault-proofs/explainer). # Adding attributes to the derivation function Source: https://docs.optimism.io/chain-operators/tutorials/adding-derivation-attributes Learn how to modify the derivation function for an OP Stack chain to track the amount of ETH being burned on L1. <Info> OP Stack Hacks are explicitly things that you can do with the OP Stack that are *not* currently intended for production use. OP Stack Hacks are not for the faint of heart. You will not be able to receive significant developer support for OP Stack Hacks. Be prepared to get your hands dirty and to work without support. </Info> ## Overview In this tutorial, you'll modify the Bedrock Rollup. Although there are many ways to modify the OP Stack, you're going to spend this tutorial modifying the Derivation function. Specifically, you're going to update the Derivation function to track the amount of ETH being burned on L1! Who's gonna tell [ultrasound.money](http://ultrasound.money) that they should replace their backend with an OP Stack chain? ## Getting the idea Let's quickly recap what you're about to do. The `op-node` is responsible for generating the Engine API payloads that trigger `op-geth` to produce blocks and transactions. The `op-node` already generates a "system transaction" for every L1 block that relays information about the current L1 state to the L2 chain. You're going to modify the `op-node` to add a new system transaction that reports the total burn amount (the base fee multiplied by the gas used) in each block. Although it might sound like a lot, the whole process only involves deploying a
프로젝트로 돌아가기