Ecotone L1 Attributes

Table of Contents

Overview

On the Ecotone activation block, and if Ecotone is not activated at Genesis, the L1 Attributes Transaction includes a call to setL1BlockValues() because the L1 Attributes transaction precedes the Ecotone Upgrade Transactions, meaning that setL1BlockValuesEcotone is not guaranteed to exist yet.

Every subsequent L1 Attributes transaction should include a call to the setL1BlockValuesEcotone() function. The input args are no longer ABI encoded function parameters, but are instead packed into 5 32-byte aligned segments (starting after the function selector). Each unsigned integer argument is encoded as big-endian using a number of bytes corresponding to the underlying type. The overall calldata layout is as follows:

Input argTypeCalldata bytesSegment
{0x440a5e20}0-3n/a
baseFeeScalaruint324-71
blobBaseFeeScalaruint328-11
sequenceNumberuint6412-19
l1BlockTimestampuint6420-27
l1BlockNumberuint6428-35
basefeeuint25636-672
blobBaseFeeuint25668-993
l1BlockHashbytes32100-1314
batcherHashbytes32132-1635

Total calldata length MUST be exactly 164 bytes, implying the sixth and final segment is only partially filled. This helps to slow database growth as every L2 block includes a L1 Attributes deposit transaction.

In the first L2 block after the Ecotone activation block, the Ecotone L1 attributes are first used.

The pre-Ecotone values are migrated over 1:1. Blocks after the Ecotone activation block contain all pre-Ecotone values 1:1, and also set the following new attributes:

  • The baseFeeScalar is set to the pre-Ecotone scalar value.
  • The blobBaseFeeScalar is set to 0.
  • The pre-Ecotone overhead attribute is dropped.
  • The blobBaseFee is set to the L1 blob base fee of the L1 origin block. Or 1 if the L1 block does not support blobs. The 1 value is derived from the EIP-4844 MIN_BLOB_GASPRICE.

L1 Attributes Predeployed Contract

The L1 Attributes predeploy stores the following values:

  • L1 block attributes:
    • number (uint64)
    • timestamp (uint64)
    • basefee (uint256)
    • hash (bytes32)
    • blobBaseFee (uint256)
  • sequenceNumber (uint64): This equals the L2 block number relative to the start of the epoch, i.e. the L2 block distance to the L2 block height that the L1 attributes last changed, and reset to 0 at the start of a new epoch.
  • System configurables tied to the L1 block, see System configuration specification:
    • batcherHash (bytes32): A versioned commitment to the batch-submitter(s) currently operating.
    • baseFeeScalar (uint32): system configurable to scale the basefee in the Ecotone l1 cost computation
    • blobBasefeeScalar (uint32): system configurable to scale the blobBaseFee in the Ecotone l1 cost computation

The overhead and scalar values can continue to be accessed after the Ecotone activation block, but no longer have any effect on system operation. These fields were also known as the l1FeeOverhead and the l1FeeScalar.

After running pnpm build in the packages/contracts-bedrock directory, the bytecode to add to the genesis file will be located in the deployedBytecode field of the build artifacts file at /packages/contracts-bedrock/forge-artifacts/L1Block.sol/L1Block.json.

Ecotone L1Block upgrade

The L1 Attributes Predeployed contract, L1Block.sol, is upgraded as part of the Ecotone upgrade. The version is incremented to 1.2.0, one new storage slot is introduced, and one existing slot begins to store additional data:

  • blobBaseFee (uint256): The L1 blob base fee.
  • blobBaseFeeScalar (uint32): The scalar value applied to the L1 blob base fee portion of the L1 cost.
  • baseFeeScalar (uint32): The scalar value applied to the L1 base fee portion of the L1 cost.

The function called by the L1 attributes transaction depends on the network upgrade:

  • Before the Ecotone activation:
    • setL1BlockValues is called, following the pre-Ecotone L1 attributes rules.
  • At the Ecotone activation block:
    • setL1BlockValues function MUST be called, except if activated at genesis. The contract is upgraded later in this block, to support setL1BlockValuesEcotone.
  • After the Ecotone activation:
    • setL1BlockValues function is deprecated and MUST never be called.
    • setL1BlockValuesEcotone MUST be called with the new Ecotone attributes.

setL1BlockValuesEcotone uses a tightly packed encoding for its parameters, which is described in L1 Attributes Deposited Transaction Calldata.