From f4ef24dbf8b3d6a28280958c9d94db4d1e527a49 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 13:03:52 -0700 Subject: [PATCH 01/52] holocene exec-engine --- specs/protocol/holocene/exec-engine.md | 61 ++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index f0be5c2bd..4f4f9b39e 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -73,3 +73,64 @@ directly store this information. [l2-to-l1-mp]: ../../protocol/predeploys.md#L2ToL1MessagePasser [output-root]: ../../glossary.md#l2-output-root + +## Fees + +Holocene adds 2 new components to the fee calculation: the `gas_premium_fee` and the `constant_fee`. +New OP stack variants have different resource consumption patterns, and thus require a more +flexible pricing model. + +### Fee Vaults + +In addition to the existing 3 fee vaults (The [`SequencerFeeVault`][sequencer-fee-vault] +[`BaseFeeVault`][base-fee-vault], and the [`L1FeeVault`][l1feevault]), we add two +new vaults for these new fees: the [`PremiumFeeVault`](predeploys.md#premiumfeevault) and the +[`ConstantFeeVault`](predeploys.md#constantfeevault). + +Like the existing vaults, these are hardcoded addresses, pointing at pre-deployed proxy contracts. +The proxies are backed by vault contract deployments, based on `FeeVault`, to route vault funds to L1 securely. + +| Vault Name | Predeploy | +| ------------------- | ------------------------------------------------------ | +| Premium Fee Vault | [`PremiumFeeVault`](predeploys.md#premiumfeevault) | +| Constant Fee Vault | [`ConstantFeeVault`](predeploys.md#constantfeevault) | + + +### Premium gas fees (Premium Fee Vault) + +The premium gas fee is set as follows: + +`gas_premium_fee = gas_used * gas_used_scalar` + +Where: +- `gas_used` is amount of gas used by the transaction. +- `gas_premium_scalar` is a `uint256` scalar set by the chain operator. the same way that `baseFeeScalar` and +`blobBaseFeeScalar` are set in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da) +calculation. + +### Constant fees (Constant Fee Vault) + +The constant gas fee is set as follows: + +`constant_gas_fee = constant_scalar` + +Where: +- `constant_scalar` is a `uint256` scalar set by the chain operator. + +#### Configuring scalars: + +`gas_premium_scalar` and `constant_scalar` are loaded in a similar way to the `baseFeeScalar` and +`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). +calculation. In more detail, these scalars can be accessed in two interchangable ways. + +- read from the deposited L1 attributes (`gasPremiumScalar` and `constantScalar`) of the current L2 block +- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) + - using the respective solidity `uint256`-getter functions (`gasPremiumScalar`, `constantScalar`) + - using direct storage-reads: + - Gas premium scalar as big-endian `uint256` in slot `7` + - Constant scalar as big-endian `uint256` in slot `8` + +[sequencer-fee-vault]: ../../protocol/predeploys.md#sequencerfeevault +[base-fee-vault]: ../../protocol/predeploys.md#basefeevault +[l1-fee-vault]: ../../protocol/predeploys.md#l1feevault + From d2f40a0d7fc97c5a060ba6a263c647df396dd2e8 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 15:04:47 -0700 Subject: [PATCH 02/52] update other files in holocene directory --- specs/protocol/holocene/configurability.md | 22 ++++++--- specs/protocol/holocene/exec-engine.md | 56 +++++++++------------- specs/protocol/holocene/l1-attributes.md | 7 ++- specs/protocol/holocene/overview.md | 1 + specs/protocol/holocene/predeploys.md | 13 ++++- 5 files changed, 57 insertions(+), 42 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 4d544bde2..25b09afcf 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -18,6 +18,7 @@ - [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) - [`setL1FeeVaultConfig`](#setl1feevaultconfig) - [`setSequencerFeeVaultConfig`](#setsequencerfeevaultconfig) + - [`setConfigurableFeeVaultConfig`](#setconfigurablefeevaultconfig) - [`OptimismPortal`](#optimismportal) - [Interface](#interface-1) - [`setConfig`](#setconfig) @@ -41,10 +42,11 @@ The `ConfigType` enum represents configuration that can be modified. | `SET_BASE_FEE_VAULT_CONFIG` | `uint8(1)` | Sets the Fee Vault Config for the `BaseFeeVault` | | `SET_L1_FEE_VAULT_CONFIG` | `uint8(2)` | Sets the Fee Vault Config for the `L1FeeVault` | | `SET_SEQUENCER_FEE_VAULT_CONFIG` | `uint8(3)` | Sets the Fee Vault Config for the `SequencerFeeVault` | -| `SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `uint8(4)` | Sets the `L1CrossDomainMessenger` address | -| `SET_L1_ERC_721_BRIDGE_ADDRESS` | `uint8(5)` | Sets the `L1ERC721Bridge` address | -| `SET_L1_STANDARD_BRIDGE_ADDRESS` | `uint8(6)` | Sets the `L1StandardBridge` address | -| `SET_REMOTE_CHAIN_ID` | `uint8(7)` | Sets the chain id of the base chain | +| `SET_CONFIGURABLE_FEE_VAULT_CONFIG` | `uint8(4)` | Sets the Fee Vault Config for the `ConfigurableFeeVault`| +| `SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `uint8(5)` | Sets the `L1CrossDomainMessenger` address | +| `SET_L1_ERC_721_BRIDGE_ADDRESS` | `uint8(6)` | Sets the `L1ERC721Bridge` address | +| `SET_L1_STANDARD_BRIDGE_ADDRESS` | `uint8(7)` | Sets the `L1StandardBridge` address | +| `SET_REMOTE_CHAIN_ID` | `uint8(8)` | Sets the chain id of the base chain | ## `SystemConfig` @@ -55,10 +57,10 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurablefeescalar) << 128 \| (uint256(_configurablefeeconstant) << 64 \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | -| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 | uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | +| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | ### Initialization @@ -73,6 +75,8 @@ The following actions should happen during the initialization of the `SystemConf - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` - `setConfig(SET_SEQUENCER_FEE_VAULT_CONFIG)` +- `setConfig(SET_GAS_PREMIUM_FEE_VAULT_CONFIG)` +- `setConfig(SET_CONSTANT_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS)` - `setConfig(SET_L1_ERC_721_BRIDGE_ADDRESS)` - `setConfig(SET_L1_STANDARD_BRIDGE_ADDRESS)` @@ -127,6 +131,12 @@ function setL1FeeVaultConfig(address,uint256,WithdrawalNetwork) function setSequencerFeeVaultConfig(address,uint256,WithdrawalNetwork) ``` +##### `setConfigurableFeeVaultConfig` + +```solidity +function setConfigurableFeeVaultConfig(address,uint256,WithdrawalNetwork) +``` + ## `OptimismPortal` The `OptimismPortal` is updated to emit a special system `TransactionDeposited` event. diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 4f4f9b39e..6e703d56a 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -11,6 +11,10 @@ - [Rationale](#rationale) - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) - [Client Implementation Considerations](#client-implementation-considerations) +- [Fees](#fees) + - [Fee Vaults](#fee-vaults) + - [Configurable fees (Configurable FeeVault)](#configurable-fees-configurable-feevault) + - [Configuring scalars](#configuring-scalars) @@ -76,56 +80,43 @@ directly store this information. ## Fees -Holocene adds 2 new components to the fee calculation: the `gas_premium_fee` and the `constant_fee`. -New OP stack variants have different resource consumption patterns, and thus require a more -flexible pricing model. +Holocene adds a new component to the fee calculation: the `ConfigurableFee`. New OP stack variants +have different resource consumption patterns, and thus require a more flexible pricing model. ### Fee Vaults In addition to the existing 3 fee vaults (The [`SequencerFeeVault`][sequencer-fee-vault] -[`BaseFeeVault`][base-fee-vault], and the [`L1FeeVault`][l1feevault]), we add two -new vaults for these new fees: the [`PremiumFeeVault`](predeploys.md#premiumfeevault) and the -[`ConstantFeeVault`](predeploys.md#constantfeevault). +[`BaseFeeVault`][base-fee-vault], and the [`L1FeeVault`][l1-fee-vault]), we add a +new vault for these new fees: the [`ConfigurableFeeVault`](predeploys.md#configurablefeevault). Like the existing vaults, these are hardcoded addresses, pointing at pre-deployed proxy contracts. The proxies are backed by vault contract deployments, based on `FeeVault`, to route vault funds to L1 securely. -| Vault Name | Predeploy | -| ------------------- | ------------------------------------------------------ | -| Premium Fee Vault | [`PremiumFeeVault`](predeploys.md#premiumfeevault) | -| Constant Fee Vault | [`ConstantFeeVault`](predeploys.md#constantfeevault) | +| Vault Name | Predeploy | +| ------------------- | ------------------------------------------------------ | +| Configurable Fee Vault | [`ConfigurableFeeVault`](predeploys.md#premiumfeevault) | - -### Premium gas fees (Premium Fee Vault) +### Configurable fees (Configurable FeeVault) The premium gas fee is set as follows: -`gas_premium_fee = gas_used * gas_used_scalar` - -Where: -- `gas_used` is amount of gas used by the transaction. -- `gas_premium_scalar` is a `uint256` scalar set by the chain operator. the same way that `baseFeeScalar` and -`blobBaseFeeScalar` are set in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da) -calculation. - -### Constant fees (Constant Fee Vault) +`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` -The constant gas fee is set as follows: +Where: -`constant_gas_fee = constant_scalar` - -Where: -- `constant_scalar` is a `uint256` scalar set by the chain operator. +- `gas_used` is amount of gas used by the transaction. +- `configurableFeeScalar` is a `uint64` scalar set by the chain operator. +- `configurableFeeConstant` is a `uint64` scalar set by the chain operator. -#### Configuring scalars: +#### Configuring scalars -`gas_premium_scalar` and `constant_scalar` are loaded in a similar way to the `baseFeeScalar` and -`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). -calculation. In more detail, these scalars can be accessed in two interchangable ways. +`configurableFeeScalar` and `configurableFeeConstant` are loaded in a similar way to the `baseFeeScalar` and +`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). +calculation. In more detail, these scalars can be accessed in two interchangable ways. -- read from the deposited L1 attributes (`gasPremiumScalar` and `constantScalar`) of the current L2 block +- read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity `uint256`-getter functions (`gasPremiumScalar`, `constantScalar`) + - using the respective solidity `uint256`-getter functions (`configurableFeeScalar`, `configurableFeeConstant`) - using direct storage-reads: - Gas premium scalar as big-endian `uint256` in slot `7` - Constant scalar as big-endian `uint256` in slot `8` @@ -133,4 +124,3 @@ calculation. In more detail, these scalars can be accessed in two interchangable [sequencer-fee-vault]: ../../protocol/predeploys.md#sequencerfeevault [base-fee-vault]: ../../protocol/predeploys.md#basefeevault [l1-fee-vault]: ../../protocol/predeploys.md#l1feevault - diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index a21d841b7..dc9413047 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -10,11 +10,12 @@ ## Overview -The L1 block attributes transaction is updated to include the EIP-1559 parameters. +The L1 block attributes transaction is updated to include the EIP-1559 parameters and the extra scalars +for the `configurableFee`. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | -| {0xd1fbe15b} | | 0-3 | n/a | +| {0xTOCHANGE} | | 0-3 | n/a | | baseFeeScalar | uint32 | 4-7 | 1 | | blobBaseFeeScalar | uint32 | 8-11 | | | sequenceNumber | uint64 | 12-19 | | @@ -26,3 +27,5 @@ The L1 block attributes transaction is updated to include the EIP-1559 parameter | batcherHash | bytes32 | 132-163 | 5 | | eip1559Denominator | uint64 | 164-171 | 6 | | eip1559Elasticity | uint64 | 172-179 | | +| configurableFeeScalar | uint64 | 180-187 | | +| configurableFeeConstant | uint64 | 188-195 | | diff --git a/specs/protocol/holocene/overview.md b/specs/protocol/holocene/overview.md index ce31862df..5eff7d0d1 100644 --- a/specs/protocol/holocene/overview.md +++ b/specs/protocol/holocene/overview.md @@ -15,6 +15,7 @@ This document is not finalized and should be considered experimental. ## Execution Layer - [L2ToL1MessagePasser Storage Root in Header](./exec-engine.md##l2tol1messagepasser-storage-root-in-header) +- [Configurable Fee](./exec-engine.md#fees) ## Consensus Layer diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 99002982d..dde29099d 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -17,6 +17,7 @@ - [`baseFeeVaultConfig`](#basefeevaultconfig) - [`sequencerFeeVaultConfig`](#sequencerfeevaultconfig) - [`l1FeeVaultConfig`](#l1feevaultconfig) + - [`configurableFeeVaultConfig`](#configurablefeevaultconfig) - [`l1CrossDomainMessenger`](#l1crossdomainmessenger) - [`l1StandardBridge`](#l1standardbridge) - [`l1ERC721Bridge`](#l1erc721bridge) @@ -53,6 +54,7 @@ of the `SystemConfig`. | `BASE_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.basefeevaultconfig")) - 1)` | The Fee Vault Config for the `BaseFeeVault` | | `L1_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.l1feevaultconfig")) - 1)` | The Fee Vault Config for the `L1FeeVault` | | `SEQUENCER_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.sequencerfeevaultconfig")) - 1)` | The Fee Vault Config for the `SequencerFeeVault` | +| `CONFIGURABLE_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.configurablefeevaultconfig")) - 1)` | The Fee Vault Config for the `ConfigurableFeeVault` | | `L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1crossdomainmessengeraddress")) - 1)` | `abi.encode(address(L1CrossDomainMessengerProxy))` | | `L1_ERC_721_BRIDGE_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1erc721bridgeaddress")) - 1)` | `abi.encode(address(L1ERC721BridgeProxy))` | | `L1_STANDARD_BRIDGE_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1standardbridgeaddress")) - 1)` | `abi.encode(address(L1StandardBridgeProxy))` | @@ -91,6 +93,7 @@ The following storage slots are defined: - `BASE_FEE_VAULT_CONFIG` - `L1_FEE_VAULT_CONFIG` - `SEQUENCER_FEE_VAULT_CONFIG` +- `CONFIGURABLE_FEE_VAULT_CONFIG` - `L1_CROSS_DOMAIN_MESSENGER_ADDRESS` - `L1_ERC_721_BRIDGE_ADDRESS` - `L1_STANDARD_BRIDGE_ADDRESS` @@ -168,6 +171,14 @@ This function MUST be called by the `L1FeeVault` to fetch network specific confi function l1FeeVaultConfig()(address,uint256,WithdrawalNetwork) ``` +##### `configurableFeeVaultConfig` + +This function MUST be called by the `ConfigurableFeeVault` to fetch network specific configuration. + +```solidity +function configurableFeeVaultConfig()(address,uint256,WithdrawalNetwork) +``` + ##### `l1CrossDomainMessenger` This function MUST be called by the `L2CrossDomainMessenger` to fetch the address of the `L1CrossDomainMessenger`. @@ -203,7 +214,7 @@ function remoteChainId()(uint256) ### FeeVault -The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` and the `SequencerFeeVault`. +The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` the `SequencerFeeVault`. #### Interface From 7ddbce3047b60bd5038da6b7a76f46f15d9d020c Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 15:30:12 -0700 Subject: [PATCH 03/52] update feevault --- specs/protocol/holocene/predeploys.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index dde29099d..b0f1cab8a 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -214,7 +214,8 @@ function remoteChainId()(uint256) ### FeeVault -The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` the `SequencerFeeVault`. +The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` the `SequencerFeeVault`, and the new +`ConfigurableFeeVault`. #### Interface @@ -230,6 +231,7 @@ The following functions are updated to read from the `L1Block` contract: | `BaseFeeVault` | `L1Block.baseFeeVaultConfig()` | | `SequencerFeeVault` | `L1Block.sequencerFeeVaultConfig()` | | `L1FeeVault` | `L1Block.l1FeeVaultConfig()` | +| `ConfigurableFeeVault` | `L1Block.configurableFeeVaultConfig()` | ##### `config` From 2e128987b463d23a102e69af7b69ccd85589b635 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 15:41:26 -0700 Subject: [PATCH 04/52] dont change the function signature --- specs/protocol/holocene/l1-attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index dc9413047..b829e6bbc 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -15,7 +15,7 @@ for the `configurableFee`. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | -| {0xTOCHANGE} | | 0-3 | n/a | +| {0xd1fbe15b} | | 0-3 | n/a | | baseFeeScalar | uint32 | 4-7 | 1 | | blobBaseFeeScalar | uint32 | 8-11 | | | sequenceNumber | uint64 | 12-19 | | From 1407fa9878f747d357631a39295c97da67d4d853 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 15:48:24 -0700 Subject: [PATCH 05/52] specify initial configurablefee --- specs/protocol/holocene/l1-attributes.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index b829e6bbc..94122c524 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -29,3 +29,13 @@ for the `configurableFee`. | eip1559Elasticity | uint64 | 172-179 | | | configurableFeeScalar | uint64 | 180-187 | | | configurableFeeConstant | uint64 | 188-195 | | + + +In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. + +The pre-Holocene values are migrated over 1:1. +Blocks after the Holocene activation block contain all pre-Holocene values 1:1, +and also set the following new attributes: + +- The `configurableFeeScalar` is set to `0`. +- The `configurableFeeConstant` is set to `0`. From 50c22ec0bb0dc5f54a9672572fe0bd2b09bf4131 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 16:04:35 -0700 Subject: [PATCH 06/52] typos in exec engine --- specs/protocol/holocene/configurability.md | 2 +- specs/protocol/holocene/exec-engine.md | 18 +++++++++--------- specs/protocol/holocene/l1-attributes.md | 3 +-- specs/protocol/holocene/predeploys.md | 6 ++++++ 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 25b09afcf..4dfc49566 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -75,7 +75,7 @@ The following actions should happen during the initialization of the `SystemConf - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` - `setConfig(SET_SEQUENCER_FEE_VAULT_CONFIG)` -- `setConfig(SET_GAS_PREMIUM_FEE_VAULT_CONFIG)` +- `setConfig(SET_CONFIGURABLE_FEE_VAULT_CONFIG)` - `setConfig(SET_CONSTANT_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS)` - `setConfig(SET_L1_ERC_721_BRIDGE_ADDRESS)` diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 6e703d56a..0b3015d6c 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -13,7 +13,7 @@ - [Client Implementation Considerations](#client-implementation-considerations) - [Fees](#fees) - [Fee Vaults](#fee-vaults) - - [Configurable fees (Configurable FeeVault)](#configurable-fees-configurable-feevault) + - [Configurable fees (Configurable Fee Vault)](#configurable-fees-configurable-fee-vault) - [Configuring scalars](#configuring-scalars) @@ -85,20 +85,20 @@ have different resource consumption patterns, and thus require a more flexible p ### Fee Vaults -In addition to the existing 3 fee vaults (The [`SequencerFeeVault`][sequencer-fee-vault] +In addition to the existing 3 fee vaults (The [`SequencerFeeVault`][sequencer-fee-vault], [`BaseFeeVault`][base-fee-vault], and the [`L1FeeVault`][l1-fee-vault]), we add a -new vault for these new fees: the [`ConfigurableFeeVault`](predeploys.md#configurablefeevault). +new vault for the `ConfigurableFee`: the [`ConfigurableFeeVault`](predeploys.md#configurablefeevault). Like the existing vaults, these are hardcoded addresses, pointing at pre-deployed proxy contracts. The proxies are backed by vault contract deployments, based on `FeeVault`, to route vault funds to L1 securely. | Vault Name | Predeploy | | ------------------- | ------------------------------------------------------ | -| Configurable Fee Vault | [`ConfigurableFeeVault`](predeploys.md#premiumfeevault) | +| Configurable Fee Vault | [`ConfigurableFeeVault`](predeploys.md#configurablefeevault) | -### Configurable fees (Configurable FeeVault) +### Configurable fees (Configurable Fee Vault) -The premium gas fee is set as follows: +The configurable fee is set as follows: `configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` @@ -116,10 +116,10 @@ calculation. In more detail, these scalars can be accessed in two interchangable - read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity `uint256`-getter functions (`configurableFeeScalar`, `configurableFeeConstant`) + - using the respective solidity `uint64`-getter functions (`configurableFeeScalar`, `configurableFeeConstant`) - using direct storage-reads: - - Gas premium scalar as big-endian `uint256` in slot `7` - - Constant scalar as big-endian `uint256` in slot `8` + - Configurable fee scalar as big-endian `uint64` in slot `7` + - Configurable fee constant as big-endian `uint64` in slot `8` [sequencer-fee-vault]: ../../protocol/predeploys.md#sequencerfeevault [base-fee-vault]: ../../protocol/predeploys.md#basefeevault diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index 94122c524..8563a8863 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -30,7 +30,6 @@ for the `configurableFee`. | configurableFeeScalar | uint64 | 180-187 | | | configurableFeeConstant | uint64 | 188-195 | | - In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. The pre-Holocene values are migrated over 1:1. @@ -38,4 +37,4 @@ Blocks after the Holocene activation block contain all pre-Holocene values 1:1, and also set the following new attributes: - The `configurableFeeScalar` is set to `0`. -- The `configurableFeeConstant` is set to `0`. +- The `configurableFeeConstant` is set to `0`. diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index b0f1cab8a..f0945de09 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -25,6 +25,7 @@ - [FeeVault](#feevault) - [Interface](#interface-1) - [`config`](#config) + - [ConfigurableFeeVault](#configurablefeevault) - [L2CrossDomainMessenger](#l2crossdomainmessenger) - [Interface](#interface-2) - [L2ERC721Bridge](#l2erc721bridge) @@ -241,6 +242,11 @@ A new function is added to fetch the full Fee Vault Config. function config()(address,uint256,WithdrawalNetwork) ``` +### ConfigurableFeeVault + +This vault implements `FeeVault`, like `BaseFeeVault`, `SequencerFeeVault`, and `L1FeeVault`. No special logic is +needed in order to insert or withdraw funds. + ### L2CrossDomainMessenger #### Interface From 78cb4cbd0306bee01e29997b502decc1827295a4 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 16:51:38 -0700 Subject: [PATCH 07/52] remove configurablefeevault --- specs/protocol/holocene/configurability.md | 17 ++++------------- specs/protocol/holocene/exec-engine.md | 4 +++- specs/protocol/holocene/predeploys.md | 21 +-------------------- 3 files changed, 8 insertions(+), 34 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 4dfc49566..dd413790c 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -18,7 +18,6 @@ - [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) - [`setL1FeeVaultConfig`](#setl1feevaultconfig) - [`setSequencerFeeVaultConfig`](#setsequencerfeevaultconfig) - - [`setConfigurableFeeVaultConfig`](#setconfigurablefeevaultconfig) - [`OptimismPortal`](#optimismportal) - [Interface](#interface-1) - [`setConfig`](#setconfig) @@ -42,11 +41,10 @@ The `ConfigType` enum represents configuration that can be modified. | `SET_BASE_FEE_VAULT_CONFIG` | `uint8(1)` | Sets the Fee Vault Config for the `BaseFeeVault` | | `SET_L1_FEE_VAULT_CONFIG` | `uint8(2)` | Sets the Fee Vault Config for the `L1FeeVault` | | `SET_SEQUENCER_FEE_VAULT_CONFIG` | `uint8(3)` | Sets the Fee Vault Config for the `SequencerFeeVault` | -| `SET_CONFIGURABLE_FEE_VAULT_CONFIG` | `uint8(4)` | Sets the Fee Vault Config for the `ConfigurableFeeVault`| -| `SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `uint8(5)` | Sets the `L1CrossDomainMessenger` address | -| `SET_L1_ERC_721_BRIDGE_ADDRESS` | `uint8(6)` | Sets the `L1ERC721Bridge` address | -| `SET_L1_STANDARD_BRIDGE_ADDRESS` | `uint8(7)` | Sets the `L1StandardBridge` address | -| `SET_REMOTE_CHAIN_ID` | `uint8(8)` | Sets the chain id of the base chain | +| `SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `uint8(4)` | Sets the `L1CrossDomainMessenger` address | +| `SET_L1_ERC_721_BRIDGE_ADDRESS` | `uint8(5)` | Sets the `L1ERC721Bridge` address | +| `SET_L1_STANDARD_BRIDGE_ADDRESS` | `uint8(6)` | Sets the `L1StandardBridge` address | +| `SET_REMOTE_CHAIN_ID` | `uint8(7)` | Sets the chain id of the base chain | ## `SystemConfig` @@ -75,7 +73,6 @@ The following actions should happen during the initialization of the `SystemConf - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` - `setConfig(SET_SEQUENCER_FEE_VAULT_CONFIG)` -- `setConfig(SET_CONFIGURABLE_FEE_VAULT_CONFIG)` - `setConfig(SET_CONSTANT_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS)` - `setConfig(SET_L1_ERC_721_BRIDGE_ADDRESS)` @@ -131,12 +128,6 @@ function setL1FeeVaultConfig(address,uint256,WithdrawalNetwork) function setSequencerFeeVaultConfig(address,uint256,WithdrawalNetwork) ``` -##### `setConfigurableFeeVaultConfig` - -```solidity -function setConfigurableFeeVaultConfig(address,uint256,WithdrawalNetwork) -``` - ## `OptimismPortal` The `OptimismPortal` is updated to emit a special system `TransactionDeposited` event. diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 0b3015d6c..f27929e0f 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -96,7 +96,7 @@ The proxies are backed by vault contract deployments, based on `FeeVault`, to ro | ------------------- | ------------------------------------------------------ | | Configurable Fee Vault | [`ConfigurableFeeVault`](predeploys.md#configurablefeevault) | -### Configurable fees (Configurable Fee Vault) +### Configurable fees The configurable fee is set as follows: @@ -108,6 +108,8 @@ Where: - `configurableFeeScalar` is a `uint64` scalar set by the chain operator. - `configurableFeeConstant` is a `uint64` scalar set by the chain operator. +These collected fees are sent to the `SequencerFeeVault`. + #### Configuring scalars `configurableFeeScalar` and `configurableFeeConstant` are loaded in a similar way to the `baseFeeScalar` and diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index f0945de09..f0fe14f21 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -17,7 +17,6 @@ - [`baseFeeVaultConfig`](#basefeevaultconfig) - [`sequencerFeeVaultConfig`](#sequencerfeevaultconfig) - [`l1FeeVaultConfig`](#l1feevaultconfig) - - [`configurableFeeVaultConfig`](#configurablefeevaultconfig) - [`l1CrossDomainMessenger`](#l1crossdomainmessenger) - [`l1StandardBridge`](#l1standardbridge) - [`l1ERC721Bridge`](#l1erc721bridge) @@ -25,7 +24,6 @@ - [FeeVault](#feevault) - [Interface](#interface-1) - [`config`](#config) - - [ConfigurableFeeVault](#configurablefeevault) - [L2CrossDomainMessenger](#l2crossdomainmessenger) - [Interface](#interface-2) - [L2ERC721Bridge](#l2erc721bridge) @@ -55,7 +53,6 @@ of the `SystemConfig`. | `BASE_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.basefeevaultconfig")) - 1)` | The Fee Vault Config for the `BaseFeeVault` | | `L1_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.l1feevaultconfig")) - 1)` | The Fee Vault Config for the `L1FeeVault` | | `SEQUENCER_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.sequencerfeevaultconfig")) - 1)` | The Fee Vault Config for the `SequencerFeeVault` | -| `CONFIGURABLE_FEE_VAULT_CONFIG` | `bytes32(uint256(keccak256("opstack.configurablefeevaultconfig")) - 1)` | The Fee Vault Config for the `ConfigurableFeeVault` | | `L1_CROSS_DOMAIN_MESSENGER_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1crossdomainmessengeraddress")) - 1)` | `abi.encode(address(L1CrossDomainMessengerProxy))` | | `L1_ERC_721_BRIDGE_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1erc721bridgeaddress")) - 1)` | `abi.encode(address(L1ERC721BridgeProxy))` | | `L1_STANDARD_BRIDGE_ADDRESS` | `bytes32(uint256(keccak256("opstack.l1standardbridgeaddress")) - 1)` | `abi.encode(address(L1StandardBridgeProxy))` | @@ -94,7 +91,6 @@ The following storage slots are defined: - `BASE_FEE_VAULT_CONFIG` - `L1_FEE_VAULT_CONFIG` - `SEQUENCER_FEE_VAULT_CONFIG` -- `CONFIGURABLE_FEE_VAULT_CONFIG` - `L1_CROSS_DOMAIN_MESSENGER_ADDRESS` - `L1_ERC_721_BRIDGE_ADDRESS` - `L1_STANDARD_BRIDGE_ADDRESS` @@ -172,14 +168,6 @@ This function MUST be called by the `L1FeeVault` to fetch network specific confi function l1FeeVaultConfig()(address,uint256,WithdrawalNetwork) ``` -##### `configurableFeeVaultConfig` - -This function MUST be called by the `ConfigurableFeeVault` to fetch network specific configuration. - -```solidity -function configurableFeeVaultConfig()(address,uint256,WithdrawalNetwork) -``` - ##### `l1CrossDomainMessenger` This function MUST be called by the `L2CrossDomainMessenger` to fetch the address of the `L1CrossDomainMessenger`. @@ -215,8 +203,7 @@ function remoteChainId()(uint256) ### FeeVault -The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` the `SequencerFeeVault`, and the new -`ConfigurableFeeVault`. +The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault`, and the `SequencerFeeVault`. #### Interface @@ -232,7 +219,6 @@ The following functions are updated to read from the `L1Block` contract: | `BaseFeeVault` | `L1Block.baseFeeVaultConfig()` | | `SequencerFeeVault` | `L1Block.sequencerFeeVaultConfig()` | | `L1FeeVault` | `L1Block.l1FeeVaultConfig()` | -| `ConfigurableFeeVault` | `L1Block.configurableFeeVaultConfig()` | ##### `config` @@ -242,11 +228,6 @@ A new function is added to fetch the full Fee Vault Config. function config()(address,uint256,WithdrawalNetwork) ``` -### ConfigurableFeeVault - -This vault implements `FeeVault`, like `BaseFeeVault`, `SequencerFeeVault`, and `L1FeeVault`. No special logic is -needed in order to insert or withdraw funds. - ### L2CrossDomainMessenger #### Interface From 6a78e21a2a8133355e5e0c566faab252e6b771c8 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 16:52:43 -0700 Subject: [PATCH 08/52] linter --- specs/protocol/holocene/exec-engine.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index f27929e0f..34a46497d 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -13,7 +13,7 @@ - [Client Implementation Considerations](#client-implementation-considerations) - [Fees](#fees) - [Fee Vaults](#fee-vaults) - - [Configurable fees (Configurable Fee Vault)](#configurable-fees-configurable-fee-vault) + - [Configurable fees](#configurable-fees) - [Configuring scalars](#configuring-scalars) From fb53c8539a7e7cd5bb4d6e302aacdc2ea51e4be8 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:13:56 -0700 Subject: [PATCH 09/52] clean up + pack storage slots --- specs/protocol/holocene/configurability.md | 1 - specs/protocol/holocene/exec-engine.md | 24 +++------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index dd413790c..f555a24de 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -73,7 +73,6 @@ The following actions should happen during the initialization of the `SystemConf - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` - `setConfig(SET_SEQUENCER_FEE_VAULT_CONFIG)` -- `setConfig(SET_CONSTANT_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS)` - `setConfig(SET_L1_ERC_721_BRIDGE_ADDRESS)` - `setConfig(SET_L1_STANDARD_BRIDGE_ADDRESS)` diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 34a46497d..6fe65760d 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -12,7 +12,6 @@ - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) - [Client Implementation Considerations](#client-implementation-considerations) - [Fees](#fees) - - [Fee Vaults](#fee-vaults) - [Configurable fees](#configurable-fees) - [Configuring scalars](#configuring-scalars) @@ -83,19 +82,6 @@ directly store this information. Holocene adds a new component to the fee calculation: the `ConfigurableFee`. New OP stack variants have different resource consumption patterns, and thus require a more flexible pricing model. -### Fee Vaults - -In addition to the existing 3 fee vaults (The [`SequencerFeeVault`][sequencer-fee-vault], -[`BaseFeeVault`][base-fee-vault], and the [`L1FeeVault`][l1-fee-vault]), we add a -new vault for the `ConfigurableFee`: the [`ConfigurableFeeVault`](predeploys.md#configurablefeevault). - -Like the existing vaults, these are hardcoded addresses, pointing at pre-deployed proxy contracts. -The proxies are backed by vault contract deployments, based on `FeeVault`, to route vault funds to L1 securely. - -| Vault Name | Predeploy | -| ------------------- | ------------------------------------------------------ | -| Configurable Fee Vault | [`ConfigurableFeeVault`](predeploys.md#configurablefeevault) | - ### Configurable fees The configurable fee is set as follows: @@ -118,11 +104,7 @@ calculation. In more detail, these scalars can be accessed in two interchangable - read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity `uint64`-getter functions (`configurableFeeScalar`, `configurableFeeConstant`) + - using the respective solidity getter functions (`configurableFeeScalar`, `configurableFeeConstant`) - using direct storage-reads: - - Configurable fee scalar as big-endian `uint64` in slot `7` - - Configurable fee constant as big-endian `uint64` in slot `8` - -[sequencer-fee-vault]: ../../protocol/predeploys.md#sequencerfeevault -[base-fee-vault]: ../../protocol/predeploys.md#basefeevault -[l1-fee-vault]: ../../protocol/predeploys.md#l1feevault + - Configurable fee scalar as big-endian `uint64` in slot `8` at offset `16`. + - Configurable fee constant as big-endian `uint64` in slot `8` at offset `0`. From b56048aa2f32994ee9b90b598420d483fe0cc5ee Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:16:51 -0700 Subject: [PATCH 10/52] optimize packing a little --- specs/protocol/holocene/exec-engine.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 6fe65760d..9f7bc7589 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -106,5 +106,5 @@ calculation. In more detail, these scalars can be accessed in two interchangable - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - using the respective solidity getter functions (`configurableFeeScalar`, `configurableFeeConstant`) - using direct storage-reads: - - Configurable fee scalar as big-endian `uint64` in slot `8` at offset `16`. - - Configurable fee constant as big-endian `uint64` in slot `8` at offset `0`. + - Configurable fee scalar as big-endian `uint64` in slot `3` at offset `24`. + - Configurable fee constant as big-endian `uint64` in slot `3` at offset `16`. From 7c90f2bf830e08afa6d1c1257a6b0282691c2b99 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:18:16 -0700 Subject: [PATCH 11/52] oxford comma --- specs/protocol/holocene/predeploys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index f0fe14f21..99002982d 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -203,7 +203,7 @@ function remoteChainId()(uint256) ### FeeVault -The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault`, and the `SequencerFeeVault`. +The following changes apply to each of the `BaseFeeVault`, the `L1FeeVault` and the `SequencerFeeVault`. #### Interface From f4e27b3ac4036199420d38345b6da8ea5bc80a9c Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:23:55 -0700 Subject: [PATCH 12/52] rephrase --- specs/protocol/holocene/exec-engine.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 9f7bc7589..fe8f132c4 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -79,8 +79,10 @@ directly store this information. ## Fees -Holocene adds a new component to the fee calculation: the `ConfigurableFee`. New OP stack variants -have different resource consumption patterns, and thus require a more flexible pricing model. +New OP stack variants have different resource consumption patterns, and thus require a more flexible +pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee +calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` +and the `configurableFeeConstant`. ### Configurable fees From 15264156314f5a1cea9e531077360b1358b99ba0 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:47:19 -0700 Subject: [PATCH 13/52] move changes to isthmus --- specs/protocol/isthmus/configurability.md | 13 ++++++ specs/protocol/isthmus/exec-engine.md | 52 +++++++++++++++++++++++ specs/protocol/isthmus/l1-attributes.md | 40 +++++++++++++++++ specs/protocol/isthmus/overview.md | 4 ++ 4 files changed, 109 insertions(+) create mode 100644 specs/protocol/isthmus/configurability.md create mode 100644 specs/protocol/isthmus/exec-engine.md create mode 100644 specs/protocol/isthmus/l1-attributes.md diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md new file mode 100644 index 000000000..eb7dc2d1e --- /dev/null +++ b/specs/protocol/isthmus/configurability.md @@ -0,0 +1,13 @@ +## `SystemConfig` + +### `ConfigUpdate` + +The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint256(0)`: + +| Name | Value | Definition | Usage | +| ---- | ----- | --- | -- | +| `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurablefeescalar) << 128 \| (uint256(_configurablefeeconstant) << 64 \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | +| `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | +| `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | +| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | \ No newline at end of file diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md new file mode 100644 index 000000000..98d45f93c --- /dev/null +++ b/specs/protocol/isthmus/exec-engine.md @@ -0,0 +1,52 @@ +# L2 Execution Engine + + + +**Table of Contents** + +- [`L2ToL1MessagePasser` Storage Root in Header](#l2tol1messagepasser-storage-root-in-header) + - [Timestamp Activation](#timestamp-activation) + - [Header Validity Rules](#header-validity-rules) + - [Header Withdrawals Root](#header-withdrawals-root) + - [Rationale](#rationale) + - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) + - [Client Implementation Considerations](#client-implementation-considerations) +- [Fees](#fees) + - [Configurable fees](#configurable-fees) + - [Configuring scalars](#configuring-scalars) + + + +## Fees + +New OP stack variants have different resource consumption patterns, and thus require a more flexible +pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee +calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` +and the `configurableFeeConstant`. + +### Configurable fees + +The configurable fee is set as follows: + +`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` + +Where: + +- `gas_used` is amount of gas used by the transaction. +- `configurableFeeScalar` is a `uint64` scalar set by the chain operator. +- `configurableFeeConstant` is a `uint64` scalar set by the chain operator. + +These collected fees are sent to the `SequencerFeeVault`. + +#### Configuring scalars + +`configurableFeeScalar` and `configurableFeeConstant` are loaded in a similar way to the `baseFeeScalar` and +`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). +calculation. In more detail, these scalars can be accessed in two interchangable ways. + +- read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block +- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) + - using the respective solidity getter functions (`configurableFeeScalar`, `configurableFeeConstant`) + - using direct storage-reads: + - Configurable fee scalar as big-endian `uint64` in slot `3` at offset `24`. + - Configurable fee constant as big-endian `uint64` in slot `3` at offset `16`. diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md new file mode 100644 index 000000000..8563a8863 --- /dev/null +++ b/specs/protocol/isthmus/l1-attributes.md @@ -0,0 +1,40 @@ +# L1 Block Attributes + + + +**Table of Contents** + +- [Overview](#overview) + + + +## Overview + +The L1 block attributes transaction is updated to include the EIP-1559 parameters and the extra scalars +for the `configurableFee`. + +| Input arg | Type | Calldata bytes | Segment | +| ----------------- | ------- | -------------- | ------- | +| {0xd1fbe15b} | | 0-3 | n/a | +| baseFeeScalar | uint32 | 4-7 | 1 | +| blobBaseFeeScalar | uint32 | 8-11 | | +| sequenceNumber | uint64 | 12-19 | | +| l1BlockTimestamp | uint64 | 20-27 | | +| l1BlockNumber | uint64 | 28-35 | | +| basefee | uint256 | 36-67 | 2 | +| blobBaseFee | uint256 | 68-99 | 3 | +| l1BlockHash | bytes32 | 100-131 | 4 | +| batcherHash | bytes32 | 132-163 | 5 | +| eip1559Denominator | uint64 | 164-171 | 6 | +| eip1559Elasticity | uint64 | 172-179 | | +| configurableFeeScalar | uint64 | 180-187 | | +| configurableFeeConstant | uint64 | 188-195 | | + +In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. + +The pre-Holocene values are migrated over 1:1. +Blocks after the Holocene activation block contain all pre-Holocene values 1:1, +and also set the following new attributes: + +- The `configurableFeeScalar` is set to `0`. +- The `configurableFeeConstant` is set to `0`. diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index bf2800450..8324cfe28 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -12,5 +12,9 @@ This document is not finalized and should be considered experimental. ## Execution Layer +- [Configurable Fee](./exec-engine.md#fees) ## Consensus Layer + +- [L1 Block Attributes](./l1-attributes.md) +- [Configurability](./configurability.md) \ No newline at end of file From 7085d984a23d9dae7dac296451a996d0da61cd62 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:48:52 -0700 Subject: [PATCH 14/52] reset holocene --- specs/protocol/holocene/configurability.md | 4 +-- specs/protocol/holocene/exec-engine.md | 37 ---------------------- specs/protocol/holocene/l1-attributes.md | 14 +------- specs/protocol/holocene/overview.md | 1 - 4 files changed, 3 insertions(+), 53 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index f555a24de..4d544bde2 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -55,10 +55,10 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurablefeescalar) << 128 \| (uint256(_configurablefeeconstant) << 64 \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | -| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | +| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 | uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | ### Initialization diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index fe8f132c4..f0be5c2bd 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -11,9 +11,6 @@ - [Rationale](#rationale) - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) - [Client Implementation Considerations](#client-implementation-considerations) -- [Fees](#fees) - - [Configurable fees](#configurable-fees) - - [Configuring scalars](#configuring-scalars) @@ -76,37 +73,3 @@ directly store this information. [l2-to-l1-mp]: ../../protocol/predeploys.md#L2ToL1MessagePasser [output-root]: ../../glossary.md#l2-output-root - -## Fees - -New OP stack variants have different resource consumption patterns, and thus require a more flexible -pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee -calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` -and the `configurableFeeConstant`. - -### Configurable fees - -The configurable fee is set as follows: - -`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` - -Where: - -- `gas_used` is amount of gas used by the transaction. -- `configurableFeeScalar` is a `uint64` scalar set by the chain operator. -- `configurableFeeConstant` is a `uint64` scalar set by the chain operator. - -These collected fees are sent to the `SequencerFeeVault`. - -#### Configuring scalars - -`configurableFeeScalar` and `configurableFeeConstant` are loaded in a similar way to the `baseFeeScalar` and -`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). -calculation. In more detail, these scalars can be accessed in two interchangable ways. - -- read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block -- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity getter functions (`configurableFeeScalar`, `configurableFeeConstant`) - - using direct storage-reads: - - Configurable fee scalar as big-endian `uint64` in slot `3` at offset `24`. - - Configurable fee constant as big-endian `uint64` in slot `3` at offset `16`. diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index 8563a8863..a21d841b7 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -10,8 +10,7 @@ ## Overview -The L1 block attributes transaction is updated to include the EIP-1559 parameters and the extra scalars -for the `configurableFee`. +The L1 block attributes transaction is updated to include the EIP-1559 parameters. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | @@ -27,14 +26,3 @@ for the `configurableFee`. | batcherHash | bytes32 | 132-163 | 5 | | eip1559Denominator | uint64 | 164-171 | 6 | | eip1559Elasticity | uint64 | 172-179 | | -| configurableFeeScalar | uint64 | 180-187 | | -| configurableFeeConstant | uint64 | 188-195 | | - -In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. - -The pre-Holocene values are migrated over 1:1. -Blocks after the Holocene activation block contain all pre-Holocene values 1:1, -and also set the following new attributes: - -- The `configurableFeeScalar` is set to `0`. -- The `configurableFeeConstant` is set to `0`. diff --git a/specs/protocol/holocene/overview.md b/specs/protocol/holocene/overview.md index 5eff7d0d1..ce31862df 100644 --- a/specs/protocol/holocene/overview.md +++ b/specs/protocol/holocene/overview.md @@ -15,7 +15,6 @@ This document is not finalized and should be considered experimental. ## Execution Layer - [L2ToL1MessagePasser Storage Root in Header](./exec-engine.md##l2tol1messagepasser-storage-root-in-header) -- [Configurable Fee](./exec-engine.md#fees) ## Consensus Layer From 148230bae7ea0d2e4946a61977003c1685183f49 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:50:38 -0700 Subject: [PATCH 15/52] linter --- specs/protocol/holocene/configurability.md | 2 +- specs/protocol/isthmus/configurability.md | 13 ++++++++++++- specs/protocol/isthmus/exec-engine.md | 7 ------- specs/protocol/isthmus/overview.md | 3 ++- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 4d544bde2..b1300be0c 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -58,7 +58,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | -| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 | uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | +| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | ### Initialization diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index eb7dc2d1e..01363fd0e 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -1,3 +1,14 @@ +# Configurability + + + +**Table of Contents** + +- [`SystemConfig`](#systemconfig) + - [`ConfigUpdate`](#configupdate) + + + ## `SystemConfig` ### `ConfigUpdate` @@ -10,4 +21,4 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurablefeescalar) << 128 \| (uint256(_configurablefeeconstant) << 64 \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | -| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | \ No newline at end of file +| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md index 98d45f93c..8d17e9c26 100644 --- a/specs/protocol/isthmus/exec-engine.md +++ b/specs/protocol/isthmus/exec-engine.md @@ -4,13 +4,6 @@ **Table of Contents** -- [`L2ToL1MessagePasser` Storage Root in Header](#l2tol1messagepasser-storage-root-in-header) - - [Timestamp Activation](#timestamp-activation) - - [Header Validity Rules](#header-validity-rules) - - [Header Withdrawals Root](#header-withdrawals-root) - - [Rationale](#rationale) - - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) - - [Client Implementation Considerations](#client-implementation-considerations) - [Fees](#fees) - [Configurable fees](#configurable-fees) - [Configuring scalars](#configuring-scalars) diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index 8324cfe28..1a518fa23 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -12,9 +12,10 @@ This document is not finalized and should be considered experimental. ## Execution Layer + - [Configurable Fee](./exec-engine.md#fees) ## Consensus Layer - [L1 Block Attributes](./l1-attributes.md) -- [Configurability](./configurability.md) \ No newline at end of file +- [Configurability](./configurability.md) From fbf8dfb23e523827e7a99a9ce11e62272cb6a520 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 17:53:50 -0700 Subject: [PATCH 16/52] update configupdate version --- specs/protocol/isthmus/configurability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 01363fd0e..1852a1955 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -13,7 +13,7 @@ ### `ConfigUpdate` -The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint256(0)`: +The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint256(1)`: | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | From 48a25af37544f9c3216ce7e77a6257b166ac80af Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 19 Sep 2024 22:44:19 -0700 Subject: [PATCH 17/52] removed mention of holocene, added isthmus to SUMMARY --- specs/SUMMARY.md | 4 ++++ specs/protocol/isthmus/exec-engine.md | 2 +- specs/protocol/isthmus/l1-attributes.md | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index 1781c5658..346d699df 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -56,6 +56,10 @@ - [Predeploys](./protocol/holocene/predeploys.md) - [L1 Block Attributes](./protocol/holocene/l1-attributes.md) - [Configurability](./protocol/holocene/configurability.md) + - [Isthmus](./protocol/isthmus/overview.md) + - [Execution Engine](./protocol/isthmus/exec-engine.md) + - [L1 Block Attributes](./protocol/isthmus/l1-attributes.md) + - [Configurability](./protocol/isthmus/configurability.md) - [Governance]() - [Governance Token](./governance/gov-token.md) - [Experimental]() diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md index 8d17e9c26..8ee39b1e8 100644 --- a/specs/protocol/isthmus/exec-engine.md +++ b/specs/protocol/isthmus/exec-engine.md @@ -13,7 +13,7 @@ ## Fees New OP stack variants have different resource consumption patterns, and thus require a more flexible -pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee +pricing model. To enable more customizable fee structures, Isthmus adds a new component to the fee calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` and the `configurableFeeConstant`. diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index 8563a8863..66e6f3c97 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -30,10 +30,10 @@ for the `configurableFee`. | configurableFeeScalar | uint64 | 180-187 | | | configurableFeeConstant | uint64 | 188-195 | | -In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. +In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. -The pre-Holocene values are migrated over 1:1. -Blocks after the Holocene activation block contain all pre-Holocene values 1:1, +The pre-Isthmus values are migrated over 1:1. +Blocks after the Isthmus activation block contain all pre-Isthmus values 1:1, and also set the following new attributes: - The `configurableFeeScalar` is set to `0`. From ead77048dcb37f22b4798cb83491b16a86306c85 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Fri, 20 Sep 2024 10:38:01 -0700 Subject: [PATCH 18/52] fixed link --- specs/protocol/isthmus/overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index ee2982d83..7c77da568 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -19,4 +19,4 @@ This document is not finalized and should be considered experimental. - [L1 Block Attributes](./l1-attributes.md) - [Configurability](./configurability.md) -- [Interop](../interop/overview.md) +- [Interop](../../interop/overview.md) From 1ade65a61f1c8d2a4828042b1da8644d66f22aad Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Fri, 20 Sep 2024 13:48:51 -0700 Subject: [PATCH 19/52] add predeploys and system-config --- specs/protocol/isthmus/predeploys.md | 36 +++++++++++++++++++++++ specs/protocol/isthmus/system-config.md | 38 +++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 specs/protocol/isthmus/predeploys.md create mode 100644 specs/protocol/isthmus/system-config.md diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md new file mode 100644 index 000000000..c3578a277 --- /dev/null +++ b/specs/protocol/isthmus/predeploys.md @@ -0,0 +1,36 @@ +# Overview + + + +**Table of Contents** + +- [Predeploys](#predeploys) + - [L1Block](#l1block) + - [Interface](#interface) + - [`setL1BlockValuesIsthmus`](#setl1blockvaluesisthmus) + - [`setIsthmus`](#setisthmus) + + + +Since we now need to include the configurable fee scalars in the L1 Attri + +## Predeploys + +### L1Block + +#### Interface + +##### `setL1BlockValuesIsthmus` + +This function MUST only be callable by the `DEPOSITOR_ACCOUNT`. It is a replacement +for `setL1BlockValuesHolocene` and its calldata is defined in [L1 Attributes](./l1-attributes.md). + +```function +function setL1BlockValuesIsthmus() +``` + +##### `setIsthmus` + +This function is meant to be called once on the activation block of the isthmus network upgrade. +It MUST only be callable by the `DEPOSITOR_ACCOUNT` once. When it is called, it MUST call +call each getter for the network specific config and set the returndata into storage. diff --git a/specs/protocol/isthmus/system-config.md b/specs/protocol/isthmus/system-config.md new file mode 100644 index 000000000..1ecd9fdd6 --- /dev/null +++ b/specs/protocol/isthmus/system-config.md @@ -0,0 +1,38 @@ +# System Config + + + +**Table of Contents** + +- [Scalars](#scalars) + - [Isthmus `scalar`, `overhead` (`uint256,uint256`) change](#isthmus-scalar-overhead-uint256uint256-change) + + + +## System config contents (version 0) + +### Scalars + +In order to allow rollup operators to adjust the new `ConfigurableFeeScalar` and `ConfigurableFeeConstant`, a change to +the `scalar` and `overhead` encoding is necessary. + +#### Isthmus `scalar`, `overhead` (`uint256,uint256`) change + +After Isthmus activation: + +- A new version to the `scalar` encoding is added. It is described as follows. + +\*Byte ranges are indicated with `[` (inclusive) and `)` (exclusive). + +- `0`: scalar-version byte +- `[1, 32)`: depending scalar-version: + - Scalar-version `2`: + - `[1, 8)`: padding, must be zero. + - `[8, 16)`: big-endian `uint64`, encoding the `configurableFeeScalar` + - `[16, 24)`: big-endian `uint64`, encoding the `configurableFeeConstant` + - `[24, 28)`: big-endian `uint32`, encoding the `blobBaseFeeScalar` + - `[28, 32)`: big-endian `uint32`, encoding the `baseFeeScalar` + - This version adds the `configurableFeeScalar` and the `configurableFeeConstant`. + +The `configurableFeeScalar` and `configurableFeeConstant` are incorporated into the L2 through the +[Isthmus L1 attributes deposit transaction calldata](l1-attributes.md). From 46738398dc7ac84e6228da3987130ba57fdc7103 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Fri, 20 Sep 2024 13:57:59 -0700 Subject: [PATCH 20/52] update summary --- specs/SUMMARY.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index 346d699df..3f6323935 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -60,6 +60,9 @@ - [Execution Engine](./protocol/isthmus/exec-engine.md) - [L1 Block Attributes](./protocol/isthmus/l1-attributes.md) - [Configurability](./protocol/isthmus/configurability.md) + - [Predeploys](./protocol/isthmus/predeploys.md) + - [System Config](./protocol/isthmus/system-config.md) + - [Governance]() - [Governance Token](./governance/gov-token.md) - [Experimental]() From b945fafadeef4310ea773f6e4fb690304583990d Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Fri, 20 Sep 2024 14:04:11 -0700 Subject: [PATCH 21/52] rerun doctoc --- specs/protocol/isthmus/system-config.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specs/protocol/isthmus/system-config.md b/specs/protocol/isthmus/system-config.md index 1ecd9fdd6..345b90de0 100644 --- a/specs/protocol/isthmus/system-config.md +++ b/specs/protocol/isthmus/system-config.md @@ -4,8 +4,9 @@ **Table of Contents** -- [Scalars](#scalars) - - [Isthmus `scalar`, `overhead` (`uint256,uint256`) change](#isthmus-scalar-overhead-uint256uint256-change) +- [System config contents (version 0)](#system-config-contents-version-0) + - [Scalars](#scalars) + - [Isthmus `scalar`, `overhead` (`uint256,uint256`) change](#isthmus-scalar-overhead-uint256uint256-change) From 2f73dc22a3d9888f23321b5d3684b334f105b48f Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Fri, 20 Sep 2024 15:05:10 -0700 Subject: [PATCH 22/52] fix calldata --- specs/protocol/isthmus/l1-attributes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index 66e6f3c97..70306f054 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -15,7 +15,7 @@ for the `configurableFee`. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | -| {0xd1fbe15b} | | 0-3 | n/a | +| {0x098999be} | | 0-3 | n/a | | baseFeeScalar | uint32 | 4-7 | 1 | | blobBaseFeeScalar | uint32 | 8-11 | | | sequenceNumber | uint64 | 12-19 | | From 43c5ea95757d039ae4c9800007deae682adcd205 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 23 Sep 2024 12:30:38 -0700 Subject: [PATCH 23/52] Update specs/protocol/isthmus/configurability.md Co-authored-by: Sebastian Stammler --- specs/protocol/isthmus/configurability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 1852a1955..56f78f1c3 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -18,7 +18,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurablefeescalar) << 128 \| (uint256(_configurablefeeconstant) << 64 \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurableFeeScalar) << 128 \| (uint256(_configurableFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | From 2efe2319c544941bc2749783666ee2172bbbdc68 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 23 Sep 2024 14:14:32 -0700 Subject: [PATCH 24/52] sebastians suggestions --- specs/protocol/isthmus/configurability.md | 2 +- specs/protocol/isthmus/exec-engine.md | 28 +++++++++++------------ specs/protocol/isthmus/l1-attributes.md | 10 ++++---- specs/protocol/isthmus/overview.md | 2 +- specs/protocol/isthmus/predeploys.md | 3 ++- specs/protocol/isthmus/system-config.md | 10 ++++---- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 56f78f1c3..43294526a 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -18,7 +18,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_configurableFeeScalar) << 128 \| (uint256(_configurableFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 128 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md index 8ee39b1e8..9817840c2 100644 --- a/specs/protocol/isthmus/exec-engine.md +++ b/specs/protocol/isthmus/exec-engine.md @@ -5,7 +5,7 @@ **Table of Contents** - [Fees](#fees) - - [Configurable fees](#configurable-fees) + - [Operator fees](#operator-fees) - [Configuring scalars](#configuring-scalars) @@ -14,32 +14,32 @@ New OP stack variants have different resource consumption patterns, and thus require a more flexible pricing model. To enable more customizable fee structures, Isthmus adds a new component to the fee -calculation: the `ConfigurableFee`, which is parameterized by two scalars: the `configurableFeeScalar` -and the `configurableFeeConstant`. +calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` +and the `operatorFeeConstant`. -### Configurable fees +### Operator fees -The configurable fee is set as follows: +The operator fee, in wei, is set as follows: -`configurableFee = gas_used * configurableFeeScalar + configurableFeeConstant` +`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant` Where: -- `gas_used` is amount of gas used by the transaction. -- `configurableFeeScalar` is a `uint64` scalar set by the chain operator. -- `configurableFeeConstant` is a `uint64` scalar set by the chain operator. +- `gasUsed` is amount of gas used by the transaction. +- `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by `1e6`. +- `operatorFeeConstant` is a `uint64` scalar set by the chain operator. These collected fees are sent to the `SequencerFeeVault`. #### Configuring scalars -`configurableFeeScalar` and `configurableFeeConstant` are loaded in a similar way to the `baseFeeScalar` and +`operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and `blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). calculation. In more detail, these scalars can be accessed in two interchangable ways. -- read from the deposited L1 attributes (`configurableFeeScalar` and `configurableFeeConstant`) of the current L2 block +- read from the deposited L1 attributes (`operatorFeeScalar` and `operatorFeeConstant`) of the current L2 block - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity getter functions (`configurableFeeScalar`, `configurableFeeConstant`) + - using the respective solidity getter functions (`operatorFeeScalar`, `operatorFeeConstant`) - using direct storage-reads: - - Configurable fee scalar as big-endian `uint64` in slot `3` at offset `24`. - - Configurable fee constant as big-endian `uint64` in slot `3` at offset `16`. + - Operator fee scalar as big-endian `uint32` in slot `3` at offset `20`. + - Operator fee constant as big-endian `uint64` in slot `3` at offset `16`. diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index 70306f054..b5ba0b492 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -11,7 +11,7 @@ ## Overview The L1 block attributes transaction is updated to include the EIP-1559 parameters and the extra scalars -for the `configurableFee`. +for the `operatorFee`. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | @@ -27,8 +27,8 @@ for the `configurableFee`. | batcherHash | bytes32 | 132-163 | 5 | | eip1559Denominator | uint64 | 164-171 | 6 | | eip1559Elasticity | uint64 | 172-179 | | -| configurableFeeScalar | uint64 | 180-187 | | -| configurableFeeConstant | uint64 | 188-195 | | +| operatorFeeScalar | uint32 | 180-183 | | +| operatorFeeConstant | uint64 | 184-191 | | In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. @@ -36,5 +36,5 @@ The pre-Isthmus values are migrated over 1:1. Blocks after the Isthmus activation block contain all pre-Isthmus values 1:1, and also set the following new attributes: -- The `configurableFeeScalar` is set to `0`. -- The `configurableFeeConstant` is set to `0`. +- The `operatorFeeScalar` is set to `0`. +- The `operatorFeeConstant` is set to `0`. diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index 7c77da568..ff13662ed 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -13,7 +13,7 @@ This document is not finalized and should be considered experimental. ## Execution Layer -- [Configurable Fee](./exec-engine.md#fees) +- [Operator Fee](./exec-engine.md#fees) ## Consensus Layer diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md index c3578a277..eaa9d423a 100644 --- a/specs/protocol/isthmus/predeploys.md +++ b/specs/protocol/isthmus/predeploys.md @@ -12,7 +12,8 @@ -Since we now need to include the configurable fee scalars in the L1 Attri +Since we now need to include the operator fee scalars in the L1 Attributes, we need new methods to +`L1Block` in order to set the new scalars. ## Predeploys diff --git a/specs/protocol/isthmus/system-config.md b/specs/protocol/isthmus/system-config.md index 345b90de0..88dc61552 100644 --- a/specs/protocol/isthmus/system-config.md +++ b/specs/protocol/isthmus/system-config.md @@ -14,7 +14,7 @@ ### Scalars -In order to allow rollup operators to adjust the new `ConfigurableFeeScalar` and `ConfigurableFeeConstant`, a change to +In order to allow rollup operators to adjust the new `operatorFeeScalar` and `operatorFeeConstant`, a change to the `scalar` and `overhead` encoding is necessary. #### Isthmus `scalar`, `overhead` (`uint256,uint256`) change @@ -29,11 +29,11 @@ After Isthmus activation: - `[1, 32)`: depending scalar-version: - Scalar-version `2`: - `[1, 8)`: padding, must be zero. - - `[8, 16)`: big-endian `uint64`, encoding the `configurableFeeScalar` - - `[16, 24)`: big-endian `uint64`, encoding the `configurableFeeConstant` + - `[12, 16)`: big-endian `uint32`, encoding the `operatorFeeScalar` + - `[16, 24)`: big-endian `uint64`, encoding the `operatorFeeConstant` - `[24, 28)`: big-endian `uint32`, encoding the `blobBaseFeeScalar` - `[28, 32)`: big-endian `uint32`, encoding the `baseFeeScalar` - - This version adds the `configurableFeeScalar` and the `configurableFeeConstant`. + - This version adds the `operatorFeeScalar` and the `operatorFeeConstant`. -The `configurableFeeScalar` and `configurableFeeConstant` are incorporated into the L2 through the +The `operatorFeeScalar` and `operatorFeeConstant` are incorporated into the L2 through the [Isthmus L1 attributes deposit transaction calldata](l1-attributes.md). From 816cc6c1c97e7b281ecb70a59c35048f794ad92e Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 23 Sep 2024 20:09:59 -0700 Subject: [PATCH 25/52] typo in l1-attributes --- specs/protocol/isthmus/configurability.md | 2 +- specs/protocol/isthmus/l1-attributes.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 43294526a..0413633aa 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -18,7 +18,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 128 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 96 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index b5ba0b492..c50ed0cd7 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -29,6 +29,7 @@ for the `operatorFee`. | eip1559Elasticity | uint64 | 172-179 | | | operatorFeeScalar | uint32 | 180-183 | | | operatorFeeConstant | uint64 | 184-191 | | +| UNUSED: MUST BE ZERO | uint32 | 192-195 | | In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. From 131435126c968d16d2718ea84fd20e0edf8820eb Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 26 Sep 2024 12:31:12 -0700 Subject: [PATCH 26/52] also change the gaspriceoracle --- specs/SUMMARY.md | 3 ++- specs/experimental/op-contracts-manager.md | 1 - specs/protocol/configurability.md | 8 ++++---- specs/protocol/isthmus/derivation.md | 24 ++++++++++++++++++++++ specs/protocol/isthmus/l1-attributes.md | 10 ++++----- specs/protocol/isthmus/predeploys.md | 20 +++++++++++++++++- 6 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 specs/protocol/isthmus/derivation.md diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index bae6ce4f4..ce897b3e2 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -57,9 +57,10 @@ - [L1 Block Attributes](./protocol/holocene/l1-attributes.md) - [Configurability](./protocol/holocene/configurability.md) - [Isthmus](./protocol/isthmus/overview.md) + - [Configurability](./protocol/isthmus/configurability.md) + - [Derivation](./protocol/holocene/derivation.md) - [Execution Engine](./protocol/isthmus/exec-engine.md) - [L1 Block Attributes](./protocol/isthmus/l1-attributes.md) - - [Configurability](./protocol/isthmus/configurability.md) - [Predeploys](./protocol/isthmus/predeploys.md) - [System Config](./protocol/isthmus/system-config.md) diff --git a/specs/experimental/op-contracts-manager.md b/specs/experimental/op-contracts-manager.md index 70196652a..fa80e67ba 100644 --- a/specs/experimental/op-contracts-manager.md +++ b/specs/experimental/op-contracts-manager.md @@ -1,6 +1,5 @@ # OP Contracts Manager -[`op-contracts/v1.4.0`]: https://github.com/ethereum-optimism/optimism/releases/tag/op-contracts%2Fv1.6.0 [Optimism Monorepo releases]: https://github.com/ethereum-optimism/optimism/releases [contract releases]: https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/VERSIONING.md [standard configuration]: ../protocol/configurability.md diff --git a/specs/protocol/configurability.md b/specs/protocol/configurability.md index 6e6ba8792..4101c2174 100644 --- a/specs/protocol/configurability.md +++ b/specs/protocol/configurability.md @@ -408,8 +408,8 @@ existing [permissioned dispute games](../fault-proof/stage-one/bridge-integratio [^of-gnosis-safe-l1]
**Notes:** Optimism Foundation (OF) multisig leveraging [battle-tested software](https://github.com/safe-global/safe-smart-account). This role is only active when -the `OptimismPortal` respected game type is [ -`PERMISSIONED_CANNON`](https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.5.0/packages/contracts-bedrock/src/dispute/lib/Types.sol#L31).
+the `OptimismPortal` respected game type is [`PERMISSIONED_CANNON`] +().
### [Guardian address](https://github.com/ethereum-optimism/optimism/blob/c927ed9e8af501fd330349607a2b09a876a9a1fb/packages/contracts-bedrock/src/L1/SuperchainConfig.sol#L50) @@ -429,8 +429,8 @@ with [permissioned dispute games](../fault-proof/stage-one/bridge-integration.md L1.
**Administrator:** [L1 Proxy Admin](#admin-roles)
**Requirement:** No requirement
-**Notes:** This role is only active when the `OptimismPortal` respected game type is [ -`PERMISSIONED_CANNON`](https://github.com/ethereum-optimism/optimism/blob/op-contracts/v1.5.0/packages/contracts-bedrock/src/dispute/lib/Types.sol#L31). +**Notes:** This role is only active when the `OptimismPortal` respected game type is [`PERMISSIONED_CANNON`] +(). The `L1ProxyAdmin` sets the implementation of the `PERMISSIONED_CANNON` game type. Thus, it determines the proposer configuration of the permissioned dispute game.
diff --git a/specs/protocol/isthmus/derivation.md b/specs/protocol/isthmus/derivation.md new file mode 100644 index 000000000..85de3fc89 --- /dev/null +++ b/specs/protocol/isthmus/derivation.md @@ -0,0 +1,24 @@ +# Isthmus L2 Chain Derivation Changes + + + +**Table of Contents** + +- [Network upgrade automation transactions](#network-upgrade-automation-transactions) + + + +# Network upgrade automation transactions + +Upgrades to these contracts requires some special treatment for these guys. + +The Isthmus hardfork activation block contains the following transactions, in this order: + +- L1 Attributes Transaction +- User deposits from L1 +- Network Upgrade Transactions + - L1Block deployment + - Update L1Block Proxy ERC-1967 Implementation + - L1Block Enable Isthmus + - GasPriceOracle deployment + - Update GasPriceOracle Proxy ERC-1967 Implementation diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index c50ed0cd7..86198b16c 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -25,11 +25,11 @@ for the `operatorFee`. | blobBaseFee | uint256 | 68-99 | 3 | | l1BlockHash | bytes32 | 100-131 | 4 | | batcherHash | bytes32 | 132-163 | 5 | -| eip1559Denominator | uint64 | 164-171 | 6 | -| eip1559Elasticity | uint64 | 172-179 | | -| operatorFeeScalar | uint32 | 180-183 | | -| operatorFeeConstant | uint64 | 184-191 | | -| UNUSED: MUST BE ZERO | uint32 | 192-195 | | +| eip1559Denominator | uint64 | 164-171 | 6 | +| eip1559Elasticity | uint64 | 172-179 | | +| operatorFeeScalar | uint32 | 180-183 | | +| operatorFeeConstant | uint64 | 184-191 | | +| UNUSED: MUST BE ZERO | uint32 | 192-195 | | In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md index eaa9d423a..0b5aa521c 100644 --- a/specs/protocol/isthmus/predeploys.md +++ b/specs/protocol/isthmus/predeploys.md @@ -5,8 +5,11 @@ **Table of Contents** - [Predeploys](#predeploys) - - [L1Block](#l1block) + - [GasPriceOracle](#gaspriceoracle) - [Interface](#interface) + - [`getOperatorFee`](#getoperatorfee) + - [L1Block](#l1block) + - [Interface](#interface-1) - [`setL1BlockValuesIsthmus`](#setl1blockvaluesisthmus) - [`setIsthmus`](#setisthmus) @@ -17,6 +20,21 @@ Since we now need to include the operator fee scalars in the L1 Attributes, we n ## Predeploys +### GasPriceOracle + +In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users +to estimate the operator fee. + +#### Interface + +##### `getOperatorFee` + +This function calculates the operator fee based on the expected amount of gas used for a certain transaction. + +```function +function getOperatorFee(uint256 gasUsed)(uint256) +``` + ### L1Block #### Interface From 76fa61a4dde0f8526be9a15cb9c6a71629b06159 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 30 Sep 2024 12:27:08 -0700 Subject: [PATCH 27/52] WIP: move everything to holocene --- specs/protocol/isthmus/l1-attributes.md | 1 - 1 file changed, 1 deletion(-) diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index 86198b16c..21fe3aa5c 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -29,7 +29,6 @@ for the `operatorFee`. | eip1559Elasticity | uint64 | 172-179 | | | operatorFeeScalar | uint32 | 180-183 | | | operatorFeeConstant | uint64 | 184-191 | | -| UNUSED: MUST BE ZERO | uint32 | 192-195 | | In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. From 3afa960277433b9877bd73f9e720b34df2bf1363 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 30 Sep 2024 13:14:07 -0700 Subject: [PATCH 28/52] move to holocene --- specs/protocol/holocene/configurability.md | 2 +- specs/protocol/holocene/derivation.md | 2 + specs/protocol/holocene/exec-engine.md | 37 +++++++++++++ specs/protocol/holocene/l1-attributes.md | 11 ++++ specs/protocol/holocene/overview.md | 1 + specs/protocol/holocene/predeploys.md | 24 +++++++- .../{isthmus => holocene}/system-config.md | 0 specs/protocol/isthmus/configurability.md | 24 -------- specs/protocol/isthmus/derivation.md | 24 -------- specs/protocol/isthmus/exec-engine.md | 45 --------------- specs/protocol/isthmus/l1-attributes.md | 40 -------------- specs/protocol/isthmus/overview.md | 7 --- specs/protocol/isthmus/predeploys.md | 55 ------------------- 13 files changed, 73 insertions(+), 199 deletions(-) rename specs/protocol/{isthmus => holocene}/system-config.md (100%) delete mode 100644 specs/protocol/isthmus/configurability.md delete mode 100644 specs/protocol/isthmus/derivation.md delete mode 100644 specs/protocol/isthmus/exec-engine.md delete mode 100644 specs/protocol/isthmus/l1-attributes.md delete mode 100644 specs/protocol/isthmus/predeploys.md diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index b1300be0c..dda95c8a4 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -55,7 +55,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 96 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/holocene/derivation.md b/specs/protocol/holocene/derivation.md index cd51a1b13..949c2a9db 100644 --- a/specs/protocol/holocene/derivation.md +++ b/specs/protocol/holocene/derivation.md @@ -341,5 +341,7 @@ The Holocene hardfork activation block contains the following transactions, in t - L1Block deployment - Update L1Block Proxy ERC-1967 Implementation - L1Block Enable Holocene + - GasPriceOracle deployment + - Update GasPriceOracle Proxy ERC-1967 Implementation - OptimismMintableERC20Factory deployment - Update OptimismMintableERC20Factory Proxy ERC-1967 Implementation diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 42d3bd891..591757ead 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -11,6 +11,9 @@ - [Rationale](#rationale) - [Forwards Compatibility Considerations](#forwards-compatibility-considerations) - [Client Implementation Considerations](#client-implementation-considerations) +- [Fees](#fees) + - [Operator fees](#operator-fees) + - [Configuring scalars](#configuring-scalars) @@ -75,3 +78,37 @@ directly store this information. [l2-to-l1-mp]: ../../protocol/predeploys.md#L2ToL1MessagePasser [output-root]: ../../glossary.md#l2-output-root + +## Fees + +New OP stack variants have different resource consumption patterns, and thus require a more flexible +pricing model. To enable more customizable fee structures, Isthmus adds a new component to the fee +calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` +and the `operatorFeeConstant`. + +### Operator fees + +The operator fee, in wei, is set as follows: + +`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant` + +Where: + +- `gasUsed` is amount of gas used by the transaction. +- `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by `1e6`. +- `operatorFeeConstant` is a `uint64` scalar set by the chain operator. + +These collected fees are sent to the `SequencerFeeVault`. + +#### Configuring scalars + +`operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and +`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). +calculation. In more detail, these scalars can be accessed in two interchangable ways. + +- read from the deposited L1 attributes (`operatorFeeScalar` and `operatorFeeConstant`) of the current L2 block +- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) + - using the respective solidity getter functions (`operatorFeeScalar`, `operatorFeeConstant`) + - using direct storage-reads: + - Operator fee scalar as big-endian `uint32` in slot `3` at offset `20`. + - Operator fee constant as big-endian `uint64` in slot `3` at offset `16`. diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index a21d841b7..aa4a1fcff 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -26,3 +26,14 @@ The L1 block attributes transaction is updated to include the EIP-1559 parameter | batcherHash | bytes32 | 132-163 | 5 | | eip1559Denominator | uint64 | 164-171 | 6 | | eip1559Elasticity | uint64 | 172-179 | | +| operatorFeeScalar | uint32 | 180-183 | | +| operatorFeeConstant | uint64 | 184-191 | | + +In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. + +The pre-Holocene values are migrated over 1:1. +Blocks after the Holocene activation block contain all pre-Holocene values 1:1, +and also set the following new attributes: + +- The `operatorFeeScalar` is set to `0`. +- The `operatorFeeConstant` is set to `0`. diff --git a/specs/protocol/holocene/overview.md b/specs/protocol/holocene/overview.md index c57ce2d85..fcf77a7eb 100644 --- a/specs/protocol/holocene/overview.md +++ b/specs/protocol/holocene/overview.md @@ -26,3 +26,4 @@ This document is not finalized and should be considered experimental. - [Predeploys](./predeploys.md) - [L1 Block Attributes](./l1-attributes.md) - [Configurability](./configurability.md) +- [System Config](./system-config.md) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 99002982d..412bb7631 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -24,12 +24,15 @@ - [FeeVault](#feevault) - [Interface](#interface-1) - [`config`](#config) - - [L2CrossDomainMessenger](#l2crossdomainmessenger) + - [GasPriceOracle](#gaspriceoracle) - [Interface](#interface-2) - - [L2ERC721Bridge](#l2erc721bridge) + - [`getOperatorFee`](#getoperatorfee) + - [L2CrossDomainMessenger](#l2crossdomainmessenger) - [Interface](#interface-3) - - [L2StandardBridge](#l2standardbridge) + - [L2ERC721Bridge](#l2erc721bridge) - [Interface](#interface-4) + - [L2StandardBridge](#l2standardbridge) + - [Interface](#interface-5) - [OptimismMintableERC721Factory](#optimismmintableerc721factory) - [Security Considerations](#security-considerations) - [GovernanceToken](#governancetoken) @@ -228,6 +231,21 @@ A new function is added to fetch the full Fee Vault Config. function config()(address,uint256,WithdrawalNetwork) ``` +### GasPriceOracle + +In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users +to estimate the operator fee. + +#### Interface + +##### `getOperatorFee` + +This function calculates the operator fee based on the expected amount of gas used for a certain transaction. + +```function +function getOperatorFee(uint256 gasUsed)(uint256) +``` + ### L2CrossDomainMessenger #### Interface diff --git a/specs/protocol/isthmus/system-config.md b/specs/protocol/holocene/system-config.md similarity index 100% rename from specs/protocol/isthmus/system-config.md rename to specs/protocol/holocene/system-config.md diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md deleted file mode 100644 index 0413633aa..000000000 --- a/specs/protocol/isthmus/configurability.md +++ /dev/null @@ -1,24 +0,0 @@ -# Configurability - - - -**Table of Contents** - -- [`SystemConfig`](#systemconfig) - - [`ConfigUpdate`](#configupdate) - - - -## `SystemConfig` - -### `ConfigUpdate` - -The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint256(1)`: - -| Name | Value | Definition | Usage | -| ---- | ----- | --- | -- | -| `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 96 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | -| `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | -| `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | -| `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/isthmus/derivation.md b/specs/protocol/isthmus/derivation.md deleted file mode 100644 index 85de3fc89..000000000 --- a/specs/protocol/isthmus/derivation.md +++ /dev/null @@ -1,24 +0,0 @@ -# Isthmus L2 Chain Derivation Changes - - - -**Table of Contents** - -- [Network upgrade automation transactions](#network-upgrade-automation-transactions) - - - -# Network upgrade automation transactions - -Upgrades to these contracts requires some special treatment for these guys. - -The Isthmus hardfork activation block contains the following transactions, in this order: - -- L1 Attributes Transaction -- User deposits from L1 -- Network Upgrade Transactions - - L1Block deployment - - Update L1Block Proxy ERC-1967 Implementation - - L1Block Enable Isthmus - - GasPriceOracle deployment - - Update GasPriceOracle Proxy ERC-1967 Implementation diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md deleted file mode 100644 index 9817840c2..000000000 --- a/specs/protocol/isthmus/exec-engine.md +++ /dev/null @@ -1,45 +0,0 @@ -# L2 Execution Engine - - - -**Table of Contents** - -- [Fees](#fees) - - [Operator fees](#operator-fees) - - [Configuring scalars](#configuring-scalars) - - - -## Fees - -New OP stack variants have different resource consumption patterns, and thus require a more flexible -pricing model. To enable more customizable fee structures, Isthmus adds a new component to the fee -calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` -and the `operatorFeeConstant`. - -### Operator fees - -The operator fee, in wei, is set as follows: - -`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant` - -Where: - -- `gasUsed` is amount of gas used by the transaction. -- `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by `1e6`. -- `operatorFeeConstant` is a `uint64` scalar set by the chain operator. - -These collected fees are sent to the `SequencerFeeVault`. - -#### Configuring scalars - -`operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and -`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). -calculation. In more detail, these scalars can be accessed in two interchangable ways. - -- read from the deposited L1 attributes (`operatorFeeScalar` and `operatorFeeConstant`) of the current L2 block -- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity getter functions (`operatorFeeScalar`, `operatorFeeConstant`) - - using direct storage-reads: - - Operator fee scalar as big-endian `uint32` in slot `3` at offset `20`. - - Operator fee constant as big-endian `uint64` in slot `3` at offset `16`. diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md deleted file mode 100644 index 21fe3aa5c..000000000 --- a/specs/protocol/isthmus/l1-attributes.md +++ /dev/null @@ -1,40 +0,0 @@ -# L1 Block Attributes - - - -**Table of Contents** - -- [Overview](#overview) - - - -## Overview - -The L1 block attributes transaction is updated to include the EIP-1559 parameters and the extra scalars -for the `operatorFee`. - -| Input arg | Type | Calldata bytes | Segment | -| ----------------- | ------- | -------------- | ------- | -| {0x098999be} | | 0-3 | n/a | -| baseFeeScalar | uint32 | 4-7 | 1 | -| blobBaseFeeScalar | uint32 | 8-11 | | -| sequenceNumber | uint64 | 12-19 | | -| l1BlockTimestamp | uint64 | 20-27 | | -| l1BlockNumber | uint64 | 28-35 | | -| basefee | uint256 | 36-67 | 2 | -| blobBaseFee | uint256 | 68-99 | 3 | -| l1BlockHash | bytes32 | 100-131 | 4 | -| batcherHash | bytes32 | 132-163 | 5 | -| eip1559Denominator | uint64 | 164-171 | 6 | -| eip1559Elasticity | uint64 | 172-179 | | -| operatorFeeScalar | uint32 | 180-183 | | -| operatorFeeConstant | uint64 | 184-191 | | - -In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. - -The pre-Isthmus values are migrated over 1:1. -Blocks after the Isthmus activation block contain all pre-Isthmus values 1:1, -and also set the following new attributes: - -- The `operatorFeeScalar` is set to `0`. -- The `operatorFeeConstant` is set to `0`. diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index ff13662ed..1a78c3552 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -4,19 +4,12 @@ **Table of Contents** -- [Execution Layer](#execution-layer) - [Consensus Layer](#consensus-layer) This document is not finalized and should be considered experimental. -## Execution Layer - -- [Operator Fee](./exec-engine.md#fees) - ## Consensus Layer -- [L1 Block Attributes](./l1-attributes.md) -- [Configurability](./configurability.md) - [Interop](../../interop/overview.md) diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md deleted file mode 100644 index 0b5aa521c..000000000 --- a/specs/protocol/isthmus/predeploys.md +++ /dev/null @@ -1,55 +0,0 @@ -# Overview - - - -**Table of Contents** - -- [Predeploys](#predeploys) - - [GasPriceOracle](#gaspriceoracle) - - [Interface](#interface) - - [`getOperatorFee`](#getoperatorfee) - - [L1Block](#l1block) - - [Interface](#interface-1) - - [`setL1BlockValuesIsthmus`](#setl1blockvaluesisthmus) - - [`setIsthmus`](#setisthmus) - - - -Since we now need to include the operator fee scalars in the L1 Attributes, we need new methods to -`L1Block` in order to set the new scalars. - -## Predeploys - -### GasPriceOracle - -In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users -to estimate the operator fee. - -#### Interface - -##### `getOperatorFee` - -This function calculates the operator fee based on the expected amount of gas used for a certain transaction. - -```function -function getOperatorFee(uint256 gasUsed)(uint256) -``` - -### L1Block - -#### Interface - -##### `setL1BlockValuesIsthmus` - -This function MUST only be callable by the `DEPOSITOR_ACCOUNT`. It is a replacement -for `setL1BlockValuesHolocene` and its calldata is defined in [L1 Attributes](./l1-attributes.md). - -```function -function setL1BlockValuesIsthmus() -``` - -##### `setIsthmus` - -This function is meant to be called once on the activation block of the isthmus network upgrade. -It MUST only be callable by the `DEPOSITOR_ACCOUNT` once. When it is called, it MUST call -call each getter for the network specific config and set the returndata into storage. From f45744f8424ebb7e40da25d4923f867a9fe566cf Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 30 Sep 2024 13:16:29 -0700 Subject: [PATCH 29/52] update summary --- specs/SUMMARY.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index ce897b3e2..5f147d008 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -56,13 +56,7 @@ - [Predeploys](./protocol/holocene/predeploys.md) - [L1 Block Attributes](./protocol/holocene/l1-attributes.md) - [Configurability](./protocol/holocene/configurability.md) - - [Isthmus](./protocol/isthmus/overview.md) - - [Configurability](./protocol/isthmus/configurability.md) - - [Derivation](./protocol/holocene/derivation.md) - - [Execution Engine](./protocol/isthmus/exec-engine.md) - - [L1 Block Attributes](./protocol/isthmus/l1-attributes.md) - - [Predeploys](./protocol/isthmus/predeploys.md) - - [System Config](./protocol/isthmus/system-config.md) + - [System Config](./protocol/holocene/system-config.md) - [Governance]() - [Governance Token](./governance/gov-token.md) From 2f0187f17631fad89f94224486be01cd3b882a56 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 30 Sep 2024 13:21:38 -0700 Subject: [PATCH 30/52] fix typos --- specs/protocol/holocene/exec-engine.md | 2 +- specs/protocol/holocene/predeploys.md | 40 ++++++++++++------------ specs/protocol/holocene/system-config.md | 8 ++--- specs/protocol/isthmus/overview.md | 3 ++ 4 files changed, 28 insertions(+), 25 deletions(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 591757ead..0a1a0e371 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -82,7 +82,7 @@ directly store this information. ## Fees New OP stack variants have different resource consumption patterns, and thus require a more flexible -pricing model. To enable more customizable fee structures, Isthmus adds a new component to the fee +pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` and the `operatorFeeConstant`. diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 412bb7631..af16199e3 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -24,15 +24,15 @@ - [FeeVault](#feevault) - [Interface](#interface-1) - [`config`](#config) - - [GasPriceOracle](#gaspriceoracle) - - [Interface](#interface-2) - - [`getOperatorFee`](#getoperatorfee) - [L2CrossDomainMessenger](#l2crossdomainmessenger) - - [Interface](#interface-3) + - [Interface](#interface-2) - [L2ERC721Bridge](#l2erc721bridge) - - [Interface](#interface-4) + - [Interface](#interface-3) - [L2StandardBridge](#l2standardbridge) + - [Interface](#interface-4) + - [GasPriceOracle](#gaspriceoracle) - [Interface](#interface-5) + - [`getOperatorFee`](#getoperatorfee) - [OptimismMintableERC721Factory](#optimismmintableerc721factory) - [Security Considerations](#security-considerations) - [GovernanceToken](#governancetoken) @@ -231,21 +231,6 @@ A new function is added to fetch the full Fee Vault Config. function config()(address,uint256,WithdrawalNetwork) ``` -### GasPriceOracle - -In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users -to estimate the operator fee. - -#### Interface - -##### `getOperatorFee` - -This function calculates the operator fee based on the expected amount of gas used for a certain transaction. - -```function -function getOperatorFee(uint256 gasUsed)(uint256) -``` - ### L2CrossDomainMessenger #### Interface @@ -273,6 +258,21 @@ The following functions are updated to read from the `L1Block` contract by calli - `otherBridge()(address)` - `OTHER_BRIDGE()(address)` +### GasPriceOracle + +In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users +to estimate the operator fee. + +#### Interface + +##### `getOperatorFee` + +This function calculates the operator fee based on the expected amount of gas used for a certain transaction. + +```function +function getOperatorFee(uint256 gasUsed)(uint256) +``` + ### OptimismMintableERC721Factory The chain id is no longer read from storage but instead is read from the `L1Block` contract by calling diff --git a/specs/protocol/holocene/system-config.md b/specs/protocol/holocene/system-config.md index 88dc61552..670e37011 100644 --- a/specs/protocol/holocene/system-config.md +++ b/specs/protocol/holocene/system-config.md @@ -6,7 +6,7 @@ - [System config contents (version 0)](#system-config-contents-version-0) - [Scalars](#scalars) - - [Isthmus `scalar`, `overhead` (`uint256,uint256`) change](#isthmus-scalar-overhead-uint256uint256-change) + - [Holocene `scalar`, `overhead` (`uint256,uint256`) change](#holocene-scalar-overhead-uint256uint256-change) @@ -17,9 +17,9 @@ In order to allow rollup operators to adjust the new `operatorFeeScalar` and `operatorFeeConstant`, a change to the `scalar` and `overhead` encoding is necessary. -#### Isthmus `scalar`, `overhead` (`uint256,uint256`) change +#### Holocene `scalar`, `overhead` (`uint256,uint256`) change -After Isthmus activation: +After Holocene activation: - A new version to the `scalar` encoding is added. It is described as follows. @@ -36,4 +36,4 @@ After Isthmus activation: - This version adds the `operatorFeeScalar` and the `operatorFeeConstant`. The `operatorFeeScalar` and `operatorFeeConstant` are incorporated into the L2 through the -[Isthmus L1 attributes deposit transaction calldata](l1-attributes.md). +[Holocene L1 attributes deposit transaction calldata](l1-attributes.md). diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index 1a78c3552..ec7bf0827 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -4,12 +4,15 @@ **Table of Contents** +- [Execution Layer](#execution-layer) - [Consensus Layer](#consensus-layer) This document is not finalized and should be considered experimental. +## Execution Layer + ## Consensus Layer - [Interop](../../interop/overview.md) From 1625dab5621a62b677b21db486cd19e456dc5681 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Mon, 30 Sep 2024 13:22:53 -0700 Subject: [PATCH 31/52] typo --- specs/protocol/holocene/configurability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index dda95c8a4..490beb0d4 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -55,7 +55,7 @@ The following `ConfigUpdate` enum is defined where the `CONFIG_VERSION` is `uint | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 96 \| (uint256(_operatorFeeConstant) << 64 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 108 \| (uint256(_operatorFeeConstant) << 96 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(_denominator)) << 32 \| uint64(_elasticity)` | Modifies the EIP-1559 denominator and elasticity | From ff1aa7f10d09f1127a8728f511d7844d3e7811b0 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 14:23:17 -0700 Subject: [PATCH 32/52] gas price oracle clarifications --- specs/protocol/holocene/predeploys.md | 24 ++++++++++++++++-- specs/protocol/holocene/system-config.md | 32 ++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 209915420..c2e980fda 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -21,8 +21,8 @@ - [`remoteChainId`](#remotechainid) - [FeeVault](#feevault) - [Interface](#interface-1) + - [`config`](#config) - [OperatorFeeVault](#operatorfeevault) - - [`config`](#config) - [L2CrossDomainMessenger](#l2crossdomainmessenger) - [Interface](#interface-2) - [L2ERC721Bridge](#l2erc721bridge) @@ -31,6 +31,7 @@ - [Interface](#interface-4) - [GasPriceOracle](#gaspriceoracle) - [Interface](#interface-5) + - [`setHolocene`](#setholocene-1) - [`getOperatorFee`](#getoperatorfee) - [OptimismMintableERC721Factory](#optimismmintableerc721factory) - [Security Considerations](#security-considerations) @@ -253,14 +254,33 @@ The following functions are updated to read from the `L1Block` contract by calli ### GasPriceOracle In order to maintain accurate offchain fee estimation, the `GasPriceOracle` must be updated to allow users -to estimate the operator fee. +to estimate the operator fee. We also add a new boolean `isHolocene` to help with evaluating the operator fee. #### Interface +##### `setHolocene` + +This function is meant to be called once on the activation block of the holocene network upgrade. +It MUST only be callable by the `DEPOSITOR_ACCOUNT` once. When it is called, it MUST call +call each getter for the network specific config and set the returndata into storage. + +```solidity +function setHolocene() external; +``` + ##### `getOperatorFee` This function calculates the operator fee based on the expected amount of gas used for a certain transaction. +It uses the following values + +- `operatorFeeScalar` +- `operatorFeeConstant` +- `isHolocene` + +`operatorFeeScalar` and `operatorFeeConstant` are read from the `L1Block` contract, and `isHolocene` +is read directly from storage. + ```function function getOperatorFee(uint256 gasUsed)(uint256) ``` diff --git a/specs/protocol/holocene/system-config.md b/specs/protocol/holocene/system-config.md index 670e37011..bed92bc23 100644 --- a/specs/protocol/holocene/system-config.md +++ b/specs/protocol/holocene/system-config.md @@ -7,6 +7,10 @@ - [System config contents (version 0)](#system-config-contents-version-0) - [Scalars](#scalars) - [Holocene `scalar`, `overhead` (`uint256,uint256`) change](#holocene-scalar-overhead-uint256uint256-change) + - [Interface](#interface) + - [`operatorFeeScalar`](#operatorfeescalar) + - [`operatorFeeConstant`](#operatorfeeconstant) + - [`setOperatorFeeScalars`](#setoperatorfeescalars) @@ -15,7 +19,9 @@ ### Scalars In order to allow rollup operators to adjust the new `operatorFeeScalar` and `operatorFeeConstant`, a change to -the `scalar` and `overhead` encoding is necessary. +the `scalar` and `overhead` encoding is necessary. As before, updates to the `operatorFeeScalar` and +`operatorFeeConstant` are signaled to the L2 through the `ConfigUpdate` log-event, specifically +using the `UpdateType.FEE_SCALARS` enum. #### Holocene `scalar`, `overhead` (`uint256,uint256`) change @@ -28,7 +34,7 @@ After Holocene activation: - `0`: scalar-version byte - `[1, 32)`: depending scalar-version: - Scalar-version `2`: - - `[1, 8)`: padding, must be zero. + - `[1, 12)`: padding, must be zero. - `[12, 16)`: big-endian `uint32`, encoding the `operatorFeeScalar` - `[16, 24)`: big-endian `uint64`, encoding the `operatorFeeConstant` - `[24, 28)`: big-endian `uint32`, encoding the `blobBaseFeeScalar` @@ -37,3 +43,25 @@ After Holocene activation: The `operatorFeeScalar` and `operatorFeeConstant` are incorporated into the L2 through the [Holocene L1 attributes deposit transaction calldata](l1-attributes.md). + +#### Interface + +The following functions are updated to access and modify the `operatorFeeScalar` and `operatorFeeConstant`: + +##### `operatorFeeScalar` + +```solidity +function operatorFeeScalar()(uint32) +``` + +##### `operatorFeeConstant` + +```solidity +function operatorFeeConstant()(uint64) +``` + +##### `setOperatorFeeScalars` + +```solidity +function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() +``` From 317ac76c3ddb5aa31e9a213d3f8c423e135340f2 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 14:51:19 -0700 Subject: [PATCH 33/52] fix typos --- specs/protocol/holocene/l1-attributes.md | 2 +- specs/protocol/holocene/overview.md | 1 + specs/protocol/holocene/predeploys.md | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index f5fdfffba..a75ccfffe 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -25,7 +25,7 @@ The L1 block attributes transaction is updated to include the EIP-1559 parameter | l1BlockHash | bytes32 | 100-131 | 4 | | batcherHash | bytes32 | 132-163 | 5 | | operatorFeeScalar | uint32 | 164-167 | 6 | -| operatorFeeConstant | uint32 | 168-171 | | +| operatorFeeConstant | uint64 | 168-175 | | In the first L2 block after the Holocene activation block, the Holocene L1 attributes are first used. diff --git a/specs/protocol/holocene/overview.md b/specs/protocol/holocene/overview.md index 3c9c80956..6815a96e0 100644 --- a/specs/protocol/holocene/overview.md +++ b/specs/protocol/holocene/overview.md @@ -26,3 +26,4 @@ This document is not finalized and should be considered experimental. - [Predeploys](./predeploys.md) - [Configurability](./configurability.md) - [System Config](./system-config.md) +- [L1 Block Attributes](./l1-attributes.md) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index c2e980fda..8328cd2c3 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -14,7 +14,7 @@ - [`baseFeeVaultConfig`](#basefeevaultconfig) - [`sequencerFeeVaultConfig`](#sequencerfeevaultconfig) - [`l1FeeVaultConfig`](#l1feevaultconfig) - - [`configurableFeeVaultConfig`](#configurablefeevaultconfig) + - [`operatorFeeVaultConfig`](#operatorfeevaultconfig) - [`l1CrossDomainMessenger`](#l1crossdomainmessenger) - [`l1StandardBridge`](#l1standardbridge) - [`l1ERC721Bridge`](#l1erc721bridge) @@ -149,12 +149,12 @@ This function MUST be called by the `L1FeeVault` to fetch network specific confi function l1FeeVaultConfig()(address,uint256,WithdrawalNetwork) ``` -##### `configurableFeeVaultConfig` +##### `operatorFeeVaultConfig` -This function MUST be called by the `ConfigurableFeeVault` to fetch network specific configuration. +This function MUST be called by the `OperatorFeeVault` to fetch network specific configuration. ```solidity -function configurableFeeVaultConfig()(address,uint256,WithdrawalNetwork) +function operatorFeeVaultConfig()(address,uint256,WithdrawalNetwork) ``` ##### `l1CrossDomainMessenger` @@ -279,7 +279,7 @@ It uses the following values - `isHolocene` `operatorFeeScalar` and `operatorFeeConstant` are read from the `L1Block` contract, and `isHolocene` -is read directly from storage. +is read directly from storage. If `isHolocene` is false, then this function MUST return `0`. ```function function getOperatorFee(uint256 gasUsed)(uint256) From bbb9e05ac3bdcbae0f76388567b721a273862235 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 14:57:07 -0700 Subject: [PATCH 34/52] another typo --- specs/protocol/holocene/exec-engine.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 9655e150d..6a39c5298 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -163,7 +163,7 @@ and the `operatorFeeConstant`. ### Operator fees -The operator fee, in wei, is set as follows: +The operator fee, is set as follows: `operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant` @@ -190,5 +190,5 @@ calculation. In more detail, these scalars can be accessed in two interchangable These collected fees are sent to a new vault for the `operatorFee`: the [`OperatorFeeVault`](predeploys.md#operatorfeevault). -Like the existing vaults, these are hardcoded addresses, pointing at pre-deployed proxy contracts. -The proxies are backed by vault contract deployments, based on `FeeVault`, to route vault funds to L1 securely. +Like the existing vaults, this is a hardcoded address, pointing at a pre-deployed proxy contract. +The proxy is backed by a vault contract deployment, based on `FeeVault`, to route vault funds to L1 securely. From 4c3eaca46e24f1ca3d4d170348c28474e158e0cf Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 15:26:20 -0700 Subject: [PATCH 35/52] update overview --- specs/protocol/holocene/overview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specs/protocol/holocene/overview.md b/specs/protocol/holocene/overview.md index 6815a96e0..a1337dd9a 100644 --- a/specs/protocol/holocene/overview.md +++ b/specs/protocol/holocene/overview.md @@ -15,6 +15,7 @@ This document is not finalized and should be considered experimental. ## Execution Layer - [L2ToL1MessagePasser Storage Root in Header](./exec-engine.md##l2tol1messagepasser-storage-root-in-header) +- [Operator Fee](./exec-engine.md#operator-fee) ## Consensus Layer From cfdc6fc6379b65dc20e63c788b30f8f42965c096 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 22:33:21 -0700 Subject: [PATCH 36/52] new role --- specs/protocol/holocene/configurability.md | 75 +++++++++++++++++++++- specs/protocol/holocene/exec-engine.md | 3 +- specs/protocol/holocene/l1-attributes.md | 2 +- specs/protocol/holocene/system-config.md | 67 ------------------- 4 files changed, 76 insertions(+), 71 deletions(-) delete mode 100644 specs/protocol/holocene/system-config.md diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 09996bcd5..79b5d40c0 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -11,11 +11,16 @@ - [`ConfigUpdate`](#configupdate) - [Initialization](#initialization) - [Modifying EIP-1559 Parameters](#modifying-eip-1559-parameters) + - [Modifying Operator Fee Scalars](#modifying-operator-fee-scalars) - [Interface](#interface) - [EIP-1559 Params](#eip-1559-params) - [`setEIP1559Params`](#seteip1559params) - [`eip1559Elasticity`](#eip1559elasticity) - [`eip1559Denominator`](#eip1559denominator) + - [Operator fee scalars](#operator-fee-scalars) + - [`operatorFeeScalar`](#operatorfeescalar) + - [`operatorFeeConstant`](#operatorfeeconstant) + - [`setOperatorFeeScalars`](#setoperatorfeescalars) - [Fee Vault Config](#fee-vault-config) - [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) - [`setL1FeeVaultConfig`](#setl1feevaultconfig) @@ -24,13 +29,18 @@ - [`OptimismPortal`](#optimismportal) - [Interface](#interface-1) - [`setConfig`](#setconfig) +- [Consensus Parameters](#consensus-parameters) + - [Operator Fee Scalar](#operator-fee-scalar) + - [Operator Fee Constant](#operator-fee-constant) +- [Service Roles](#service-roles) + - [Operator Fee Manager](#operator-fee-manager) ## Overview The `SystemConfig` and `OptimismPortal` are updated with a new flow for chain -configurability. +configurability. A new admin role `OperatorFeeManager` is added to manage the operator fee collection. ## Constants @@ -59,10 +69,11 @@ The following `ConfigUpdate` event is defined where the `CONFIG_VERSION` is `uin | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_operatorFeeScalar) << 108 \| (uint256(_operatorFeeConstant) << 96 \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(uint32(_denominator))) << 32 \| uint64(uint32(_elasticity))` | Modifies the EIP-1559 denominator and elasticity | +| `OPERATOR_FEE_SCALARS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee scalars | ### Initialization @@ -73,6 +84,7 @@ The following actions should happen during the initialization of the `SystemConf - `emit ConfigUpdate.GAS_LIMIT` - `emit ConfigUpdate.UNSAFE_BLOCK_SIGNER` - `emit ConfigUpdate.EIP_1559_PARAMS` +- `emit ConfigUpdate.OPERATOR_FEE_SCALARS` - `setConfig(SET_GAS_PAYING_TOKEN)` - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` @@ -91,6 +103,12 @@ A new `SystemConfig` `UpdateType` is introduced that enables the modification of [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) parameters. This allows for the chain operator to modify the `BASE_FEE_MAX_CHANGE_DENOMINATOR` and the `ELASTICITY_MULTIPLIER`. +### Modifying Operator Fee Scalars + +A new `SystemConfig` `UpdateType` is introduced that enables the modification of +the `operatorFeeScalar` and `operatorFeeConstant`. This allows the [`OperatorFeeManager`](#operator-fee-manager) +to modify the `operatorFeeScalar` and `operatorFeeConstant`. + ### Interface #### EIP-1559 Params @@ -122,6 +140,34 @@ This function returns the currently configured EIP-1559 denominator. function eip1559Denominator()(uint64) ``` +#### Operator fee scalars + +##### `operatorFeeScalar` + +This function returns the currently configured operator fee scalar. + +```solidity +function operatorFeeScalar()(uint32) +``` + +##### `operatorFeeConstant` + +This function returns the currently configured operator fee constant. + +```solidity +function operatorFeeConstant()(uint64) +``` + +##### `setOperatorFeeScalars` + +This function sets the `operatorFeeScalar` and `operatorFeeConstant`. + +This function MUST only be callable by the [`OperatorFeeManager`](#operator-fee-manager). + +```solidity +function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() +``` + #### Fee Vault Config For each `FeeVault`, there is a setter for its config. The arguments to the setter include @@ -182,3 +228,28 @@ The following fields are included: - `version` is `uint256(0)` - `opaqueData` is the tightly packed transaction data where `mint` is `0`, `value` is `0`, the `gasLimit` is `200_000`, `isCreation` is `false` and the `data` is `abi.encodeCall(L1Block.setConfig, (_type, _value))` + +## Consensus Parameters + +### [Operator Fee Scalar](exec-engine.md#operator-fees) + +**Description:** Operator fee scalar -- used to calculate the operator fee
+**Administrator:** [Operator Fee Manager](#operator-fee-manager)
+**Requirement:** TODO
+**Notes:**
+ +### [Operator Fee Constant](exec-engine.md#operator-fees) + +**Description:** Operator fee constant -- used to calculate the operator fee
+**Administrator:** [Operator Fee Manager](#operator-fee-manager)
+**Requirement:** TODO
+**Notes:**
+ +## Service Roles + +### Operator Fee Manager + +**Description:** Account authorized to modify the operator fee scalars and collect the operator fees.
+**Administrator:** [System Config Owner](../configurability.md#system-config)
+**Requirement:**
+**Notes:**
diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 6a39c5298..f02569599 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -191,4 +191,5 @@ calculation. In more detail, these scalars can be accessed in two interchangable These collected fees are sent to a new vault for the `operatorFee`: the [`OperatorFeeVault`](predeploys.md#operatorfeevault). Like the existing vaults, this is a hardcoded address, pointing at a pre-deployed proxy contract. -The proxy is backed by a vault contract deployment, based on `FeeVault`, to route vault funds to L1 securely. +The proxy is backed by a vault contract deployment, based on `FeeVault`, to route vault funds to L1 securely. It is +managed by the [`OperatorFeeVaultManager`](predeploys.md#operatorfeevaultmanager). diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index a75ccfffe..8619184f6 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -10,7 +10,7 @@ ## Overview -The L1 block attributes transaction is updated to include the EIP-1559 parameters. +The L1 block attributes transaction is updated to include the Operator Fee scalars. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | diff --git a/specs/protocol/holocene/system-config.md b/specs/protocol/holocene/system-config.md deleted file mode 100644 index bed92bc23..000000000 --- a/specs/protocol/holocene/system-config.md +++ /dev/null @@ -1,67 +0,0 @@ -# System Config - - - -**Table of Contents** - -- [System config contents (version 0)](#system-config-contents-version-0) - - [Scalars](#scalars) - - [Holocene `scalar`, `overhead` (`uint256,uint256`) change](#holocene-scalar-overhead-uint256uint256-change) - - [Interface](#interface) - - [`operatorFeeScalar`](#operatorfeescalar) - - [`operatorFeeConstant`](#operatorfeeconstant) - - [`setOperatorFeeScalars`](#setoperatorfeescalars) - - - -## System config contents (version 0) - -### Scalars - -In order to allow rollup operators to adjust the new `operatorFeeScalar` and `operatorFeeConstant`, a change to -the `scalar` and `overhead` encoding is necessary. As before, updates to the `operatorFeeScalar` and -`operatorFeeConstant` are signaled to the L2 through the `ConfigUpdate` log-event, specifically -using the `UpdateType.FEE_SCALARS` enum. - -#### Holocene `scalar`, `overhead` (`uint256,uint256`) change - -After Holocene activation: - -- A new version to the `scalar` encoding is added. It is described as follows. - -\*Byte ranges are indicated with `[` (inclusive) and `)` (exclusive). - -- `0`: scalar-version byte -- `[1, 32)`: depending scalar-version: - - Scalar-version `2`: - - `[1, 12)`: padding, must be zero. - - `[12, 16)`: big-endian `uint32`, encoding the `operatorFeeScalar` - - `[16, 24)`: big-endian `uint64`, encoding the `operatorFeeConstant` - - `[24, 28)`: big-endian `uint32`, encoding the `blobBaseFeeScalar` - - `[28, 32)`: big-endian `uint32`, encoding the `baseFeeScalar` - - This version adds the `operatorFeeScalar` and the `operatorFeeConstant`. - -The `operatorFeeScalar` and `operatorFeeConstant` are incorporated into the L2 through the -[Holocene L1 attributes deposit transaction calldata](l1-attributes.md). - -#### Interface - -The following functions are updated to access and modify the `operatorFeeScalar` and `operatorFeeConstant`: - -##### `operatorFeeScalar` - -```solidity -function operatorFeeScalar()(uint32) -``` - -##### `operatorFeeConstant` - -```solidity -function operatorFeeConstant()(uint64) -``` - -##### `setOperatorFeeScalars` - -```solidity -function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() -``` From 3db2793175bdd5ae54c06ed905253b2e790894f8 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Tue, 1 Oct 2024 22:42:48 -0700 Subject: [PATCH 37/52] operator fee manager doesnt collect fees --- specs/protocol/holocene/configurability.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 79b5d40c0..1e24b2e82 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -40,7 +40,7 @@ ## Overview The `SystemConfig` and `OptimismPortal` are updated with a new flow for chain -configurability. A new admin role `OperatorFeeManager` is added to manage the operator fee collection. +configurability. A new service role `OperatorFeeManager` is added to manage the operator fee collection. ## Constants @@ -249,7 +249,7 @@ The following fields are included: ### Operator Fee Manager -**Description:** Account authorized to modify the operator fee scalars and collect the operator fees.
+**Description:** Account authorized to modify the operator fee scalar.
**Administrator:** [System Config Owner](../configurability.md#system-config)
**Requirement:**
**Notes:**
From e2af3235d62cca8805da06115c23f0708dead389 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 10:11:52 -0700 Subject: [PATCH 38/52] fill in constants --- specs/protocol/holocene/configurability.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 1e24b2e82..30a16f334 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -235,15 +235,13 @@ The following fields are included: **Description:** Operator fee scalar -- used to calculate the operator fee
**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** TODO
-**Notes:**
+**Requirement:** Between 0 and 0.5 * (baseFee + priorityFee)
### [Operator Fee Constant](exec-engine.md#operator-fees) **Description:** Operator fee constant -- used to calculate the operator fee
**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** TODO
-**Notes:**
+**Requirement:** Between 0 and 600 Gwei
## Service Roles From b88dcf857f17c9cd97fc589fb012c859bd245e29 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 10:51:13 -0700 Subject: [PATCH 39/52] add operator fee vault address --- specs/protocol/holocene/predeploys.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 8328cd2c3..136167a52 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -222,7 +222,9 @@ function config()(address,uint256,WithdrawalNetwork) ### OperatorFeeVault This vault implements `FeeVault`, like `BaseFeeVault`, `SequencerFeeVault`, and `L1FeeVault`. No special logic is -needed in order to insert or withdraw funds. +needed in order to insert or withdraw funds. + +Its address will be `0x420000000000000000000000000000000000001b`. ### L2CrossDomainMessenger From dcf4bdd4557b816db30f00212132c4fbbbcebdfd Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 12:12:18 -0700 Subject: [PATCH 40/52] dont emit new configupdate --- specs/protocol/holocene/configurability.md | 1 - 1 file changed, 1 deletion(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 30a16f334..655965358 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -84,7 +84,6 @@ The following actions should happen during the initialization of the `SystemConf - `emit ConfigUpdate.GAS_LIMIT` - `emit ConfigUpdate.UNSAFE_BLOCK_SIGNER` - `emit ConfigUpdate.EIP_1559_PARAMS` -- `emit ConfigUpdate.OPERATOR_FEE_SCALARS` - `setConfig(SET_GAS_PAYING_TOKEN)` - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` From 6ad2938e769c5ea7728bea09b1c6edffd24e5a12 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 12:18:48 -0700 Subject: [PATCH 41/52] typo --- specs/protocol/holocene/predeploys.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/protocol/holocene/predeploys.md b/specs/protocol/holocene/predeploys.md index 136167a52..84308133a 100644 --- a/specs/protocol/holocene/predeploys.md +++ b/specs/protocol/holocene/predeploys.md @@ -222,7 +222,7 @@ function config()(address,uint256,WithdrawalNetwork) ### OperatorFeeVault This vault implements `FeeVault`, like `BaseFeeVault`, `SequencerFeeVault`, and `L1FeeVault`. No special logic is -needed in order to insert or withdraw funds. +needed in order to insert or withdraw funds. Its address will be `0x420000000000000000000000000000000000001b`. From 3d9f9678bb31ea51ae54489ff2293d36647d3844 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 13:54:43 -0700 Subject: [PATCH 42/52] typos --- specs/protocol/holocene/configurability.md | 10 +++++----- specs/protocol/holocene/exec-engine.md | 8 ++++---- specs/protocol/holocene/l1-attributes.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 655965358..670882d08 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -11,13 +11,13 @@ - [`ConfigUpdate`](#configupdate) - [Initialization](#initialization) - [Modifying EIP-1559 Parameters](#modifying-eip-1559-parameters) - - [Modifying Operator Fee Scalars](#modifying-operator-fee-scalars) + - [Modifying Operator Fee Parameters](#modifying-operator-fee-parameters) - [Interface](#interface) - [EIP-1559 Params](#eip-1559-params) - [`setEIP1559Params`](#seteip1559params) - [`eip1559Elasticity`](#eip1559elasticity) - [`eip1559Denominator`](#eip1559denominator) - - [Operator fee scalars](#operator-fee-scalars) + - [Operator fee parameters](#operator-fee-parameters) - [`operatorFeeScalar`](#operatorfeescalar) - [`operatorFeeConstant`](#operatorfeeconstant) - [`setOperatorFeeScalars`](#setoperatorfeescalars) @@ -73,7 +73,7 @@ The following `ConfigUpdate` event is defined where the `CONFIG_VERSION` is `uin | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(uint32(_denominator))) << 32 \| uint64(uint32(_elasticity))` | Modifies the EIP-1559 denominator and elasticity | -| `OPERATOR_FEE_SCALARS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee scalars | +| `OPERATOR_FEE_SCALARS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee parameters | ### Initialization @@ -102,7 +102,7 @@ A new `SystemConfig` `UpdateType` is introduced that enables the modification of [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) parameters. This allows for the chain operator to modify the `BASE_FEE_MAX_CHANGE_DENOMINATOR` and the `ELASTICITY_MULTIPLIER`. -### Modifying Operator Fee Scalars +### Modifying Operator Fee Parameters A new `SystemConfig` `UpdateType` is introduced that enables the modification of the `operatorFeeScalar` and `operatorFeeConstant`. This allows the [`OperatorFeeManager`](#operator-fee-manager) @@ -139,7 +139,7 @@ This function returns the currently configured EIP-1559 denominator. function eip1559Denominator()(uint64) ``` -#### Operator fee scalars +#### Operator fee parameters ##### `operatorFeeScalar` diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index f02569599..b9053e0ea 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -20,8 +20,8 @@ - [Encoding](#encoding) - [Rationale](#rationale-2) - [Fees](#fees) - - [Operator fees](#operator-fees) - - [Configuring scalars](#configuring-scalars) + - [Operator Fee](#operator-fee) + - [Configuring Scalars](#configuring-scalars) - [Fee Vaults](#fee-vaults) @@ -161,7 +161,7 @@ pricing model. To enable more customizable fee structures, Holocene adds a new c calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` and the `operatorFeeConstant`. -### Operator fees +### Operator Fee The operator fee, is set as follows: @@ -173,7 +173,7 @@ Where: - `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by `1e6`. - `operatorFeeConstant` is a `uint64` scalar set by the chain operator. -#### Configuring scalars +#### Configuring Scalars `operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and `blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). diff --git a/specs/protocol/holocene/l1-attributes.md b/specs/protocol/holocene/l1-attributes.md index 8619184f6..6225143ff 100644 --- a/specs/protocol/holocene/l1-attributes.md +++ b/specs/protocol/holocene/l1-attributes.md @@ -10,7 +10,7 @@ ## Overview -The L1 block attributes transaction is updated to include the Operator Fee scalars. +The L1 block attributes transaction is updated to include the operator fee parameters. | Input arg | Type | Calldata bytes | Segment | | ----------------- | ------- | -------------- | ------- | From 3c99591c8311ae92533d0ce5f6bffe4188d0a263 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 2 Oct 2024 14:36:30 -0700 Subject: [PATCH 43/52] add more support for operator fee manager --- specs/protocol/holocene/configurability.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/specs/protocol/holocene/configurability.md b/specs/protocol/holocene/configurability.md index 670882d08..c28bd8118 100644 --- a/specs/protocol/holocene/configurability.md +++ b/specs/protocol/holocene/configurability.md @@ -21,6 +21,7 @@ - [`operatorFeeScalar`](#operatorfeescalar) - [`operatorFeeConstant`](#operatorfeeconstant) - [`setOperatorFeeScalars`](#setoperatorfeescalars) + - [`setOperatorFeeManager`](#setoperatorfeemanager) - [Fee Vault Config](#fee-vault-config) - [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) - [`setL1FeeVaultConfig`](#setl1feevaultconfig) @@ -73,7 +74,8 @@ The following `ConfigUpdate` event is defined where the `CONFIG_VERSION` is `uin | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(uint32(_denominator))) << 32 \| uint64(uint32(_elasticity))` | Modifies the EIP-1559 denominator and elasticity | -| `OPERATOR_FEE_SCALARS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee parameters | +| `OPERATOR_FEE_PARAMS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee parameters | +| `OPERATOR_FEE_MANAGER` | `uint8(6)` | `abi.encode(address)` | Modifies the operator fee manager | ### Initialization @@ -167,6 +169,16 @@ This function MUST only be callable by the [`OperatorFeeManager`](#operator-fee- function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() ``` +##### `setOperatorFeeManager` + +This function sets the `operatorFeeManager`. + +This function MUST only be callable by the chain governor. + +```solidity +function setOperatorFeeManager(address _operatorFeeManager)() +``` + #### Fee Vault Config For each `FeeVault`, there is a setter for its config. The arguments to the setter include From 4e0f7242311b491c848cf89a848158ad88cf0de6 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 3 Oct 2024 11:31:06 -0700 Subject: [PATCH 44/52] typos --- specs/SUMMARY.md | 16 ++++----- specs/protocol/holocene/exec-engine.md | 41 ----------------------- specs/protocol/isthmus/configurability.md | 2 +- specs/protocol/isthmus/overview.md | 1 - 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index 9f78b275a..7b51475c6 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -53,16 +53,14 @@ - [Holocene](./protocol/holocene/overview.md) - [Derivation](./protocol/holocene/derivation.md) - [Execution Engine](./protocol/holocene/exec-engine.md) -<<<<<<< HEAD - - [Predeploys](./protocol/holocene/predeploys.md) - - [Configurability](./protocol/holocene/configurability.md) - [System Config](./protocol/holocene/system-config.md) - - [L1 Attributes](./protocol/holocene/l1-attributes.md) - -======= - - [System Config](./protocol/holocene/system-config.md) ->>>>>>> main - + - [Isthmus](./protocol/isthmus/overview.md) + - [Configurability](./protocol/isthmus/configurability.md) + - [Derivation](./protocol/isthmus/derivation.md) + - [Execution Engine](./protocol/isthmus/exec-engine.md) + - [L1 Attributes](./protocol/isthmus/l1-attributes.md) + - [Predeploys](./protocol/isthmus/predeploys.md) + - [Superchain Config](./protocol/isthmus/superchain-config.md) - [Governance]() - [Governance Token](./governance/gov-token.md) - [Experimental]() diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 8064b56d4..127b6f0f0 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -101,44 +101,3 @@ historical execution, as L1 would have to be consulted for fetching the values f Instead, we re-use an unused field in the L1 block header as to make these parameters available, retaining the purity of the function that computes the next block's base fee from the chain configuration, parent block header, and next block timestamp. - - -## Fees - -New OP stack variants have different resource consumption patterns, and thus require a more flexible -pricing model. To enable more customizable fee structures, Holocene adds a new component to the fee -calculation: the `operatorFee`, which is parameterized by two scalars: the `operatorFeeScalar` -and the `operatorFeeConstant`. - -### Operator Fee - -The operator fee, is set as follows: - -`operatorFee = (gasUsed * operatorFeeScalar / 1e6) + operatorFeeConstant` - -Where: - -- `gasUsed` is amount of gas used by the transaction. -- `operatorFeeScalar` is a `uint32` scalar set by the chain operator, scaled by `1e6`. -- `operatorFeeConstant` is a `uint64` scalar set by the chain operator. - -#### Configuring Scalars - -`operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and -`blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). -calculation. In more detail, these scalars can be accessed in two interchangable ways. - -- read from the deposited L1 attributes (`operatorFeeScalar` and `operatorFeeConstant`) of the current L2 block -- read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) - - using the respective solidity getter functions (`operatorFeeScalar`, `operatorFeeConstant`) - - using direct storage-reads: - - Operator fee scalar as big-endian `uint32` in slot `3` at offset `20`. - - Operator fee constant as big-endian `uint64` in slot `3` at offset `16`. - -### Fee Vaults - -These collected fees are sent to a new vault for the `operatorFee`: the [`OperatorFeeVault`](predeploys.md#operatorfeevault). - -Like the existing vaults, this is a hardcoded address, pointing at a pre-deployed proxy contract. -The proxy is backed by a vault contract deployment, based on `FeeVault`, to route vault funds to L1 securely. It is -managed by the [`OperatorFeeVaultManager`](predeploys.md#operatorfeevaultmanager). diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 676e225f2..6f10b8e94 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -66,7 +66,7 @@ The following `ConfigUpdate` event is defined where the `CONFIG_VERSION` is `uin | Name | Value | Definition | Usage | | ---- | ----- | --- | -- | | `BATCHER` | `uint8(0)` | `abi.encode(address)` | Modifies the account that is authorized to progress the safe chain | -| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobBaseFeeScalar) << 32) \| _baseFeeScalar` | Modifies the fee scalars | +| `FEE_SCALARS` | `uint8(1)` | `(uint256(0x01) << 248) \| (uint256(_blobbasefeeScalar) << 32) \| _basefeeScalar` | Modifies the fee scalars | | `GAS_LIMIT` | `uint8(2)` | `abi.encode(uint64 _gasLimit)` | Modifies the L2 gas limit | | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(uint32(_denominator))) << 32 \| uint64(uint32(_elasticity))` | Modifies the EIP-1559 denominator and elasticity | diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index 91e26bb1b..a49e1ff1f 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -25,5 +25,4 @@ This document is not finalized and should be considered experimental. - [SuperchainConfig](./superchain-config.md) - [Predeploys](./predeploys.md) -- [System Config](./system-config.md) - [L1 Block Attributes](./l1-attributes.md) From 9ab37f9c66c0b1857912fa1d62140918b9526fcc Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 3 Oct 2024 11:33:26 -0700 Subject: [PATCH 45/52] run linter --- specs/protocol/holocene/exec-engine.md | 4 ---- specs/protocol/isthmus/configurability.md | 8 +++++--- specs/protocol/isthmus/exec-engine.md | 5 ++++- specs/protocol/isthmus/overview.md | 3 ++- specs/protocol/isthmus/predeploys.md | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/specs/protocol/holocene/exec-engine.md b/specs/protocol/holocene/exec-engine.md index 127b6f0f0..186df9d5b 100644 --- a/specs/protocol/holocene/exec-engine.md +++ b/specs/protocol/holocene/exec-engine.md @@ -15,10 +15,6 @@ - [Header Validity Rules](#header-validity-rules) - [Encoding](#encoding) - [Rationale](#rationale-1) -- [Fees](#fees) - - [Operator Fee](#operator-fee) - - [Configuring Scalars](#configuring-scalars) - - [Fee Vaults](#fee-vaults) diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index 6f10b8e94..b84dae180 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -99,13 +99,15 @@ These actions MAY only be triggered if there is a diff to the value. Since the `OperatorFeeVault` is new in Isthmus, the `setConfig(SET_OPERATOR_FEE_VAULT_CONFIG)` MUST be emitted. `ConfigUpdate.OPERATOR_FEE_PARAMS` and `ConfigUpdate.OPERATOR_FEE_MANAGER` MAY be emitted. If they are not emitted, -the `operatorFeeScalar` and `operatorFeeConstant` are set to 0 by default, and the `OperatorFeeManager` is set to the chain governor by default. +the `operatorFeeScalar` and `operatorFeeConstant` are set to 0 by default, and the `OperatorFeeManager` +is set to the chain governor by default. ### Modifying Operator Fee Parameters A new `SystemConfig` `UpdateType` is introduced that enables the modification of -the `operatorFeeScalar` and `operatorFeeConstant`. This allows the [`OperatorFeeManager`](#operator-fee-manager) -to modify the `operatorFeeScalar` and `operatorFeeConstant`. +the `operatorFeeScalar` and `operatorFeeConstant` by the [`OperatorFeeManager`](#operator-fee-manager). + +Another `UpdateType` is added to modify the [`OperatorFeeManager`]. ### Interface diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md index 75562c5f6..792c7f257 100644 --- a/specs/protocol/isthmus/exec-engine.md +++ b/specs/protocol/isthmus/exec-engine.md @@ -14,7 +14,7 @@ - [Client Implementation Considerations](#client-implementation-considerations) - [Fees](#fees) - [Operator Fee](#operator-fee) - - [Configuring Scalars](#configuring-scalars) + - [Configuring Parameters](#configuring-parameters) - [Fee Vaults](#fee-vaults) @@ -81,6 +81,9 @@ an outbound withdrawal for a long period of time, the node may not have access t clients are able to at the very least reconstruct the account storage root at a given block on the fly if it does not directly store this information. +[l2-to-l1-mp]: ../../protocol/predeploys.md#L2ToL1MessagePasser +[output-root]: ../../glossary.md#l2-output-root + ## Fees New OP stack variants have different resource consumption patterns, and thus require a more flexible diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index a49e1ff1f..84a3b4626 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -21,8 +21,9 @@ This document is not finalized and should be considered experimental. - [Isthmus Derivation](./derivation.md#isthmus-derivation) - [Configurability](./configurability.md) + ## Smart Contracts - [SuperchainConfig](./superchain-config.md) - [Predeploys](./predeploys.md) -- [L1 Block Attributes](./l1-attributes.md) +- [L1 Block Attributes](./l1-attributes.md) diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md index a923f1429..5273da233 100644 --- a/specs/protocol/isthmus/predeploys.md +++ b/specs/protocol/isthmus/predeploys.md @@ -290,7 +290,7 @@ function setIsthmus() external; This function calculates the operator fee based on the expected amount of gas used for a certain transaction. -It uses the following values: +It uses the following values: - `operatorFeeScalar` - `operatorFeeConstant` From 6c578386282ef7bac72fc5c102f59f8efed2a026 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 7 Nov 2024 17:51:17 -0800 Subject: [PATCH 46/52] set fee manager in roles --- specs/protocol/isthmus/configurability.md | 20 ++--------------- specs/protocol/isthmus/overview.md | 1 + specs/protocol/isthmus/system-config.md | 26 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100644 specs/protocol/isthmus/system-config.md diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index b84dd635c..bf7d5cfbc 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -16,7 +16,6 @@ - [`operatorFeeScalar`](#operatorfeescalar) - [`operatorFeeConstant`](#operatorfeeconstant) - [`setOperatorFeeScalars`](#setoperatorfeescalars) - - [`setOperatorFeeManager`](#setoperatorfeemanager) - [Fee Vault Config](#fee-vault-config) - [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) - [`setL1FeeVaultConfig`](#setl1feevaultconfig) @@ -71,7 +70,6 @@ The following `ConfigUpdate` event is defined where the `CONFIG_VERSION` is `uin | `UNSAFE_BLOCK_SIGNER` | `uint8(3)` | `abi.encode(address)` | Modifies the account that is authorized to progress the unsafe chain | | `EIP_1559_PARAMS` | `uint8(4)` | `uint256(uint64(uint32(_denominator))) << 32 \| uint64(uint32(_elasticity))` | Modifies the EIP-1559 denominator and elasticity | | `OPERATOR_FEE_PARAMS` | `uint8(5)` | `uint256(_operatorFeeScalar) << 64 \| _operatorFeeConstant` | Modifies the operator fee parameters | -| `OPERATOR_FEE_MANAGER` | `uint8(6)` | `abi.encode(address)` | Modifies the operator fee manager | ### Initialization @@ -83,7 +81,6 @@ The following actions should happen during the initialization of the `SystemConf - `emit ConfigUpdate.UNSAFE_BLOCK_SIGNER` - `emit ConfigUpdate.EIP_1559_PARAMS` - `emit ConfigUpdate.OPERATOR_FEE_PARAMS` -- `emit ConfigUpdate.OPERATOR_FEE_MANAGER` - `setConfig(SET_GAS_PAYING_TOKEN)` - `setConfig(SET_BASE_FEE_VAULT_CONFIG)` - `setConfig(SET_L1_FEE_VAULT_CONFIG)` @@ -98,17 +95,14 @@ These actions MAY only be triggered if there is a diff to the value. Since the `OperatorFeeVault` is new in Isthmus, the `setConfig(SET_OPERATOR_FEE_VAULT_CONFIG)` MUST be emitted. -`ConfigUpdate.OPERATOR_FEE_PARAMS` and `ConfigUpdate.OPERATOR_FEE_MANAGER` MAY be emitted. If they are not emitted, -the `operatorFeeScalar` and `operatorFeeConstant` are set to 0 by default, and the `OperatorFeeManager` -is set to the chain governor by default. +`ConfigUpdate.OPERATOR_FEE_PARAMS` MAY be emitted. If it is not emitted, the `operatorFeeScalar` and +`operatorFeeConstant` are set to 0 by default. ### Modifying Operator Fee Parameters A new `SystemConfig` `UpdateType` is introduced that enables the modification of the `operatorFeeScalar` and `operatorFeeConstant` by the [`OperatorFeeManager`](#operator-fee-manager). -Another `UpdateType` is added to modify the [`OperatorFeeManager`]. - ### Interface #### Operator fee parameters @@ -139,16 +133,6 @@ This function MUST only be callable by the [`OperatorFeeManager`](#operator-fee- function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() ``` -##### `setOperatorFeeManager` - -This function sets the `operatorFeeManager`. - -This function MUST only be callable by the chain governor. - -```solidity -function setOperatorFeeManager(address _operatorFeeManager)() -``` - #### Fee Vault Config For each `FeeVault`, there is a setter for its config. The arguments to the setter include diff --git a/specs/protocol/isthmus/overview.md b/specs/protocol/isthmus/overview.md index 84a3b4626..776747ab1 100644 --- a/specs/protocol/isthmus/overview.md +++ b/specs/protocol/isthmus/overview.md @@ -27,3 +27,4 @@ This document is not finalized and should be considered experimental. - [SuperchainConfig](./superchain-config.md) - [Predeploys](./predeploys.md) - [L1 Block Attributes](./l1-attributes.md) +- [System Config](./system-config.md) diff --git a/specs/protocol/isthmus/system-config.md b/specs/protocol/isthmus/system-config.md new file mode 100644 index 000000000..c7cd07c12 --- /dev/null +++ b/specs/protocol/isthmus/system-config.md @@ -0,0 +1,26 @@ +# System Config + + + +**Table of Contents** + + + +## Overview + +The `SystemConfig` is updated to set a new role: the `OPERATOR_FEE_MANAGER`. This role is set once upon +initialization and can only be set again with another call to `initialize`. + +### `Roles` + +The `Roles` struct is updated to include the new `OPERATOR_FEE_MANAGER` role. + +```solidity +struct Roles { + address owner; + address feeAdmin; + address operatorFeeManager; // new role +} +``` + +The operator may only change the `operatorFeeManager` role with a call to `initialize`. From 219e72c7650d5daafb81268d8f64140156be6403 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 7 Nov 2024 20:00:27 -0800 Subject: [PATCH 47/52] add sysconfig to summary --- specs/SUMMARY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index e776be4ad..38fe13b2b 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -61,6 +61,7 @@ - [L1 Attributes](./protocol/isthmus/l1-attributes.md) - [Predeploys](./protocol/isthmus/predeploys.md) - [Superchain Config](./protocol/isthmus/superchain-config.md) + - [System Config](./protocol/isthmus/system-config.md) - [Governance]() - [Governance Token](./governance/gov-token.md) - [Experimental]() From 762dbf7ca1e8d18f7c219958615195485a495a45 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Sun, 17 Nov 2024 22:27:23 -0800 Subject: [PATCH 48/52] move roles to root configurability.md + typo --- specs/protocol/configurability.md | 22 +++++++++++++++ specs/protocol/isthmus/configurability.md | 34 ++--------------------- specs/protocol/isthmus/exec-engine.md | 2 +- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/specs/protocol/configurability.md b/specs/protocol/configurability.md index 267cb3521..d79571df2 100644 --- a/specs/protocol/configurability.md +++ b/specs/protocol/configurability.md @@ -30,6 +30,8 @@ - [Start block](#start-block) - [Superchain target](#superchain-target) - [Governance Token](#governance-token) + - [Operator Fee Scalar](#operator-fee-scalar) + - [Operator Fee Constant](#operator-fee-constant) - [Resource Config](#resource-config) - [Policy Parameters](#policy-parameters) - [Data Availability Type](#data-availability-type) @@ -47,6 +49,7 @@ - [Guardian address](#guardian-address) - [Proposer address](#proposer-address) - [Sequencer P2P / Unsafe head signer](#sequencer-p2p--unsafe-head-signer) + - [Operator Fee Manager](#operator-fee-manager) @@ -283,6 +286,18 @@ contracts deployed on layer 1.
**Requirement:** Disabled
**Notes:** Simple clear restriction.
+### [Operator Fee Scalar](exec-engine.md#operator-fees) + +**Description:** Operator fee scalar -- used to calculate the operator fee
+**Administrator:** [Operator Fee Manager](#operator-fee-manager)
+**Requirement:** Between 0 and 0.5 * (baseFee + priorityFee)
+ +### [Operator Fee Constant](exec-engine.md#operator-fees) + +**Description:** Operator fee constant -- used to calculate the operator fee
+**Administrator:** [Operator Fee Manager](#operator-fee-manager)
+**Requirement:** Between 0 and 600 Gwei
+ [^chain-id-uniqueness]: The chain ID must be globally unique among all EVM chains. ### Resource Config @@ -441,4 +456,11 @@ configuration of the permissioned dispute game.
**Requirement:** No requirement
**Notes:**
+### Operator Fee Manager + +**Description:** Account authorized to modify the operator fee scalar.
+**Administrator:** [System Config Owner](#admin-roles)
+**Requirement:**
+**Notes:**
+ [^of-gnosis-safe-l1]: 5 of 7 GnosisSafe controlled by Optimism Foundation (OF). Mainnet and Sepolia addresses can be found at [privileged roles](https://docs.optimism.io/chain/security/privileged-roles). diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index bf7d5cfbc..bd99fe404 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -25,11 +25,6 @@ - [Interface](#interface-1) - [`setConfig`](#setconfig) - [`upgrade`](#upgrade) -- [Consensus Parameters](#consensus-parameters) - - [Operator Fee Scalar](#operator-fee-scalar) - - [Operator Fee Constant](#operator-fee-constant) -- [Service Roles](#service-roles) - - [Operator Fee Manager](#operator-fee-manager) @@ -101,7 +96,7 @@ Since the `OperatorFeeVault` is new in Isthmus, the `setConfig(SET_OPERATOR_FEE_ ### Modifying Operator Fee Parameters A new `SystemConfig` `UpdateType` is introduced that enables the modification of -the `operatorFeeScalar` and `operatorFeeConstant` by the [`OperatorFeeManager`](#operator-fee-manager). +the `operatorFeeScalar` and `operatorFeeConstant` by the [`OperatorFeeManager`](../configurability.md#operator-fee-manager). ### Interface @@ -127,7 +122,7 @@ function operatorFeeConstant()(uint64) This function sets the `operatorFeeScalar` and `operatorFeeConstant`. -This function MUST only be callable by the [`OperatorFeeManager`](#operator-fee-manager). +This function MUST only be callable by the [`OperatorFeeManager`](../configurability.md#operator-fee-manager). ```solidity function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() @@ -216,28 +211,3 @@ The following fields are included: - `version` is `uint256(0)` - `opaqueData` is the tightly packed transaction data where `mint` is `0`, `value` is `0`, the `gasLimit` is `200_000`, `isCreation` is `false` and the `data` is the data passed into `upgrade`. - -## Consensus Parameters - -The operator fee scalar and constant are new consensus parameters, so we define standard values for them. - -### [Operator Fee Scalar](exec-engine.md#operator-fees) - -**Description:** Operator fee scalar -- used to calculate the operator fee
-**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** Between 0 and 0.5 * (baseFee + priorityFee)
- -### [Operator Fee Constant](exec-engine.md#operator-fees) - -**Description:** Operator fee constant -- used to calculate the operator fee
-**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** Between 0 and 600 Gwei
- -## Service Roles - -### Operator Fee Manager - -**Description:** Account authorized to modify the operator fee scalar.
-**Administrator:** [System Config Owner](../configurability.md#system-config)
-**Requirement:**
-**Notes:**
diff --git a/specs/protocol/isthmus/exec-engine.md b/specs/protocol/isthmus/exec-engine.md index a6f981868..0e99a74fc 100644 --- a/specs/protocol/isthmus/exec-engine.md +++ b/specs/protocol/isthmus/exec-engine.md @@ -169,7 +169,7 @@ Where: `operatorFeeScalar` and `operatorFeeConstant` are loaded in a similar way to the `baseFeeScalar` and `blobBaseFeeScalar` used in the [`L1Fee`](../../protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da). -calculation. In more detail, these paramters can be accessed in two interchangable ways. +calculation. In more detail, these parameters can be accessed in two interchangable ways. - read from the deposited L1 attributes (`operatorFeeScalar` and `operatorFeeConstant`) of the current L2 block - read from the L1 Block Info contract (`0x4200000000000000000000000000000000000015`) From 99c9f4d299db2585fb4daf0c129fe7a4beef3fb9 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Sun, 17 Nov 2024 22:31:09 -0800 Subject: [PATCH 49/52] typo --- specs/protocol/configurability.md | 7 +++++-- specs/protocol/isthmus/configurability.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/specs/protocol/configurability.md b/specs/protocol/configurability.md index d79571df2..d754d1a75 100644 --- a/specs/protocol/configurability.md +++ b/specs/protocol/configurability.md @@ -290,13 +290,16 @@ contracts deployed on layer 1.
**Description:** Operator fee scalar -- used to calculate the operator fee
**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** Between 0 and 0.5 * (baseFee + priorityFee)
+**Requirement:** 0
### [Operator Fee Constant](exec-engine.md#operator-fees) **Description:** Operator fee constant -- used to calculate the operator fee
**Administrator:** [Operator Fee Manager](#operator-fee-manager)
-**Requirement:** Between 0 and 600 Gwei
+**Requirement:** 0
+ +Note that the operator fee scalar and constant are primarily used for non-standard configurations, +like op-succinct, so their standard values are 0. [^chain-id-uniqueness]: The chain ID must be globally unique among all EVM chains. diff --git a/specs/protocol/isthmus/configurability.md b/specs/protocol/isthmus/configurability.md index bd99fe404..63e56e39f 100644 --- a/specs/protocol/isthmus/configurability.md +++ b/specs/protocol/isthmus/configurability.md @@ -125,7 +125,7 @@ This function sets the `operatorFeeScalar` and `operatorFeeConstant`. This function MUST only be callable by the [`OperatorFeeManager`](../configurability.md#operator-fee-manager). ```solidity -function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant)() +function setOperatorFeeScalar(uint32 _operatorFeeScalar, uint64 _operatorFeeConstant) ``` #### Fee Vault Config From 18c81271d9954f1f051037226804e320187be13a Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 20 Nov 2024 10:50:20 -0800 Subject: [PATCH 50/52] operator fee manager --- specs/protocol/configurability.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/protocol/configurability.md b/specs/protocol/configurability.md index d754d1a75..9ba1a1d4a 100644 --- a/specs/protocol/configurability.md +++ b/specs/protocol/configurability.md @@ -463,7 +463,7 @@ configuration of the permissioned dispute game.
**Description:** Account authorized to modify the operator fee scalar.
**Administrator:** [System Config Owner](#admin-roles)
-**Requirement:**
-**Notes:**
+**Requirement:** `address(0)`
+**Notes:** For standard configurations, the operator fee manager is not used, so it is set to the null address.
[^of-gnosis-safe-l1]: 5 of 7 GnosisSafe controlled by Optimism Foundation (OF). Mainnet and Sepolia addresses can be found at [privileged roles](https://docs.optimism.io/chain/security/privileged-roles). From 65126640304e23ffa48e852ff29db6548d110d40 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Sun, 24 Nov 2024 22:39:06 -0800 Subject: [PATCH 51/52] clarification on l1 block attributes function selector --- specs/protocol/isthmus/l1-attributes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/specs/protocol/isthmus/l1-attributes.md b/specs/protocol/isthmus/l1-attributes.md index e9aa4da6d..1f1e0e559 100644 --- a/specs/protocol/isthmus/l1-attributes.md +++ b/specs/protocol/isthmus/l1-attributes.md @@ -27,6 +27,9 @@ The L1 block attributes transaction is updated to include the operator fee param | operatorFeeScalar | uint32 | 164-167 | 6 | | operatorFeeConstant | uint64 | 168-175 | | +Note that the first input argument, in the same pattern as previous versions of the L1 attributes transaction, +is the function selector: the first four bytes of `keccak256("setL1BlockValuesIsthmus()")`. + In the first L2 block after the Isthmus activation block, the Isthmus L1 attributes are first used. The pre-Isthmus values are migrated over 1:1. From c7cffb13c4634cbe9fb96898aafda721754ff981 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Wed, 4 Dec 2024 12:22:43 -0800 Subject: [PATCH 52/52] Update to getL1Fee; --- specs/protocol/isthmus/predeploys.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/specs/protocol/isthmus/predeploys.md b/specs/protocol/isthmus/predeploys.md index 9df6bdec2..291446446 100644 --- a/specs/protocol/isthmus/predeploys.md +++ b/specs/protocol/isthmus/predeploys.md @@ -243,6 +243,12 @@ is read directly from storage. If `isIsthmus` is false, then this function MUST function getOperatorFee(uint256 gasUsed)(uint256) ``` +##### `getL1Fee` + +This function will be updated to include the operator fee, for post-Isthmus chains. The API will +remain the same. Since the operator fee is 0 by default, most chains who are not using the operator +fee will not be affected by this change. + ### OptimismMintableERC721Factory The chain id is no longer read from storage but instead is read from the `L1Block` contract by calling