Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interop: add separation for static vs. dynamic values in L1Attributes #179

Merged
merged 28 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d3c1b07
interop: add separation for static vs dynamic values in L1Attributes
0xfuturistic May 9, 2024
b8fcbc1
interop: add setConfig to L1Block
0xfuturistic May 9, 2024
692033e
interop: drop consecutive blank line
0xfuturistic May 9, 2024
e7478ef
interop: add subsections for L1Block section
0xfuturistic May 9, 2024
66d4025
interop: add BaseFeeScalar, BlobBaseFeeScalar to static values in L1B…
0xfuturistic May 9, 2024
7703b3e
interop: update table of contents
0xfuturistic May 9, 2024
9238943
interop: drop L1 Attributes subsection
0xfuturistic May 10, 2024
7a9a428
interop: update table of contents
0xfuturistic May 10, 2024
bd5c70c
interop: improve subsection for setConfig
0xfuturistic May 10, 2024
d1cc33a
interop: fix lint
0xfuturistic May 10, 2024
01a118d
interop: update table of contents
0xfuturistic May 10, 2024
6b382fc
interop: more precise breakdown of second argument of `setConfig`
0xfuturistic May 10, 2024
cbd2bff
contracts-bedrock: fix line lengths in predeploys
0xfuturistic May 10, 2024
0e5a865
interop: use table for config values
0xfuturistic May 13, 2024
dab1593
interop: add appendix
0xfuturistic May 13, 2024
a91c032
interop: break vars into list for setConfig
0xfuturistic May 13, 2024
f9b41c5
interop: rename setConfig subsection to Static Configuration
0xfuturistic May 13, 2024
d6bc872
interop: fix lint
0xfuturistic May 13, 2024
db9295e
interop: fix lint
0xfuturistic May 13, 2024
61fbc9b
interop: add dependencySet() method
0xfuturistic May 13, 2024
0f2a169
interop: improve wording around L1Block methods
0xfuturistic May 13, 2024
0c98b47
interop: fix lint
0xfuturistic May 13, 2024
aee036c
interop: add inline definition for static values
0xfuturistic May 13, 2024
47ff3b7
interop: update table of contents
0xfuturistic May 13, 2024
edfaf05
interop: add auth for L1Block set config
0xfuturistic May 13, 2024
70aafce
interop: add type for chainId
0xfuturistic May 13, 2024
5aa63da
interop: define constant for depositor account
0xfuturistic May 13, 2024
fa21980
interop: fix lint
0xfuturistic May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 57 additions & 32 deletions specs/interop/predeploys.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
- [Sending Messages](#sending-messages)
- [Relaying Messages](#relaying-messages)
- [L1Block](#l1block)
- [L1Attributes](#l1attributes)
- [Static Configuration](#static-configuration)
- [Dependency Set](#dependency-set)
- [Security Considerations](#security-considerations)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Expand Down Expand Up @@ -233,37 +234,61 @@ getters.

## L1Block

| Constant | Value |
|----------|----------------------------------------------|
| Address | `0x4200000000000000000000000000000000000015` |

The `L1Block` contract is updated to include the set of allowed chains. The L1 Attributes transaction
sets the set of allowed chains. The `L1Block` contract MUST provide a public getter to check if a particular
chain is in the dependency set called `isInDependencySet(uint256)`. This function MUST return true when
the chain's chain id is passed in as an argument.

The `setL1BlockValuesInterop()` function MUST be called on every block after the interop upgrade block.
The interop upgrade block itself MUST include a call to `setL1BlockValuesEcotone`.

### L1Attributes

The L1 Atrributes transaction is updated to include the dependency set. Since the dependency set is dynamically sized,
a `uint8` "interopSetSize" parameter prefixes tightly packed `uint256` values that represent each chain id.

| Input arg | Type | Calldata bytes | Segment |
|-------------------|--------------------------|-------------------------|---------|
| {0x760ee04d} | bytes4 | 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 |
| interopSetSize | uint8 | 164-165 | 6 |
| chainIds | uint256\[interopSetSize] | 165-(32*interopSetSize) | 6+ |
| Constant | Value |
|---------------------|----------------------------------------------|
| Address | `0x4200000000000000000000000000000000000015` |
| `DEPOSITOR_ACCOUNT` | `0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001` |

### Static Configuration

The `L1Block` contract MUST include method `setConfig(ConfigType, bytes)` for setting the system's static values, which
0xfuturistic marked this conversation as resolved.
Show resolved Hide resolved
are defined as values that only change based on the chain operator's input. This function serves to reduce the size of
the L1 Attributes transaction, as well as to reduce the need to add specific one off functions. It can only be called by
0xfuturistic marked this conversation as resolved.
Show resolved Hide resolved
`DEPOSITOR_ACCOUNT`.

The `ConfigType` enum is defined as follows:

```solidity
enum ConfigType {
GAS_PAYING_TOKEN,
ADD_DEPENDENCY,
REMOVE_DEPENDENCY
}
```

The second argument to `setConfig` is a `bytes` value that is ABI encoded with the necessary values for the `ConfigType`.

| ConfigType | Value |
|---------------------|---------------------------------------------|
| `GAS_PAYING_TOKEN` | `abi.encode(token, decimals, name, symbol)` |
| `ADD_DEPENDENCY` | `abi.encode(chainId)` |
| `REMOVE_DEPENDENCY` | `abi.encode(chainId)` |

where

- `token` is the gas paying token's address (type `address`)

- `decimals` is the gas paying token's decimals (type `uint8`)

- `name` is the gas paying token's name (type `bytes32`)

- `symbol` is the gas paying token's symbol (type `bytes32`)

- `chainId` is the chain id intended to be added or removed from the dependency set (type `uint256`)

Calls to `setConfig` MUST originate from `SystemConfig` and are forwarded to `L1Block` by `OptimismPortal`.

### Dependency Set

`L1Block` is updated to include the set of allowed chains. These chains are added and removed through `setConfig` calls
with `ADD_DEPENDENCY` or `REMOVE_DEPENDENCY`, respectively.

`L1Block` MUST provide a public getter to check if a particular chain is in the dependency set called
`isInDependencySet(uint256)`. This function MUST return true when a chain id in the dependency set, or the chain's chain
id, is passed in as an argument, and false otherwise. Additionally, `L1Block` MUST provide a public getter to return the
dependency set called `dependencySet()`. This function MUST return the array of chain ids that are in the dependency set.
`L1Block` MUST also provide a public getter to get the dependency set size called `dependencySetSize()`. This function
MUST return the length of the dependency set array.

## Security Considerations

Expand Down