diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index ebdb6b6b1..8f97b4f84 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -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) diff --git a/book/src/building/README.md b/book/src/building/README.md new file mode 100644 index 000000000..6a0ee39a7 --- /dev/null +++ b/book/src/building/README.md @@ -0,0 +1,3 @@ +# Building + +This section offers in-depth documentation into the various `op-alloy` crates. diff --git a/book/src/building/genesis/rollup-config.md b/book/src/building/genesis/rollup-config.md new file mode 100644 index 000000000..8bde48ffd --- /dev/null +++ b/book/src/building/genesis/rollup-config.md @@ -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` + + + +[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 diff --git a/book/src/building/genesis/system-config.md b/book/src/building/genesis/system-config.md new file mode 100644 index 000000000..10cf129f8 --- /dev/null +++ b/book/src/building/genesis/system-config.md @@ -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 diff --git a/book/src/examples/README.md b/book/src/examples/README.md new file mode 100644 index 000000000..e22c01625 --- /dev/null +++ b/book/src/examples/README.md @@ -0,0 +1,5 @@ +# Examples + +Examples for working with `op-alloy-*` crates. + +TODO: document `op-alloy` crate use and using it with re-exports. diff --git a/book/src/intro.md b/book/src/intro.md index c150e4d92..1bdf0eafc 100644 --- a/book/src/intro.md +++ b/book/src/intro.md @@ -21,11 +21,11 @@ performance types, traits, and middleware from [alloy][alloy]. To get started with op-alloy, add op-alloy crates as a dependency and take your first steps. -### [Building with op-alloy](./building/rollup-configs.md) +### [Building with op-alloy](./building/README.md) A walkthrough of building with op-alloy. -### [Examples](./examples/genesis/loading-a-rollup-config.md) +### [Examples](./examples/README.md) This section will give you practical examples of how Alloy can be used in your codebase.