From e3f7543f126e7fff8bceaa02d5204782b41be600 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Mon, 30 Jun 2025 18:38:53 -0500 Subject: [PATCH 1/9] design doc: Configurable Calldata Gas Costs --- protocol/configurable-calldata-gas.md | 77 +++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 protocol/configurable-calldata-gas.md diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md new file mode 100644 index 00000000..61ce8995 --- /dev/null +++ b/protocol/configurable-calldata-gas.md @@ -0,0 +1,77 @@ +# Configurable Calldata Gas Costs + +#### Metadata + +Authors: @niran +Created: 2025-06-30 + +--- + +# Purpose + +This document proposes making calldata costs configurable by the chain operator at runtime, not just during hard forks. + +--- + +# Summary + +[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal makes these parameters configurable via `SystemConfig` instead of hard-coded in the client. + +We introduce **two new configuration values** that can be modified via the rollup's `SystemConfig` contract: + +| Name | Type | Default | Meaning | +|------|------|-------------------|---------| +| `eip7623StandardTokenCost` | `uint32` | `4` | The ratio of the cost of a non-zero byte in `tx.data` to the cost of a zero byte in `tx.data` | +| `eip7623TotalCostFloorPerToken` | `uint32` | `10` | The cost of a zero byte in `tx.data` when calculating the total cost floor | + +These values are updated via a single new function in `SystemConfig`: + +```solidity +function setEIP7623Params(uint32 standardTokenCost, uint32 totalCostFloorPerToken) external onlyOwner; +``` + +This function will emit a `ConfigUpdate` log-event, with a new `UpdateType`: `UpdateType.EIP7623_PARAMS`. + +At the next fork, op-geth stops reading the compile-time constants in `FloorDataGas` and instead calls a `FloorDataGasFunc` built from the values stored in two dedicated slots of the `L1Block` contract. The values are included in the state of the rollup via the [L1 block attributes](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/isthmus/l1-attributes.md) transaction that updates the `L1Block` contract's storage. + +--- + +# Problem Statement & Context + +In Ethereum, calldata costs are determined within the calculation for intrinsic gas, which requires a hard fork to change. Recent EIPs have avoided changing the cost of calldata directly by setting a floor for the transaction's cost instead. Pectra's [EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) set a floor of 10 gas for zero bytes and 40 gas for nonzero bytes. [EIP 7976](https://eips.ethereum.org/EIPS/eip-7976) proposes to increase the floor cost further based partially on L1's plans to increase the gas target. These gas cost floors primarily affect calldata-heavy transactions, leaving execution-heavy transactions unaffected. + +Rollups have inherited Ethereum's intrinsic gas formula, but rollups have different constraints for the calldata that they process, particularly the L1's data availability capacity, the rollup's block time, and the rollup's gas limit. These constraints change over time, so the cost of calldata must change accordingly to use L1's data availability capacity without exceeding it. At a minimum, rollups will want to adjust their calldata costs with every L1 hard fork that changes blob capacity, which coincides well with OP Stack forks. But any time a rollup wants to change its gas limit (as `SystemConfig` already allows), it will also want to adjust its calldata costs to account for the new gas limit. + +Since Pectra increased L1's data availability capacity to a target of 6 128kb blobs every 12 seconds, it can handle 64 kb/s of throughput. A single rollup with a two-second block time can only accept 128kb of batches per block. At 40 gas per byte (as of Pectra's [EIP 7623](https://eips.ethereum.org/EIPS/eip-7623)), it would cost 5.12M gas per block for a rollup's calldata to use enough blobs to hit L1's blob target. Most OP Stack chains have gas targets high enough to accept far more than 128kb of calldata per block! This allows blocks to exceed the rollup's constraints without putting any pressure on the base fee to price out this congestion. + +| Chain | Gas target | Underpricing factor | +|-------|------------|---------------------| +| Base | 50M | ≈ 9.8× | +| OP Mainnet | 20M | ≈ 3.9× | +| Ink | 15M | ≈ 2.9× | +| Unichain | 15M | ≈ 2.9× | +| Mode | 15M | ≈ 2.9× | + +Because so many OP Stack rollups have underpriced calldata, these chains rely on [batcher sequencer throttling](https://docs.optimism.io/operators/chain-operators/configuration/batcher#batcher-sequencer-throttling) to prevent large backlogs of batches from accumulating. The downside of this approach is that it "breaks the fee market." Users must outbid each other's priority fees in a first-price auction instead of expecting all transactions willing to pay the current base fee to be included in blocks. Many applications do not expect to actively participate in priority fee auctions because EIP 1559 has been so successful at eliminating them, so they experience these periods as a denial of service. (The base fee also plummets to zero during these periods, so even when the throttle is no longer binding, it takes time for the priority fee auction to end.) + +Pricing calldata correctly should make batcher sequencer throttling unnecessary and eliminate the priority fee auctions we see today when calldata is congested. + +--- + +# Alternatives Considered + +* **Continue hard-coding gas costs**. Updating gas costs once or twice per year on a similar cadence to L1 hard forks is likely frequent enough for most chains, but it doesn't address differences in gas targets between OP Stack chains without each chain maintaining a persistent fork of the client. +* **Full fee-abstraction** (see [`specs#73`](https://github.com/ethereum-optimism/specs/issues/73)). Only addresses fees, but we need to manipulate gas consumption for the fee market to function properly. +* **Expose a single configuration value**. We don't foresee `eip7623StandardTokenCost` ever being modified from its default value of `4`, but it's included in the proposal for completeness. +* **Change the actual calldata gas cost, not just the floor**. This diverges from how the L1 community has been addressing calldata costs and impacts more transactions than are necessary to solve the problem. +* **Adopt multidimensional metering** (see the [Ethereum Magicians thread](https://ethresear.ch/t/a-practical-proposal-for-multidimensional-gas-metering/22668)). This is likely the proper medium-term solution, but it will take time for the proposal to stabilize and to be adopted on L1. +* **Generalized configurable gas schedule**. There are more resources that are mispriced on rollups besides calldata. Extending this proposal to cover them would likely require dynamic arrays in `SystemConfig` and `L1Block`, so the added complexity doesn't seem worth it yet. Calldata would likely still be a special case since there's no corresponding opcode to price. + +--- + +# Risks & Uncertainties + +* As with all updates to `SystemConfig` and `L1Block`, the storage slots must be carefully allocated to ensure forward compatibility. +* Future Ethereum EIPs may make this configuration obsolete. +* Without care, it might be possible to set values so high that the system transaction cannot be executed and the chain will halt. + From 9261c6e02f3f20e6164135f0ae221a84097329dc Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 2 Jul 2025 11:48:54 -0500 Subject: [PATCH 2/9] Reformat metadata --- protocol/configurable-calldata-gas.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index 61ce8995..c35208b2 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -1,9 +1,10 @@ # Configurable Calldata Gas Costs -#### Metadata +| | | +| ------------------ | -------------------------------------------------- | +| Author | @niran | +| Created at | 2025-06-30 | -Authors: @niran -Created: 2025-06-30 --- From 363a1c4af6654cc92bfafe8fb6256ed27eca4d89 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 2 Jul 2025 12:05:10 -0500 Subject: [PATCH 3/9] Add a risk about Glamsterdam's gas repricing --- protocol/configurable-calldata-gas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index c35208b2..ea45ebd4 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -75,4 +75,4 @@ Pricing calldata correctly should make batcher sequencer throttling unnecessary * As with all updates to `SystemConfig` and `L1Block`, the storage slots must be carefully allocated to ensure forward compatibility. * Future Ethereum EIPs may make this configuration obsolete. * Without care, it might be possible to set values so high that the system transaction cannot be executed and the chain will halt. - +* L1's Glamsterdam fork might include [EIP 7904](https://eips.ethereum.org/EIPS/eip-7904), which aims to reprice the entire gas schedule. The OP Stack fork that includes Glamsterdam would need to consider how rollups with customized calldata costs would transition to a new value in a coordinated way. From 2f36340876b4371a9b283098ac2659e0f56994fc Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 2 Jul 2025 13:28:13 -0500 Subject: [PATCH 4/9] Use smaller types for the config values to fit in 32 bits --- protocol/configurable-calldata-gas.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index ea45ebd4..b79eea1e 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -22,8 +22,8 @@ We introduce **two new configuration values** that can be modified via the rollu | Name | Type | Default | Meaning | |------|------|-------------------|---------| -| `eip7623StandardTokenCost` | `uint32` | `4` | The ratio of the cost of a non-zero byte in `tx.data` to the cost of a zero byte in `tx.data` | -| `eip7623TotalCostFloorPerToken` | `uint32` | `10` | The cost of a zero byte in `tx.data` when calculating the total cost floor | +| `eip7623StandardTokenCost` | `uint8` | `4` | The ratio of the cost of a non-zero byte in `tx.data` to the cost of a zero byte in `tx.data` | +| `eip7623TotalCostFloorPerToken` | `uint24` | `10` | The cost of a zero byte in `tx.data` when calculating the total cost floor | These values are updated via a single new function in `SystemConfig`: From 9cdb74a07f41baa2595891bf0f0f7c37baaa75f3 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Tue, 8 Jul 2025 16:50:20 -0500 Subject: [PATCH 5/9] Use the estimated FastLZ compressed size instead of zero bytes vs nonzero bytes to price calldata --- protocol/configurable-calldata-gas.md | 39 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index b79eea1e..61745159 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -16,24 +16,31 @@ This document proposes making calldata costs configurable by the chain operator # Summary -[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal makes these parameters configurable via `SystemConfig` instead of hard-coded in the client. - -We introduce **two new configuration values** that can be modified via the rollup's `SystemConfig` contract: +[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal uses similar cost floor logic, but uses a single parameter for the cost of a fastLZ-compresses byte of calldata. This parameter is configurable via `SystemConfig` instead of hard-coded in the client. | Name | Type | Default | Meaning | |------|------|-------------------|---------| -| `eip7623StandardTokenCost` | `uint8` | `4` | The ratio of the cost of a non-zero byte in `tx.data` to the cost of a zero byte in `tx.data` | -| `eip7623TotalCostFloorPerToken` | `uint24` | `10` | The cost of a zero byte in `tx.data` when calculating the total cost floor | +| `calldataGasPerFastLZByte` | `uint32` | `120` | The cost of a fastLZ-compressed byte of calldata | These values are updated via a single new function in `SystemConfig`: ```solidity -function setEIP7623Params(uint32 standardTokenCost, uint32 totalCostFloorPerToken) external onlyOwner; +function setCalldataGasPerFastLZByte(uint32 calldataGasPerFastLZByte) external onlyOwner; ``` -This function will emit a `ConfigUpdate` log-event, with a new `UpdateType`: `UpdateType.EIP7623_PARAMS`. +This function will emit a `ConfigUpdate` log-event, with a new `UpdateType`: `UpdateType.CALLDATA_GAS_PER_FASTLZ_BYTE`. + +At the next fork, op-geth stops reading the compile-time constants in `FloorDataGas` and instead calls a `FloorDataGasFunc` built from the values stored in a dedicated slot of the `L1Block` contract. The value is included in the state of the rollup via the [L1 block attributes](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/isthmus/l1-attributes.md) transaction that updates the `L1Block` contract's storage. + +Instead of using zero bytes and nonzero bytes as heuristics for compressed calldata size like Ethereum does, we repurpose OP Stack's [FastLZ compression size estimation](https://specs.optimism.io/protocol/fjord/exec-engine.html#fees) from the L1 data fee calculation that was introduced in Fjord to give a more accurate estimate of the L1 blob space consumed by a transaction's calldata. This allows us to set lower gas costs for calldata and allow more of it to be used before the chain's base fee begins to rise. + +``` +estimatedSizeScaled = max(minTransactionSize * 1e6, intercept + fastlzCoef*fastlzSize) +estimatedSize = estimatedSizeScaled / 1e6 +floorDataGas = estimatedSize * calldataGasPerFastLZByte +``` -At the next fork, op-geth stops reading the compile-time constants in `FloorDataGas` and instead calls a `FloorDataGasFunc` built from the values stored in two dedicated slots of the `L1Block` contract. The values are included in the state of the rollup via the [L1 block attributes](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/isthmus/l1-attributes.md) transaction that updates the `L1Block` contract's storage. +The default value of `calldataGasPerFastLZByte` is 120, which allows a chain with a gas target of 15M to sustain around 64 kb of calldata per block when all transactions are purely calldata. This throughput matches the entire target throughput for blobs on L1: six 128kb blobs every 12 seconds. --- @@ -43,15 +50,15 @@ In Ethereum, calldata costs are determined within the calculation for intrinsic Rollups have inherited Ethereum's intrinsic gas formula, but rollups have different constraints for the calldata that they process, particularly the L1's data availability capacity, the rollup's block time, and the rollup's gas limit. These constraints change over time, so the cost of calldata must change accordingly to use L1's data availability capacity without exceeding it. At a minimum, rollups will want to adjust their calldata costs with every L1 hard fork that changes blob capacity, which coincides well with OP Stack forks. But any time a rollup wants to change its gas limit (as `SystemConfig` already allows), it will also want to adjust its calldata costs to account for the new gas limit. -Since Pectra increased L1's data availability capacity to a target of 6 128kb blobs every 12 seconds, it can handle 64 kb/s of throughput. A single rollup with a two-second block time can only accept 128kb of batches per block. At 40 gas per byte (as of Pectra's [EIP 7623](https://eips.ethereum.org/EIPS/eip-7623)), it would cost 5.12M gas per block for a rollup's calldata to use enough blobs to hit L1's blob target. Most OP Stack chains have gas targets high enough to accept far more than 128kb of calldata per block! This allows blocks to exceed the rollup's constraints without putting any pressure on the base fee to price out this congestion. +Since Pectra increased L1's data availability capacity to a target of 6 128kb blobs every 12 seconds, it can sustain 64 kb/s of throughput. A single rollup with a two-second block time can only accept 128kb of batches per block. At 40 gas per byte (as of Pectra's [EIP 7623](https://eips.ethereum.org/EIPS/eip-7623)), it would cost 5.12M gas per block for a rollup's calldata to use enough blobs to hit L1's blob target. Most OP Stack chains have gas targets high enough to accept far more than 128kb of calldata per block! This allows blocks to exceed the rollup's constraints without putting any pressure on the base fee to price out this congestion. -| Chain | Gas target | Underpricing factor | -|-------|------------|---------------------| -| Base | 50M | ≈ 9.8× | -| OP Mainnet | 20M | ≈ 3.9× | -| Ink | 15M | ≈ 2.9× | -| Unichain | 15M | ≈ 2.9× | -| Mode | 15M | ≈ 2.9× | +| Chain | Gas target | Block time | Underpricing factor | Suggested `calldataGasPerFastLZByte` | +|-------|------------|------------|---------------------|--------------------------------------| +| Base | 50M | 2s | ≈ 9.8× | 390 | +| Unichain | 15M | 1s | ≈ 5.9× | 235 | +| OP Mainnet | 20M | 2s | ≈ 3.9× | 158 | +| Ink | 15M | 2s | ≈ 2.9× | 120 | +| Mode | 15M | 2s | ≈ 2.9× | 120 | Because so many OP Stack rollups have underpriced calldata, these chains rely on [batcher sequencer throttling](https://docs.optimism.io/operators/chain-operators/configuration/batcher#batcher-sequencer-throttling) to prevent large backlogs of batches from accumulating. The downside of this approach is that it "breaks the fee market." Users must outbid each other's priority fees in a first-price auction instead of expecting all transactions willing to pay the current base fee to be included in blocks. Many applications do not expect to actively participate in priority fee auctions because EIP 1559 has been so successful at eliminating them, so they experience these periods as a denial of service. (The base fee also plummets to zero during these periods, so even when the throttle is no longer binding, it takes time for the priority fee auction to end.) From a18493143c3e9e67f5910e680aa2f78e910ec460 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Tue, 8 Jul 2025 17:05:08 -0500 Subject: [PATCH 6/9] Fix typos --- protocol/configurable-calldata-gas.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index 61745159..86cb309b 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -16,7 +16,7 @@ This document proposes making calldata costs configurable by the chain operator # Summary -[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal uses similar cost floor logic, but uses a single parameter for the cost of a fastLZ-compresses byte of calldata. This parameter is configurable via `SystemConfig` instead of hard-coded in the client. +[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal uses similar cost floor logic, but uses a single parameter for the cost of a FastLZ-compressed byte of calldata. This parameter is configurable via `SystemConfig` instead of hard-coded in the client. | Name | Type | Default | Meaning | |------|------|-------------------|---------| From 69ae7acb7bd7dc0eb4d97e3bd862d43532d51313 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 9 Jul 2025 10:11:08 -0500 Subject: [PATCH 7/9] Remove outdated risk --- protocol/configurable-calldata-gas.md | 1 - 1 file changed, 1 deletion(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index 86cb309b..df6a1646 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -70,7 +70,6 @@ Pricing calldata correctly should make batcher sequencer throttling unnecessary * **Continue hard-coding gas costs**. Updating gas costs once or twice per year on a similar cadence to L1 hard forks is likely frequent enough for most chains, but it doesn't address differences in gas targets between OP Stack chains without each chain maintaining a persistent fork of the client. * **Full fee-abstraction** (see [`specs#73`](https://github.com/ethereum-optimism/specs/issues/73)). Only addresses fees, but we need to manipulate gas consumption for the fee market to function properly. -* **Expose a single configuration value**. We don't foresee `eip7623StandardTokenCost` ever being modified from its default value of `4`, but it's included in the proposal for completeness. * **Change the actual calldata gas cost, not just the floor**. This diverges from how the L1 community has been addressing calldata costs and impacts more transactions than are necessary to solve the problem. * **Adopt multidimensional metering** (see the [Ethereum Magicians thread](https://ethresear.ch/t/a-practical-proposal-for-multidimensional-gas-metering/22668)). This is likely the proper medium-term solution, but it will take time for the proposal to stabilize and to be adopted on L1. * **Generalized configurable gas schedule**. There are more resources that are mispriced on rollups besides calldata. Extending this proposal to cover them would likely require dynamic arrays in `SystemConfig` and `L1Block`, so the added complexity doesn't seem worth it yet. Calldata would likely still be a special case since there's no corresponding opcode to price. From f0d161626f5b5d2823a6f07299b9fe8c81f1fbd4 Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 9 Jul 2025 10:36:41 -0500 Subject: [PATCH 8/9] Rename the setting --- protocol/configurable-calldata-gas.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index df6a1646..89c1fbab 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -16,19 +16,19 @@ This document proposes making calldata costs configurable by the chain operator # Summary -[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal uses similar cost floor logic, but uses a single parameter for the cost of a FastLZ-compressed byte of calldata. This parameter is configurable via `SystemConfig` instead of hard-coded in the client. +[EIP 7623](https://eips.ethereum.org/EIPS/eip-7623) uses `STANDARD_TOKEN_COST` and `TOTAL_COST_FLOOR_PER_TOKEN` parameters to calculate the floor cost of each transaction. This proposal uses similar cost floor logic, but uses a single parameter for the cost of a compressed byte of calldata, estimated using FastLZ compression. This parameter is configurable via `SystemConfig` instead of hard-coded in the client. | Name | Type | Default | Meaning | -|------|------|-------------------|---------| -| `calldataGasPerFastLZByte` | `uint32` | `120` | The cost of a fastLZ-compressed byte of calldata | +|------|------|---------|---------| +| `calldataGasPerCompressedByte` | `uint32` | `120` | The cost per estimated compressed byte of calldata | These values are updated via a single new function in `SystemConfig`: ```solidity -function setCalldataGasPerFastLZByte(uint32 calldataGasPerFastLZByte) external onlyOwner; +function setCalldataGasPerCompressedByte(uint32 calldataGasPerCompressedByte) external onlyOwner; ``` -This function will emit a `ConfigUpdate` log-event, with a new `UpdateType`: `UpdateType.CALLDATA_GAS_PER_FASTLZ_BYTE`. +This function will emit a `ConfigUpdate` log-event, with a new `UpdateType`: `UpdateType.CALLDATA_GAS_PER_COMPRESSED_BYTE`. At the next fork, op-geth stops reading the compile-time constants in `FloorDataGas` and instead calls a `FloorDataGasFunc` built from the values stored in a dedicated slot of the `L1Block` contract. The value is included in the state of the rollup via the [L1 block attributes](https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/isthmus/l1-attributes.md) transaction that updates the `L1Block` contract's storage. @@ -37,10 +37,10 @@ Instead of using zero bytes and nonzero bytes as heuristics for compressed calld ``` estimatedSizeScaled = max(minTransactionSize * 1e6, intercept + fastlzCoef*fastlzSize) estimatedSize = estimatedSizeScaled / 1e6 -floorDataGas = estimatedSize * calldataGasPerFastLZByte +floorDataGas = estimatedSize * calldataGasPerCompressedByte ``` -The default value of `calldataGasPerFastLZByte` is 120, which allows a chain with a gas target of 15M to sustain around 64 kb of calldata per block when all transactions are purely calldata. This throughput matches the entire target throughput for blobs on L1: six 128kb blobs every 12 seconds. +The default value of `calldataGasPerCompressedByte` is 120, which allows a chain with a gas target of 15M to sustain around 64 kb of calldata per block when all transactions are purely calldata. This throughput matches the entire target throughput for blobs on L1: six 128kb blobs every 12 seconds. --- @@ -52,7 +52,7 @@ Rollups have inherited Ethereum's intrinsic gas formula, but rollups have differ Since Pectra increased L1's data availability capacity to a target of 6 128kb blobs every 12 seconds, it can sustain 64 kb/s of throughput. A single rollup with a two-second block time can only accept 128kb of batches per block. At 40 gas per byte (as of Pectra's [EIP 7623](https://eips.ethereum.org/EIPS/eip-7623)), it would cost 5.12M gas per block for a rollup's calldata to use enough blobs to hit L1's blob target. Most OP Stack chains have gas targets high enough to accept far more than 128kb of calldata per block! This allows blocks to exceed the rollup's constraints without putting any pressure on the base fee to price out this congestion. -| Chain | Gas target | Block time | Underpricing factor | Suggested `calldataGasPerFastLZByte` | +| Chain | Gas target | Block time | Underpricing factor | Suggested `calldataGasPerCompressedByte` | |-------|------------|------------|---------------------|--------------------------------------| | Base | 50M | 2s | ≈ 9.8× | 390 | | Unichain | 15M | 1s | ≈ 5.9× | 235 | From a714be2fa1ab2b6d90aa38f108587bf09a27443d Mon Sep 17 00:00:00 2001 From: Niran Babalola Date: Wed, 9 Jul 2025 10:42:01 -0500 Subject: [PATCH 9/9] Add a note about the alternative to continue charging for zero bytes and nonzero bytes --- protocol/configurable-calldata-gas.md | 1 + 1 file changed, 1 insertion(+) diff --git a/protocol/configurable-calldata-gas.md b/protocol/configurable-calldata-gas.md index 89c1fbab..bc9b78fa 100644 --- a/protocol/configurable-calldata-gas.md +++ b/protocol/configurable-calldata-gas.md @@ -69,6 +69,7 @@ Pricing calldata correctly should make batcher sequencer throttling unnecessary # Alternatives Considered * **Continue hard-coding gas costs**. Updating gas costs once or twice per year on a similar cadence to L1 hard forks is likely frequent enough for most chains, but it doesn't address differences in gas targets between OP Stack chains without each chain maintaining a persistent fork of the client. +* **Continue using zero bytes and nonzero bytes as heuristics for compressed calldata size**. This would minimize the diff from standard Ethereum clients, but would underutilize the L1's data availability capacity. Since FastLZ compression is already consensus-critical within the L1 data fee calculation, repurposing it here gives us significant benefits at low cost. * **Full fee-abstraction** (see [`specs#73`](https://github.com/ethereum-optimism/specs/issues/73)). Only addresses fees, but we need to manipulate gas consumption for the fee market to function properly. * **Change the actual calldata gas cost, not just the floor**. This diverges from how the L1 community has been addressing calldata costs and impacts more transactions than are necessary to solve the problem. * **Adopt multidimensional metering** (see the [Ethereum Magicians thread](https://ethresear.ch/t/a-practical-proposal-for-multidimensional-gas-metering/22668)). This is likely the proper medium-term solution, but it will take time for the proposal to stabilize and to be adopted on L1.