-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
holocene: smart contract changes (#358)
* holocene: standard L2 genesis This scopes out the work for implementing the standard L2 genesis smart contract changes. The additional diff on top of this smart contract work is defining the network upgrade transactions, the public interface for the `SystemConfig` for setting these values and the enum `ConfigType` definition. * lint * lint: escape * specs: fixup * specs: fixup * specs: fixup * lint: fix * lint: fix * specs: update * specs: lintspecs: lintspecs: lintspecs: lintspecs: lintspecs: lintspecs: lintspecs: lint * lint: fix * specs: cleanup * specs: toc * specs: update * toc: update * specs: fix * lint: fix * lint: fix * lint: fix * lint * specs: update * lint: specs * specs: update * specs: more updates * specs: toc * specs: update name * specs: update * specs: specify initialize * specs: toc * lint: fix * specs: delete dead spec * specs: lint fix
- Loading branch information
Showing
7 changed files
with
488 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# Configurability | ||
|
||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** | ||
|
||
- [Overview](#overview) | ||
- [Constants](#constants) | ||
- [`ConfigType`](#configtype) | ||
- [`SystemConfig`](#systemconfig) | ||
- [`ConfigUpdate`](#configupdate) | ||
- [Initialization](#initialization) | ||
- [Modifying EIP-1559 Parameters](#modifying-eip-1559-parameters) | ||
- [Interface](#interface) | ||
- [EIP-1559 Params](#eip-1559-params) | ||
- [`setEIP1559Params`](#seteip1559params) | ||
- [Fee Vault Config](#fee-vault-config) | ||
- [`setBaseFeeVaultConfig`](#setbasefeevaultconfig) | ||
- [`setL1FeeVaultConfig`](#setl1feevaultconfig) | ||
- [`setSequencerFeeVaultConfig`](#setsequencerfeevaultconfig) | ||
- [`OptimismPortal`](#optimismportal) | ||
- [Interface](#interface-1) | ||
- [`setConfig`](#setconfig) | ||
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
## Overview | ||
|
||
The `SystemConfig` and `OptimismPortal` are updated with a new flow for chain | ||
configurability. | ||
|
||
## Constants | ||
|
||
### `ConfigType` | ||
|
||
The `ConfigType` enum represents configuration that can be modified. | ||
|
||
| Name | Value | Description | | ||
| ---- | ----- | --- | | ||
| `SET_GAS_PAYING_TOKEN` | `uint8(0)` | Modifies the gas paying token for the chain | | ||
| `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 | | ||
|
||
## `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(_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 | | ||
|
||
### Initialization | ||
|
||
The following actions should happen during the initialization of the `SystemConfig`: | ||
|
||
- `emit ConfigUpdate.BATCHER` | ||
- `emit ConfigUpdate.FEE_SCALARS` | ||
- `emit ConfigUpdate.GAS_LIMIT` | ||
- `emit ConfigUpdate.UNSAFE_BLOCK_SIGNER` | ||
- `emit ConfigUpdate.EIP_1559_PARAMS` | ||
- `setConfig(SET_GAS_PAYING_TOKEN)` | ||
- `setConfig(SET_BASE_FEE_VAULT_CONFIG)` | ||
- `setConfig(SET_L1_FEE_VAULT_CONFIG)` | ||
- `setConfig(SET_SEQUENCER_FEE_VAULT_CONFIG)` | ||
- `setConfig(SET_L1_CROSS_DOMAIN_MESSENGER_ADDRESS)` | ||
- `setConfig(SET_L1_ERC_721_BRIDGE_ADDRESS)` | ||
- `setConfig(SET_L1_STANDARD_BRIDGE_ADDRESS)` | ||
- `setConfig(SET_REMOTE_CHAIN_ID)` | ||
|
||
These actions MAY only be triggered if there is a diff to the value. | ||
|
||
### Modifying EIP-1559 Parameters | ||
|
||
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`. | ||
|
||
### Interface | ||
|
||
#### EIP-1559 Params | ||
|
||
##### `setEIP1559Params` | ||
|
||
This function MUST only be callable by the chain governor. | ||
|
||
```solidity | ||
function setEIP1559Params(uint64 _denominator, uint64 _elasticity) | ||
``` | ||
|
||
The `_denominator` and `_elasticity` MUST be set to values greater to than 0. | ||
It is possible for the chain operator to set EIP-1559 parameters that result in poor user experience. | ||
|
||
#### Fee Vault Config | ||
|
||
For each `FeeVault`, there is a setter for its config. The arguments to the setter include | ||
the `RECIPIENT`, the `MIN_WITHDRAWAL_AMOUNT` and the `WithdrawalNetwork`. | ||
Each of these functions should be `public` and only callable by the chain governor. | ||
|
||
Each function calls `OptimismPortal.setConfig(ConfigType,bytes)` with its corresponding `ConfigType`. | ||
|
||
##### `setBaseFeeVaultConfig` | ||
|
||
```solidity | ||
function setBaseFeeVaultConfig(address,uint256,WithdrawalNetwork) | ||
``` | ||
|
||
##### `setL1FeeVaultConfig` | ||
|
||
```solidity | ||
function setL1FeeVaultConfig(address,uint256,WithdrawalNetwork) | ||
``` | ||
|
||
##### `setSequencerFeeVaultConfig` | ||
|
||
```solidity | ||
function setSequencerFeeVaultConfig(address,uint256,WithdrawalNetwork) | ||
``` | ||
|
||
## `OptimismPortal` | ||
|
||
The `OptimismPortal` is updated to emit a special system `TransactionDeposited` event. | ||
|
||
### Interface | ||
|
||
#### `setConfig` | ||
|
||
The `setConfig` function MUST only be callable by the `SystemConfig`. This ensures that the `SystemConfig` | ||
is the single source of truth for chain operator ownership. | ||
|
||
```solidity | ||
function setConfig(ConfigType,bytes) | ||
``` | ||
|
||
This function emits a `TransactionDeposited` event. | ||
|
||
```solidity | ||
event TransactionDeposited(address indexed from, address indexed to, uint256 indexed version, bytes opaqueData); | ||
``` | ||
|
||
The following fields are included: | ||
|
||
- `from` is the `DEPOSITOR_ACCOUNT` | ||
- `to` is `Predeploys.L1Block` | ||
- `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))` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Derivation | ||
|
||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** | ||
|
||
- [Network upgrade automation transactions](#network-upgrade-automation-transactions) | ||
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
# Network upgrade automation transactions | ||
|
||
The Holocene 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 Holocene | ||
- OptimismMintableERC20Factory deployment | ||
- Update OptimismMintableERC20Factory Proxy ERC-1967 Implementation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# L1 Block Attributes | ||
|
||
<!-- START doctoc generated TOC please keep comment here to allow auto update --> | ||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> | ||
**Table of Contents** | ||
|
||
- [Overview](#overview) | ||
|
||
<!-- END doctoc generated TOC please keep comment here to allow auto update --> | ||
|
||
## Overview | ||
|
||
The L1 block attributes transaction is updated to include the EIP-1559 parameters. | ||
|
||
| 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 | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.