Skip to content

Commit 51f9ffc

Browse files
committed
fees and precompile updates
1 parent 710bcd2 commit 51f9ffc

File tree

9 files changed

+73
-31
lines changed

9 files changed

+73
-31
lines changed

src/content/docs/en/developers/transaction-fees-on-scroll.mdx

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,29 @@ when the sequencer commits the data to L1.
8181

8282
As mentioned, the `L1GasPriceOracle` is used to estimate the L1 gas fee given raw transaction data. This is a **push oracle**, updated by a relayer run by Scroll.
8383

84-
The data fee is based on multiple factors:
84+
<Aside type="note" title="Fee Calculation Changes">
85+
The L1 data fee calculation has evolved through several network upgrades:
86+
- **Pre-Curie**: Based on calldata gas costs
87+
- **Curie**: Introduced blob-based data availability with `commitScalar` and `blobScalar`
88+
- **Feynman**: Added compression penalty factor
89+
- **Galileo**: Updated penalty calculation formula
90+
</Aside>
91+
92+
#### Post-Curie Fee Calculation (Current)
8593

86-
- The bytes which are `zeros` and `nonzeros` of an RLP-encoded transaction with Signature
87-
- `l1BaseFee` - Current base fee on the L1
88-
- `overhead` - Additional gas overhead of a data commitment transaction
89-
- `scalingFactor` - A scaling factor used to account for price spikes
90-
- `PRECISION` - A constant used to scale the final fee
94+
Since the [Curie upgrade](/technology/overview/scroll-upgrades/curie-upgrade), transaction data is stored in blobs, and the fee is calculated as:
9195

92-
The following steps are taken to calculate the L1 data fee:
96+
```javascript
97+
l1Fee = (commitScalar * l1BaseFee + blobScalar * txDataLength * l1BlobBaseFee) / PRECISION
98+
```
9399

94-
1. Read three fields `l1BaseFee`, `overhead`, `scalar` from the `L1GasPriceOracle` contract. The slots for these fields in the contract are:
100+
Where `PRECISION = 1e9`.
95101

96-
| Field | Slot |
97-
| --------- | ---- |
98-
| l1BaseFee | 1 |
99-
| overhead | 2 |
100-
| scalar | 3 |
102+
#### Pre-Curie Fee Calculation (Legacy)
103+
104+
Before Curie, the fee was based on calldata gas costs:
105+
106+
1. Read three fields `l1BaseFee`, `overhead`, `scalar` from the `L1GasPriceOracle` contract.
101107

102108
2. Count the number of zero bytes and non-zero bytes from the transaction.
103109
3. Calculate the L1 data fee, given `TX_DATA_ZERO_GAS = 4` and `TX_DATA_NON_ZERO_GAS = 16`[^eip-2028] and `PRECISION = 1e9`:
@@ -119,31 +125,63 @@ The following steps are taken to calculate the L1 data fee:
119125
function overhead() external view returns (uint256);
120126
```
121127

122-
Returns the current L1 fee overhead
128+
Returns the current L1 fee overhead (used in pre-Curie fee calculation).
123129

124130
#### scalar
125131

126132
```solidity
127133
function scalar() external view returns (uint256);
128134
```
129135

130-
Returns the current l1 fee scalar
136+
Returns the current L1 fee scalar (used in pre-Curie fee calculation).
131137

132138
#### l1BaseFee
133139

134140
```solidity
135141
function l1BaseFee() external view returns (uint256);
136142
```
137143

138-
Returns the latest known l1 base fee
144+
Returns the latest known L1 base fee.
145+
146+
#### l1BlobBaseFee
147+
148+
```solidity
149+
function l1BlobBaseFee() external view returns (uint256);
150+
```
151+
152+
Returns the latest known L1 blob base fee (introduced in Curie upgrade).
153+
154+
#### commitScalar
155+
156+
```solidity
157+
function commitScalar() external view returns (uint256);
158+
```
159+
160+
Returns the current L1 commit fee scalar (introduced in Curie upgrade).
161+
162+
#### blobScalar
163+
164+
```solidity
165+
function blobScalar() external view returns (uint256);
166+
```
167+
168+
Returns the current L1 blob fee scalar (introduced in Curie upgrade).
169+
170+
#### penaltyFactor
171+
172+
```solidity
173+
function penaltyFactor() external view returns (uint256);
174+
```
175+
176+
Returns the current compression penalty factor (introduced in Feynman upgrade).
139177

140178
#### getL1Fee
141179

142180
```solidity
143181
function getL1Fee(bytes memory data) external view returns (uint256);
144182
```
145183

146-
Computes the L1 portion of the fee based on the size of the RLP encoded input transaction, the current L1 base fee, and the various dynamic parameters.
184+
Computes the L1 portion of the fee based on the size of the RLP encoded input transaction, the current L1 base fee, and the various dynamic parameters. The calculation method depends on the current network fork (pre-Curie, Curie, Feynman, or Galileo).
147185

148186
**Returns:** L1 fee that should be paid for the transaction
149187

@@ -157,9 +195,9 @@ Computes the L1 portion of the fee based on the size of the RLP encoded input tr
157195
function getL1GasUsed(bytes memory data) external view returns (uint256);
158196
```
159197

160-
Computes the amount of L1 gas used for a transaction. Adds the overhead which represents the per-transaction gas overhead of posting the transaction and state roots to L1. Adds 74 bytes of padding to account for the fact that the input does not have a signature.
198+
Computes the amount of L1 gas used for a transaction. After the Curie upgrade, this returns 0 since all transaction data is stored in blobs.
161199

162-
**Returns:** Amount of L1 gas used to publish the transaction.
200+
**Returns:** Amount of L1 gas used to publish the transaction (0 post-Curie).
163201

164202
| Parameter | Description |
165203
| --------- | ----------------------------------------------------------- |

src/content/docs/en/technology/chain/blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The block header in Scroll mirrors the structure of Ethereum's. However, certain
3030
| `extraData` | Signature by the block's signer, followed by arbitrary additional data. |
3131
| `mixHash` | Always 0. |
3232
| `nonce` | Always 0. |
33-
| `baseFee` | Currently empty in Scroll because we haven't enabled the EIP-1559. |
33+
| `baseFee` | The base fee for this block. Since the [Curie upgrade](/technology/overview/scroll-upgrades/curie-upgrade), Scroll uses EIP-1559 with the base fee set by the sequencer. |
3434

3535
## Block Time
3636

src/content/docs/en/technology/chain/transactions.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ A transaction is a cryptographically signed message that initiates a state trans
1414

1515
## Transaction Type
1616

17-
Currently, Scroll supports three types of transactions.
17+
Currently, Scroll supports four types of transactions.
1818

1919
- Pre-EIP-155 Transaction: This is to support the [Singleton Factory](https://eips.ethereum.org/EIPS/eip-2470) contract.
2020
- Legacy Transaction (refer to [EIP-155](https://eips.ethereum.org/EIPS/eip-155))
21+
- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) Transaction (Type 2): Supported since the [Curie upgrade](/technology/overview/scroll-upgrades/curie-upgrade). Scroll uses a modified EIP-1559 fee market where the sequencer sets the L2 base fee based on the L1 base fee, and ETH is not burned.
2122
- `L1MessageTx` Typed Transaction (Type: `0x7E`): This is a new [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) transaction introduced in Scroll as described below. This transaction type is for transactions initiated on L1.
2223

23-
Note that [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) and [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) transaction types are not supported in Scroll currently. Scroll will bring back these two transaction types in the future.
24+
Note that [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) access list transactions are not yet supported on Scroll.
2425

2526
### L1 Message Transaction
2627

src/content/docs/es/technology/chain/blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ La block header en Scroll refleja la estructura de Ethereum. Sin embargo, alguno
3030
| `extraData` | Datos arbitrarios adicionales. |
3131
| `mixHash` | Siempre 0. |
3232
| `nonce` | Siempre 0. |
33-
| `baseFee` | Actualmente vacío en Scroll porque no hemos activado el EIP-1559. |
33+
| `baseFee` | La comisión base de este bloque. Desde la [actualización Curie](/technology/overview/scroll-upgrades/curie-upgrade), Scroll utiliza EIP-1559 con la comisión base establecida por el secuenciador. |
3434

3535
## Tiempo de bloque
3636

src/content/docs/es/technology/chain/transactions.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ Una transacción es un mensaje firmado criptográficamente que inicia una transi
1414

1515
## Tipo de Transacción
1616

17-
Actualmente, Scroll admite tres tipos de transacciones.
17+
Actualmente, Scroll admite cuatro tipos de transacciones.
1818

1919
- Transacción Pre-EIP-155: Soporta el contrato [Singleton Factory](https://eips.ethereum.org/EIPS/eip-2470).
2020
- Transacción Legacy (consulte [EIP-155](https://eips.ethereum.org/EIPS/eip-155))
21+
- Transacción [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) (Tipo 2): Soportada desde la [actualización Curie](/technology/overview/scroll-upgrades/curie-upgrade). Scroll utiliza un mercado de comisiones EIP-1559 modificado donde el secuenciador establece la comisión base de L2 basándose en la comisión base de L1, y el ETH no se quema.
2122
- Transacción tipo `L1MessageTx` (Tipo: `0x7E`): Se trata de una nueva transacción [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) introducida en Scroll como se describe a continuación. Este tipo de transacción es para transacciones iniciadas en L1.
2223

23-
Ten en cuenta que los tipos de transacción [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) y [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) no están soportados actualmente en Scroll. Scroll incorporará estos dos tipos de transacción en el futuro.
24+
Ten en cuenta que las transacciones de lista de acceso [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) aún no están soportadas en Scroll.
2425

2526
### Transacción de Mensajes en L1
2627

src/content/docs/tr/technology/chain/blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Scroll'daki blok başlığı Ethereum'un yapısını yansıtır. Ancak blok baş
3030
| `extraData` | Bloğu imzalayan kişinin imzası ve ardından isteğe bağlı ek veriler. |
3131
| `mixHash` | Her zaman 0. |
3232
| `nonce` | Her zaman 0. |
33-
| `baseFee` | Scroll'da EIP-1559'u etkinleştirmediğimiz için şu anda boş. |
33+
| `baseFee` | Bu bloğun taban ücreti. [Curie yükseltmesinden](/technology/overview/scroll-upgrades/curie-upgrade) bu yana Scroll, sıralayıcı tarafından belirlenen taban ücreti ile EIP-1559 kullanmaktadır. |
3434

3535
## Blok süresi
3636

src/content/docs/tr/technology/chain/transactions.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ import TransactionBatching from "../_images/batching.png"
1414

1515
## İşlem tipi
1616

17-
Şu anda Scroll üç tür işlemi desteklemektedir.
17+
Şu anda Scroll dört tür işlemi desteklemektedir.
1818

1919
- EIP-155 Öncesi İşlem: Bu, [Singleton Factory](https://eips.ethereum.org/EIPS/eip-2470) sözleşmesini desteklemek içindir.
2020
- Eski Tip İşlem (bkz. [EIP-155](https://eips.ethereum.org/EIPS/eip-155))
21+
- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) İşlemi (Tip 2): [Curie yükseltmesinden](/technology/overview/scroll-upgrades/curie-upgrade) bu yana desteklenmektedir. Scroll, sıralayıcının L1 taban ücretine göre L2 taban ücretini belirlediği ve ETH'nin yakılmadığı değiştirilmiş bir EIP-1559 ücret piyasası kullanır.
2122
- `L1MessageTx` Tipi Belirli İşlem (Tip: `0x7E`): Bu, aşağıda açıklandığı gibi Scroll'da tanıtılan yeni bir [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) işlemidir. Bu işlem tipi L1'de başlatılan işlemler içindir.
2223

23-
Unutmayın ki [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) ve [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) işlem tipleri şu anda Scroll'da desteklenmemektedir. Scroll gelecekte bu iki işlem türünü geri getirecektir.
24+
Unutmayın ki [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) erişim listesi işlemleri henüz Scroll'da desteklenmemektedir.
2425

2526
### L1 Mesaj İşlemi
2627

src/content/docs/zh/technology/chain/blocks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Scroll 中的区块头映射了以太坊的结构。但是修改了区块头中
3030
| `extraData` | 由区块的签名者签名,跟随任意附加数据。 |
3131
| `mixHash` | 始终为 0。 |
3232
| `nonce` | 始终为 0。 |
33-
| `baseFee` | 目前在Scroll中为空,因为我们尚未启用 EIP-1559。 |
33+
| `baseFee` | 此区块的基础费用。自 [Curie 升级](/technology/overview/scroll-upgrades/curie-upgrade)起,Scroll 使用 EIP-1559,基础费用由排序器设置|
3434

3535
## 区块时间
3636

src/content/docs/zh/technology/chain/transactions.mdx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@ import TransactionBatching from "../_images/batching.png"
1414

1515
## 交易类型
1616

17-
目前,Scroll 支持三种类型的交易
17+
目前,Scroll 支持四种类型的交易
1818

1919
- Pre-EIP-155 交易: 以支持 [Singleton Factory](https://eips.ethereum.org/EIPS/eip-2470) 合约。
2020
- Legacy 交易 (参考 [EIP-155](https://eips.ethereum.org/EIPS/eip-155))
21+
- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) 交易 (类型 2): 自 [Curie 升级](/technology/overview/scroll-upgrades/curie-upgrade)起支持。Scroll 使用修改版的 EIP-1559 费用市场,其中排序器根据 L1 基础费用设置 L2 基础费用,且 ETH 不会被销毁。
2122
- `L1MessageTx` 类型交易 (类型: `0x7E`): 这是 Scroll 引入的一种新的 [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) 交易,如下所述。此交易类型适用于在 L1 上发起的交易。
2223

23-
请注意,Scroll 当前不支持 [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) 交易类型。Scroll 未来将会引入这两种交易类型
24+
请注意,Scroll 当前不支持 [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) 访问列表交易
2425

2526
### L1 Message 交易
2627

0 commit comments

Comments
 (0)