|
| 1 | +# Jovian L1 Attributes |
| 2 | + |
| 3 | +<!-- START doctoc generated TOC please keep comment here to allow auto update --> |
| 4 | +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
| 5 | +**Table of Contents** |
| 6 | + |
| 7 | +- [Overview](#overview) |
| 8 | +- [L1 Attributes Predeployed Contract](#l1-attributes-predeployed-contract) |
| 9 | + - [Jovian L1Block upgrade](#jovian-l1block-upgrade) |
| 10 | + |
| 11 | +<!-- END doctoc generated TOC please keep comment here to allow auto update --> |
| 12 | + |
| 13 | +## Overview |
| 14 | + |
| 15 | +On the Jovian activation block, and if Jovian is not activated at Genesis, |
| 16 | +the L1 Attributes Transaction includes a call to `setL1BlockValuesEcotone()` |
| 17 | +because the L1 Attributes transaction precedes the [Jovian Upgrade Transactions][jovian-upgrade-txs], |
| 18 | +meaning that `setL1BlockValuesJovian` is not guaranteed to exist yet. |
| 19 | + |
| 20 | +Every subsequent L1 Attributes transaction should include a call to the `setL1BlockValuesJovian()` function. |
| 21 | +There are two additional `uint64` fields for the consensus nonces packed into calldata. |
| 22 | +The overall calldata layout is as follows: |
| 23 | + |
| 24 | +[jovian-upgrade-txs]: derivation.md#network-upgrade-automation-transactions |
| 25 | + |
| 26 | +| Input arg | Type | Calldata bytes | Segment | |
| 27 | +| ----------------- | ------- |----------------| ------- | |
| 28 | +| {0x3db6be2b} | | 0-3 | n/a | |
| 29 | +| baseFeeScalar | uint32 | 4-7 | 1 | |
| 30 | +| blobBaseFeeScalar | uint32 | 8-11 | | |
| 31 | +| sequenceNumber | uint64 | 12-19 | | |
| 32 | +| l1BlockTimestamp | uint64 | 20-27 | | |
| 33 | +| l1BlockNumber | uint64 | 28-35 | | |
| 34 | +| basefee | uint256 | 36-67 | 2 | |
| 35 | +| blobBaseFee | uint256 | 68-99 | 3 | |
| 36 | +| l1BlockHash | bytes32 | 100-131 | 4 | |
| 37 | +| batcherHash | bytes32 | 132-163 | 5 | |
| 38 | +| depositNonce | uint64 | 164-171 | 6 | |
| 39 | +| configUpdateNonce | uint64 | 172-179 | | |
| 40 | + |
| 41 | +Total calldata length MUST be exactly 180 bytes, implying the sixth and final segment is only |
| 42 | +partially filled. This helps to slow database growth as every L2 block includes a L1 Attributes |
| 43 | +deposit transaction. |
| 44 | + |
| 45 | +In the first L2 block after the Jovian activation block, the Jovian L1 attributes are first used. |
| 46 | + |
| 47 | +The pre-Jovian values are migrated over 1:1. |
| 48 | +Blocks after the Jovian activation block contain all pre-Jovian values 1:1, |
| 49 | +and also set the following new attributes: |
| 50 | + |
| 51 | +- The `depositNonce` has the default value of 0. |
| 52 | +- The `configUpdateNonce` has the default value of 0. |
| 53 | + |
| 54 | +## L1 Attributes Predeployed Contract |
| 55 | + |
| 56 | +The L1 Attributes predeploy stores the following values: |
| 57 | + |
| 58 | +- L1 block attributes: |
| 59 | + - `number` (`uint64`) |
| 60 | + - `timestamp` (`uint64`) |
| 61 | + - `basefee` (`uint256`) |
| 62 | + - `hash` (`bytes32`) |
| 63 | + - `blobBaseFee` (`uint256`) |
| 64 | +- `sequenceNumber` (`uint64`): This equals the L2 block number relative to the start of the epoch, |
| 65 | + i.e. the L2 block distance to the L2 block height that the L1 attributes last changed, |
| 66 | + and reset to 0 at the start of a new epoch. |
| 67 | +- System configurables tied to the L1 block, see [System configuration specification][sys-config]: |
| 68 | + - `batcherHash` (`bytes32`): A versioned commitment to the batch-submitter(s) currently operating. |
| 69 | + - `baseFeeScalar` (`uint32`): system configurable to scale the `basefee` in the Ecotone l1 cost computation |
| 70 | + - `blobBasefeeScalar` (`uint32`): system configurable to scale the `blobBaseFee` in the Ecotone l1 cost computation |
| 71 | + - `depositNonce` (`uint64`): nonce that increments for every `TransactionDeposited` event on the l1 |
| 72 | + - `configUpdateNonce` (`uint64`): nonce that increments for every `ConfigUpdate` event on the l1 |
| 73 | + |
| 74 | +Note that the `depositNonce` and `configUpdateNonce` will remain with 0 values until the relevant |
| 75 | +`SystemConfig` and `OptimismPortal2` contracts are upgraded on l1 to `SystemConfigJovian` and |
| 76 | +`OptimismPortalJovian` respectively. This MUST happen after the hardfork activation date, and |
| 77 | +before the next hardfork. |
| 78 | + |
| 79 | +After running `pnpm build` in the `packages/contracts-bedrock` directory, the bytecode to add to |
| 80 | +the genesis file will be located in the `deployedBytecode` field of the build artifacts file at |
| 81 | +`/packages/contracts-bedrock/forge-artifacts/L1Block.sol/L1Block.json`. |
| 82 | + |
| 83 | +### Jovian L1Block upgrade |
| 84 | + |
| 85 | +The L1 Attributes Predeployed contract, `L1Block.sol`, is upgraded as part of the Jovian upgrade. |
| 86 | +The version is incremented to `1.6.0`, and one new storage slot is introduced: |
| 87 | + |
| 88 | +- `depositNonce` (`uint64`): nonce that increments for every `TransactionDeposited` event on the l1 |
| 89 | +- `configUpdateNonce` (`uint64`): nonce that increments for every `ConfigUpdate` event on the l1 |
| 90 | + |
| 91 | +The function called by the L1 attributes transaction depends on the network upgrade: |
| 92 | + |
| 93 | +- Before the Jovian activation: |
| 94 | + - `setL1BlockValuesEcotone` is called, following the Ecotone L1 attributes rules. |
| 95 | +- At the Jovian activation block: |
| 96 | + - `setL1BlockValuesEcotone` function MUST be called, except if activated at genesis. |
| 97 | + The contract is upgraded later in this block, to support `setL1BlockValuesJovian`. |
| 98 | +- After the Jovian activation: |
| 99 | + - `setL1BlockValuesEcotone` function is deprecated and MUST never be called. |
| 100 | + - `setL1BlockValuesJovian` MUST be called with the new Jovian attributes. |
0 commit comments