-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(book): Genesis - System Config (#211)
### Description Adds docs for the `SystemConfig` and structures the book out a bit.
- Loading branch information
Showing
6 changed files
with
88 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
# Summary | ||
|
||
- [Introduction](./intro.md) | ||
- [Glossary](./glossary.md) | ||
- [Getting Started](./starting/installation.md) | ||
- [Building](./building/README.md) | ||
- [Genesis](./building/genesis/README.md) | ||
- [Rollup Config](./building/genesis/rollup-config.md) | ||
- [System Config](./building/genesis/system-config.md) | ||
- [Examples](./examples/README.md) | ||
- [Contributing](./CONTRIBUTING.md) | ||
- [Licensing](./LICENSE.md) | ||
- [Glossary](./glossary.md) |
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,3 @@ | ||
# Building | ||
|
||
This section offers in-depth documentation into the various `op-alloy` crates. |
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,38 @@ | ||
# Rollup Configs | ||
|
||
Rollup configurations are a consensus construct used to configure an Optimism Consensus client. | ||
When an OP Stack chain is deployed into production or consensus nodes are configured to sync the chain, | ||
certain consensus parameters can be configured. These parameters are defined in the [OP Stack specs][config]. | ||
|
||
Consensus parameters are consumed by OP Stack software through the `RollupConfig` type defined in the | ||
[`op-alloy-genesis`][genesis] crate. | ||
|
||
## `RollupConfig` Type | ||
|
||
The [`RollupConfig`][rc] type is defined in [`op-alloy-genesis`][genesis]. | ||
|
||
A predefined rollup config can be loaded from a given L2 chain id using | ||
the [`rollup_config_from_chain_id`][rcid] method. An example is shown below. | ||
|
||
```rust | ||
use op_alloy_genesis::{OP_MAINNET_CONFIG, rollup_config_from_chain_id}; | ||
|
||
let op_mainnet_config = rollup_config_from_chain_id(10).expect("infallible"); | ||
assert_eq!(OP_MAINNET_CONFIG, op_mainnet_config); | ||
``` | ||
|
||
The `OP_MAINNET_CONFIG` is one of the predefined rollup configs exported by | ||
the [`op-alloy-genesis`][genesis] crate. Other predefined configs include | ||
the following. | ||
|
||
- `OP_MAINNET_CONFIG` | ||
- `OP_SEPOLIA_CONFIG` | ||
- `BASE_MAINNET_CONFIG` | ||
- `BASE_SEPOLIA_CONFIG` | ||
|
||
<!-- Links --> | ||
|
||
[rcid]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/rollup/fn.rollup_config_from_chain_id.html | ||
[rc]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/rollup/struct.RollupConfig.html | ||
[genesis]: https://crates.io/crates/op-alloy-genesis | ||
[config]: https://specs.optimism.io/protocol/configurability.html |
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,32 @@ | ||
# System Config | ||
|
||
The system configuration is a set of configurable chain parameters | ||
defined in a contract on L1. These parameters can be changed through | ||
the system config contract, emitting events that are picked up by | ||
the [rollup node derivation process][derivation]. To dive deeper | ||
into the System Config, visit the [OP Stack Specifications][specs]. | ||
|
||
## `SystemConfig` Type | ||
|
||
The [`SystemConfig`][sc] type is defined in [`op-alloy-genesis`][genesis]. | ||
|
||
Parameters defined in the [`SystemConfig`][sc] are expected to be updated | ||
through L1 receipts, using the [`update_with_receipts`][update] method. | ||
|
||
## Holocene Updates | ||
|
||
The [Holocene Hardfork][holocene] introduced an update to the [`SystemConfig`][sc] | ||
type, adding EIP-1559 parameters to the config. | ||
|
||
The [`SystemConfig`][sc] type in [`op-alloy-genesis`][genesis] provides a method | ||
called [`eip_1559_params`][eip] that returns the EIP-1559 parameters encoded as | ||
a [`B64`][b64]. | ||
|
||
[holocene]: https://specs.optimism.io/protocol/holocene/overview.html | ||
[b64]: https://docs.rs/alloy-primitives/latest/alloy_primitives/aliases/type.B64.html | ||
[eip]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/system/struct.SystemConfig.html#method.eip_1559_params | ||
[update]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/system/struct.SystemConfig.html#method.update_with_receipts | ||
[sc]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/system/struct.SystemConfig.html | ||
[specs]: https://specs.optimism.io/protocol/system-config.html#system-config | ||
[derivation]: https://specs.optimism.io/protocol/derivation.html | ||
[genesis]: https://crates.io/crates/op-alloy-genesis |
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,5 @@ | ||
# Examples | ||
|
||
Examples for working with `op-alloy-*` crates. | ||
|
||
TODO: document `op-alloy` crate use and using it with re-exports. |
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