Optimism 백서

Optimism

원문

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

your Scalar Values to send transaction to the L1 SystemConfigProxy.setGasConfigEcotone ```bash theme={null} cast send \ --private-key $GS_ADMIN_PRIVATE_KEY \ --rpc-url $ETH_RPC_URL \ <CONTRACT_ADDRESS> \ "setGasConfigEcotone(uint32,uint32)" \ <basefeeScalar> <blobbasefeeScalar> ``` Check that the gas price oracle on L2 returns the expected values for `baseFeeScalar` and `blobBaseFeeScalar` (wait \~1 minute): <Info> This is checked on L2, so ensure you are using an RPC URL for your chain. You'll also need to provide a `gas-price` to geth when making this call. </Info> <Tabs> <Tab title="baseFeeScalar"> ```shell theme={null} cast call 0x420000000000000000000000000000000000000F 'baseFeeScalar()(uint256)' --rpc-url YOUR_L2_RPC_URL ``` </Tab> <Tab title="blobBaseFeeScalar"> ```shell theme={null} cast call 0x420000000000000000000000000000000000000F 'blobBaseFeeScalar()(uint256)' --rpc-url YOUR_L2_RPC_URL ``` </Tab> </Tabs> </Step> <Step title="Update your batcher to post blobs"> Now that the fee config has been updated, you should immediately configure your batcher! <Info> Your chain may be undercharging users during the time between updating the scalar values and updating the Batcher, so aim to do this immediately after. </Info> Steps to configure the batcher: * Configure `OP_BATCHER_DATA_AVAILABILITY_TYPE=blobs`. The batcher will have to be restarted for it to take effect. * Ensure your `OP_BATCHER_MAX_CHANNEL_DURATION` is properly set to maximize your fee savings. See [OP Batcher Max Channel Configuration](/chain-operators/guides/configuration/batcher#set-your--op_batcher_max_channel_duration) for more details. * Optionally, you can configure your batcher to support multi-blobs. See [Multi-Blob Batcher Configuration](/chain-operators/guides/configuration/batcher#configure-your-batcher-to-use-multiple-blobs) for more details. </Step> </Steps> ## Switch back to using calldata As a chain operator, if the `blobBaseFee` is expensive enough and your chain is not processing enough transactions to meaningfully fill blobs within your configured batcher `OP_BATCHER_MAX_CHANNEL_DURATION`, you may wish to switch back to posting data to calldata. To judge whether your transactions will be cheaper as blobs or as calldata, compare the current blob base fee with the L1 base fee, or set `OP_BATCHER_DATA_AVAILABILITY_TYPE=auto` to let the batcher make the comparison automatically; see [Choose a data availability type](/use-cases/tune-batcher-costs#step-3-choose-a-data-availability-type) in the Tune batcher costs guide for the trade-offs. Chains can follow these steps to switch from blobs back to using calldata. <Steps> <Step title="Determine your scalar values for using calldata"> If you are using calldata, then you can set your `BaseFeeScalar` similarly to how you would have set "scalar" prior to Ecotone, though with a 5-10% bump to compensate for the removal of the "overhead" component. For a walkthrough of sizing the scalars against your measured batcher spend, see [Recover the spend with fee scalars](/use-cases/tune-batcher-costs#step-5-recover-the-spend-with-fee-scalars) in the Tune batcher costs guide. <Info> Since the Pectra upgrade on L1, chains which exclusively use calldata DA need to scale up their BaseFeeScalar by 10/4. See [this notice](/notices/archive/pectra-changes). </Info> Chains can update their fees to increase or decrease their margin. If using calldata, then `BaseFeeScalar` should be scaled to achieve the desired margin. For example, to increase your L1 Fee margin by 10%: ``` BaseFeeScalar = BaseFeeScalar * 1.1 BlobBaseFeeScalar = 0 ``` </Step> <Step title="Update your scalar values for using calldata"> To set your scalar values, follow the same process as laid out in [Update your Scalar values for Blobs](#update-your-scalar-values-for-blobs). </Step> <Step title="Update your batcher to post calldata"> Now that the fee config has been updated, you will want to immediately configure your batcher. <Info> Reminder, that your chain may be undercharging users during the time between updating the scalar values and updating the Batcher, so aim to do this immediately after. </Info> * Configure `OP_BATCHER_DATA_AVAILABILITY_TYPE=calldata`. The batcher will have to be restarted for it to take effect. * Ensure your `OP_BATCHER_MAX_CHANNEL_DURATION` is properly set to maximize savings. **NOTE:** While setting a high value here will lower costs, it will be less meaningful than for low throughput chains using blobs. See [OP Batcher Max Channel Configuration](/chain-operators/guides/configuration/batcher#set-your--op_batcher_max_channel_duration) for more details. </Step> </Steps> ## Use auto DA mode in your batcher The batcher now supports automatically switching from blobs to calldata depending on which DA type is more affordable. This is an optimization which allows for a slightly better DA profit margin for your chain. To enable this mode, set `OP_BATCHER_DATA_AVAILABILITY_TYPE=auto`. ## Other considerations * For information on L1 Data Fee changes related to the Ecotone upgrade, visit the [Transaction Fees page](/op-stack/transactions/fees#ecotone). * If you want to enable archive nodes, you will need to access a blob archiver service. You can use [Optimism's](/op-mainnet/network-information/snapshots) or [run your own](/chain-operators/tools/explorer#create-an-archive-node). # Deploy a Custom Gas Token chain Source: https://docs.optimism.io/chain-operators/guides/features/custom-gas-token-guide Learn how to deploy a Custom Gas Token chain using OP Deployer. This guide provides instructions for chain operators who want to deploy a Custom Gas Token (CGT) chain. See the [Custom Gas Token overview](/op-stack/features/custom-gas-token) for a general understanding of this OP Stack feature. A Custom Gas Token chain enables you to use any asset as the native fee currency instead of ETH. This asset may be an existing L1 token, a representation of a token from another chain, or a newly defined asset (or new L2 token) created at genesis. <Warning> Custom Gas Token v2 is a new implementation that is not compatible with legacy CGT chains. There is currently no migration path from legacy CGT to CGT v2, though one is planned to be put together. </Warning> ## Prerequisites Before deploying a CGT chain, ensure you have: * **OP Deployer installed**: See [Install op-deployer](/chain-operators/tools/op-deployer/installation) for setup instructions * **L1 RPC endpoint**: Access to an Ethereum L1 node for deployment * **Funded deployer account**: ETH for L1 gas costs during deployment * **Token design**: Clear plan for your native asset (supply, distribution, bridging mechanism) * **Security audit**: Thorough review of any authorized minters or bridge contracts you plan to deploy ## Deployment steps Deploying a CGT chain follows the standard OP Stack deployment process with additional configuration for Custom Gas Token specific parameters. <Steps> <Step title="Initialize your intent file"> Create a new intent file using OP Deployer's [init command](/chain-operators/tools/op-deployer/usage/init): ```bash 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> \ --intent-type custom ``` This creates an `intent.toml` file. </Step> <Step title="Configure Custom Gas Token parameters"> Open your `intent.toml` file and add the Custom Gas Token configuration. Below is an example with CGT-specific fields: ```toml theme={null} configType = "custom" l1ChainID = 11155111 fundDevAccounts = false useInterop = false l1ContractsLocator = "tag://op-contracts/v6.0.0" l2ContractsLocator = "tag://op-contracts/v6.0.0" [superchainRoles] SuperchainProxyAdminOwner = "0xYourMultisigAddress" SuperchainGuardian = "0xYourMultisigAddress" Challenger = "0xYourMultisigAddress" [[chains]] id = "0x0000000000000000000000000000000000000000000000000000000000001234" baseFeeVaultRecipient = "0xYourFeeRecipientAddress" l1FeeVaultRecipient = "0xYourFeeRecipientAddress" sequencerFeeVaultRecipient = "0xYourFeeRecipientAddress" operatorFeeVaultRecipient = "0xYourFeeRecipientAddress" eip1559DenominatorCanyon = 0 eip1559Denominator = 0 eip1559Elasticity = 0 gasLimit = 60000000 operatorFeeScalar = 0 operatorFeeConstant = 0 minBaseFee = 0 daFootprintGasScalar = 0 [chains.roles] l1ProxyAdminOwner = "0xYourMultisigAddress" l2ProxyAdminOwner = "0xYourMultisigAddress" systemConfigOwner = "0xYourMultisigAddress" unsafeBlockSigner = "0xYourSequencerAddress" batcher = "0xYourBatcherAddress" proposer = "0xYourProposerAddress" challenger = "0xYourChallengerAddress" [chains.customGasToken] name = "My Custom Token" symbol = "MCT" initialLiquidity = "0x..." # optional, default: type(uint248).max liquidityControllerOwner = "0x..." # optional, default: L2ProxyAdminOwner ``` ### Key CGT configuration fields | Field | Description | Required | | - | - | - | | `name` | Name of the native asset (e.g., "My Custom Token") | Yes | | `symbol` | Symbol for the native asset (e.g., "MCT") | Yes | | `initialLiquiditySupply` | Initial supply minted to NativeAssetLiquidity at genesis | No, default: type(uint248).max | | `liquidityControllerOwner` | Manages the asset supply | No, `L2ProxyAdminOwner` will be used as default | <Warning> **Fee parameter calculation is critical**: Your `minBaseFee` and `operatorFee` must accurately account for L1 gas costs and DA fees denominated in your custom token. If set too low, your chain may not cover operational costs. If set too high, users will pay excessive fees. </Warning> <Info> **Decimal support**: CGT v2 currently supports only 18-decimal tokens. Support for other decimals may be added in future releases. </Info> </Step> <Step title="Deploy L1 contracts"> Deploy your L1 contracts using OP Deployer's [apply command](/chain-operators/tools/op-deployer/usage/apply) ```bash theme={null} op-deployer apply \ --l1-rpc-url <your L1 RPC URL> \ --private-key <your deployer private key> ``` This deploys all necessary L1 contracts including `SystemConfig` with the `isCustomGasToken` flag enabled, which instructs L1 contracts to reject ETH-value transactions. <Info> The deployment process will automatically deploy the CGT-specific predeploys (`NativeAssetLiquidity` and `LiquidityController`) during genesis initialization. </Info> </Step> <Step title="(Optional) Verify L1 contracts"> Optionally you can use OP Deployer's [verify command](/chain-operators/tools/op-deployer/usage/verify) to verify your L1 contracts on Blockscout or Etherscan. </Step> <Step title="Create genesis file with CGT configuration"> After L1 deployment completes, initialize your L2 genesis with OP Deployer's [apply command](/chain-operators/tools/op-deployer/usage/apply): ```bash theme={null} op-deployer apply \ --deployment-target genesis ``` The genesis configuration is applied based on your `intent.toml`. </Step> <Step title="Start your chain services"> Start your OP Stack services to start sequencing your CGT chain: * Sequencer Execution Client * Sequencer Consensus Client * Batcher * Proposer * Challenger </Step> <Step title="Verify and test"> Before going live, thoroughly test your CGT chain. The following are some key areas to check: **Verify flag alignment** * Check L1 SystemConfig.isCustomGasToken() returns true * Check L2 L1Block.isCustomGasToken() returns true * Verify both flags match **Test native asset operations** * Test minting native assets via authorized minter * Test burning native assets * Test fee payments in native token * Verify fee vault accumulation **Test ETH rejection** * Attempt ETH deposit via OptimismPortal (should fail) * Attempt ETH withdrawal via L2ToL1MessagePasser (should fail) * Verify ETH operations are properly blocked **Test bridge functionality** * Test deposits (L1 → L2 native asset minting) * Test withdrawals (L2 native → L1 token) * Verify proper locking/unlocking in liquidity contract </Step> </Steps> ## Post-deployment considerations ### Supply management After deployment, you can: * **Withdraw excess liquidity**: If genesis created more supply than needed, withdraw and burn via `L2ToL1MessagePasser` * **Add new minters**: Authorize additional contracts to mint native assets as your ecosystem grows * **Revoke minters**: Remove authorization from compromised or deprecated contracts * **Implement rate limits**: Add safeguards to control minting velocity ### Fee parameter adjustments Monitor your chain's operational costs and adjust fee parameters as needed: * **minBaseFee**: Adjust based on L1 gas costs and your token's value, using `SystemConfig.setMinBaseFee()` * **operatorFee**: Adjust based on data availability costs, using `SystemConfig.setOperatorFeeScalars()` ### Developer documentation Create clear documentation for your users covering: * How to acquire native assets (bridge, DEX, faucet, etc.) * Bridge contract addresses and interfaces * Fee structure and token economics * Wallet configuration (RPC endpoints, chain ID, token metadata) ## Troubleshooting ### Flag mismatch errors **Symptom**: Transactions failing with "custom gas token mismatch" errors **Solution**: Verify that `SystemConfig.isCustomGasToken()` on L1 and `L1Block.isCustomGasToken()` on L2 return the same value. If mismatched, this indicates a critical configuration error. ### Fee parameter issues **Symptom**: Chain operator losing money on transaction costs or users complaining about excessive fees **Solution**: Review and recalculate your `minBaseFee` and `operatorFee` parameters based on: * Current L1 gas prices * Your token's market value or peg * Data availability costs * Target fee structure for users ### Liquidity depletion **Symptom**: Minting transactions failing due to insufficient liquidity **Solution**: * Check `NativeAssetLiquidity` balance * If depleted, this indicates an imbalance between minting and burning * Review bridge logic to ensure burns are occurring correctly * Consider increasing initial liquidity supply in future deployments ### Unauthorized minting attempts **Symptom**: Unauthorized addresses attempting to mint native assets **Solution**: * Review access control configuration on `LiquidityController` * Ensure only audited and secured contracts are authorized * Implement rate limiting if not already in place * Consider revoking and re-authorizing with additional safeguards ## Resources * [Custom Gas Token feature overview](/op-stack/features/custom-gas-token) * [OP Deployer documentation](/chain-operators/tools/op-deployer/overview) # Enable span batches Source: https://docs.optimism.io/chain-operators/guides/features/enable-span-batches Learn how to enable span batches on your OP Stack chain by confirming Delta activation and configuring the batch type on op-batcher. Span batches encode a span of consecutive L2 blocks in a single batch, reducing the overhead of batch submission. This is especially beneficial for sparse, low-throughput chains. The format was introduced in the Delta network upgrade, and chains opt into it through the `op-batcher` configuration. For background on what span batches are and why they exist, see [Span batches](/op-stack/features/span-batches). ## Before you begin Span batches are only valid once the Delta upgrade is active on your chain. The `op-node` derivation pipeline drops any span batch whose L1 origin predates Delta activation, logging `dropping span batch before Delta activation`. <Warning> Do not enable span batches on the batcher before Delta is active on your chain. Verifier nodes will drop the span batches your batcher posts, so the data you pay to submit will not advance the safe chain. </Warning> ## Enable span batches <Steps> <Step title="Confirm Delta is active on your chain"> Delta activation is recorded as `delta_time` in your chain's rollup configuration (the `rollup.json` file passed to `op-node`). Delta is active once `delta_time` is set and the L2 block timestamp has passed that value. You can read it from the rollup configuration file directly, or query a running `op-node`: ```bash theme={null} cast rpc --rpc-url <OP_NODE_RPC_URL> optimism_rollupConfig | jq .delta_time ``` If the result is a timestamp in the past, Delta is active. If it is `null`, Delta is not scheduled on your chain and must be activated first. For new chains, the `l2GenesisDeltaTimeOffset` deploy configuration parameter schedules Delta relative to genesis (`0` activates it at genesis) — see the [rollup deployment configuration reference](/chain-operators/reference/rollup-deployment-configuration). For Delta activation times on OP Mainnet and OP Sepolia, see [Network upgrades](/op-stack/protocol/network-upgrades). </Step> <Step title="Set the batch type on op-batcher"> The `op-batcher` `--batch-type` flag (environment variable `OP_BATCHER_BATCH_TYPE`) selects the batch format: `0` for singular batches (the default) and `1` for span batches. Set it to `1` and restart the batcher: ```bash theme={null} --batch-type=1 ``` or, as an environment variable: ```bash theme={null} OP_BATCHER_BATCH_TYPE=1 ``` Optionally, `--max-blocks-per-span-batch` (`OP_BATCHER_MAX_BLOCKS_PER_SPAN_BATCH`) caps the number of L2 blocks added to a single span batch. The default is `0`, which means no maximum. See the [batcher configuration reference](/chain-operators/reference/batcher-configuration) for details on both flags. </Step> <Step title="Verify the batcher configuration"> On startup, the batcher logs its channel configuration. Check the `Initialized channel-config` log line and confirm it reports `batch_type=1`: ```text theme={null} INFO [...] Initialized channel-config ... batch_type=1 ... ``` </Step> </Steps> ## Revert to singular batches Singular batches remain valid after Delta, so you can switch back at any time by setting `--batch-type=0` (or unsetting `OP_BATCHER_BATCH_TYPE`, since `0` is the default) and restarting the batcher. ## Next steps * Learn what span batches are and how the format works in the [span batches explainer](/op-stack/features/span-batches). * Review the other batcher settings that affect cost and stability in [Configure the batcher](/chain-operators/guides/configuration/batcher). * Read the [span batches specification](https://specs.optimism.io/protocol/delta/span-batches.html?utm_source=op-docs\&utm_medium=docs) for the full format definition. # Enabling Sequencer Defined Metering Source: https://docs.optimism.io/chain-operators/guides/features/sequencer-defined-metering Turn Sequencer Defined Metering on or off on an OP Stack sequencer, and confirm which gate is holding it back. <Warning> SDM is not yet live. Stock public `op-reth` supports the SDM consensus and verification mechanism, but it does **not** implement a refund-producing policy. Enabling its operator gate does not cause it to issue refunds or append post-exec transactions. </Warning> This guide covers the operator control surface for **Sequencer Defined Metering (SDM)**: turning it on, confirming it, and turning it off. For what SDM does and what changes on your chain when it activates, see the [SDM explainer](/op-stack/features/sdm). ## Before you start Run versions of `op-reth`, and of `op-node` or `kona-node`, that implement the [Lagoon hardfork](/op-stack/protocol/hardforks/lagoon). Verifier operators do not opt in to anything and have no SDM configuration. If you run verifier nodes only, running up-to-date software is all you need to do, and the rest of this page does not apply to you. ## Chain operator opt-in A sequencer appends a post-exec transaction only if Lagoon is active at the block's timestamp and the operator has opted in on that node. If either is false, th
프로젝트로 돌아가기