From bfbbd98816c156ec8707cba4216e7e32544bfa86 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Tue, 7 Jan 2025 22:02:08 +0100 Subject: [PATCH] Migrate alloy-rs/op-alloy-protocol->op-rs/maili-protocol & alloy-rs/op-alloy-provider->op-rs/maili-provider --- .github/ISSUE_TEMPLATE/BUG-FORM.yml | 12 +- .github/ISSUE_TEMPLATE/FEATURE-FORM.yml | 8 - .github/PULL_REQUEST_TEMPLATE.md | 2 +- .github/workflows/ci.yml | 4 +- Cargo.toml | 26 +- Justfile | 2 +- README.md | 60 +- book/README.md | 4 +- book/book.toml | 6 +- book/src/CONTRIBUTING.md | 14 +- book/src/LICENSE.md | 10 +- book/src/building/README.md | 34 +- book/src/building/consensus.md | 84 - book/src/building/engine.md | 30 - book/src/building/genesis/README.md | 14 - book/src/building/genesis/rollup-config.md | 37 - book/src/building/genesis/system-config.md | 30 - book/src/building/protocol/README.md | 26 +- book/src/building/protocol/batches.md | 24 +- book/src/building/protocol/block-info.md | 6 +- book/src/building/protocol/channels.md | 14 +- book/src/building/protocol/frames.md | 28 +- book/src/building/rollup-configs.md | 37 - book/src/building/rpc_types.md | 20 - book/src/examples/README.md | 4 +- book/src/examples/batch-to-frames.md | 2 +- book/src/examples/frames-to-batch.md | 2 +- book/src/examples/load-a-rollup-config.md | 34 - .../examples/new-l1-block-info-tx-hardfork.md | 113 - book/src/glossary.md | 2 +- book/src/intro.md | 30 +- book/src/links.md | 80 +- book/src/starting.md | 44 +- cliff.toml | 4 +- crates/consensus/Cargo.toml | 59 - crates/consensus/README.md | 25 - crates/consensus/src/block.rs | 6 - crates/consensus/src/eip1559.rs | 99 - .../src/hardforks/bytecode/ecotone_tx_0.hex | 1 - .../src/hardforks/bytecode/ecotone_tx_1.hex | 1 - .../src/hardforks/bytecode/ecotone_tx_2.hex | 1 - .../src/hardforks/bytecode/ecotone_tx_3.hex | 1 - .../src/hardforks/bytecode/ecotone_tx_4.hex | 1 - .../src/hardforks/bytecode/ecotone_tx_5.hex | 1 - .../hardforks/bytecode/eip4788_ecotone.hex | 1 - .../src/hardforks/bytecode/fjord_tx_0.hex | 1 - .../src/hardforks/bytecode/fjord_tx_1.hex | 1 - .../src/hardforks/bytecode/fjord_tx_2.hex | 1 - .../src/hardforks/bytecode/gpo_ecotone.hex | 1 - .../src/hardforks/bytecode/gpo_fjord.hex | 1 - .../hardforks/bytecode/l1_block_ecotone.hex | 1 - crates/consensus/src/hardforks/ecotone.rs | 192 -- crates/consensus/src/hardforks/fjord.rs | 127 - crates/consensus/src/hardforks/forks.rs | 52 - crates/consensus/src/hardforks/mod.rs | 16 - crates/consensus/src/hardforks/traits.rs | 9 - crates/consensus/src/hardforks/utils.rs | 13 - crates/consensus/src/lib.rs | 47 - crates/consensus/src/receipt/envelope.rs | 377 --- crates/consensus/src/receipt/mod.rs | 18 - crates/consensus/src/receipt/receipts.rs | 352 --- crates/consensus/src/transaction/deposit.rs | 671 ----- crates/consensus/src/transaction/envelope.rs | 628 ----- crates/consensus/src/transaction/mod.rs | 60 - crates/consensus/src/transaction/pooled.rs | 523 ---- crates/consensus/src/transaction/source.rs | 128 - crates/consensus/src/transaction/tx_type.rs | 165 -- crates/consensus/src/transaction/typed.rs | 392 --- crates/genesis/Cargo.toml | 51 - crates/genesis/README.md | 37 - crates/genesis/src/addresses.rs | 118 - crates/genesis/src/chain.rs | 256 -- crates/genesis/src/genesis.rs | 88 - crates/genesis/src/lib.rs | 44 - crates/genesis/src/params.rs | 106 - crates/genesis/src/rollup.rs | 556 ---- crates/genesis/src/system.rs | 768 ------ crates/network/Cargo.toml | 27 - crates/network/README.md | 15 - crates/network/src/lib.rs | 235 -- crates/op-alloy/Cargo.toml | 87 - crates/op-alloy/README.md | 96 - crates/op-alloy/src/lib.rs | 44 - crates/protocol/Cargo.toml | 4 +- crates/protocol/README.md | 15 +- crates/protocol/examples/batch_to_frames.rs | 4 +- crates/protocol/examples/frames_to_batch.rs | 2 +- crates/protocol/src/lib.rs | 4 +- crates/provider/Cargo.toml | 4 +- crates/provider/README.md | 12 +- crates/provider/src/lib.rs | 4 +- crates/registry/Cargo.toml | 31 - crates/registry/Justfile | 9 - crates/registry/README.md | 101 - crates/registry/etc/bind.sh | 24 - crates/registry/etc/chainList.json | 583 ---- crates/registry/etc/configs.json | 2336 ----------------- crates/registry/src/chain_list.rs | 67 - crates/registry/src/lib.rs | 56 - crates/registry/src/superchain.rs | 190 -- .../registry/src/test_utils/base_mainnet.rs | 54 - .../registry/src/test_utils/base_sepolia.rs | 54 - crates/registry/src/test_utils/mod.rs | 13 - crates/registry/src/test_utils/op_mainnet.rs | 54 - crates/registry/src/test_utils/op_sepolia.rs | 54 - crates/registry/superchain-registry | 1 - crates/rpc-jsonrpsee/Cargo.toml | 38 - crates/rpc-jsonrpsee/README.md | 10 - crates/rpc-jsonrpsee/src/lib.rs | 12 - crates/rpc-jsonrpsee/src/traits.rs | 149 -- crates/rpc-types-engine/Cargo.toml | 68 - crates/rpc-types-engine/README.md | 10 - crates/rpc-types-engine/src/attributes.rs | 164 -- crates/rpc-types-engine/src/envelope.rs | 213 -- crates/rpc-types-engine/src/lib.rs | 29 - crates/rpc-types-engine/src/payload_v3.rs | 41 - crates/rpc-types-engine/src/payload_v4.rs | 46 - crates/rpc-types-engine/src/superchain.rs | 410 --- crates/rpc-types/Cargo.toml | 64 - crates/rpc-types/README.md | 10 - crates/rpc-types/src/config.rs | 83 - crates/rpc-types/src/genesis.rs | 259 -- crates/rpc-types/src/lib.rs | 37 - crates/rpc-types/src/net.rs | 305 --- crates/rpc-types/src/output.rs | 25 - crates/rpc-types/src/receipt.rs | 316 --- crates/rpc-types/src/safe_head.rs | 29 - crates/rpc-types/src/sync.rs | 67 - crates/rpc-types/src/transaction.rs | 320 --- crates/rpc-types/src/transaction/request.rs | 202 -- scripts/check_no_std.sh | 8 +- 131 files changed, 200 insertions(+), 13738 deletions(-) delete mode 100644 book/src/building/consensus.md delete mode 100644 book/src/building/engine.md delete mode 100644 book/src/building/genesis/README.md delete mode 100644 book/src/building/genesis/rollup-config.md delete mode 100644 book/src/building/genesis/system-config.md delete mode 100644 book/src/building/rollup-configs.md delete mode 100644 book/src/building/rpc_types.md delete mode 100644 book/src/examples/load-a-rollup-config.md delete mode 100644 book/src/examples/new-l1-block-info-tx-hardfork.md delete mode 100644 crates/consensus/Cargo.toml delete mode 100644 crates/consensus/README.md delete mode 100644 crates/consensus/src/block.rs delete mode 100644 crates/consensus/src/eip1559.rs delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_0.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_1.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_2.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_3.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_4.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/ecotone_tx_5.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/eip4788_ecotone.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/fjord_tx_0.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/fjord_tx_1.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/fjord_tx_2.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/gpo_ecotone.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/gpo_fjord.hex delete mode 100644 crates/consensus/src/hardforks/bytecode/l1_block_ecotone.hex delete mode 100644 crates/consensus/src/hardforks/ecotone.rs delete mode 100644 crates/consensus/src/hardforks/fjord.rs delete mode 100644 crates/consensus/src/hardforks/forks.rs delete mode 100644 crates/consensus/src/hardforks/mod.rs delete mode 100644 crates/consensus/src/hardforks/traits.rs delete mode 100644 crates/consensus/src/hardforks/utils.rs delete mode 100644 crates/consensus/src/lib.rs delete mode 100644 crates/consensus/src/receipt/envelope.rs delete mode 100644 crates/consensus/src/receipt/mod.rs delete mode 100644 crates/consensus/src/receipt/receipts.rs delete mode 100644 crates/consensus/src/transaction/deposit.rs delete mode 100644 crates/consensus/src/transaction/envelope.rs delete mode 100644 crates/consensus/src/transaction/mod.rs delete mode 100644 crates/consensus/src/transaction/pooled.rs delete mode 100644 crates/consensus/src/transaction/source.rs delete mode 100644 crates/consensus/src/transaction/tx_type.rs delete mode 100644 crates/consensus/src/transaction/typed.rs delete mode 100644 crates/genesis/Cargo.toml delete mode 100644 crates/genesis/README.md delete mode 100644 crates/genesis/src/addresses.rs delete mode 100644 crates/genesis/src/chain.rs delete mode 100644 crates/genesis/src/genesis.rs delete mode 100644 crates/genesis/src/lib.rs delete mode 100644 crates/genesis/src/params.rs delete mode 100644 crates/genesis/src/rollup.rs delete mode 100644 crates/genesis/src/system.rs delete mode 100644 crates/network/Cargo.toml delete mode 100644 crates/network/README.md delete mode 100644 crates/network/src/lib.rs delete mode 100644 crates/op-alloy/Cargo.toml delete mode 100644 crates/op-alloy/README.md delete mode 100644 crates/op-alloy/src/lib.rs delete mode 100644 crates/registry/Cargo.toml delete mode 100644 crates/registry/Justfile delete mode 100644 crates/registry/README.md delete mode 100755 crates/registry/etc/bind.sh delete mode 100644 crates/registry/etc/chainList.json delete mode 100644 crates/registry/etc/configs.json delete mode 100644 crates/registry/src/chain_list.rs delete mode 100644 crates/registry/src/lib.rs delete mode 100644 crates/registry/src/superchain.rs delete mode 100644 crates/registry/src/test_utils/base_mainnet.rs delete mode 100644 crates/registry/src/test_utils/base_sepolia.rs delete mode 100644 crates/registry/src/test_utils/mod.rs delete mode 100644 crates/registry/src/test_utils/op_mainnet.rs delete mode 100644 crates/registry/src/test_utils/op_sepolia.rs delete mode 160000 crates/registry/superchain-registry delete mode 100644 crates/rpc-jsonrpsee/Cargo.toml delete mode 100644 crates/rpc-jsonrpsee/README.md delete mode 100644 crates/rpc-jsonrpsee/src/lib.rs delete mode 100644 crates/rpc-jsonrpsee/src/traits.rs delete mode 100644 crates/rpc-types-engine/Cargo.toml delete mode 100644 crates/rpc-types-engine/README.md delete mode 100644 crates/rpc-types-engine/src/attributes.rs delete mode 100644 crates/rpc-types-engine/src/envelope.rs delete mode 100644 crates/rpc-types-engine/src/lib.rs delete mode 100644 crates/rpc-types-engine/src/payload_v3.rs delete mode 100644 crates/rpc-types-engine/src/payload_v4.rs delete mode 100644 crates/rpc-types-engine/src/superchain.rs delete mode 100644 crates/rpc-types/Cargo.toml delete mode 100644 crates/rpc-types/README.md delete mode 100644 crates/rpc-types/src/config.rs delete mode 100644 crates/rpc-types/src/genesis.rs delete mode 100644 crates/rpc-types/src/lib.rs delete mode 100644 crates/rpc-types/src/net.rs delete mode 100644 crates/rpc-types/src/output.rs delete mode 100644 crates/rpc-types/src/receipt.rs delete mode 100644 crates/rpc-types/src/safe_head.rs delete mode 100644 crates/rpc-types/src/sync.rs delete mode 100644 crates/rpc-types/src/transaction.rs delete mode 100644 crates/rpc-types/src/transaction/request.rs diff --git a/.github/ISSUE_TEMPLATE/BUG-FORM.yml b/.github/ISSUE_TEMPLATE/BUG-FORM.yml index 6a8ed1b4..7ce591bc 100644 --- a/.github/ISSUE_TEMPLATE/BUG-FORM.yml +++ b/.github/ISSUE_TEMPLATE/BUG-FORM.yml @@ -15,23 +15,15 @@ body: description: What component is the bug in? multiple: true options: - - consensus - - network - - genesis - protocol - provider - - op-alloy - - registry - - rpc-jsonrpsee - - rpc-types - - rpc-types-engine - other validations: required: true - type: input attributes: - label: What version of op-alloy are you on? - placeholder: "Run `cargo tree | grep op-alloy` and paste the output here" + label: What version of maili are you on? + placeholder: "Run `cargo tree | grep maili` and paste the output here" - type: dropdown attributes: label: Operating System diff --git a/.github/ISSUE_TEMPLATE/FEATURE-FORM.yml b/.github/ISSUE_TEMPLATE/FEATURE-FORM.yml index c15dc772..d93ce5be 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE-FORM.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE-FORM.yml @@ -13,16 +13,8 @@ body: description: What crate is the feature for? multiple: true options: - - consensus - - network - - genesis - protocol - provider - - op-alloy - - registry - - rpc-jsonrpsee - - rpc-types - - rpc-types-engine - other validations: required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 27830988..5da09c12 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -4,7 +4,7 @@ the requirements below. Bug fixes and new features should include tests. -Contributors guide: https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md +Contributors guide: https://github.com/op-rs/maili/blob/main/CONTRIBUTING.md The contributors guide includes instructions for running rustfmt and building the documentation. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 697a1aa0..bf6e74d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: cache-on-failure: true - name: cargo hack run: | - cargo hack build --workspace --target wasm32-unknown-unknown --exclude op-alloy-network --exclude op-alloy-rpc-jsonrpsee --exclude op-alloy-provider + cargo hack build --workspace --target wasm32-unknown-unknown --exclude maili-provider wasm-wasi: runs-on: ubuntu-latest @@ -103,7 +103,7 @@ jobs: cache-on-failure: true - name: cargo hack run: | - cargo hack build --workspace --target wasm32-wasip1 --exclude op-alloy-network --exclude op-alloy-rpc-types --exclude op-alloy-provider + cargo hack build --workspace --target wasm32-wasip1 --exclude maili-provider no-std: runs-on: ubuntu-latest diff --git a/Cargo.toml b/Cargo.toml index 66da46e0..4b0d8a46 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,13 +3,13 @@ members = ["crates/*"] resolver = "2" [workspace.package] -version = "0.9.0" +version = "0.1.0" edition = "2021" rust-version = "1.81" authors = ["Alloy Contributors"] license = "MIT OR Apache-2.0" -homepage = "https://github.com/alloy-rs/op-alloy" -repository = "https://github.com/alloy-rs/op-alloy" +homepage = "https://github.com/op-rs/maili" +repository = "https://github.com/op-rs/maili" exclude = ["benches/", "tests/"] [workspace.lints.rustdoc] @@ -36,15 +36,17 @@ rustdoc-args = ["--cfg", "docsrs"] [workspace.dependencies] # Workspace -op-alloy-genesis = { version = "0.9.0", path = "crates/genesis", default-features = false } -op-alloy-protocol = { version = "0.9.0", path = "crates/protocol", default-features = false } -op-alloy-consensus = { version = "0.9.0", path = "crates/consensus", default-features = false } -op-alloy-network = { version = "0.9.0", path = "crates/network", default-features = false } -op-alloy-provider = { version = "0.9.0", path = "crates/provider", default-features = false } -op-alloy-registry = { version = "0.9.0", path = "crates/registry", default-features = false } -op-alloy-rpc-types = { version = "0.9.0", path = "crates/rpc-types", default-features = false } -op-alloy-rpc-jsonrpsee = { version = "0.9.0", path = "crates/rpc-jsonrpsee", default-features = false } -op-alloy-rpc-types-engine = { version = "0.9.0", path = "crates/rpc-types-engine", default-features = false } +maili-protocol = { version = "0.1.0", path = "crates/protocol", default-features = false } +maili-provider = { version = "0.1.0", path = "crates/provider", default-features = false } + +# OP-Alloy +op-alloy-genesis = { version = "0.9.0", default-features = false } +op-alloy-consensus = { version = "0.9.0", default-features = false } +op-alloy-network = { version = "0.9.0", default-features = false } +op-alloy-registry = { version = "0.9.0", default-features = false } +op-alloy-rpc-types = { version = "0.9.0", default-features = false } +op-alloy-rpc-jsonrpsee = { version = "0.9.0", default-features = false } +op-alloy-rpc-types-engine = { version = "0.9.0", default-features = false } # Alloy alloy-eips = { version = "0.9.2", default-features = false } diff --git a/Justfile b/Justfile index 985121b9..2a925db6 100644 --- a/Justfile +++ b/Justfile @@ -54,7 +54,7 @@ check: # Runs `cargo hack check` against the workspace hack: - cargo hack check --feature-powerset --no-dev-deps --exclude op-alloy --workspace + cargo hack check --feature-powerset --no-dev-deps --workspace # Updates the git submodule source source: diff --git a/README.md b/README.md index 60f1d672..33373bcf 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,31 @@ -# op-alloy +# maili -CI -License -License -Book +CI +License +License +Book -Built on [Alloy][alloy], op-alloy connects applications to the OP Stack. +OP Stack unique types and interfaces. ## Usage -The following crates are provided by `op-alloy`. +The following crates are provided by `maili`. -- [`op-alloy-consensus`][op-alloy-consensus] -- [`op-alloy-genesis`][op-alloy-genesis] -- [`op-alloy-network`][op-alloy-network] -- [`op-alloy-protocol`][op-alloy-protocol] -- [`op-alloy-registry`][op-alloy-registry] -- [`op-alloy-provider`][op-alloy-provider] -- [`op-alloy-rpc-jsonrpsee`][op-alloy-rpc-jsonrpsee] -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] -- [`op-alloy-rpc-types`][op-alloy-rpc-types] +- [`maili-protocol`][maili-protocol] +- [`maili-provider`][maili-provider] ## Development Status -`op-alloy` is currently in active development, and is not yet ready for use in production. +`maili` is currently in active development, and is not yet ready for use in production. ## Supported Rust Versions (MSRV) The current MSRV (minimum supported rust version) is 1.81. -Unlike Alloy, op-alloy may use the latest stable release, +Unlike Alloy, maili may use the latest stable release, to benefit from the latest features. The MSRV is not increased automatically, and will be updated @@ -41,7 +34,7 @@ only as part of a patch (pre-1.0) or minor (post-1.0) release. ## Contributing -op-alloy is built by open source contributors like you, thank you for improving the project! +maili is built by open source contributors like you, thank you for improving the project! A [contributing guide][contributing] is available that sets guidelines for contributing. @@ -51,17 +44,13 @@ linting rules and passes clippy. ## `no_std` -op-alloy is intended to be `no_std` compatible, initially for use in [kona][kona]. +maili is intended to be `no_std` compatible, initially for use in [kona][kona]. The following crates support `no_std`. Notice, provider crates do not support `no_std` compatibility. -- [`op-alloy-genesis`][op-alloy-genesis] -- [`op-alloy-protocol`][op-alloy-protocol] -- [`op-alloy-registry`][op-alloy-registry] (note: requires `serde`) -- [`op-alloy-consensus`][op-alloy-consensus] -- [`op-alloy-rpc-types`][op-alloy-rpc-types] -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] +- [`maili-protocol`][maili-protocol] +- [`maili-provider`][maili-provider] If you would like to add no_std support to a crate, please make sure to update [scripts/check_no_std.sh][check-no-std]. @@ -69,7 +58,7 @@ please make sure to update [scripts/check_no_std.sh][check-no-std]. ## Credits -op-alloy is inspired by the work of several teams and projects, most notably [the Alloy project][alloy]. +maili implements the OP-unique spec, [op-alloy][op-alloy] is the glue that sticks OP to Ethereum. This would not be possible without the hard work from open source contributors. Thank you. @@ -89,15 +78,8 @@ shall be dual licensed as above, without any additional terms or conditions. [check-no-std]: ./scripts/check_no_std.sh [kona]: https://github.com/anton-rs/kona -[alloy]: https://github.com/alloy-rs/alloy -[contributing]: https://alloy-rs.github.io/op-alloy - -[op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus -[op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis -[op-alloy-network]: https://crates.io/crates/op-alloy-network -[op-alloy-protocol]: https://crates.io/crates/op-alloy-protocol -[op-alloy-registry]: https://crates.io/crates/op-alloy-registry -[op-alloy-provider]: https://crates.io/crates/op-alloy-provider -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee -[op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine -[op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types +[op-alloy]: https://github.com/alloy-rs/op-alloy +[contributing]: https://op-rs.github.io/maili + +[maili-protocol]: https://crates.io/crates/maili-protocol +[maili-provider]: https://crates.io/crates/maili-provider diff --git a/book/README.md b/book/README.md index c1614e4b..995c1081 100644 --- a/book/README.md +++ b/book/README.md @@ -1,6 +1,6 @@ -# `op-alloy-book` +# `maili-book` -This repository contains the source code for the op-alloy book, which is available at [alloy-rs.github.io/op-alloy](https://alloy-rs.github.io/op-alloy/). +This repository contains the source code for the maili book, which is available at [op-rs.github.io/maili](https://op-rs.github.io/maili/). ## Contributing diff --git a/book/book.toml b/book/book.toml index 51fecf78..442b20bf 100644 --- a/book/book.toml +++ b/book/book.toml @@ -3,7 +3,7 @@ authors = ["refcell"] language = "en" multilingual = false src = "src" -title = "The op-alloy Book" +title = "The maili Book" [preprocessor.mermaid] command = "mdbook-mermaid" @@ -15,7 +15,7 @@ command = "mdbook-mermaid" [output.html] default-theme = "ferra" preferred-dark-theme = "ferra" -git-repository-url = "https://github.com/alloy-rs/op-alloy" -edit-url-template = "https://github.com/alloy-rs/op-alloy/edit/main/book/{path}" +git-repository-url = "https://github.com/op-rs/" +edit-url-template = "https://github.com/op-rs/maili/edit/main/book/{path}" additional-css = ["custom.css"] additional-js = ["mermaid.min.js", "mermaid-init.js"] diff --git a/book/src/CONTRIBUTING.md b/book/src/CONTRIBUTING.md index 2a8da08c..e3c619f9 100644 --- a/book/src/CONTRIBUTING.md +++ b/book/src/CONTRIBUTING.md @@ -35,12 +35,12 @@ Before working with this repository locally, you'll need to install a few depend The [OP Stack][op-stack] is a set of standardized open-source specifications that powers Optimism, developed by the Optimism Collective. -`op-alloy` is a rust implementation of core OP Stack types, transports, -middleware and more. Not all types and implementation details in `op-alloy` +`maili` is a rust implementation of distinguished OP Stack types, transports, +middleware and more. Not all types and implementation details in `maili` are present in the OP Stack [specs][specs], and on the flipside, not all -specifications are implemented by `op-alloy`. That said, `op-alloy` is +specifications are implemented by `maili`. That said, `maili` is entirely _based off_ of the [specs][specs], and new functionality or -core modifications to `op-alloy` must be reflected in the [specs][specs]. +core modifications to `maili` must be reflected in the [specs][specs]. As such, the first step for introducing changes to the OP Stack is to [open a pr][specs-pr] in the [specs repository][specs-repo]. These @@ -49,7 +49,7 @@ implementations of the OP Stack are able to synchronize and implement the changes. Once changes are merged in the OP Stack [specs][specs] repo, they -may be added to `op-alloy` in a **backwards-compatible** way such +may be added to `maili` in a **backwards-compatible** way such that pre-upgrade functionality persists. The primary way to enable backwards-compatibility is by using timestamp-based activation for protocol upgrades. @@ -62,5 +62,5 @@ protocol upgrades. [specs-pr]: https://github.com/ethereum-optimism/specs/pulls [specs]: https://specs.optimism.io/ [op-stack]: https://docs.optimism.io/stack/getting-started -[book]: https://github.com/alloy-rs/op-alloy/tree/main/book -[new-issue]: https://github.com/alloy-rs/op-alloy/issues/new +[book]: https://github.com/op-rs/maili/tree/main/book +[new-issue]: https://github.com/op-rs/maili/issues/new diff --git a/book/src/LICENSE.md b/book/src/LICENSE.md index 414b0e98..5c0cee7d 100644 --- a/book/src/LICENSE.md +++ b/book/src/LICENSE.md @@ -1,10 +1,6 @@ # Licensing -op-alloy is dually licensed under the [Apache 2.0][apache] and the [MIT][mit] license. +maili is dually licensed under the [Apache 2.0][apache] and the [MIT][mit] license. -The [SNAPPY license][snappy] is added for the use of [snap][snap] in `op-alloy-rpc-types-engine`. - -[snap]: https://github.com/BurntSushi/rust-snappy -[snappy]: https://github.com/alloy-rs/op-alloy/blob/main/SNAPPY-LICENSE -[apache]: https://github.com/alloy-rs/op-alloy/blob/main/LICENSE-APACHE -[mit]: https://github.com/alloy-rs/op-alloy/blob/main/LICENSE-MIT +[apache]: https://github.com/op-rs/maili/blob/main/LICENSE-APACHE +[mit]: https://github.com/op-rs/maili/blob/main/LICENSE-MIT diff --git a/book/src/building/README.md b/book/src/building/README.md index 5359e68d..10817f3b 100644 --- a/book/src/building/README.md +++ b/book/src/building/README.md @@ -1,38 +1,16 @@ # Building -This section offers in-depth documentation into the various `op-alloy` crates. +This section offers in-depth documentation into the various `maili` crates. Some of the primary crates and their types are listed below. -- [`op-alloy-genesis`][op-alloy-genesis] provides the - [`RollupConfig`][rollup-config] and [`SystemConfig`][system-config] types. -- [`op-alloy-consensus`][op-alloy-consensus] provides [`OpBlock`][op-block], - [`OpTxEnvelope`][op-tx-envelope], [`OpReceiptEnvelope`][op-rx-envelope], - [`Hardforks`][hardforks], and more. -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] provides the - [`OpPayloadAttributes`][op-payload-attributes] and - [`OpAttributesWithParent`][op-attributes-with-parent]. -- [`op-alloy-protocol`][op-alloy-protocol] provides [`Frame`][frame], +- [`maili-protocol`][maili-protocol] provides [`Frame`][frame], [`Channel`][channel], [`Batch`][batch] types and more. -[rollup-config]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/rollup/struct.RollupConfig.html -[system-config]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/system/struct.SystemConfig.html +[frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[batch]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html -[op-block]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/type.OpBlock.html -[op-tx-envelope]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpTxEnvelope.html -[op-rx-envelope]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpReceiptEnvelope.html -[hardforks]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/hardforks/struct.Hardforks.html - -[op-payload-attributes]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpPayloadAttributes.html -[op-attributes-with-parent]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpAttributesWithParent.html - -[frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html - -[op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis -[op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus -[op-alloy-protocol]: https://crates.io/crates/op-alloy-protocol -[op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine +[maili-protocol]: https://crates.io/crates/maili-protocol diff --git a/book/src/building/consensus.md b/book/src/building/consensus.md deleted file mode 100644 index 909c1e0d..00000000 --- a/book/src/building/consensus.md +++ /dev/null @@ -1,84 +0,0 @@ -# Consensus - -op-alloy-consensus crate - -The `op-alloy-consensus` crate provides an Optimism consensus interface. -It contains constants, types, and functions for implementing Optimism EL -consensus and communication. This includes an extended `OpTxEnvelope` type -with [deposit transactions][deposit], and receipts containing OP Stack -specific fields (`deposit_nonce` + `deposit_receipt_version`). - -In general a type belongs in this crate if it exists in the -`alloy-consensus` crate, but was modified from the base Ethereum protocol -in the OP Stack. For consensus types that are not modified by the OP Stack, -the `alloy-consensus` types should be used instead. - - -## Block - -[`op-alloy-consensus`][consensus] exports an Optimism block type, [`OpBlock`][op-block]. - -This type simply re-uses the `alloy-consensus` block type, with `OpTxEnvelope` -as the type of transactions in the block. - - -## Transactions - -Optimism extends the Ethereum [EIP-2718][2718] transaction envelope to include a -deposit variant. - -### [`OpTxEnvelope`][envelope] - -The [`OpTxEnvelope`][envelope] type is based on [Alloy][alloy]'s -[`TxEnvelope`][tx-envelope] type. - -Optimism modifies the `TxEnvelope` to the following. -- Legacy -- EIP-2930 -- EIP-1559 -- EIP-7702 -- Deposit - -Deposit is a custom transaction type that is either an L1 attributes -deposit transaction or a user-submitted deposit transaction. Read more -about deposit transactions in [the specs][specs]. - -### Transaction Types ([`OpTxType`][ty]) - -The [`OpTxType`][ty] enumerates the transaction types using their byte identifier, -represents as a `u8` in rust. - - -## Receipt Types - -Just like [`op-alloy-consensus`][consensus] defines transaction types, -it also defines associated receipt types. - -[`OpReceiptEnvelope`][ore] defines an [Eip-2718][2718] receipt envelope type -modified for the OP Stack. It contains the following variants - mapping -directly to the `OpTxEnvelope` variants defined above. - -- Legacy -- EIP-2930 -- EIP-1559 -- EIP-7702 -- Deposit - -There is also an [`OpDepositReceipt`][odr] type, extending the alloy receipt -type with a deposit nonce and deposit receipt version. - - -## Hardforks - -Aside from transactions and receipts, [`op-alloy-consensus`][consensus] exports -one other core primitive called [`Hardforks`][hardforks]. - -Hardforks provides hardfork transaction constructors - that is, it provides -methods that return upgrade transactions for each hardfork. Some of these -are the following. - -- [`Hardforks::ecotone_txs()`][ecotone] -- [`Hardforks::fjord_txs()`][fjord] - - -{{#include ../links.md}} diff --git a/book/src/building/engine.md b/book/src/building/engine.md deleted file mode 100644 index 6aca8dc9..00000000 --- a/book/src/building/engine.md +++ /dev/null @@ -1,30 +0,0 @@ -# RPC Engine Types - -op-alloy-rpc-types-engine crate - -The [`op-alloy-rpc-types-engine`][engine] crate provides Optimism types for interfacing -with the Engine API in the OP Stack. - -Optimism defines a custom payload attributes type called [`OpPayloadAttributes`][attributes]. -`OpPayloadAttributes` extends alloy's [`PayloadAttributes`][pa] with a few fields: transactions, -a flag for enabling the tx pool, the gas limit, and EIP 1559 parameters. - -Wrapping `OpPayloadAttributes`, the [`OpAttributesWithParent`][parent] type extends payload -attributes with the parent block (referenced as an [`L2BlockInfo`][lbi]) and a flag -for whether the associated batch is the last batch in the span. - -Optimism also returns a custom type for the `engine_getPayload` request for both V3 and -V4 payload envelopes. These are the [`OpExecutionPayloadEnvelopeV3`][v3] and -[`OpExecutionPayloadEnvelopeV4`][v4] types, which both wrap payload envelope types -from [`alloy-rpc-types-engine`][alloy-engine]. - - - - -[alloy-engine]: https://crates.io/crates/alloy-rpc-types-engine -[v3]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpExecutionPayloadEnvelopeV3.html -[v4]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpExecutionPayloadEnvelopeV4.html -[parent]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpAttributesWithParent.html -[pa]: https://docs.rs/alloy-rpc-types-engine/latest/alloy_rpc_types_engine/payload/struct.PayloadAttributes.html -[attributes]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpPayloadAttributes.html -[engine]: https://docs.rs/op-alloy-rpc-types-engine/latest/op_alloy_rpc_types_engine/struct.OpAttributesWithParent.html diff --git a/book/src/building/genesis/README.md b/book/src/building/genesis/README.md deleted file mode 100644 index 14f61fee..00000000 --- a/book/src/building/genesis/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Genesis - -op-alloy-genesis crate - -The genesis crate contains types related to chain genesis. - -This section contains in-depth sections on building with [`op-alloy-genesis`][genesis] crate types. - -- [The Rollup Config](./rollup-config.md) -- [The System Config](./system-config.md) - - - -{{#include ../../links.md}} diff --git a/book/src/building/genesis/rollup-config.md b/book/src/building/genesis/rollup-config.md deleted file mode 100644 index 23dd4c61..00000000 --- a/book/src/building/genesis/rollup-config.md +++ /dev/null @@ -1,37 +0,0 @@ -# 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][spec-configurability]. - -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` - - - - -{{#include ../../links.md}} diff --git a/book/src/building/genesis/system-config.md b/book/src/building/genesis/system-config.md deleted file mode 100644 index d526c03c..00000000 --- a/book/src/building/genesis/system-config.md +++ /dev/null @@ -1,30 +0,0 @@ -# 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][system-config-specs]. - -## `SystemConfig` Type - -The [`SystemConfig`][system-config] type is defined in -[`op-alloy-genesis`][genesis]. - -Parameters defined in the [`SystemConfig`][system-config] 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`][system-config] type, adding EIP-1559 parameters to the config. - -The [`SystemConfig`][system-config] 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]. - - - - -{{#include ../../links.md}} diff --git a/book/src/building/protocol/README.md b/book/src/building/protocol/README.md index df694ba3..23e0a6d9 100644 --- a/book/src/building/protocol/README.md +++ b/book/src/building/protocol/README.md @@ -1,17 +1,17 @@ # Protocol -op-alloy-protocol crate +maili-protocol crate -The [`op-alloy-protocol`][protocol] crate contains types, constants, and methods +The [`maili-protocol`][protocol] crate contains types, constants, and methods specific to Optimism derivation and batch-submission. -[`op-alloy-protocol`][protocol] supports `no_std`. +[`maili-protocol`][protocol] supports `no_std`. ## Background Protocol types are primarily used for L2 chain derivation. This section will break down L2 chain derivation as it relates to types defined in -`op-alloy-protocol` - that is, from the raw L2 chain data posted to L1, to the +`maili-protocol` - that is, from the raw L2 chain data posted to L1, to the [`Batch`][batch] type. And since the [`Batch`][batch] type naively breaks up into the payload attributes, once executed, it becomes the canonical L2 block! Note though, this provides an incredibly simplified introduction. It is advised @@ -20,7 +20,7 @@ derivation. The L2 chain is derived from data posted to the L1 chain - either as calldata or blob data. Data is iteratively pulled from each L1 block and translated -into the first type defined by `op-alloy-protocol`: the [`Frame`][frame] type. +into the first type defined by `maili-protocol`: the [`Frame`][frame] type. [`Frame`][frame]s are [parsed][parsed] from the raw data. Each [`Frame`][frame] is a part of a [`Channel`][channel], the next type one level up in deriving @@ -52,15 +52,15 @@ type. -[decoded]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html#method.decode -[batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html -[ready]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.is_ready -[added]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.add_frame -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html -[parsed]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.parse_frames +[decoded]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html#method.decode +[batch]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html +[ready]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.is_ready +[added]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.add_frame +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html +[parsed]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.parse_frames -[protocol]: https://crates.io/crates/op-alloy-protocol +[protocol]: https://crates.io/crates/maili-protocol [s]: https://specs.optimism.io/protocol/derivation.html#overview [lcd]: https://specs.optimism.io/protocol/derivation.html#overview [channel-specs]: https://specs.optimism.io/protocol/derivation.html#channel-format diff --git a/book/src/building/protocol/batches.md b/book/src/building/protocol/batches.md index 7873873c..2acde3a8 100644 --- a/book/src/building/protocol/batches.md +++ b/book/src/building/protocol/batches.md @@ -92,26 +92,26 @@ more functionality. [holocene]: https://specs.optimism.io/protocol/holocene/overview.html -[check-batch-prefix]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SpanBatch.html#method.check_batch_prefix -[check-batch-span]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SpanBatch.html#method.check_batch -[span-batch-element]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SpanBatchElement.html -[check-batch-single]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SingleBatch.html#method.check_batch +[check-batch-prefix]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SpanBatch.html#method.check_batch_prefix +[check-batch-span]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SpanBatch.html#method.check_batch +[span-batch-element]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SpanBatchElement.html +[check-batch-single]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SingleBatch.html#method.check_batch [bytes]: https://docs.rs/alloy-primitives/latest/alloy_primitives/struct.Bytes.html [block-hash]: https://docs.rs/alloy-primitives/latest/alloy_primitives/aliases/type.BlockHash.html [epoch]: https://specs.optimism.io/glossary.html?highlight=Epoch#sequencing-epoch -[decode]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html#method.decode -[timestamp]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html#method.timestamp +[decode]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html#method.decode +[timestamp]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html#method.timestamp [specs]: https://specs.optimism.io/protocol/derivation.html#batch-format -[derived]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.RawSpanBatch.html#method.derive -[batch-type]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.BatchType.html -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html -[span-batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SpanBatch.html -[single-batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SingleBatch.html +[derived]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.RawSpanBatch.html#method.derive +[batch-type]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.BatchType.html +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[batch]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html +[span-batch]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SpanBatch.html +[single-batch]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SingleBatch.html [delta]: https://specs.optimism.io/protocol/delta/overview.html diff --git a/book/src/building/protocol/block-info.md b/book/src/building/protocol/block-info.md index 06f980bd..aa0d6ef6 100644 --- a/book/src/building/protocol/block-info.md +++ b/book/src/building/protocol/block-info.md @@ -22,6 +22,6 @@ construct the [`L2BlockInfo`][lbi] from a block and `ChainGenesis`. -[bi]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.BlockInfo.html -[lbi]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.L2BlockInfo.html -[fbg]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.L2BlockInfo.html#method.from_block_and_genesis +[bi]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.BlockInfo.html +[lbi]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.L2BlockInfo.html +[fbg]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.L2BlockInfo.html#method.from_block_and_genesis diff --git a/book/src/building/protocol/channels.md b/book/src/building/protocol/channels.md index f5005f23..75ba19ce 100644 --- a/book/src/building/protocol/channels.md +++ b/book/src/building/protocol/channels.md @@ -61,7 +61,7 @@ expected to be populated with [`Frame`][frame]s using its a minimal [`Channel`][channel] using a few frames. ```rust -use op_alloy_protocol::{Channel, Frame}; +use maili_protocol::{Channel, Frame}; // Construct a channel at the given L1 block. let id = [0xee; 16]; @@ -94,16 +94,16 @@ still open, and the frame hasn't already been added. -[is-ready]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.is_ready -[add-frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.add_frame +[is-ready]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.is_ready +[add-frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.add_frame -[block-info]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.BlockInfo.html +[block-info]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.BlockInfo.html [frame-docs]: ./frames.md [specs]: https://specs.optimism.io/protocol/derivation.html#batch-submission-wire-format [seq-batch]: https://specs.optimism.io/glossary.html#sequencer-batch -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[cid]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/type.ChannelId.html -[frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[cid]: https://docs.rs/maili-protocol/latest/maili_protocol/type.ChannelId.html +[frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html diff --git a/book/src/building/protocol/frames.md b/book/src/building/protocol/frames.md index 411e3acc..9cea7d5f 100644 --- a/book/src/building/protocol/frames.md +++ b/book/src/building/protocol/frames.md @@ -55,9 +55,9 @@ Where `++` represents concatenation. The frame's fields map to it's encoding. - `is_last` is a single byte [`Frame::is_last`][is_last]. -## op-alloy's `Frame` Type +## maili's `Frame` Type -[`op-alloy-protocol`][protocol] provides the [`Frame`][frame] type with a few useful +[`maili-protocol`][protocol] provides the [`Frame`][frame] type with a few useful methods. [`Frame`][frame]s can be encoded and decoded using the [`Frame::encode`][encode] and [`Frame::decode`][decode] methods. Given the raw batcher transaction data or blob data containing the concatenated derivation version and contiguous list of encoded frames, @@ -67,19 +67,19 @@ provide ways to decode single and multiple frames, respectively. -[encode]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.encode -[decode]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.decode +[encode]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.encode +[decode]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.decode -[parse_frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.parse_frame -[parse_frames]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.parse_frames +[parse_frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.parse_frame +[parse_frames]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.parse_frames -[protocol]: https://crates.io/crate/op-alloy-protocol +[protocol]: https://crates.io/crate/maili-protocol -[id]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#structfield.id -[number]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#structfield.number -[data]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#structfield.data -[is_last]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#structfield.is_last +[id]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#structfield.id +[number]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#structfield.number +[data]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#structfield.data +[is_last]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#structfield.is_last -[cid]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/type.ChannelId.html -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html +[cid]: https://docs.rs/maili-protocol/latest/maili_protocol/type.ChannelId.html +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html diff --git a/book/src/building/rollup-configs.md b/book/src/building/rollup-configs.md deleted file mode 100644 index 72fc9aa9..00000000 --- a/book/src/building/rollup-configs.md +++ /dev/null @@ -1,37 +0,0 @@ -# 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][spec-configurability]. - -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` - - - - -{{#include ../links.md}} diff --git a/book/src/building/rpc_types.md b/book/src/building/rpc_types.md deleted file mode 100644 index ce2f2a9b..00000000 --- a/book/src/building/rpc_types.md +++ /dev/null @@ -1,20 +0,0 @@ -# RPC Types - -The [`op-alloy-rpc-types`][rpc] crate contains RPC-related types. - -The [`OpTransactionRequest`][req] type acts as a builder for -[`OpTypedTransaction`][typed]. - -[`Transaction`][tx] is a transaction type. - -Related to receipts, [`op-alloy-rpc-types`][rpc] contains the -[`OpTransactionReceipt`][receipt] type and it's field types. - - - - -[rpc]: https://crates.io/crates/op-alloy-rpc-types -[typed]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpTypedTransaction.html -[tx]: https://docs.rs/op-alloy-rpc-types/latest/op_alloy_rpc_types/transaction/struct.Transaction.html -[req]: https://docs.rs/op-alloy-rpc-types/latest/op_alloy_rpc_types/receipt/struct.OpTransactionReceipt.html -[receipt]: https://docs.rs/op-alloy-rpc-types/latest/op_alloy_rpc_types/receipt/struct.OpTransactionReceipt.html diff --git a/book/src/examples/README.md b/book/src/examples/README.md index 7e241ba7..ce4f3ab6 100644 --- a/book/src/examples/README.md +++ b/book/src/examples/README.md @@ -1,8 +1,6 @@ # Examples -Examples for working with `op-alloy-*` crates. +Examples for working with `maili-*` crates. -- [Load a Rollup Config for a Chain ID](./load-a-rollup-config.md) -- [Create a new L1BlockInfoTx Hardfork Variant](./new-l1-block-info-tx-hardfork.md) - [Transform Frames to a Batch](./frames-to-batch.md) - [Transform a Batch to Frames](./batch-to-frames.md) diff --git a/book/src/examples/batch-to-frames.md b/book/src/examples/batch-to-frames.md index 4fc2bf80..2d27523f 100644 --- a/book/src/examples/batch-to-frames.md +++ b/book/src/examples/batch-to-frames.md @@ -48,7 +48,7 @@ ready to be batch-submitted to the data-availability layer. ## Running this example: -- Clone the examples repository: `git clone git@github.com:alloy-rs/op-alloy.git` +- Clone the examples repository: `git clone git@github.com:op-rs/maili.git` - Run: `cargo run --example batch_to_frames` ```rust diff --git a/book/src/examples/frames-to-batch.md b/book/src/examples/frames-to-batch.md index 15736dd3..c73b559a 100644 --- a/book/src/examples/frames-to-batch.md +++ b/book/src/examples/frames-to-batch.md @@ -43,7 +43,7 @@ to wind up with the example's desired [`Batch`][batch]. ## Running this example: -- Clone the examples repository: `git clone git@github.com:alloy-rs/op-alloy.git` +- Clone the examples repository: `git clone git@github.com:op-rs/maili.git` - Run: `cargo run --example frames_to_batch` ```rust diff --git a/book/src/examples/load-a-rollup-config.md b/book/src/examples/load-a-rollup-config.md deleted file mode 100644 index ec2db0af..00000000 --- a/book/src/examples/load-a-rollup-config.md +++ /dev/null @@ -1,34 +0,0 @@ -# Loading a Rollup Config from a Chain ID - -In this section, the code examples demonstrate loading the -rollup config for the given L2 Chain ID. - -Let's load the Rollup Config for OP Mainnet which hash chain id 10. - -```rust -use op_alloy_genesis::{OP_MAINNET_CONFIG, rollup_config_from_chain_id}; - -// The chain id for OP Mainnet -let op_mainnet_id = 10; - -// Load a rollup config from the chain id. -let op_mainnet_config = rollup_config_from_chain_id(op_mainnet_id).expect("infallible"); - -// The chain id should match the hardcoded chain id. -assert_eq!(OP_MAINNET_CONFIG, op_mainnet_config); -``` - -> ⚠️ Available Configs -> -> The `rollup_config_from_chain_id` method in `op-alloy-genesis` uses hardcoded -> rollup configs. But, there are only a few of these hardcoded rollup configs in -> `op-alloy-genesis`. This method and these configs are provided for `no_std` -> environments where dynamic filesystem loading at runtime is not supported -> in `no_std` environments. -> -> In a `std` environment, the [superchain][superchain] crate may be used which -> dynamically provides all rollup configs from the [superchain-registry][registry] -> for their respective chain ids. - -[superchain]: https://crates.io/crates/superchain -[registry]: https://github.com/ethereum-optimism/superchain-registry diff --git a/book/src/examples/new-l1-block-info-tx-hardfork.md b/book/src/examples/new-l1-block-info-tx-hardfork.md deleted file mode 100644 index a16ad3e4..00000000 --- a/book/src/examples/new-l1-block-info-tx-hardfork.md +++ /dev/null @@ -1,113 +0,0 @@ -# Create a L1BlockInfoTx Variant for a new Hardfork - -This example walks through creating a variant of the [`L1BlockInfoTx`][info-tx] -for a new Hardfork. - -> [!NOTE] -> -> This example is very verbose. -> To grok required changes, view [this PR diff][pr-diff] -> which introduces Isthmus hardfork changes to the `L1BlockInfoTx` with a new variant. - - -## Required Genesis Updates - -The first updates that need to be made are to [`op-alloy-genesis`][genesis] -types, namely the [`RollupConfig`][rc] and [`HardForkConfiguration`][hfc]. - -First, add a timestamp field to the [`RollupConfig`][rc]. Let's use the -hardfork name "Glacier" as an example. - -```rust -pub struct RollupConfig { - ... - /// `glacier_time` sets the activation time for the Glacier network upgrade. - /// Active if `glacier_time` != None && L2 block timestamp >= Some(glacier_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub glacier_time: Option, - ... -} -``` - -Add an accessor on the [`RollupConfig`][rc] to provide a way of checking whether the -"Glacier" hardfork is active for a given timestamp. Also update the prior hardfork -accessor to call this method (let's use "Isthmus" as the prior hardfork). - -```rust - /// Returns true if Isthmus is active at the given timestamp. - pub fn is_isthmus_active(&self, timestamp: u64) -> bool { - self.isthmus_time.map_or(false, |t| timestamp >= t) || self.is_glacier_active(timestamp) - } - - /// Returns true if Glacier is active at the given timestamp. - pub fn is_glacier_active(&self, timestamp: u64) -> bool { - self.glacier_time.map_or(false, |t| timestamp >= t) - } -``` - -Lastly, add the "Glacier" timestamp to the [`HardForkConfiguration`][hfc]. - -```rust -pub struct HardForkConfiguration { - ... - /// Glacier hardfork activation time - pub glacier_time: Option, -} -``` - - -## Protocol Changes - -Introduce a new `glacier.rs` module containing a `L1BlockInfoGlacier` type -in [`op_alloy_genesis::info` module][info-mod]. - -This should include a few methods used in the `L1BlockInfoTx` later. - -```rust - pub fn encode_calldata(&self) -> Bytes { ... } - - pub fn decode_calldata(r: &[u8]) -> Result { ... } -``` - -Use other hardfork variants like the [`L1BlockInfoEcotone`][ecotone] -for reference. - -Next, add the new "Glacier" variant to the [`L1BlockInfoTx`][info-tx]. - -```rust -pub enum L1BlockInfoTx { - ... - Glacier(L1BlockInfoGlacier) -} -``` - -Update [`L1BlockInfoTx::try_new`][try-new] to construct the `L1BlockInfoGlacier` -if the hardfork is active using the `RollupConfig::is_glacier_active`. - -Also, be sure to update [`L1BlockInfoTx::decode_calldata`][decode-calldata] -with the new variant decoding, as well as other [`L1BlockInfoTx`][info-tx] -methods. - -Once some tests are added surrounding the decoding and encoding of the new -`L1BlockInfoGlacier` variant, all required changes are complete! - -Now, [this example PR diff][pr-diff] introducing the Isthmus changes should -make sense, since it effectively implements the above changes for the Isthmus -hardfork (replacing "Glacier" with "Isthmus"). Notice, Isthmus introduces -some new "operator fee" fields as part of it's `L1BlockInfoIsthmus` type. -Some new error variants to the [`BlockInfoError`][bie] are needed as well. - - - - -[bie]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.BlockInfoError.html -[pr-diff]: https://github.com/alloy-rs/op-alloy/pull/130/files -[decode-calldata]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.L1BlockInfoTx.html#method.decode_calldata -[try-new]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.L1BlockInfoTx.html#method.try_new -[ecotone]: https://github.com/alloy-rs/op-alloy/blob/main/crates/protocol/src/info/ecotone.rs -[info-mod]: https://github.com/alloy-rs/op-alloy/blob/main/crates/protocol/src/info/mod.rs -[genesis]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/index.html -[rc]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/struct.RollupConfig.html -[hfc]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/struct.HardForkConfiguration.html -[info-tx]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.L1BlockInfoTx.html diff --git a/book/src/glossary.md b/book/src/glossary.md index 62c194a5..981bca45 100644 --- a/book/src/glossary.md +++ b/book/src/glossary.md @@ -1,5 +1,5 @@ # Glossary -*This document contains definitions for terms used throughout the op-alloy book.* +*This document contains definitions for terms used throughout the maili book.* diff --git a/book/src/intro.md b/book/src/intro.md index 87e44704..618f34b2 100644 --- a/book/src/intro.md +++ b/book/src/intro.md @@ -1,15 +1,15 @@ -# op-alloy +# maili - + -Welcome to the hands-on guide for getting started with `op-alloy`! +Welcome to the hands-on guide for getting started with `maili`! -`op-alloy` connects applications to the OP Stack, leveraging high -performance types, traits, and middleware from [Alloy][alloy]. +`maili` connects the OP Stack, debuting unique types and interfaces linked to +Ethereum via [OP-Alloy][op-alloy] primitives. > 📖 Development Status > -> `op-alloy` is in active development, and is not yet ready for use in production. +> `maili` is in active development, and is not yet ready for use in production. > During development, this book will evolve quickly and may contain inaccuracies. > > Please [open an issue][new-issue] if you find any errors or have any suggestions for @@ -19,28 +19,28 @@ performance types, traits, and middleware from [Alloy][alloy]. ### [Getting Started](./starting/installation.md) -To get started with op-alloy, add its crates as a dependency and take your first steps. +To get started with maili, add its crates as a dependency and take your first steps. -### [Building with op-alloy](./building/README.md) +### [Building with maili](./building/README.md) -Walk through types and functionality available in different `op-alloy` crates. +Walk through types and functionality available in different `maili` crates. ### [Examples](./examples/README.md) -Get hands-on experience using `op-alloy` crates for critical OP Stack functionality. +Get hands-on experience using `maili` crates for critical OP Stack functionality. ### [Contributing](./CONTRIBUTING.md) -Contributors are welcome! It is built and maintained by Alloy contributors, -members of [OP Labs][op-labs], and the broader open source community. +Contributors are welcome! It is built and maintained by op-rs contributors, +members of [OP Labs][op-labs] and the broader open source community. -`op-alloy` follows and expands the OP Stack standards set in the [specs]. +`maili` follows and expands the OP Stack standards set in the [specs]. The [contributing guide][contributing] breaks down how the [specs] -integrate with `op-alloy` and how to contribute to `op-alloy`. +integrate with `maili` and how to contribute to `maili`. ### [Licensing](./LICENSE.md) -`op-alloy` is licensed under the combined Apache 2.0 and MIT License, along +`maili` is licensed under the combined Apache 2.0 and MIT License, along with a SNAPPY license for snappy encoding use. diff --git a/book/src/links.md b/book/src/links.md index 45dc9792..90a7c019 100644 --- a/book/src/links.md +++ b/book/src/links.md @@ -1,58 +1,34 @@ - - -[check-no-std]: https://github.com/alloy-rs/op-alloy/blob/main/scripts/check_no_std.sh -[contributing]: https://alloy-rs.github.io/op-alloy -[op-alloy-crate]: https://crates.io/crates/op-alloy -[op-alloy-ff]: https://docs.rs/crate/op-alloy/latest/features - -[op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus -[op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis -[op-alloy-network]: https://crates.io/crates/op-alloy-network -[op-alloy-protocol]: https://crates.io/crates/op-alloy-protocol -[op-alloy-provider]: https://crates.io/crates/op-alloy-provider -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee -[op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine -[op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types - - - -[genesis]: https://crates.io/crates/op-alloy-genesis -[rc]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/rollup/struct.RollupConfig.html -[rcid]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/rollup/fn.rollup_config_from_chain_id.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 -[system-config]: https://docs.rs/op-alloy-genesis/latest/op_alloy_genesis/system/struct.SystemConfig.html - - - -[compress-brotli]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/fn.compress_brotli.html -[encode-batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SingleBatch.html#method.encode -[encode-frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.encode -[add-frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.add_frame -[decode-batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SingleBatch.html#method.decode -[single-batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.SingleBatch.html + + +[check-no-std]: https://github.com/op-rs/maili/blob/main/scripts/check_no_std.sh +[contributing]: https://op-rs.github.io/maili +[maili-crate]: https://crates.io/crates/maili +[maili-ff]: https://docs.rs/crate/maili/latest/features + +[maili-protocol]: https://crates.io/crates/maili-protocol +[maili-provider]: https://crates.io/crates/maili-provider + + + +[compress-brotli]: https://docs.rs/maili-protocol/latest/maili_protocol/fn.compress_brotli.html +[encode-batch]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SingleBatch.html#method.encode +[encode-frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.encode +[add-frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.add_frame +[decode-batch]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SingleBatch.html#method.decode +[single-batch]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.SingleBatch.html [bytes]: https://docs.rs/alloy-primitives/latest/alloy_primitives/struct.Bytes.html -[channel-id]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/type.ChannelId.html -[channel]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html -[channel-out]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.ChannelOut.html -[ready-bytes]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.ChannelOut.html#method.ready_bytes -[output-frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.ChannelOut.html#method.output_frame -[decode-frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html#method.decode +[channel-id]: https://docs.rs/maili-protocol/latest/maili_protocol/type.ChannelId.html +[channel]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html +[channel-out]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.ChannelOut.html +[ready-bytes]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.ChannelOut.html#method.ready_bytes +[output-frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.ChannelOut.html#method.output_frame +[decode-frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html#method.decode [hex]: https://docs.rs/hex-literal/latest/hex_literal/macro.hex.html [fjord]: https://specs.optimism.io/protocol/fjord/overview.html -[frame-data]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.frame_data -[is-ready]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Channel.html#method.is_ready -[frame]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/struct.Frame.html -[batch]: https://docs.rs/op-alloy-protocol/latest/op_alloy_protocol/enum.Batch.html - - - -[consensus]: https://crates.io/crates/op-alloy-consensus -[odr]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/struct.OpDepositReceipt.html -[ore]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpReceiptEnvelope.html -[op-block]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/type.OpBlock.html -[ty]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpTxType.html -[envelope]: https://docs.rs/op-alloy-consensus/latest/op_alloy_consensus/enum.OpTxEnvelope.html +[frame-data]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.frame_data +[is-ready]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Channel.html#method.is_ready +[frame]: https://docs.rs/maili-protocol/latest/maili_protocol/struct.Frame.html +[batch]: https://docs.rs/maili-protocol/latest/maili_protocol/enum.Batch.html diff --git a/book/src/starting.md b/book/src/starting.md index 4bcd96b8..4eeba160 100644 --- a/book/src/starting.md +++ b/book/src/starting.md @@ -1,42 +1,36 @@ # Installation -[op-alloy][op-alloy] consists of a number of crates that provide a range of functionality +[maili][maili] consists of a number of crates that provide a range of functionality essential for interfacing with any OP Stack chain. -The most succinct way to work with `op-alloy` is to add the [`op-alloy`][op-alloy-crate] crate +The most succinct way to work with `maili` is to add the [`maili`][maili-crate] crate with the `full` feature flag from the command-line using Cargo. ```txt -cargo add op-alloy --features full +cargo add maili --features full ``` Alternatively, you can add the following to your `Cargo.toml` file. ```txt -op-alloy = { version = "0.5", features = ["full"] } +maili = { version = "0.5", features = ["full"] } ``` For more fine-grained control over the features you wish to include, you can add the individual -crates to your `Cargo.toml` file, or use the `op-alloy` crate with the features you need. +crates to your `Cargo.toml` file, or use the `maili` crate with the features you need. -After `op-alloy` is added as a dependency, crates re-exported by `op-alloy` are now available. +After `maili` is added as a dependency, crates re-exported by `maili` are now available. ```rust -use op_alloy::{ - genesis::{RollupConfig, SystemConfig}, - consensus::OpBlock, +use maili::{ protocol::BlockInfo, - network::Optimism, provider::ext::engine::OpEngineApi, - rpc_types::OpTransactionReceipt, - rpc_jsonrpsee::traits::RollupNode, - rpc_types_engine::OpAttributesWithParent, }; ``` ## Features -The [`op-alloy`][op-alloy-crate] defines many [feature flags][op-alloy-ff] including the following. +The [`maili`][maili-crate] defines many [feature flags][maili-ff] including the following. Default - `std` @@ -46,7 +40,7 @@ Default Full enables the most commonly used crates. - `full` -The `k256` feature flag enables the `k256` feature on the `op-alloy-consensus` crate. +The `k256` feature flag enables the `k256` feature on the `maili-consensus` crate. - `k256` Arbitrary enables arbitrary features on crates, deriving the `Arbitrary` trait on types. @@ -56,29 +50,19 @@ Serde derives serde's Serialize and Deserialize traits on types. - `serde` Additionally, individual crates can be enabled using their shorthand names. -For example, the `consensus` feature flag provides the `op-alloy-consensus` re-export -so `op-alloy-consensus` types can be used from `op-alloy` through `op_alloy::consensus::InsertTypeHere`. +For example, the `protocol` feature flag provides the `maili-protocol` re-export +so `maili-protocol` types can be used from `maili` through `maili::protocol::InsertTypeHere`. ## Crates -- [`op-alloy-network`][op-alloy-network] -- [`op-alloy-genesis`][op-alloy-genesis] (supports `no_std`) -- [`op-alloy-protocol`][op-alloy-protocol] (supports `no_std`) -- [`op-alloy-provider`][op-alloy-provider] -- [`op-alloy-consensus`][op-alloy-consensus] (supports `no_std`) -- [`op-alloy-rpc-jsonrpsee`][op-alloy-rpc-jsonrpsee] -- [`op-alloy-rpc-types`][op-alloy-rpc-types] (supports `no_std`) -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] (supports `no_std`) +- [`maili-protocol`][maili-protocol] (supports `no_std`) +- [`maili-provider`][maili-provider] ## `no_std` As noted above, the following crates are `no_std` compatible. -- [`op-alloy-consensus`][op-alloy-consensus] -- [`op-alloy-genesis`][op-alloy-genesis] -- [`op-alloy-protocol`][op-alloy-protocol] -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] -- [`op-alloy-rpc-types`][op-alloy-rpc-types] +- [`maili-protocol`][maili-protocol] To add `no_std` support to a crate, ensure the [check_no_std][check-no-std] script is updated to include this crate once `no_std` compatible. diff --git a/cliff.toml b/cliff.toml index dcb0f4b3..87cb83cf 100644 --- a/cliff.toml +++ b/cliff.toml @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # https://tera.netlify.app/docs/#introduction body = """ {% if version %}\ - ## [{{ version | trim_start_matches(pat="v") }}](https://github.com/alloy-rs/op-alloy + ## [{{ version | trim_start_matches(pat="v") }}](https://github.com/op-rs/maili /releases/tag/v{{ version | trim_start_matches(pat="v") }}) - {{ timestamp | date(format="%Y-%m-%d") }} {% endif %}\ {% for group, commits in commits | group_by(attribute="group") %} @@ -30,7 +30,7 @@ footer = "" conventional_commits = true filter_unconventional = false commit_preprocessors = [ - { pattern = '#(\d+)', replace = "[#$1](https://github.com/alloy-rs/op-alloy/issues/$1)" }, + { pattern = '#(\d+)', replace = "[#$1](https://github.com/op-rs/maili/issues/$1)" }, ] commit_parsers = [ { message = "^[Ff]eat", group = "Features" }, diff --git a/crates/consensus/Cargo.toml b/crates/consensus/Cargo.toml deleted file mode 100644 index 9e881d50..00000000 --- a/crates/consensus/Cargo.toml +++ /dev/null @@ -1,59 +0,0 @@ -[package] -name = "op-alloy-consensus" -description = "Optimism alloy consensus types" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -authors.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Alloy -alloy-rlp.workspace = true -alloy-eips.workspace = true -alloy-consensus.workspace = true -alloy-primitives = { workspace = true, features = ["rlp"] } - -# misc -thiserror.workspace = true -derive_more = { workspace = true, features = ["display"] } - -# arbitrary -arbitrary = { workspace = true, features = ["derive"], optional = true } - -# serde -serde_with = { workspace = true, optional = true } -alloy-serde = { workspace = true, optional = true } -serde = { workspace = true, features = ["derive"], optional = true } - -[dev-dependencies] -rand.workspace = true -bincode.workspace = true -serde_json.workspace = true -alloy-signer.workspace = true -tokio = { workspace = true, features = ["macros"] } -arbitrary = { workspace = true, features = ["derive"] } -alloy-primitives = { workspace = true, features = ["rand", "arbitrary"] } - -[features] -default = ["std"] -std = ["alloy-eips/std", "alloy-consensus/std", "derive_more/std"] -k256 = ["alloy-primitives/k256", "alloy-consensus/k256"] -kzg = ["alloy-eips/kzg", "alloy-consensus/kzg", "std"] -arbitrary = [ - "std", - "dep:arbitrary", - "alloy-consensus/arbitrary", - "alloy-eips/arbitrary", - "alloy-primitives/rand", - "alloy-primitives/arbitrary", -] -serde = ["dep:serde", "dep:alloy-serde", "alloy-primitives/serde", "alloy-consensus/serde", "alloy-eips/serde"] -serde-bincode-compat = ["serde_with"] diff --git a/crates/consensus/README.md b/crates/consensus/README.md deleted file mode 100644 index 67451d3b..00000000 --- a/crates/consensus/README.md +++ /dev/null @@ -1,25 +0,0 @@ -## `op-alloy-consensus` - -CI -op-alloy-consensus crate -MIT License -Apache License -Book - - -Optimism consensus interface. - -This crate contains constants, types, and functions for implementing Optimism EL consensus and communication. This -includes an extended `OpTxEnvelope` type with [deposit transactions][deposit], and receipts containing OP Stack -specific fields (`deposit_nonce` + `deposit_receipt_version`). - -In general a type belongs in this crate if it exists in the `alloy-consensus` crate, but was modified from the base Ethereum protocol in the OP Stack. -For consensus types that are not modified by the OP Stack, the `alloy-consensus` types should be used instead. - -[deposit]: https://specs.optimism.io/protocol/deposits.html - -### Provenance - -Much of this code was ported from [reth-primitives] as part of ongoing alloy migrations. - -[reth-primitives]: https://github.com/paradigmxyz/reth/tree/main/crates/primitives diff --git a/crates/consensus/src/block.rs b/crates/consensus/src/block.rs deleted file mode 100644 index 4bc03b9e..00000000 --- a/crates/consensus/src/block.rs +++ /dev/null @@ -1,6 +0,0 @@ -//! Optimism Block Type. - -use crate::OpTxEnvelope; - -/// An Optimism block type. -pub type OpBlock = alloy_consensus::Block; diff --git a/crates/consensus/src/eip1559.rs b/crates/consensus/src/eip1559.rs deleted file mode 100644 index 01fa9e4a..00000000 --- a/crates/consensus/src/eip1559.rs +++ /dev/null @@ -1,99 +0,0 @@ -//! Support for EIP-1559 parameters after holocene. - -use alloy_eips::eip1559::BaseFeeParams; -use alloy_primitives::{Bytes, B64}; - -/// Extracts the Holocene 1599 parameters from the encoded form: -/// -/// -/// Returns (`elasticity`, `denominator`) -pub fn decode_eip_1559_params(eip_1559_params: B64) -> (u32, u32) { - let denominator: [u8; 4] = eip_1559_params.0[..4].try_into().expect("sufficient length"); - let elasticity: [u8; 4] = eip_1559_params.0[4..8].try_into().expect("sufficient length"); - - (u32::from_be_bytes(elasticity), u32::from_be_bytes(denominator)) -} - -/// Decodes the `eip1559` parameters from the `extradata` bytes. -/// -/// Returns (`elasticity`, `denominator`) -pub fn decode_holocene_extra_data(extra_data: &[u8]) -> Result<(u32, u32), EIP1559ParamError> { - if extra_data.len() < 9 { - return Err(EIP1559ParamError::NoEIP1559Params); - } - - if extra_data[0] != 0 { - // version must be 0: https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/holocene/exec-engine.md#eip-1559-parameters-in-block-header - return Err(EIP1559ParamError::InvalidVersion(extra_data[0])); - } - // skip the first version byte - Ok(decode_eip_1559_params(B64::from_slice(&extra_data[1..9]))) -} - -/// Encodes the `eip1559` parameters for the payload. -pub fn encode_holocene_extra_data( - eip_1559_params: B64, - default_base_fee_params: BaseFeeParams, -) -> Result { - // 9 bytes: 1 byte for version (0) and 8 bytes for eip1559 params - let mut extra_data = [0u8; 9]; - // If eip 1559 params aren't set, use the canyon base fee param constants - // otherwise use them - if eip_1559_params.is_zero() { - // Try casting max_change_denominator to u32 - let max_change_denominator: u32 = (default_base_fee_params.max_change_denominator) - .try_into() - .map_err(|_| EIP1559ParamError::DenominatorOverflow)?; - - // Try casting elasticity_multiplier to u32 - let elasticity_multiplier: u32 = (default_base_fee_params.elasticity_multiplier) - .try_into() - .map_err(|_| EIP1559ParamError::ElasticityOverflow)?; - - // Copy the values safely - extra_data[1..5].copy_from_slice(&max_change_denominator.to_be_bytes()); - extra_data[5..9].copy_from_slice(&elasticity_multiplier.to_be_bytes()); - } else { - let (elasticity, denominator) = decode_eip_1559_params(eip_1559_params); - extra_data[1..5].copy_from_slice(&denominator.to_be_bytes()); - extra_data[5..9].copy_from_slice(&elasticity.to_be_bytes()); - } - Ok(Bytes::copy_from_slice(&extra_data)) -} - -/// Error type for EIP-1559 parameters -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -pub enum EIP1559ParamError { - /// Thrown if the extra data begins with the wrong version byte. - #[error("Invalid EIP1559 version byte: {0}")] - InvalidVersion(u8), - /// No EIP-1559 parameters provided. - #[error("No EIP1559 parameters provided")] - NoEIP1559Params, - /// Denominator overflow. - #[error("Denominator overflow")] - DenominatorOverflow, - /// Elasticity overflow. - #[error("Elasticity overflow")] - ElasticityOverflow, -} - -#[cfg(test)] -mod tests { - use super::*; - use core::str::FromStr; - - #[test] - fn test_get_extra_data_post_holocene() { - let eip_1559_params = B64::from_str("0x0000000800000008").unwrap(); - let extra_data = encode_holocene_extra_data(eip_1559_params, BaseFeeParams::new(80, 60)); - assert_eq!(extra_data.unwrap(), Bytes::copy_from_slice(&[0, 0, 0, 0, 8, 0, 0, 0, 8])); - } - - #[test] - fn test_get_extra_data_post_holocene_default() { - let eip_1559_params = B64::ZERO; - let extra_data = encode_holocene_extra_data(eip_1559_params, BaseFeeParams::new(80, 60)); - assert_eq!(extra_data.unwrap(), Bytes::copy_from_slice(&[0, 0, 0, 0, 80, 0, 0, 0, 60])); - } -} diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_0.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_0.hex deleted file mode 100644 index fc51cb65..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_0.hex +++ /dev/null @@ -1 +0,0 @@ -7ef90afea0877a6077205782ea15a6dc8699fa5ebcec5e0f4389f09cb8eda09488231346f89442100000000000000000000000000000000000008080808305b8d880b90abd3630383036303430353233343830313536313030313035373630303038306664356235303631303533653830363130303230363030303339363030306633666536303830363034303532333438303135363130303130353736303030383066643562353036303034333631303631303066353537363030303335363065303163383036333833383166353861313136313030393735373830363363353938353931383131363130303636353738303633633539383539313831343631303232393537383036336535393162323832313436313032343935373830363365383162326336643134363130323839353738303633663832303631343031343631303239323537363030303830666435623830363338333831663538613134363130316533353738303633386232333966373331343631303166373537383036333965386334393636313436313032303035373830363362383037373765613134363130323039353736303030383066643562383036333534666434643530313136313030643335373830363335346664346435303134363130313333353738303633356366323439363931343631303137633537383036333634636132336566313436313031383535373830363336386435646361363134363130316232353736303030383066643562383036333031356438656239313436313030666135373830363330396264356136303134363130313066353738303633343430613565323031343631303132623537356236303030383066643562363130313064363130313038333636303034363130343463353635623631303239623536356230303562363130313138363030323534383135363562363034303531393038313532363032303031356236303430353138303931303339306633356236313031306436313033646135363562363130313666363034303531383036303430303136303430353238303630303538313532363032303031376633313265333232653330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323530383135363562363034303531363130313232393139303631303462653536356236313031313836303031353438313536356236303033353436313031393939303637666666666666666666666666666666663136383135363562363034303531363766666666666666666666666666666666393039313136383135323630323030313631303132323536356236303033353436313031636539303638303130303030303030303030303030303030393030343633666666666666666631363831353635623630343035313633666666666666666639303931313638313532363032303031363130313232353635623630303035343631303139393930363766666666666666666666666666666666313638313536356236313031313836303035353438313536356236313031313836303036353438313536356236303030353436313031393939303638303130303030303030303030303030303030393030343637666666666666666666666666666666663136383135363562363030333534363130316365393036633031303030303030303030303030303030303030303030303030393030343633666666666666666631363831353635623631303236343733646561646465616464656164646561646465616464656164646561646465616464656164303030313831353635623630343035313733666666666666666666666666666666666666666666666666666666666666666666666666666666663930393131363831353236303230303136313031323235363562363130313138363030343534383135363562363130313138363030373534383135363562333337336465616464656164646561646465616464656164646561646465616464656164646561643030303131343631303334323537363034303531376630386333373961303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323630323036303034383230313532363033623630323438323031353237663463333134323663366636333662336132303666366536633739323037343638363532303634363537303666373336393734366637323230363136333633366636303434383230313532376637353665373432303633363136653230373336353734323034633331323036323663366636333662323037363631366337353635373330303030303030303030363036343832303135323630383430313630343035313830393130333930666435623630303038303534363766666666666666666666666666666666393838393136363830313030303030303030303030303030303030323766666666666666666666666666666666666666666666666666666666666666666630303030303030303030303030303030303030303030303030303030303030303930393131363939383931363939393039393137393839303938313739303937353536303031393439303934353536303032393239303932353536303033383035343931393039343136376666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666630303030303030303030303030303030393139303931313631373930393235353630303439313930393135353630303535353630303635353536356233333733646561646465616464656164646561646465616464656164646561646465616464656164303030313134363130343033353736333363633530623435363030303532363030343630316366643562363030343335363038303163363030333535363031343335363038303163363030303535363032343335363030313535363034343335363030373535363036343335363030323535363038343335363030343535353635623830333536376666666666666666666666666666666638313136383131343631303434373537363030303830666435623931393035303536356236303030383036303030383036303030383036303030383036313031303038393862303331323135363130343639353736303030383066643562363130343732383936313034326635363562393735303631303438303630323038613031363130343266353635623936353036303430383930313335393535303630363038393031333539343530363130343963363038303861303136313034326635363562393739613936393935303934393739333936393536306130383530313335393535303630633038353031333539343630653030313335393335303931353035303536356236303030363032303830383335323833353138303832383530313532363030303562383138313130313536313034656235373835383130313833303135313835383230313630343030313532383230313631303463663536356238313831313131353631303466643537363030303630343038333837303130313532356235303630316630313766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666665303136393239303932303136303430303139333932353035303530353666656131363437333666366336333433303030383066303030610a \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_1.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_1.hex deleted file mode 100644 index 696061df..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_1.hex +++ /dev/null @@ -1 +0,0 @@ -7ef91feca0a312b4510adf943510f05fcc8f15f86995a5066bd83ce11384688ae20e6ecf42944210000000000000000000000000000000000001808080830f424080b91fab3630383036303430353233343830313536313030313035373630303038306664356235303631306662353830363130303230363030303339363030306633666536303830363034303532333438303135363130303130353736303030383066643562353036303034333631303631303066353537363030303335363065303163383036333534666434643530313136313030393735373830363364653236633461313131363130303636353738303633646532366334613131343631303164613537383036336634356536356438313436313031656435373830363366383230363134303134363130316635353738303633666531373362393731343631303163633537363030303830666435623830363335346664346435303134363130313636353738303633363864356463613631343631303161663537383036333665663235633361313436313031636335373830363363353938353931383134363130316432353736303030383066643562383036333331336365353637313136313030643335373830363333313363653536373134363130313237353738303633343939343865306531343631303132653537383036333465663665323234313436313031343135373830363335313962346264333134363130313565353736303030383066643562383036333063313863313632313436313030666135373830363332326239306162333134363130313135353738303633326530663236323531343631303131663537356236303030383066643562363130313032363130316664353635623630343035313930383135323630323030313562363034303531383039313033393066333562363130313164363130333165353635623030356236313031303236303036383135363562363030363631303130323536356236313031303236313031336333363630303436313062373335363562363130353431353635623630303035343631303134653930363066663136383135363562363034303531393031353135383135323630323030313631303130633536356236313031303236313035363535363562363130316132363034303531383036303430303136303430353238303630303538313532363032303031376633313265333232653330303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323530383135363562363034303531363130313063393139303631306334323536356236313031623736313035633635363562363034303531363366666666666666663930393131363831353236303230303136313031306335363562343836313031303235363562363130316237363130363462353635623631303130323631303165383336363030343631306237333536356236313036616335363562363130313032363130373630353635623631303130323631303835333536356236303030383035343630666631363135363130323936353736303430353137663038633337396130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303038313532363032303630303438323031353236303238363032343832303135323766343736313733353037323639363336353466373236313633366336353361323036663736363537323638363536313634323832393230363937333230363436353630343438323031353237663730373236353633363137343635363430303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036303634383230313532363038343031356236303430353138303931303339306664356237333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633386232333966373336303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313032663535373364363030303830336533643630303066643562353035303530353036303430353133643630316631393630316638323031313638323031383036303430353235303831303139303631303331393931393036313063623535363562393035303930353635623733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363365353931623238323630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631303337643537336436303030383033653364363030306664356235303530353035303630343035313364363031663139363031663832303131363832303138303630343035323530383130313930363130336131393139303631306363653536356237336666666666666666666666666666666666666666666666666666666666666666666666666666666631363333373366666666666666666666666666666666666666666666666666666666666666666666666666666666313631343631303438313537363034303531376630386333373961303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323630323036303034383230313532363034313630323438323031353237663437363137333530373236393633363534663732363136333663363533613230366636653663373932303734363836353230363436353730366637333639373436303434383230313532376636663732323036313633363336663735366537343230363336313665323037333635373432303639373334353633366637343666366536353230363636633631363036343832303135323766363730303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630383438323031353236306134303136313032386435363562363030303534363066663136313536313035313435373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630323636303234383230313532376634373631373335303732363936333635346637323631363336633635336132303435363336663734366636653635323036313663373236353631363437393230363034343832303135323766363136333734363937363635303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630363438323031353236303834303136313032386435363562363030303830353437666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666303031363630303131373930353535363562363030303830353436306666313631353631303535633537363130353536383236313038623435363562393239313530353035363562363130353536383236313039353835363562363030303733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363335636632343936393630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631303266353537336436303030383033653364363030306664356236303030373334323030303030303030303030303030303030303030303030303030303030303030303030303135373366666666666666666666666666666666666666666666666666666666666666666666666666666666313636333638643564636136363034303531383136336666666666666666313636306530316238313532363030343031363032303630343035313830383330333831383635616661313538303135363130363237353733643630303038303365336436303030666435623530353035303530363034303531336436303166313936303166383230313136383230313830363034303532353038313031393036313033313939313930363130643034353635623630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633633539383539313836303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313036323735373364363030303830336533643630303066643562363030303830363130366238383336313061623435363562363030303534393039313530363066663136313536313036636335373932393135303530353635623733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363338623233396637333630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631303732623537336436303030383033653364363030306664356235303530353035303630343035313364363031663139363031663832303131363832303138303630343035323530383130313930363130373466393139303631306362353536356236313037353939303832363130643539353635623933393235303530353035363562363030303830353436306666313631353631303766343537363034303531376630386333373961303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323630323036303034383230313532363032363630323438323031353237663437363137333530373236393633363534663732363136333663363533613230373336333631366336313732323832393230363937333230363436353730373236303434383230313532376636353633363137343635363430303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363036343832303135323630383430313631303238643536356237333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633396538633439363636303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313032663535373364363030303830336533643630303066643562363030303733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363366383230363134303630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631303266353537336436303030383033653364363030306664356236303030383036313038633038333631306162343536356239303530363030303631303863633631303536353536356236313038643436313036346235363562363130386466393036303130363130643731353635623633666666666666666631363631303865663931393036313064396435363562393035303630303036313038666236313038353335363562363130393033363130356336353635623633666666666666666631363631303931333931393036313064396435363562393035303630303036313039323138323834363130643539353635623631303932623930383536313064396435363562393035303631303933393630303636303061363130656661353635623631303934343930363031303631306439643536356236313039346539303832363130663036353635623936393535303530353035303530353035363562363030303830363130393634383336313061623435363562393035303630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633396538633439363636303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313039633735373364363030303830336533643630303066643562353035303530353036303430353133643630316631393630316638323031313638323031383036303430353235303831303139303631303965623931393036313063623535363562363130396633363130353635353635623733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363338623233396637333630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631306135323537336436303030383033653364363030306664356235303530353035303630343035313364363031663139363031663832303131363832303138303630343035323530383130313930363130613736393139303631306362353536356236313061383039303835363130643539353635623631306138613931393036313064396435363562363130613934393139303631306439643536356239303530363130616132363030363630306136313065666135363562363130616163393038323631306630363536356239343933353035303530353035363562383035313630303039303831393038313562383138313130313536313062333735373834383138313531383131303631306164373537363130616437363130663431353635623031363032303031353137666666303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303031363630303030333631306231373537363130623130363030343834363130643539353635623932353036313062323535363562363130623232363031303834363130643539353635623932353035623830363130623266383136313066373035363562393135303530363130616264353635623530363130616163383236313034343036313064353935363562376634653438376237313030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363030303532363034313630303435323630323436303030666435623630303036303230383238343033313231353631306238353537363030303830666435623831333536376666666666666666666666666666666638303832313131353631306239643537363030303830666435623831383430313931353038343630316638333031313236313062623135373630303038306664356238313335383138313131313536313062633335373631306263333631306234343536356236303430353136303166383230313766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666665303930383131363630336630313136383130313930383338323131383138333130313731353631306330393537363130633039363130623434353635623831363034303532383238313532383736303230383438373031303131313135363130633232353736303030383066643562383236303230383630313630323038333031333736303030393238313031363032303031393239303932353235303935393435303530353035303530353635623630303036303230383038333532383335313830383238353031353236303030356238313831313031353631306336663537383538313031383330313531383538323031363034303031353238323031363130633533353635623831383131313135363130633831353736303030363034303833383730313031353235623530363031663031376666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666530313639323930393230313630343030313933393235303530353035363562363030303630323038323834303331323135363130636337353736303030383066643562353035313931393035303536356236303030363032303832383430333132313536313063653035373630303038306664356238313531373366666666666666666666666666666666666666666666666666666666666666666666666666666666383131363831313436313037353935373630303038306664356236303030363032303832383430333132313536313064313635373630303038306664356238313531363366666666666666663831313638313134363130373539353736303030383066643562376634653438376237313030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363030303532363031313630303435323630323436303030666435623630303038323139383231313135363130643663353736313064366336313064326135363562353030313930353635623630303036336666666666666666383038333136383138353136383138333034383131313832313531353136313536313064393435373631306439343631306432613536356230323934393335303530353035303536356236303030383137666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666630343833313138323135313531363135363130646435353736313064643536313064326135363562353030323930353635623630303138313831356238303835313131353631306533333537383137666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666630343832313131353631306531393537363130653139363130643261353635623830383531363135363130653236353739313831303239313562393338343163393339303830303239303631306464663536356235303932353039323930353035363562363030303832363130653461353735303630303136313035353635363562383136313065353735373530363030303631303535363536356238313630303138313134363130653664353736303032383131343631306537373537363130653933353635623630303139313530353036313035353635363562363066663834313131353631306538383537363130653838363130643261353635623530353036303031383231623631303535363536356235303630323038333130363130313333383331303136363034653834313036303062383431303136313731353631306562363537353038313831306136313035353635363562363130656330383338333631306464613536356238303766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666663034383231313135363130656632353736313065663236313064326135363562303239333932353035303530353635623630303036313037353938333833363130653362353635623630303038323631306633633537376634653438376237313030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363030303532363031323630303435323630323436303030666435623530303439303536356237663465343837623731303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036303030353236303332363030343532363032343630303066643562363030303766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666663832303336313066613135373631306661313631306432613536356235303630303130313930353666656131363437333666366336333433303030383066303030610a \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_2.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_2.hex deleted file mode 100644 index 21029860..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_2.hex +++ /dev/null @@ -1 +0,0 @@ -7ef86aa018acb38c5ff1c238a7460ebc1b421fa49ec4874bdf1e0a530d234104e5e67dbc940000000000000000000000000000000000000000944210000000000000000000000000000000000000808082c35080983659cfe607dbe8500fc591d1852b76fee44d5a05e13097ff \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_3.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_3.hex deleted file mode 100644 index 11850b04..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_3.hex +++ /dev/null @@ -1 +0,0 @@ -7ef86aa0ee4f9385eceef498af0be7ec5862229f426dec41c8d42397c7257a5117d9230a940000000000000000000000000000000000000000944210000000000000000000000000000000000001808082c35080983659cfe6b528d11cc114e026f138fe568744c6d45ce6da7a \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_4.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_4.hex deleted file mode 100644 index 063a89f9..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_4.hex +++ /dev/null @@ -1 +0,0 @@ -7ef857a00c1cb38e99dbc9cbfab3bb80863380b0905290b37eb3d6ab18dc01c1f3e75f9394421000000000000000000000000000000000000094b528d11cc114e026f138fe568744c6d45ce6da7a808083013880808422b908b3 \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/ecotone_tx_5.hex b/crates/consensus/src/hardforks/bytecode/ecotone_tx_5.hex deleted file mode 100644 index d2d1e456..00000000 --- a/crates/consensus/src/hardforks/bytecode/ecotone_tx_5.hex +++ /dev/null @@ -1 +0,0 @@ -7ef90115a069b763c48478b9dc2f65ada09b3d92133ec592ea715ec65ad6e7f3dc519dc00c940b799c86a49deeb90402691f1041aa3af2d3c8758080808303d09080b8d536303631383036303039356633393566663333333733666666666666666666666666666666666666666666666666666666666666666666666666666666653134363034643537363032303336313436303234353735663566666435623566333538303135363034393537363230303166666638313036393038313534313436303363353735663566666435623632303031666666303135343566353236303230356666333562356635666664356236323030316666663432303634323831353535663335393036323030316666663031353530300a \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/eip4788_ecotone.hex b/crates/consensus/src/hardforks/bytecode/eip4788_ecotone.hex deleted file mode 100644 index 1764b177..00000000 --- a/crates/consensus/src/hardforks/bytecode/eip4788_ecotone.hex +++ /dev/null @@ -1 +0,0 @@ -60618060095f395ff33373fffffffffffffffffffffffffffffffffffffffe14604d57602036146024575f5ffd5b5f35801560495762001fff810690815414603c575f5ffd5b62001fff01545f5260205ff35b5f5ffd5b62001fff42064281555f359062001fff015500 diff --git a/crates/consensus/src/hardforks/bytecode/fjord_tx_0.hex b/crates/consensus/src/hardforks/bytecode/fjord_tx_0.hex deleted file mode 100644 index 9b5f4713..00000000 --- a/crates/consensus/src/hardforks/bytecode/fjord_tx_0.hex +++ /dev/null @@ -1 +0,0 @@ -7ef9306ea086122c533fdcb89b16d8713174625e44578a89751d96c098ec19ab40a51a8ea39442100000000000000000000000000000000000028080808316201080b9302d36303830363034303532333438303135363130303130353736303030383066643562353036313137663638303631303032303630303033393630303066336665363038303630343035323334383031353631303031303537363030303830666435623530363030343336313036313031333635373630303033353630653031633830363336656632356333613131363130306232353738303633646532366334613131313631303038313537383036336634356536356438313136313030363635373830363366343565363564383134363130323562353738303633663832303631343031343631303236333537383036336665313733623937313436313032306435373630303038306664356238303633646532366334613131343631303233353537383036336631633761353862313436313032343835373630303038306664356238303633366566323563336131343631303230643537383036333865393862313036313436313032313335373830363339363065336132333134363130323162353738303633633539383539313831343631303232643537363030303830666435623830363334393934386530653131363130313039353738303633353139623462643331313631303065653537383036333531396234626433313436313031396635373830363335346664346435303134363130316137353738303633363864356463613631343631303166303537363030303830666435623830363334393934386530653134363130313666353738303633346566366532323431343631303138323537363030303830666435623830363330633138633136323134363130313362353738303633323262393061623331343631303135363537383036333265306632363235313436313031363035373830363333313363653536373134363130313638353735623630303038306664356236313031343336313032366235363562363034303531393038313532363032303031356236303430353138303931303339306633356236313031356536313033386335363562303035623631303134333630303638313536356236303036363130313433353635623631303134333631303137643336363030343631313261313536356236313035313535363562363030303534363130313866393036306666313638313536356236303430353139303135313538313532363032303031363130313464353635623631303134333631303535323536356236313031653336303430353138303630343030313630343035323830363030353831353236303230303137663331326533333265333030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303038313532353038313536356236303430353136313031346439313930363131333730353635623631303166383631303562333536356236303430353136336666666666666666393039313136383135323630323030313631303134643536356234383631303134333536356236313031356536313036333835363562363030303534363130313866393036313031303039303034363066663136383135363562363130316638363130383332353635623631303134333631303234333336363030343631313261313536356236313038393335363562363130313433363130323536333636303034363131336533353635623631303938643536356236313031343336313061363935363562363130313433363130623563353635623630303038303534363066663136313536313033303435373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630323836303234383230313532376634373631373335303732363936333635346637323631363336633635336132303666373636353732363836353631363432383239323036393733323036343635363034343832303135323766373037323635363336313734363536343030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630363438323031353236303834303135623630343035313830393130333930666435623733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363338623233396637333630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631303336333537336436303030383033653364363030306664356235303530353035303630343035313364363031663139363031663832303131363832303138303630343035323530383130313930363130333837393139303631313366633536356239303530393035363562333337336465616464656164646561646465616464656164646561646465616464656164646561643030303131343631303435353537363034303531376630386333373961303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323630323036303034383230313532363034313630323438323031353237663437363137333530373236393633363534663732363136333663363533613230366636653663373932303734363836353230363436353730366637333639373436303434383230313532376636663732323036313633363336663735366537343230363336313665323037333635373432303639373334353633366637343666366536353230363636633631363036343832303135323766363730303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630383438323031353236306134303136313032666235363562363030303534363066663136313536313034653835373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630323636303234383230313532376634373631373335303732363936333635346637323631363336633635336132303435363336663734366636653635323036313663373236353631363437393230363034343832303135323766363136333734363937363635303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630363438323031353236303834303136313032666235363562363030303830353437666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666303031363630303131373930353535363562363030303830353436313031303039303034363066663136313536313035333535373631303532663832363130626264353635623932393135303530353635623630303035343630666631363135363130353439353736313035326638323631306264633536356236313035326638323631306338303536356236303030373334323030303030303030303030303030303030303030303030303030303030303030303030303135373366666666666666666666666666666666666666666666666666666666666666666666666666666666313636333563663234393639363034303531383136336666666666666666313636306530316238313532363030343031363032303630343035313830383330333831383635616661313538303135363130333633353733643630303038303365336436303030666435623630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633363864356463613636303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313036313435373364363030303830336533643630303066643562353035303530353036303430353133643630316631393630316638323031313638323031383036303430353235303831303139303631303338373931393036313134313535363562333337336465616464656164646561646465616464656164646561646465616464656164646561643030303131343631303664623537363034303531376630386333373961303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030383135323630323036303034383230313532363033663630323438323031353237663437363137333530373236393633363534663732363136333663363533613230366636653663373932303734363836353230363436353730366637333639373436303434383230313532376636663732323036313633363336663735366537343230363336313665323037333635373432303639373334363661366637323634323036363663363136373030363036343832303135323630383430313631303266623536356236303030353436306666313636313037366435373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630333936303234383230313532376634373631373335303732363936333635346637323631363336633635336132303436366136663732363432303633363136653230366636653663373932303632363034343832303135323766363532303631363337343639373636313734363536343230363136363734363537323230343536333666373436663665363530303030303030303030303030303630363438323031353236303834303136313032666235363562363030303534363130313030393030343630666631363135363130383034353736303430353137663038633337396130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303038313532363032303630303438323031353236303234383038323031353237663437363137333530373236393633363534663732363136333663363533613230343636613666373236343230363136633732363536313634373932303631363336303434383230313532376637343639373636353030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363036343832303135323630383430313631303266623536356236303030383035343766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666303066663136363130313030313739303535353635623630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633633539383539313836303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313036313435373364363030303830336533643630303066643562363030303830353436313031303039303034363066663136313536313038646135373632306634323430363130386335363130386234383436313064643435363562353136313038633039303630343436313134366135363562363131306631353635623631303864303930363031303631313438323536356236313035326639313930363131346266353635623630303036313038653538333631313135303536356236303030353439303931353036306666313631353631303866393537393239313530353035363562373334323030303030303030303030303030303030303030303030303030303030303030303030303135373366666666666666666666666666666666666666666666666666666666666666666666666666666666313636333862323339663733363034303531383136336666666666666666313636306530316238313532363030343031363032303630343035313830383330333831383635616661313538303135363130393538353733643630303038303365336436303030666435623530353035303530363034303531336436303166313936303166383230313136383230313830363034303532353038313031393036313039376339313930363131336663353635623631303938363930383236313134366135363562393339323530353035303536356236303030383035343631303130303930303436306666313636313061323535373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630333636303234383230313532376634373631373335303732363936333635346637323631363336633635336132303637363537343463333134363635363535353730373036353732343236663735363034343832303135323766366536343230366636653663373932303733373537303730366637323734373332303436366136663732363430303030303030303030303030303030303030303630363438323031353236303834303136313032666235363562363030303631306133323833363034343631313436613536356239303530363030303631306134313630666638333631313462663536356236313061346239303833363131343661353635623631306135363930363031303631313436613536356239303530363130613631383136313131653035363562393439333530353035303530353635623630303038303534363066663136313536313061666435373630343035313766303863333739613030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303831353236303230363030343832303135323630323636303234383230313532376634373631373335303732363936333635346637323631363336633635336132303733363336313663363137323238323932303639373332303634363537303732363034343832303135323766363536333631373436353634303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630363438323031353236303834303136313032666235363562373334323030303030303030303030303030303030303030303030303030303030303030303030303135373366666666666666666666666666666666666666666666666666666666666666666666666666666666313636333965386334393636363034303531383136336666666666666666313636306530316238313532363030343031363032303630343035313830383330333831383635616661313538303135363130333633353733643630303038303365336436303030666435623630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633663832303631343036303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313033363335373364363030303830336533643630303066643562363030303631303532663631306263623833363130646434353635623531363130626437393036303434363131343661353635623631313165303536356236303030383036313062653838333631313135303536356239303530363030303631306266343631303535323536356236313062666336313038333235363562363130633037393036303130363131346661353635623633666666666666666631363631306331373931393036313134383235363562393035303630303036313063323336313062356335363562363130633262363130356233353635623633666666666666666631363631306333623931393036313134383235363562393035303630303036313063343938323834363131343661353635623631306335333930383536313134383235363562393035303631306336313630303636303061363131363436353635623631306336633930363031303631313438323536356236313063373639303832363131346266353635623936393535303530353035303530353035363562363030303830363130633863383336313131353035363562393035303630303037333432303030303030303030303030303030303030303030303030303030303030303030303030313537336666666666666666666666666666666666666666666666666666666666666666666666666666666631363633396538633439363636303430353138313633666666666666666631363630653031623831353236303034303136303230363034303531383038333033383138363561666131353830313536313063656635373364363030303830336533643630303066643562353035303530353036303430353133643630316631393630316638323031313638323031383036303430353235303831303139303631306431333931393036313133666335363562363130643162363130353532353635623733343230303030303030303030303030303030303030303030303030303030303030303030303031353733666666666666666666666666666666666666666666666666666666666666666666666666666666663136363338623233396637333630343035313831363366666666666666663136363065303162383135323630303430313630323036303430353138303833303338313836356166613135383031353631306437613537336436303030383033653364363030306664356235303530353035303630343035313364363031663139363031663832303131363832303138303630343035323530383130313930363130643965393139303631313366633536356236313064613839303835363131343661353635623631306462323931393036313134383235363562363130646263393139303631313438323536356239303530363130646361363030363630306136313136343635363562363130613631393038323631313462663536356236303630363130663633353635623831383135333630303130313931393035303536356236303030383238343033393335303562383338313130313536313039383635373832383130313531383238323031353131383630303031613135393039333032393236303031303136313064656535363562383235623630323038323130363130653562353738323531363130653236363031663833363130646462353635623532363032303932393039323031393137666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666653039303931303139303630323130313631306531313536356238313135363130393836353738323531363130653730363030313834303338333631306464623536356235323031363030313031393239313530353035363562363030303630303138333033393235303562363130313037383231303631306562633537363130656165383336306666313636313065613936306664363130656139383736303038316336306530303138393631306464623536356236313064646235363562393335303631303130363832303339313530363130653834353635623630303738323130363130656539353736313065653238333630666631363631306561393630303738353033363130656139383736303038316336306530303138393631306464623536356239303530363130393836353635623631306136313833363066663136363130656139383536303038316338353630303531623031383736313064646235363562363130663562383238323033363130663366363130663266383436303030383135313830363030303161383136303031316136303038316231373831363030323161363031303162313739313530353039313930353035363562363339653337373962393032363031333163363131666666313639303536356238303630303231623630343035313031383238313531363065303163313836306530316238313531313838313532353035303530353635623630303130313931393035303536356236313830303033383630343035313339363138303030363034303531303136303230383330313830363030643835353138323031303338323630303230313562383138313130313536313130393635373630303038303562353035303830353136303430353136303030383239303161363030313833393031613630303831623137363030323932393039323161363031303162393139303931313736333965333737396239383130323630313131633631376666633136393039313031383035313630653038313831316338373836303338313138393039313162393039313138393039313532383430313930383138333033393038343834313036313066656235373530363131303236353635623630303138343031393335303631316666663832313136313130323035373832353136303030383139303161363030313832393031613630303831623137363030323931393039313161363031303162313738313033363131303230353735303631313032363536356235303631306638663536356238333833313036313130333435373530353036313130393635363562363030313833303339323530383538333131313536313130353235373631313034663837383738383836303336313065306635363562393635303562363131303636363030393835303136303033383530313630303338353031363130646536353635623931353036313130373338373832383436313065376235363562393635303530363131303862383436313130383638363834383630313631306630323536356236313066303235363562393135303530383039333530363130663833353635623530353036313130613838333833383438383531383530313033363130653066353635623932353035303530363034303531393135303631383030303832303138303832303339313530383138333532363032303833303136303030356238333831313031353631313064643537383238313031353138323832303135323630323030313631313063353536356235303630303039323031393138323532353036303230303136303430353239313930353035363562363030303830363131313031383336323063633339343631313438323536356236313131326239303766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666643736333230303631313635323536356239303530363131313362363036343632306634323430363131366336353635623831313231353631303532663537363130393836363036343632306634323430363131366336353635623830353136303030393038313930383135623831383131303135363131316433353738343831383135313831313036313131373335373631313137333631313738323536356230313630323030313531376666663030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030313636303030303336313131623335373631313161633630303438343631313436613536356239323530363131316331353635623631313162653630313038343631313436613536356239323530356238303631313163623831363131376231353635623931353035303631313135393536356235303631306136313832363130343430363131343661353635623630303038303631313165633833363131306631353635623930353036303030363131316638363130623563353635623631313230303631303562333536356236336666666666666666313636313132313039313930363131343832353635623631313231383631303535323536356236313132323036313038333235363562363131323262393036303130363131346661353635623633666666666666666631363631313233623931393036313134383235363562363131323435393139303631313436613536356239303530363131323533363030363630303236313134383235363562363131323565393036303061363131363436353635623631313236383832383436313134383235363562363130613631393139303631313462663536356237663465343837623731303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036303030353236303431363030343532363032343630303066643562363030303630323038323834303331323135363131326233353736303030383066643562383133353637666666666666666666666666666666663830383231313135363131326362353736303030383066643562383138343031393135303834363031663833303131323631313264663537363030303830666435623831333538313831313131353631313266313537363131326631363131323732353635623630343035313630316638323031376666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666530393038313136363033663031313638313031393038333832313138313833313031373135363131333337353736313133333736313132373235363562383136303430353238323831353238373630323038343837303130313131313536313133353035373630303038306664356238323630323038363031363032303833303133373630303039323831303136303230303139323930393235323530393539343530353035303530353035363562363030303630323038303833353238333531383038323835303135323630303035623831383131303135363131333964353738353831303138333031353138353832303136303430303135323832303136313133383135363562383138313131313536313133616635373630303036303430383338373031303135323562353036303166303137666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666653031363932393039323031363034303031393339323530353035303536356236303030363032303832383430333132313536313133663535373630303038306664356235303335393139303530353635623630303036303230383238343033313231353631313430653537363030303830666435623530353139313930353035363562363030303630323038323834303331323135363131343237353736303030383066643562383135313633666666666666666638313136383131343631303938363537363030303830666435623766346534383762373130303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303630303035323630313136303034353236303234363030306664356236303030383231393832313131353631313437643537363131343764363131343362353635623530303139303536356236303030383137666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666630343833313138323135313531363135363131346261353736313134626136313134336235363562353030323930353635623630303038323631313466353537376634653438376237313030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030363030303532363031323630303435323630323436303030666435623530303439303536356236303030363366666666666666663830383331363831383531363831383330343831313138323135313531363135363131353164353736313135316436313134336235363562303239343933353035303530353035363562363030313831383135623830383531313135363131353766353738313766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666663034383231313135363131353635353736313135363536313134336235363562383038353136313536313135373235373931383130323931356239333834316339333930383030323930363131353262353635623530393235303932393035303536356236303030383236313135393635373530363030313631303532663536356238313631313561333537353036303030363130353266353635623831363030313831313436313135623935373630303238313134363131356333353736313135646635363562363030313931353035303631303532663536356236306666383431313135363131356434353736313135643436313134336235363562353035303630303138323162363130353266353635623530363032303833313036313031333338333130313636303465383431303630306238343130313631373135363131363032353735303831383130613631303532663536356236313136306338333833363131353236353635623830376666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666303438323131313536313136336535373631313633653631313433623536356230323933393235303530353035363562363030303631303938363833383336313135383735363562363030303830383231323832376637666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666303338343133383131353136313536313136386335373631313638633631313433623536356238323766383030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303033383431323831313631353631313663303537363131366330363131343362353635623530353030313930353635623630303037663766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666636303030383431333630303038343133383538333034383531313832383231363136313536313137303735373631313730373631313433623536356237663830303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036303030383731323836383230353838313238313834313631363135363131373432353736313137343236313134336235363562363030303837313239323530383738323035383731323834383431363136313536313137356535373631313735653631313433623536356238373835303538373132383138343136313631353631313737343537363131373734363131343362353635623530353035303932393039333032393339323530353035303536356237663465343837623731303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303036303030353236303332363030343532363032343630303066643562363030303766666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666663832303336313137653235373631313765323631313433623536356235303630303130313930353666656131363437333666366336333433303030383066303030610a \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/fjord_tx_1.hex b/crates/consensus/src/hardforks/bytecode/fjord_tx_1.hex deleted file mode 100644 index 652af273..00000000 --- a/crates/consensus/src/hardforks/bytecode/fjord_tx_1.hex +++ /dev/null @@ -1 +0,0 @@ -7ef86aa01e6bb0c28bfab3dc9b36ffb0f721f00d6937f33577606325692db0965a7d58c694000000000000000000000000000000000000000094b528d11cc114e026f138fe568744c6d45ce6da7a808082c35080983659cfe6a919894851548179a0750865e7974da599c0fac7 \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/fjord_tx_2.hex b/crates/consensus/src/hardforks/bytecode/fjord_tx_2.hex deleted file mode 100644 index e72d425a..00000000 --- a/crates/consensus/src/hardforks/bytecode/fjord_tx_2.hex +++ /dev/null @@ -1 +0,0 @@ -7ef857a0bac7bb0d5961cad209a345408b0280a0d4686b1b20665e1b0f9cdafd73b19b6b94deaddeaddeaddeaddeaddeaddeaddeaddead000194b528d11cc114e026f138fe568744c6d45ce6da7a808083015f9080848e98b106 \ No newline at end of file diff --git a/crates/consensus/src/hardforks/bytecode/gpo_ecotone.hex b/crates/consensus/src/hardforks/bytecode/gpo_ecotone.hex deleted file mode 100644 index 4fc96a0e..00000000 --- a/crates/consensus/src/hardforks/bytecode/gpo_ecotone.hex +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b50610fb5806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806354fd4d5011610097578063de26c4a111610066578063de26c4a1146101da578063f45e65d8146101ed578063f8206140146101f5578063fe173b97146101cc57600080fd5b806354fd4d501461016657806368d5dca6146101af5780636ef25c3a146101cc578063c5985918146101d257600080fd5b8063313ce567116100d3578063313ce5671461012757806349948e0e1461012e5780634ef6e22414610141578063519b4bd31461015e57600080fd5b80630c18c162146100fa57806322b90ab3146101155780632e0f26251461011f575b600080fd5b6101026101fd565b6040519081526020015b60405180910390f35b61011d61031e565b005b610102600681565b6006610102565b61010261013c366004610b73565b610541565b60005461014e9060ff1681565b604051901515815260200161010c565b610102610565565b6101a26040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161010c9190610c42565b6101b76105c6565b60405163ffffffff909116815260200161010c565b48610102565b6101b761064b565b6101026101e8366004610b73565b6106ac565b610102610760565b610102610853565b6000805460ff1615610296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f47617350726963654f7261636c653a206f76657268656164282920697320646560448201527f707265636174656400000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610cb5565b905090565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663e591b2826040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a19190610cce565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610481576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e2073657420697345636f746f6e6520666c6160648201527f6700000000000000000000000000000000000000000000000000000000000000608482015260a40161028d565b60005460ff1615610514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a2045636f746f6e6520616c72656164792060448201527f6163746976650000000000000000000000000000000000000000000000000000606482015260840161028d565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b6000805460ff161561055c57610556826108b4565b92915050565b61055682610958565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff166368d5dca66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610627573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103199190610d04565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663c59859186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610627573d6000803e3d6000fd5b6000806106b883610ab4565b60005490915060ff16156106cc5792915050565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa15801561072b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074f9190610cb5565b6107599082610d59565b9392505050565b6000805460ff16156107f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a207363616c61722829206973206465707260448201527f6563617465640000000000000000000000000000000000000000000000000000606482015260840161028d565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663f82061406040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102f5573d6000803e3d6000fd5b6000806108c083610ab4565b905060006108cc610565565b6108d461064b565b6108df906010610d71565b63ffffffff166108ef9190610d9d565b905060006108fb610853565b6109036105c6565b63ffffffff166109139190610d9d565b905060006109218284610d59565b61092b9085610d9d565b90506109396006600a610efa565b610944906010610d9d565b61094e9082610f06565b9695505050505050565b60008061096483610ab4565b9050600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109eb9190610cb5565b6109f3610565565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a769190610cb5565b610a809085610d59565b610a8a9190610d9d565b610a949190610d9d565b9050610aa26006600a610efa565b610aac9082610f06565b949350505050565b80516000908190815b81811015610b3757848181518110610ad757610ad7610f41565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016600003610b1757610b10600484610d59565b9250610b25565b610b22601084610d59565b92505b80610b2f81610f70565b915050610abd565b50610aac82610440610d59565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600060208284031215610b8557600080fd5b813567ffffffffffffffff80821115610b9d57600080fd5b818401915084601f830112610bb157600080fd5b813581811115610bc357610bc3610b44565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908382118183101715610c0957610c09610b44565b81604052828152876020848701011115610c2257600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b81811015610c6f57858101830151858201604001528201610c53565b81811115610c81576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b600060208284031215610cc757600080fd5b5051919050565b600060208284031215610ce057600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461075957600080fd5b600060208284031215610d1657600080fd5b815163ffffffff8116811461075957600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610d6c57610d6c610d2a565b500190565b600063ffffffff80831681851681830481118215151615610d9457610d94610d2a565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610dd557610dd5610d2a565b500290565b600181815b80851115610e3357817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610e1957610e19610d2a565b80851615610e2657918102915b93841c9390800290610ddf565b509250929050565b600082610e4a57506001610556565b81610e5757506000610556565b8160018114610e6d5760028114610e7757610e93565b6001915050610556565b60ff841115610e8857610e88610d2a565b50506001821b610556565b5060208310610133831016604e8410600b8410161715610eb6575081810a610556565b610ec08383610dda565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115610ef257610ef2610d2a565b029392505050565b60006107598383610e3b565b600082610f3c577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610fa157610fa1610d2a565b506001019056fea164736f6c634300080f000a diff --git a/crates/consensus/src/hardforks/bytecode/gpo_fjord.hex b/crates/consensus/src/hardforks/bytecode/gpo_fjord.hex deleted file mode 100644 index 42f73850..00000000 --- a/crates/consensus/src/hardforks/bytecode/gpo_fjord.hex +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b506117f6806100206000396000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80636ef25c3a116100b2578063de26c4a111610081578063f45e65d811610066578063f45e65d81461025b578063f820614014610263578063fe173b971461020d57600080fd5b8063de26c4a114610235578063f1c7a58b1461024857600080fd5b80636ef25c3a1461020d5780638e98b10614610213578063960e3a231461021b578063c59859181461022d57600080fd5b806349948e0e11610109578063519b4bd3116100ee578063519b4bd31461019f57806354fd4d50146101a757806368d5dca6146101f057600080fd5b806349948e0e1461016f5780634ef6e2241461018257600080fd5b80630c18c1621461013b57806322b90ab3146101565780632e0f262514610160578063313ce56714610168575b600080fd5b61014361026b565b6040519081526020015b60405180910390f35b61015e61038c565b005b610143600681565b6006610143565b61014361017d3660046112a1565b610515565b60005461018f9060ff1681565b604051901515815260200161014d565b610143610552565b6101e36040518060400160405280600581526020017f312e332e3000000000000000000000000000000000000000000000000000000081525081565b60405161014d9190611370565b6101f86105b3565b60405163ffffffff909116815260200161014d565b48610143565b61015e610638565b60005461018f90610100900460ff1681565b6101f8610832565b6101436102433660046112a1565b610893565b6101436102563660046113e3565b61098d565b610143610a69565b610143610b5c565b6000805460ff1615610304576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f47617350726963654f7261636c653a206f76657268656164282920697320646560448201527f707265636174656400000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038791906113fc565b905090565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610455576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604160248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e2073657420697345636f746f6e6520666c6160648201527f6700000000000000000000000000000000000000000000000000000000000000608482015260a4016102fb565b60005460ff16156104e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a2045636f746f6e6520616c72656164792060448201527f616374697665000000000000000000000000000000000000000000000000000060648201526084016102fb565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055565b60008054610100900460ff16156105355761052f82610bbd565b92915050565b60005460ff16156105495761052f82610bdc565b61052f82610c80565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16635cf249696040518163ffffffff1660e01b8152600401602060405180830381865afa158015610363573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff166368d5dca66040518163ffffffff1660e01b8152600401602060405180830381865afa158015610614573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190611415565b3373deaddeaddeaddeaddeaddeaddeaddeaddead0001146106db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603f60248201527f47617350726963654f7261636c653a206f6e6c7920746865206465706f73697460448201527f6f72206163636f756e742063616e20736574206973466a6f726420666c61670060648201526084016102fb565b60005460ff1661076d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f47617350726963654f7261636c653a20466a6f72642063616e206f6e6c79206260448201527f65206163746976617465642061667465722045636f746f6e650000000000000060648201526084016102fb565b600054610100900460ff1615610804576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f47617350726963654f7261636c653a20466a6f726420616c726561647920616360448201527f746976650000000000000000000000000000000000000000000000000000000060648201526084016102fb565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100179055565b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663c59859186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610614573d6000803e3d6000fd5b60008054610100900460ff16156108da57620f42406108c56108b484610dd4565b516108c090604461146a565b6110f1565b6108d0906010611482565b61052f91906114bf565b60006108e583611150565b60005490915060ff16156108f95792915050565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610958573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097c91906113fc565b610986908261146a565b9392505050565b60008054610100900460ff16610a25576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603660248201527f47617350726963654f7261636c653a206765744c314665655570706572426f7560448201527f6e64206f6e6c7920737570706f72747320466a6f72640000000000000000000060648201526084016102fb565b6000610a3283604461146a565b90506000610a4160ff836114bf565b610a4b908361146a565b610a5690601061146a565b9050610a61816111e0565b949350505050565b6000805460ff1615610afd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f47617350726963654f7261636c653a207363616c61722829206973206465707260448201527f656361746564000000000000000000000000000000000000000000000000000060648201526084016102fb565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa158015610363573d6000803e3d6000fd5b600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff1663f82061406040518163ffffffff1660e01b8152600401602060405180830381865afa158015610363573d6000803e3d6000fd5b600061052f610bcb83610dd4565b51610bd790604461146a565b6111e0565b600080610be883611150565b90506000610bf4610552565b610bfc610832565b610c079060106114fa565b63ffffffff16610c179190611482565b90506000610c23610b5c565b610c2b6105b3565b63ffffffff16610c3b9190611482565b90506000610c49828461146a565b610c539085611482565b9050610c616006600a611646565b610c6c906010611482565b610c7690826114bf565b9695505050505050565b600080610c8c83611150565b9050600073420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16639e8c49666040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1391906113fc565b610d1b610552565b73420000000000000000000000000000000000001573ffffffffffffffffffffffffffffffffffffffff16638b239f736040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e91906113fc565b610da8908561146a565b610db29190611482565b610dbc9190611482565b9050610dca6006600a611646565b610a6190826114bf565b6060610f63565b818153600101919050565b600082840393505b838110156109865782810151828201511860001a1590930292600101610dee565b825b60208210610e5b578251610e26601f83610ddb565b52602092909201917fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090910190602101610e11565b8115610986578251610e706001840383610ddb565b520160010192915050565b60006001830392505b6101078210610ebc57610eae8360ff16610ea960fd610ea98760081c60e00189610ddb565b610ddb565b935061010682039150610e84565b60078210610ee957610ee28360ff16610ea960078503610ea98760081c60e00189610ddb565b9050610986565b610a618360ff16610ea98560081c8560051b0187610ddb565b610f5b828203610f3f610f2f84600081518060001a8160011a60081b178160021a60101b17915050919050565b639e3779b90260131c611fff1690565b8060021b6040510182815160e01c1860e01b8151188152505050565b600101919050565b6180003860405139618000604051016020830180600d8551820103826002015b81811015611096576000805b50508051604051600082901a600183901a60081b1760029290921a60101b91909117639e3779b9810260111c617ffc16909101805160e081811c878603811890911b90911890915284019081830390848410610feb5750611026565b600184019350611fff8211611020578251600081901a600182901a60081b1760029190911a60101b1781036110205750611026565b50610f8f565b838310611034575050611096565b600183039250858311156110525761104f8787888603610e0f565b96505b611066600985016003850160038501610de6565b9150611073878284610e7b565b96505061108b8461108686848601610f02565b610f02565b915050809350610f83565b50506110a88383848851850103610e0f565b925050506040519150618000820180820391508183526020830160005b838110156110dd5782810151828201526020016110c5565b506000920191825250602001604052919050565b60008061110183620cc394611482565b61112b907ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd763200611652565b905061113b6064620f42406116c6565b81121561052f576109866064620f42406116c6565b80516000908190815b818110156111d35784818151811061117357611173611782565b01602001517fff00000000000000000000000000000000000000000000000000000000000000166000036111b3576111ac60048461146a565b92506111c1565b6111be60108461146a565b92505b806111cb816117b1565b915050611159565b50610a618261044061146a565b6000806111ec836110f1565b905060006111f8610b5c565b6112006105b3565b63ffffffff166112109190611482565b611218610552565b611220610832565b61122b9060106114fa565b63ffffffff1661123b9190611482565b611245919061146a565b905061125360066002611482565b61125e90600a611646565b6112688284611482565b610a6191906114bf565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156112b357600080fd5b813567ffffffffffffffff808211156112cb57600080fd5b818401915084601f8301126112df57600080fd5b8135818111156112f1576112f1611272565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561133757611337611272565b8160405282815287602084870101111561135057600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b8181101561139d57858101830151858201604001528201611381565b818111156113af576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b6000602082840312156113f557600080fd5b5035919050565b60006020828403121561140e57600080fd5b5051919050565b60006020828403121561142757600080fd5b815163ffffffff8116811461098657600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561147d5761147d61143b565b500190565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156114ba576114ba61143b565b500290565b6000826114f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600063ffffffff8083168185168183048111821515161561151d5761151d61143b565b02949350505050565b600181815b8085111561157f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048211156115655761156561143b565b8085161561157257918102915b93841c939080029061152b565b509250929050565b6000826115965750600161052f565b816115a35750600061052f565b81600181146115b957600281146115c3576115df565b600191505061052f565b60ff8411156115d4576115d461143b565b50506001821b61052f565b5060208310610133831016604e8410600b8410161715611602575081810a61052f565b61160c8383611526565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561163e5761163e61143b565b029392505050565b60006109868383611587565b6000808212827f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0384138115161561168c5761168c61143b565b827f80000000000000000000000000000000000000000000000000000000000000000384128116156116c0576116c061143b565b50500190565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6000841360008413858304851182821616156117075761170761143b565b7f800000000000000000000000000000000000000000000000000000000000000060008712868205881281841616156117425761174261143b565b6000871292508782058712848416161561175e5761175e61143b565b878505871281841616156117745761177461143b565b505050929093029392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036117e2576117e261143b565b506001019056fea164736f6c634300080f000a diff --git a/crates/consensus/src/hardforks/bytecode/l1_block_ecotone.hex b/crates/consensus/src/hardforks/bytecode/l1_block_ecotone.hex deleted file mode 100644 index 2baf6f70..00000000 --- a/crates/consensus/src/hardforks/bytecode/l1_block_ecotone.hex +++ /dev/null @@ -1 +0,0 @@ -608060405234801561001057600080fd5b5061053e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c80638381f58a11610097578063c598591811610066578063c598591814610229578063e591b28214610249578063e81b2c6d14610289578063f82061401461029257600080fd5b80638381f58a146101e35780638b239f73146101f75780639e8c496614610200578063b80777ea1461020957600080fd5b806354fd4d50116100d357806354fd4d50146101335780635cf249691461017c57806364ca23ef1461018557806368d5dca6146101b257600080fd5b8063015d8eb9146100fa57806309bd5a601461010f578063440a5e201461012b575b600080fd5b61010d61010836600461044c565b61029b565b005b61011860025481565b6040519081526020015b60405180910390f35b61010d6103da565b61016f6040518060400160405280600581526020017f312e322e3000000000000000000000000000000000000000000000000000000081525081565b60405161012291906104be565b61011860015481565b6003546101999067ffffffffffffffff1681565b60405167ffffffffffffffff9091168152602001610122565b6003546101ce9068010000000000000000900463ffffffff1681565b60405163ffffffff9091168152602001610122565b6000546101999067ffffffffffffffff1681565b61011860055481565b61011860065481565b6000546101999068010000000000000000900467ffffffffffffffff1681565b6003546101ce906c01000000000000000000000000900463ffffffff1681565b61026473deaddeaddeaddeaddeaddeaddeaddeaddead000181565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610122565b61011860045481565b61011860075481565b3373deaddeaddeaddeaddeaddeaddeaddeaddead000114610342576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f4c31426c6f636b3a206f6e6c7920746865206465706f7369746f72206163636f60448201527f756e742063616e20736574204c3120626c6f636b2076616c7565730000000000606482015260840160405180910390fd5b6000805467ffffffffffffffff98891668010000000000000000027fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116998916999099179890981790975560019490945560029290925560038054919094167fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000009190911617909255600491909155600555600655565b3373deaddeaddeaddeaddeaddeaddeaddeaddead00011461040357633cc50b456000526004601cfd5b60043560801c60035560143560801c600055602435600155604435600755606435600255608435600455565b803567ffffffffffffffff8116811461044757600080fd5b919050565b600080600080600080600080610100898b03121561046957600080fd5b6104728961042f565b975061048060208a0161042f565b9650604089013595506060890135945061049c60808a0161042f565b979a969950949793969560a0850135955060c08501359460e001359350915050565b600060208083528351808285015260005b818110156104eb578581018301518582016040015282016104cf565b818111156104fd576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01692909201604001939250505056fea164736f6c634300080f000a diff --git a/crates/consensus/src/hardforks/ecotone.rs b/crates/consensus/src/hardforks/ecotone.rs deleted file mode 100644 index 144b2f59..00000000 --- a/crates/consensus/src/hardforks/ecotone.rs +++ /dev/null @@ -1,192 +0,0 @@ -//! Module containing a [Transaction] builder for the Ecotone network upgrade transactions. -//! -//! [Transaction]: alloy_consensus::Transaction - -use alloc::{string::String, vec::Vec}; -use alloy_eips::eip2718::Encodable2718; -use alloy_primitives::{address, hex, Address, Bytes, TxKind, B256, U256}; - -use crate::{Hardfork, TxDeposit, UpgradeDepositSource}; - -/// The Ecotone network upgrade transactions. -#[derive(Debug, Default, Clone, Copy)] -pub struct Ecotone; - -impl Ecotone { - /// The Gas Price Oracle Address - /// This is computed by using go-ethereum's `crypto.CreateAddress` function, - /// with the Gas Price Oracle Deployer Address and nonce 0. - pub const GAS_PRICE_ORACLE: Address = address!("b528d11cc114e026f138fe568744c6d45ce6da7a"); - - /// The Enable Ecotone Input Method 4Byte Signature - pub const ENABLE_ECOTONE_INPUT: [u8; 4] = hex!("22b908b3"); - - /// L1 Block Deployer Address - pub const L1_BLOCK_DEPLOYER: Address = address!("4210000000000000000000000000000000000000"); - - /// The Gas Price Oracle Deployer Address - pub const GAS_PRICE_ORACLE_DEPLOYER: Address = - address!("4210000000000000000000000000000000000001"); - - /// The new L1 Block Address - /// This is computed by using go-ethereum's `crypto.CreateAddress` function, - /// with the L1 Block Deployer Address and nonce 0. - pub const NEW_L1_BLOCK: Address = address!("07dbe8500fc591d1852b76fee44d5a05e13097ff"); - - /// EIP-4788 From Address - pub const EIP4788_FROM: Address = address!("0B799C86a49DEeb90402691F1041aa3AF2d3C875"); - - /// Returns the source hash for the deployment of the l1 block contract. - pub fn deploy_l1_block_source() -> B256 { - UpgradeDepositSource { intent: String::from("Ecotone: L1 Block Deployment") }.source_hash() - } - - /// Returns the source hash for the deployment of the gas price oracle contract. - pub fn deploy_gas_price_oracle_source() -> B256 { - UpgradeDepositSource { intent: String::from("Ecotone: Gas Price Oracle Deployment") } - .source_hash() - } - - /// Returns the source hash for the update of the l1 block proxy. - pub fn update_l1_block_source() -> B256 { - UpgradeDepositSource { intent: String::from("Ecotone: L1 Block Proxy Update") } - .source_hash() - } - - /// Returns the source hash for the update of the gas price oracle proxy. - pub fn update_gas_price_oracle_source() -> B256 { - UpgradeDepositSource { intent: String::from("Ecotone: Gas Price Oracle Proxy Update") } - .source_hash() - } - - /// Returns the source hash for the Ecotone Beacon Block Roots Contract deployment. - pub fn beacon_roots_source() -> B256 { - UpgradeDepositSource { - intent: String::from("Ecotone: beacon block roots contract deployment"), - } - .source_hash() - } - - /// Returns the source hash for the Ecotone Gas Price Oracle activation. - pub fn enable_ecotone_source() -> B256 { - UpgradeDepositSource { intent: String::from("Ecotone: Gas Price Oracle Set Ecotone") } - .source_hash() - } - - /// Returns the EIP-4788 creation data. - pub fn eip4788_creation_data() -> Bytes { - include_bytes!("./bytecode/eip4788_ecotone.hex").into() - } - - /// Returns the raw bytecode for the L1 Block deployment. - pub fn l1_block_deployment_bytecode() -> Bytes { - include_bytes!("./bytecode/l1_block_ecotone.hex").into() - } - - /// Returns the gas price oracle deployment bytecode. - pub fn ecotone_gas_price_oracle_deployment_bytecode() -> Bytes { - include_bytes!("./bytecode/gpo_ecotone.hex").into() - } - - /// Returns the list of [TxDeposit]s for the Ecotone network upgrade. - pub fn deposits() -> impl Iterator { - ([ - TxDeposit { - source_hash: Self::deploy_l1_block_source(), - from: Self::L1_BLOCK_DEPLOYER, - to: TxKind::Create, - mint: 0.into(), - value: U256::ZERO, - gas_limit: 375_000, - is_system_transaction: false, - input: Self::l1_block_deployment_bytecode(), - }, - TxDeposit { - source_hash: Self::deploy_gas_price_oracle_source(), - from: Self::GAS_PRICE_ORACLE_DEPLOYER, - to: TxKind::Create, - mint: 0.into(), - value: U256::ZERO, - gas_limit: 1_000_000, - is_system_transaction: false, - input: Self::ecotone_gas_price_oracle_deployment_bytecode(), - }, - TxDeposit { - source_hash: Self::update_l1_block_source(), - from: Address::default(), - to: TxKind::Call(Self::L1_BLOCK_DEPLOYER), - mint: 0.into(), - value: U256::ZERO, - gas_limit: 50_000, - is_system_transaction: false, - input: super::upgrade_to_calldata(Self::NEW_L1_BLOCK), - }, - TxDeposit { - source_hash: Self::update_gas_price_oracle_source(), - from: Address::default(), - to: TxKind::Call(Self::GAS_PRICE_ORACLE_DEPLOYER), - mint: 0.into(), - value: U256::ZERO, - gas_limit: 50_000, - is_system_transaction: false, - input: super::upgrade_to_calldata(Self::GAS_PRICE_ORACLE), - }, - TxDeposit { - source_hash: Self::enable_ecotone_source(), - from: Self::L1_BLOCK_DEPLOYER, - to: TxKind::Call(Self::GAS_PRICE_ORACLE), - mint: 0.into(), - value: U256::ZERO, - gas_limit: 80_000, - is_system_transaction: false, - input: Self::ENABLE_ECOTONE_INPUT.into(), - }, - TxDeposit { - source_hash: Self::beacon_roots_source(), - from: Self::EIP4788_FROM, - to: TxKind::Create, - mint: 0.into(), - value: U256::ZERO, - gas_limit: 250_000, - is_system_transaction: false, - input: Self::eip4788_creation_data(), - }, - ]) - .into_iter() - } -} - -impl Hardfork for Ecotone { - /// Constructs the Ecotone network upgrade transactions. - fn txs(&self) -> impl Iterator + '_ { - Self::deposits().map(|tx| { - let mut encoded = Vec::new(); - tx.encode_2718(&mut encoded); - Bytes::from(encoded) - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloc::vec; - - #[test] - fn test_ecotone_txs_encoded() { - let ecotone_upgrade_tx = Ecotone.txs().collect::>(); - assert_eq!(ecotone_upgrade_tx.len(), 6); - - let expected_txs: Vec = vec![ - hex::decode(include_bytes!("./bytecode/ecotone_tx_0.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/ecotone_tx_1.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/ecotone_tx_2.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/ecotone_tx_3.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/ecotone_tx_4.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/ecotone_tx_5.hex")).unwrap().into(), - ]; - for (i, expected) in expected_txs.iter().enumerate() { - assert_eq!(ecotone_upgrade_tx[i], *expected); - } - } -} diff --git a/crates/consensus/src/hardforks/fjord.rs b/crates/consensus/src/hardforks/fjord.rs deleted file mode 100644 index 1d4cf831..00000000 --- a/crates/consensus/src/hardforks/fjord.rs +++ /dev/null @@ -1,127 +0,0 @@ -//! Module containing a [Transaction] builder for the Fjord network upgrade transactions. -//! -//! [Transaction]: alloy_consensus::Transaction - -use alloc::{string::String, vec::Vec}; -use alloy_eips::eip2718::Encodable2718; -use alloy_primitives::{address, hex, Address, Bytes, TxKind, B256, U256}; - -use crate::{Hardfork, TxDeposit, UpgradeDepositSource}; - -/// The Fjord network upgrade transactions. -#[derive(Debug, Default, Clone, Copy)] -pub struct Fjord; - -impl Fjord { - /// The Gas Price Oracle Address - /// This is computed by using go-ethereum's `crypto.CreateAddress` function, - /// with the Gas Price Oracle Deployer Address and nonce 0. - pub const GAS_PRICE_ORACLE: Address = address!("b528d11cc114e026f138fe568744c6d45ce6da7a"); - - /// The L1 Info Depositer Address. - pub const L1_INFO_DEPOSITER: Address = address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001"); - - /// Fjord Gas Price Oracle Deployer Address. - pub const GAS_PRICE_ORACLE_FJORD_DEPLOYER: Address = - address!("4210000000000000000000000000000000000002"); - - /// Fjord Gas Price Oracle address. - pub const FJORD_GAS_PRICE_ORACLE: Address = - address!("a919894851548179a0750865e7974da599c0fac7"); - - /// The Set Fjord Four Byte Method Signature. - pub const SET_FJORD_METHOD_SIGNATURE: [u8; 4] = hex!("8e98b106"); - - /// Returns the source hash for the deployment of the Fjord Gas Price Oracle. - pub fn deploy_fjord_gas_price_oracle_source() -> B256 { - UpgradeDepositSource { intent: String::from("Fjord: Gas Price Oracle Deployment") } - .source_hash() - } - - /// Returns the source hash for the update of the Fjord Gas Price Oracle. - pub fn update_fjord_gas_price_oracle_source() -> B256 { - UpgradeDepositSource { intent: String::from("Fjord: Gas Price Oracle Proxy Update") } - .source_hash() - } - - /// [UpgradeDepositSource] for setting the Fjord Gas Price Oracle. - pub fn enable_fjord_source() -> B256 { - UpgradeDepositSource { intent: String::from("Fjord: Gas Price Oracle Set Fjord") } - .source_hash() - } - - /// Returns the fjord gas price oracle deployment bytecode. - pub fn gas_price_oracle_deployment_bytecode() -> alloy_primitives::Bytes { - include_bytes!("./bytecode/gpo_fjord.hex").into() - } - - /// Returns the list of [TxDeposit]s for the Fjord network upgrade. - pub fn deposits() -> impl Iterator { - ([ - TxDeposit { - source_hash: Self::deploy_fjord_gas_price_oracle_source(), - from: Self::GAS_PRICE_ORACLE_FJORD_DEPLOYER, - to: TxKind::Create, - mint: 0.into(), - value: U256::ZERO, - gas_limit: 1_450_000, - is_system_transaction: false, - input: Self::gas_price_oracle_deployment_bytecode(), - }, - TxDeposit { - source_hash: Self::update_fjord_gas_price_oracle_source(), - from: Address::ZERO, - to: TxKind::Call(Self::GAS_PRICE_ORACLE), - mint: 0.into(), - value: U256::ZERO, - gas_limit: 50_000, - is_system_transaction: false, - input: super::upgrade_to_calldata(Self::FJORD_GAS_PRICE_ORACLE), - }, - // Enable Fjord - TxDeposit { - source_hash: Self::enable_fjord_source(), - from: Self::L1_INFO_DEPOSITER, - to: TxKind::Call(Self::GAS_PRICE_ORACLE), - mint: 0.into(), - value: U256::ZERO, - gas_limit: 90_000, - is_system_transaction: false, - input: Self::SET_FJORD_METHOD_SIGNATURE.into(), - }, - ]) - .into_iter() - } -} - -impl Hardfork for Fjord { - /// Constructs the Fjord network upgrade transactions. - fn txs(&self) -> impl Iterator + '_ { - Self::deposits().map(|tx| { - let mut encoded = Vec::new(); - tx.encode_2718(&mut encoded); - Bytes::from(encoded) - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloc::vec; - - #[test] - fn test_fjord_txs_encoded() { - let fjord_upgrade_tx = Fjord.txs().collect::>(); - assert_eq!(fjord_upgrade_tx.len(), 3); - - let expected_txs: Vec = vec![ - hex::decode(include_bytes!("./bytecode/fjord_tx_0.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/fjord_tx_1.hex")).unwrap().into(), - hex::decode(include_bytes!("./bytecode/fjord_tx_2.hex")).unwrap().into(), - ]; - for (i, expected) in expected_txs.iter().enumerate() { - assert_eq!(fjord_upgrade_tx[i], *expected); - } - } -} diff --git a/crates/consensus/src/hardforks/forks.rs b/crates/consensus/src/hardforks/forks.rs deleted file mode 100644 index 4862ef4f..00000000 --- a/crates/consensus/src/hardforks/forks.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! Contains all hardforks represented in the [crate::Hardfork] type. - -use crate::{Ecotone, Fjord}; - -/// Optimism Hardforks -/// -/// This type is used to encapsulate hardfork transactions. -/// It exposes methods that return hardfork upgrade transactions -/// as [alloy_primitives::Bytes]. -/// -/// # Example -/// -/// Build ecotone hardfork upgrade transaction: -/// ```rust -/// use op_alloy_consensus::{Hardfork, Hardforks}; -/// let ecotone_upgrade_tx = Hardforks::ECOTONE.txs(); -/// assert_eq!(ecotone_upgrade_tx.collect::>().len(), 6); -/// ``` -/// -/// Build fjord hardfork upgrade transactions: -/// ```rust -/// use op_alloy_consensus::{Hardfork, Hardforks}; -/// let fjord_upgrade_txs = Hardforks::FJORD.txs(); -/// assert_eq!(fjord_upgrade_txs.collect::>().len(), 3); -/// ``` -#[derive(Debug, Default, Clone, Copy)] -#[non_exhaustive] -pub struct Hardforks; - -impl Hardforks { - /// The ecotone hardfork upgrade transactions. - pub const ECOTONE: Ecotone = Ecotone; - - /// The fjord hardfork upgrade transactions. - pub const FJORD: Fjord = Fjord; -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::Hardfork; - use alloc::vec::Vec; - - #[test] - fn test_hardforks() { - let ecotone_upgrade_tx = Hardforks::ECOTONE.txs(); - assert_eq!(ecotone_upgrade_tx.collect::>().len(), 6); - - let fjord_upgrade_txs = Hardforks::FJORD.txs(); - assert_eq!(fjord_upgrade_txs.collect::>().len(), 3); - } -} diff --git a/crates/consensus/src/hardforks/mod.rs b/crates/consensus/src/hardforks/mod.rs deleted file mode 100644 index b66c9744..00000000 --- a/crates/consensus/src/hardforks/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -//! OP Stack Hardfork Transaction Updates - -mod traits; -pub use traits::Hardfork; - -mod forks; -pub use forks::Hardforks; - -mod fjord; -pub use fjord::Fjord; - -mod ecotone; -pub use ecotone::Ecotone; - -mod utils; -pub(crate) use utils::upgrade_to_calldata; diff --git a/crates/consensus/src/hardforks/traits.rs b/crates/consensus/src/hardforks/traits.rs deleted file mode 100644 index f4bbd3d0..00000000 --- a/crates/consensus/src/hardforks/traits.rs +++ /dev/null @@ -1,9 +0,0 @@ -//! The trait abstraction for a Hardfork. - -use alloy_primitives::Bytes; - -/// The trait abstraction for a Hardfork. -pub trait Hardfork { - /// Returns the hardfork upgrade transactions as [Bytes]. - fn txs(&self) -> impl Iterator + '_; -} diff --git a/crates/consensus/src/hardforks/utils.rs b/crates/consensus/src/hardforks/utils.rs deleted file mode 100644 index c8052abf..00000000 --- a/crates/consensus/src/hardforks/utils.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Utilities for creating hardforks. - -use alloy_primitives::{hex, Address, Bytes}; - -/// UpgradeTo Function 4Byte Signature -pub(crate) const UPGRADE_TO_FUNC_BYTES_4: [u8; 4] = hex!("3659cfe6"); - -/// Turns the given address into calldata for the `upgradeTo` function. -pub(crate) fn upgrade_to_calldata(addr: Address) -> Bytes { - let mut v = UPGRADE_TO_FUNC_BYTES_4.to_vec(); - v.extend_from_slice(addr.as_slice()); - v.into() -} diff --git a/crates/consensus/src/lib.rs b/crates/consensus/src/lib.rs deleted file mode 100644 index ab118c65..00000000 --- a/crates/consensus/src/lib.rs +++ /dev/null @@ -1,47 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate alloc; - -mod receipt; -pub use receipt::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope, OpTxReceipt}; - -mod transaction; -pub use transaction::{ - DepositSourceDomain, DepositSourceDomainIdentifier, DepositTransaction, L1InfoDepositSource, - OpPooledTransaction, OpTxEnvelope, OpTxType, OpTypedTransaction, TxDeposit, - UpgradeDepositSource, UserDepositSource, DEPOSIT_TX_TYPE_ID, -}; - -pub mod eip1559; -pub use eip1559::{ - decode_eip_1559_params, decode_holocene_extra_data, encode_holocene_extra_data, - EIP1559ParamError, -}; - -mod hardforks; -pub use hardforks::{Ecotone, Fjord, Hardfork, Hardforks}; - -mod block; -pub use block::OpBlock; - -#[cfg(feature = "serde")] -pub use transaction::serde_deposit_tx_rpc; - -/// Bincode-compatible serde implementations for consensus types. -/// -/// `bincode` crate doesn't work well with optionally serializable serde fields, but some of the -/// consensus types require optional serialization for RPC compatibility. This module makes so that -/// all fields are serialized. -/// -/// Read more: -#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))] -pub mod serde_bincode_compat { - pub use super::transaction::serde_bincode_compat::TxDeposit; -} diff --git a/crates/consensus/src/receipt/envelope.rs b/crates/consensus/src/receipt/envelope.rs deleted file mode 100644 index b321e81a..00000000 --- a/crates/consensus/src/receipt/envelope.rs +++ /dev/null @@ -1,377 +0,0 @@ -//! Receipt envelope types for Optimism. - -use crate::{OpDepositReceipt, OpDepositReceiptWithBloom, OpTxType}; -use alloc::vec::Vec; -use alloy_consensus::{Eip658Value, Receipt, ReceiptWithBloom, TxReceipt}; -use alloy_eips::eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}; -use alloy_primitives::{logs_bloom, Bloom, Log}; -use alloy_rlp::{length_of_length, BufMut, Decodable, Encodable}; - -/// Receipt envelope, as defined in [EIP-2718], modified for OP Stack chains. -/// -/// This enum distinguishes between tagged and untagged legacy receipts, as the -/// in-protocol merkle tree may commit to EITHER 0-prefixed or raw. Therefore -/// we must ensure that encoding returns the precise byte-array that was -/// decoded, preserving the presence or absence of the `TransactionType` flag. -/// -/// Transaction receipt payloads are specified in their respective EIPs. -/// -/// [EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718 -#[derive(Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(tag = "type"))] -#[non_exhaustive] -pub enum OpReceiptEnvelope { - /// Receipt envelope with no type flag. - #[cfg_attr(feature = "serde", serde(rename = "0x0", alias = "0x00"))] - Legacy(ReceiptWithBloom>), - /// Receipt envelope with type flag 1, containing a [EIP-2930] receipt. - /// - /// [EIP-2930]: https://eips.ethereum.org/EIPS/eip-2930 - #[cfg_attr(feature = "serde", serde(rename = "0x1", alias = "0x01"))] - Eip2930(ReceiptWithBloom>), - /// Receipt envelope with type flag 2, containing a [EIP-1559] receipt. - /// - /// [EIP-1559]: https://eips.ethereum.org/EIPS/eip-1559 - #[cfg_attr(feature = "serde", serde(rename = "0x2", alias = "0x02"))] - Eip1559(ReceiptWithBloom>), - /// Receipt envelope with type flag 4, containing a [EIP-7702] receipt. - /// - /// [EIP-7702]: https://eips.ethereum.org/EIPS/eip-7702 - #[cfg_attr(feature = "serde", serde(rename = "0x4", alias = "0x04"))] - Eip7702(ReceiptWithBloom>), - /// Receipt envelope with type flag 126, containing a [deposit] receipt. - /// - /// [deposit]: https://specs.optimism.io/protocol/deposits.html - #[cfg_attr(feature = "serde", serde(rename = "0x7e", alias = "0x7E"))] - Deposit(ReceiptWithBloom>), -} - -impl OpReceiptEnvelope { - /// Creates a new [`OpReceiptEnvelope`] from the given parts. - pub fn from_parts<'a>( - status: bool, - cumulative_gas_used: u64, - logs: impl IntoIterator, - tx_type: OpTxType, - deposit_nonce: Option, - deposit_receipt_version: Option, - ) -> Self { - let logs = logs.into_iter().cloned().collect::>(); - let logs_bloom = logs_bloom(&logs); - let inner_receipt = - Receipt { status: Eip658Value::Eip658(status), cumulative_gas_used, logs }; - match tx_type { - OpTxType::Legacy => { - Self::Legacy(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip2930 => { - Self::Eip2930(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip1559 => { - Self::Eip1559(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Eip7702 => { - Self::Eip7702(ReceiptWithBloom { receipt: inner_receipt, logs_bloom }) - } - OpTxType::Deposit => { - let inner = OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: inner_receipt, - deposit_nonce, - deposit_receipt_version, - }, - logs_bloom, - }; - Self::Deposit(inner) - } - } - } -} - -impl OpReceiptEnvelope { - /// Return the [`OpTxType`] of the inner receipt. - pub const fn tx_type(&self) -> OpTxType { - match self { - Self::Legacy(_) => OpTxType::Legacy, - Self::Eip2930(_) => OpTxType::Eip2930, - Self::Eip1559(_) => OpTxType::Eip1559, - Self::Eip7702(_) => OpTxType::Eip7702, - Self::Deposit(_) => OpTxType::Deposit, - } - } - - /// Return true if the transaction was successful. - pub fn is_success(&self) -> bool { - self.status() - } - - /// Returns the success status of the receipt's transaction. - pub fn status(&self) -> bool { - self.as_receipt().unwrap().status.coerce_status() - } - - /// Returns the cumulative gas used at this receipt. - pub fn cumulative_gas_used(&self) -> u64 { - self.as_receipt().unwrap().cumulative_gas_used - } - - /// Return the receipt logs. - pub fn logs(&self) -> &[T] { - &self.as_receipt().unwrap().logs - } - - /// Return the receipt's bloom. - pub const fn logs_bloom(&self) -> &Bloom { - match self { - Self::Legacy(t) => &t.logs_bloom, - Self::Eip2930(t) => &t.logs_bloom, - Self::Eip1559(t) => &t.logs_bloom, - Self::Eip7702(t) => &t.logs_bloom, - Self::Deposit(t) => &t.logs_bloom, - } - } - - /// Return the receipt's deposit_nonce if it is a deposit receipt. - pub fn deposit_nonce(&self) -> Option { - self.as_deposit_receipt().and_then(|r| r.deposit_nonce) - } - - /// Return the receipt's deposit version if it is a deposit receipt. - pub fn deposit_receipt_version(&self) -> Option { - self.as_deposit_receipt().and_then(|r| r.deposit_receipt_version) - } - - /// Returns the deposit receipt if it is a deposit receipt. - pub const fn as_deposit_receipt_with_bloom(&self) -> Option<&OpDepositReceiptWithBloom> { - match self { - Self::Deposit(t) => Some(t), - _ => None, - } - } - - /// Returns the deposit receipt if it is a deposit receipt. - pub const fn as_deposit_receipt(&self) -> Option<&OpDepositReceipt> { - match self { - Self::Deposit(t) => Some(&t.receipt), - _ => None, - } - } - - /// Return the inner receipt. Currently this is infallible, however, future - /// receipt types may be added. - pub const fn as_receipt(&self) -> Option<&Receipt> { - match self { - Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) | Self::Eip7702(t) => { - Some(&t.receipt) - } - Self::Deposit(t) => Some(&t.receipt.inner), - } - } -} - -impl OpReceiptEnvelope { - /// Get the length of the inner receipt in the 2718 encoding. - pub fn inner_length(&self) -> usize { - match self { - Self::Legacy(t) => t.length(), - Self::Eip2930(t) => t.length(), - Self::Eip1559(t) => t.length(), - Self::Eip7702(t) => t.length(), - Self::Deposit(t) => t.length(), - } - } - - /// Calculate the length of the rlp payload of the network encoded receipt. - pub fn rlp_payload_length(&self) -> usize { - let length = self.inner_length(); - match self { - Self::Legacy(_) => length, - _ => length + 1, - } - } -} - -impl TxReceipt for OpReceiptEnvelope -where - T: Clone + core::fmt::Debug + PartialEq + Eq + Send + Sync, -{ - type Log = T; - - fn status_or_post_state(&self) -> Eip658Value { - self.as_receipt().unwrap().status - } - - fn status(&self) -> bool { - self.as_receipt().unwrap().status.coerce_status() - } - - /// Return the receipt's bloom. - fn bloom(&self) -> Bloom { - *self.logs_bloom() - } - - fn bloom_cheap(&self) -> Option { - Some(self.bloom()) - } - - /// Returns the cumulative gas used at this receipt. - fn cumulative_gas_used(&self) -> u64 { - self.as_receipt().unwrap().cumulative_gas_used - } - - /// Return the receipt logs. - fn logs(&self) -> &[T] { - &self.as_receipt().unwrap().logs - } -} - -impl Encodable for OpReceiptEnvelope { - fn encode(&self, out: &mut dyn alloy_rlp::BufMut) { - self.network_encode(out) - } - - fn length(&self) -> usize { - let mut payload_length = self.rlp_payload_length(); - if !self.is_legacy() { - payload_length += length_of_length(payload_length); - } - payload_length - } -} - -impl Decodable for OpReceiptEnvelope { - fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { - Self::network_decode(buf) - .map_or_else(|_| Err(alloy_rlp::Error::Custom("Unexpected type")), Ok) - } -} - -impl Encodable2718 for OpReceiptEnvelope { - fn type_flag(&self) -> Option { - match self { - Self::Legacy(_) => None, - Self::Eip2930(_) => Some(OpTxType::Eip2930 as u8), - Self::Eip1559(_) => Some(OpTxType::Eip1559 as u8), - Self::Eip7702(_) => Some(OpTxType::Eip7702 as u8), - Self::Deposit(_) => Some(OpTxType::Deposit as u8), - } - } - - fn encode_2718_len(&self) -> usize { - self.inner_length() + !self.is_legacy() as usize - } - - fn encode_2718(&self, out: &mut dyn BufMut) { - match self.type_flag() { - None => {} - Some(ty) => out.put_u8(ty), - } - match self { - Self::Deposit(t) => t.encode(out), - Self::Legacy(t) | Self::Eip2930(t) | Self::Eip1559(t) | Self::Eip7702(t) => { - t.encode(out) - } - } - } -} - -impl Decodable2718 for OpReceiptEnvelope { - fn typed_decode(ty: u8, buf: &mut &[u8]) -> Eip2718Result { - match ty.try_into().map_err(|_| Eip2718Error::UnexpectedType(ty))? { - OpTxType::Legacy => { - Err(alloy_rlp::Error::Custom("type-0 eip2718 transactions are not supported") - .into()) - } - OpTxType::Eip1559 => Ok(Self::Eip1559(Decodable::decode(buf)?)), - OpTxType::Eip7702 => Ok(Self::Eip7702(Decodable::decode(buf)?)), - OpTxType::Eip2930 => Ok(Self::Eip2930(Decodable::decode(buf)?)), - OpTxType::Deposit => Ok(Self::Deposit(Decodable::decode(buf)?)), - } - } - - fn fallback_decode(buf: &mut &[u8]) -> Eip2718Result { - Ok(Self::Legacy(Decodable::decode(buf)?)) - } -} - -#[cfg(all(test, feature = "arbitrary"))] -impl<'a, T> arbitrary::Arbitrary<'a> for OpReceiptEnvelope -where - T: arbitrary::Arbitrary<'a>, -{ - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - match u.int_in_range(0..=4)? { - 0 => Ok(Self::Legacy(ReceiptWithBloom::arbitrary(u)?)), - 1 => Ok(Self::Eip2930(ReceiptWithBloom::arbitrary(u)?)), - 2 => Ok(Self::Eip1559(ReceiptWithBloom::arbitrary(u)?)), - _ => Ok(Self::Deposit(OpDepositReceiptWithBloom::arbitrary(u)?)), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_consensus::{Receipt, ReceiptWithBloom}; - use alloy_eips::eip2718::Encodable2718; - use alloy_primitives::{address, b256, bytes, hex, Log, LogData}; - use alloy_rlp::Encodable; - - #[cfg(not(feature = "std"))] - use alloc::vec; - - // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 - #[test] - fn encode_legacy_receipt() { - let expected = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"); - - let mut data = vec![]; - let receipt = - OpReceiptEnvelope::Legacy(ReceiptWithBloom { - receipt: Receipt { - status: false.into(), - cumulative_gas_used: 0x1, - logs: vec![Log { - address: address!("0000000000000000000000000000000000000011"), - data: LogData::new_unchecked( - vec![ - b256!("000000000000000000000000000000000000000000000000000000000000dead"), - b256!("000000000000000000000000000000000000000000000000000000000000beef"), - ], - bytes!("0100ff"), - ), - }], - }, - logs_bloom: [0; 256].into(), - }); - - receipt.network_encode(&mut data); - - // check that the rlp length equals the length of the expected rlp - assert_eq!(receipt.length(), expected.len()); - assert_eq!(data, expected); - } - - #[test] - fn legacy_receipt_from_parts() { - let receipt = - OpReceiptEnvelope::from_parts(true, 100, vec![], OpTxType::Legacy, None, None); - assert!(receipt.status()); - assert_eq!(receipt.cumulative_gas_used(), 100); - assert_eq!(receipt.logs().len(), 0); - assert_eq!(receipt.tx_type(), OpTxType::Legacy); - } - - #[test] - fn deposit_receipt_from_parts() { - let receipt = - OpReceiptEnvelope::from_parts(true, 100, vec![], OpTxType::Deposit, Some(1), Some(2)); - assert!(receipt.status()); - assert_eq!(receipt.cumulative_gas_used(), 100); - assert_eq!(receipt.logs().len(), 0); - assert_eq!(receipt.tx_type(), OpTxType::Deposit); - assert_eq!(receipt.deposit_nonce(), Some(1)); - assert_eq!(receipt.deposit_receipt_version(), Some(2)); - } -} diff --git a/crates/consensus/src/receipt/mod.rs b/crates/consensus/src/receipt/mod.rs deleted file mode 100644 index a259ee52..00000000 --- a/crates/consensus/src/receipt/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Receipt types for Optimism. - -use alloy_consensus::TxReceipt; - -mod envelope; -pub use envelope::OpReceiptEnvelope; - -mod receipts; -pub use receipts::{OpDepositReceipt, OpDepositReceiptWithBloom}; - -/// Receipt is the result of a transaction execution. -pub trait OpTxReceipt: TxReceipt { - /// Returns the deposit nonce of the transaction. - fn deposit_nonce(&self) -> Option; - - /// Returns the deposit receipt version of the transaction. - fn deposit_receipt_version(&self) -> Option; -} diff --git a/crates/consensus/src/receipt/receipts.rs b/crates/consensus/src/receipt/receipts.rs deleted file mode 100644 index 4a9ba7ed..00000000 --- a/crates/consensus/src/receipt/receipts.rs +++ /dev/null @@ -1,352 +0,0 @@ -//! Transaction receipt types for Optimism. - -use super::OpTxReceipt; -use alloy_consensus::{ - Eip658Value, Receipt, ReceiptWithBloom, RlpDecodableReceipt, RlpEncodableReceipt, TxReceipt, -}; -use alloy_primitives::{Bloom, Log}; -use alloy_rlp::{Buf, BufMut, Decodable, Encodable, Header}; - -/// Receipt containing result of transaction execution. -#[derive(Clone, Debug, PartialEq, Eq, Default)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct OpDepositReceipt { - /// The inner receipt type. - #[cfg_attr(feature = "serde", serde(flatten))] - pub inner: Receipt, - /// Deposit nonce for Optimism deposit transactions - #[cfg_attr( - feature = "serde", - serde( - default, - skip_serializing_if = "Option::is_none", - with = "alloy_serde::quantity::opt" - ) - )] - pub deposit_nonce: Option, - /// Deposit receipt version for Optimism deposit transactions - /// - /// The deposit receipt version was introduced in Canyon to indicate an update to how - /// receipt hashes should be computed when set. The state transition process - /// ensures this is only set for post-Canyon deposit transactions. - #[cfg_attr( - feature = "serde", - serde( - default, - skip_serializing_if = "Option::is_none", - with = "alloy_serde::quantity::opt" - ) - )] - pub deposit_receipt_version: Option, -} - -impl OpDepositReceipt { - /// Calculates [`Log`]'s bloom filter. this is slow operation and [OpDepositReceiptWithBloom] - /// can be used to cache this value. - pub fn bloom_slow(&self) -> Bloom { - self.inner.logs.iter().collect() - } - - /// Calculates the bloom filter for the receipt and returns the [OpDepositReceiptWithBloom] - /// container type. - pub fn with_bloom(self) -> OpDepositReceiptWithBloom { - self.into() - } -} - -impl OpDepositReceipt { - /// Returns length of RLP-encoded receipt fields with the given [`Bloom`] without an RLP header. - pub fn rlp_encoded_fields_length_with_bloom(&self, bloom: &Bloom) -> usize { - self.inner.rlp_encoded_fields_length_with_bloom(bloom) - + self.deposit_nonce.map_or(0, |nonce| nonce.length()) - + self.deposit_receipt_version.map_or(0, |version| version.length()) - } - - /// RLP-encodes receipt fields with the given [`Bloom`] without an RLP header. - pub fn rlp_encode_fields_with_bloom(&self, bloom: &Bloom, out: &mut dyn BufMut) { - self.inner.rlp_encode_fields_with_bloom(bloom, out); - - if let Some(nonce) = self.deposit_nonce { - nonce.encode(out); - } - if let Some(version) = self.deposit_receipt_version { - version.encode(out); - } - } - - /// Returns RLP header for this receipt encoding with the given [`Bloom`]. - pub fn rlp_header_with_bloom(&self, bloom: &Bloom) -> Header { - Header { list: true, payload_length: self.rlp_encoded_fields_length_with_bloom(bloom) } - } -} - -impl OpDepositReceipt { - /// RLP-decodes receipt's field with a [`Bloom`]. - /// - /// Does not expect an RLP header. - pub fn rlp_decode_fields_with_bloom( - buf: &mut &[u8], - ) -> alloy_rlp::Result> { - let ReceiptWithBloom { receipt: inner, logs_bloom } = - Receipt::rlp_decode_fields_with_bloom(buf)?; - - let deposit_nonce = (!buf.is_empty()).then(|| Decodable::decode(buf)).transpose()?; - let deposit_receipt_version = - (!buf.is_empty()).then(|| Decodable::decode(buf)).transpose()?; - - Ok(ReceiptWithBloom { - logs_bloom, - receipt: Self { inner, deposit_nonce, deposit_receipt_version }, - }) - } -} - -impl AsRef> for OpDepositReceipt { - fn as_ref(&self) -> &Receipt { - &self.inner - } -} - -impl TxReceipt for OpDepositReceipt -where - T: AsRef + Clone + core::fmt::Debug + PartialEq + Eq + Send + Sync, -{ - type Log = T; - - fn status_or_post_state(&self) -> Eip658Value { - self.inner.status_or_post_state() - } - - fn status(&self) -> bool { - self.inner.status() - } - - fn bloom(&self) -> Bloom { - self.inner.bloom_slow() - } - - fn cumulative_gas_used(&self) -> u64 { - self.inner.cumulative_gas_used() - } - - fn logs(&self) -> &[Self::Log] { - self.inner.logs() - } -} - -impl RlpEncodableReceipt for OpDepositReceipt { - fn rlp_encoded_length_with_bloom(&self, bloom: &Bloom) -> usize { - self.rlp_header_with_bloom(bloom).length_with_payload() - } - - fn rlp_encode_with_bloom(&self, bloom: &Bloom, out: &mut dyn BufMut) { - self.rlp_header_with_bloom(bloom).encode(out); - self.rlp_encode_fields_with_bloom(bloom, out); - } -} - -impl RlpDecodableReceipt for OpDepositReceipt { - fn rlp_decode_with_bloom(buf: &mut &[u8]) -> alloy_rlp::Result> { - let header = Header::decode(buf)?; - if !header.list { - return Err(alloy_rlp::Error::UnexpectedString); - } - - if buf.len() < header.payload_length { - return Err(alloy_rlp::Error::InputTooShort); - } - - // Note: we pass a separate buffer to `rlp_decode_fields_with_bloom` to allow it decode - // optional fields based on the remaining length. - let mut fields_buf = &buf[..header.payload_length]; - let this = Self::rlp_decode_fields_with_bloom(&mut fields_buf)?; - - if !fields_buf.is_empty() { - return Err(alloy_rlp::Error::UnexpectedLength); - } - - buf.advance(header.payload_length); - - Ok(this) - } -} - -impl OpTxReceipt for OpDepositReceipt { - fn deposit_nonce(&self) -> Option { - self.deposit_nonce - } - - fn deposit_receipt_version(&self) -> Option { - self.deposit_receipt_version - } -} - -/// [`OpDepositReceipt`] with calculated bloom filter, modified for the OP Stack. -/// -/// This convenience type allows us to lazily calculate the bloom filter for a -/// receipt, similar to [`Sealed`]. -/// -/// [`Sealed`]: alloy_consensus::Sealed -pub type OpDepositReceiptWithBloom = ReceiptWithBloom>; - -#[cfg(any(test, feature = "arbitrary"))] -impl<'a, T> arbitrary::Arbitrary<'a> for OpDepositReceipt -where - T: arbitrary::Arbitrary<'a>, -{ - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - #[cfg(not(feature = "std"))] - use alloc::vec::Vec; - let deposit_nonce = Option::::arbitrary(u)?; - let deposit_receipt_version = - deposit_nonce.is_some().then(|| u64::arbitrary(u)).transpose()?; - Ok(Self { - inner: Receipt { - status: Eip658Value::arbitrary(u)?, - cumulative_gas_used: u64::arbitrary(u)?, - logs: Vec::::arbitrary(u)?, - }, - deposit_nonce, - deposit_receipt_version, - }) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_consensus::Receipt; - use alloy_primitives::{address, b256, bytes, hex, Bytes, Log, LogData}; - use alloy_rlp::{Decodable, Encodable}; - - #[cfg(not(feature = "std"))] - use alloc::{vec, vec::Vec}; - - // Test vector from: https://eips.ethereum.org/EIPS/eip-2481 - #[test] - fn decode_legacy_receipt() { - let data = hex!("f901668001b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f85ff85d940000000000000000000000000000000000000011f842a0000000000000000000000000000000000000000000000000000000000000deada0000000000000000000000000000000000000000000000000000000000000beef830100ff"); - - // EIP658Receipt - let expected = - OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: Receipt { - status: false.into(), - cumulative_gas_used: 0x1, - logs: vec![Log { - address: address!("0000000000000000000000000000000000000011"), - data: LogData::new_unchecked( - vec![ - b256!("000000000000000000000000000000000000000000000000000000000000dead"), - b256!("000000000000000000000000000000000000000000000000000000000000beef"), - ], - bytes!("0100ff"), - ), - }], - }, - deposit_nonce: None, - deposit_receipt_version: None, - }, - logs_bloom: [0; 256].into(), - }; - - let receipt = OpDepositReceiptWithBloom::decode(&mut &data[..]).unwrap(); - assert_eq!(receipt, expected); - } - - #[test] - fn gigantic_receipt() { - let receipt = OpDepositReceipt { - inner: Receipt { - cumulative_gas_used: 16747627, - status: true.into(), - logs: vec![ - Log { - address: address!("4bf56695415f725e43c3e04354b604bcfb6dfb6e"), - data: LogData::new_unchecked( - vec![b256!( - "c69dc3d7ebff79e41f525be431d5cd3cc08f80eaf0f7819054a726eeb7086eb9" - )], - Bytes::from(vec![1; 0xffffff]), - ), - }, - Log { - address: address!("faca325c86bf9c2d5b413cd7b90b209be92229c2"), - data: LogData::new_unchecked( - vec![b256!( - "8cca58667b1e9ffa004720ac99a3d61a138181963b294d270d91c53d36402ae2" - )], - Bytes::from(vec![1; 0xffffff]), - ), - }, - ], - }, - deposit_nonce: None, - deposit_receipt_version: None, - } - .with_bloom(); - - let mut data = vec![]; - - receipt.encode(&mut data); - let decoded = OpDepositReceiptWithBloom::decode(&mut &data[..]).unwrap(); - - // receipt.clone().to_compact(&mut data); - // let (decoded, _) = Receipt::from_compact(&data[..], data.len()); - assert_eq!(decoded, receipt); - } - - #[test] - fn regolith_receipt_roundtrip() { - let data = hex!("f9010c0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf"); - - // Deposit Receipt (post-regolith) - let expected = OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: Receipt:: { - cumulative_gas_used: 46913, - logs: vec![], - status: true.into(), - }, - deposit_nonce: Some(4012991), - deposit_receipt_version: None, - }, - logs_bloom: [0; 256].into(), - }; - - let receipt = OpDepositReceiptWithBloom::decode(&mut &data[..]).unwrap(); - assert_eq!(receipt, expected); - - let mut buf = Vec::new(); - receipt.encode(&mut buf); - assert_eq!(buf, &data[..]); - } - - #[test] - fn post_canyon_receipt_roundtrip() { - let data = hex!("f9010d0182b741b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0833d3bbf01"); - - // Deposit Receipt (post-regolith) - let expected = OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: Receipt:: { - cumulative_gas_used: 46913, - logs: vec![], - status: true.into(), - }, - deposit_nonce: Some(4012991), - deposit_receipt_version: Some(1), - }, - logs_bloom: [0; 256].into(), - }; - - let receipt = OpDepositReceiptWithBloom::decode(&mut &data[..]).unwrap(); - assert_eq!(receipt, expected); - - let mut buf = Vec::new(); - expected.encode(&mut buf); - assert_eq!(buf, &data[..]); - } -} diff --git a/crates/consensus/src/transaction/deposit.rs b/crates/consensus/src/transaction/deposit.rs deleted file mode 100644 index 75149600..00000000 --- a/crates/consensus/src/transaction/deposit.rs +++ /dev/null @@ -1,671 +0,0 @@ -//! Deposit Transaction type. - -use super::OpTxType; -use crate::DepositTransaction; -use alloc::vec::Vec; -use alloy_consensus::{Sealable, Transaction, Typed2718}; -use alloy_eips::{ - eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}, - eip2930::AccessList, -}; -use alloy_primitives::{ - keccak256, Address, Bytes, ChainId, PrimitiveSignature as Signature, TxHash, TxKind, B256, U256, -}; -use alloy_rlp::{ - Buf, BufMut, Decodable, Encodable, Error as DecodeError, Header, EMPTY_STRING_CODE, -}; -use core::mem; - -/// Deposit transactions, also known as deposits are initiated on L1, and executed on L2. -#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)] -#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct TxDeposit { - /// Hash that uniquely identifies the source of the deposit. - pub source_hash: B256, - /// The address of the sender account. - pub from: Address, - /// The address of the recipient account, or the null (zero-length) address if the deposited - /// transaction is a contract creation. - #[cfg_attr(feature = "serde", serde(default, skip_serializing_if = "TxKind::is_create"))] - pub to: TxKind, - /// The ETH value to mint on L2. - #[cfg_attr(feature = "serde", serde(default, with = "alloy_serde::quantity::opt"))] - pub mint: Option, - /// The ETH value to send to the recipient account. - pub value: U256, - /// The gas limit for the L2 transaction. - #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity", rename = "gas"))] - pub gas_limit: u64, - /// Field indicating if this transaction is exempt from the L2 gas limit. - #[cfg_attr( - feature = "serde", - serde( - default, - with = "alloy_serde::quantity", - rename = "isSystemTx", - skip_serializing_if = "core::ops::Not::not" - ) - )] - pub is_system_transaction: bool, - /// Input has two uses depending if transaction is Create or Call (if `to` field is None or - /// Some). - pub input: Bytes, -} - -impl DepositTransaction for TxDeposit { - fn source_hash(&self) -> Option { - Some(self.source_hash) - } - - fn mint(&self) -> Option { - self.mint - } - - fn is_system_transaction(&self) -> bool { - self.is_system_transaction - } - - fn is_deposit(&self) -> bool { - true - } -} - -impl TxDeposit { - /// Decodes the inner [TxDeposit] fields from RLP bytes. - /// - /// NOTE: This assumes a RLP header has already been decoded, and _just_ decodes the following - /// RLP fields in the following order: - /// - /// - `source_hash` - /// - `from` - /// - `to` - /// - `mint` - /// - `value` - /// - `gas_limit` - /// - `is_system_transaction` - /// - `input` - pub fn rlp_decode_fields(buf: &mut &[u8]) -> alloy_rlp::Result { - Ok(Self { - source_hash: Decodable::decode(buf)?, - from: Decodable::decode(buf)?, - to: Decodable::decode(buf)?, - mint: if *buf.first().ok_or(DecodeError::InputTooShort)? == EMPTY_STRING_CODE { - buf.advance(1); - None - } else { - Some(Decodable::decode(buf)?) - }, - value: Decodable::decode(buf)?, - gas_limit: Decodable::decode(buf)?, - is_system_transaction: Decodable::decode(buf)?, - input: Decodable::decode(buf)?, - }) - } - - /// Decodes the transaction from RLP bytes. - pub fn rlp_decode(buf: &mut &[u8]) -> alloy_rlp::Result { - let header = Header::decode(buf)?; - if !header.list { - return Err(alloy_rlp::Error::UnexpectedString); - } - let remaining = buf.len(); - - if header.payload_length > remaining { - return Err(alloy_rlp::Error::InputTooShort); - } - - let this = Self::rlp_decode_fields(buf)?; - - if buf.len() + header.payload_length != remaining { - return Err(alloy_rlp::Error::UnexpectedLength); - } - - Ok(this) - } - - /// Outputs the length of the transaction's fields, without a RLP header or length of the - /// eip155 fields. - pub(crate) fn rlp_encoded_fields_length(&self) -> usize { - self.source_hash.length() - + self.from.length() - + self.to.length() - + self.mint.map_or(1, |mint| mint.length()) - + self.value.length() - + self.gas_limit.length() - + self.is_system_transaction.length() - + self.input.0.length() - } - - /// Encodes only the transaction's fields into the desired buffer, without a RLP header. - /// - pub(crate) fn rlp_encode_fields(&self, out: &mut dyn alloy_rlp::BufMut) { - self.source_hash.encode(out); - self.from.encode(out); - self.to.encode(out); - if let Some(mint) = self.mint { - mint.encode(out); - } else { - out.put_u8(EMPTY_STRING_CODE); - } - self.value.encode(out); - self.gas_limit.encode(out); - self.is_system_transaction.encode(out); - self.input.encode(out); - } - - /// Calculates a heuristic for the in-memory size of the [TxDeposit] transaction. - #[inline] - pub fn size(&self) -> usize { - mem::size_of::() + // source_hash - mem::size_of::
() + // from - self.to.size() + // to - mem::size_of::>() + // mint - mem::size_of::() + // value - mem::size_of::() + // gas_limit - mem::size_of::() + // is_system_transaction - self.input.len() // input - } - - /// Get the transaction type - pub(crate) const fn tx_type(&self) -> OpTxType { - OpTxType::Deposit - } - - /// Create an rlp header for the transaction. - fn rlp_header(&self) -> Header { - Header { list: true, payload_length: self.rlp_encoded_fields_length() } - } - - /// RLP encodes the transaction. - pub fn rlp_encode(&self, out: &mut dyn BufMut) { - self.rlp_header().encode(out); - self.rlp_encode_fields(out); - } - - /// Get the length of the transaction when RLP encoded. - pub fn rlp_encoded_length(&self) -> usize { - self.rlp_header().length_with_payload() - } - - /// Get the length of the transaction when EIP-2718 encoded. This is the - /// 1 byte type flag + the length of the RLP encoded transaction. - pub fn eip2718_encoded_length(&self) -> usize { - self.rlp_encoded_length() + 1 - } - - fn network_header(&self) -> Header { - Header { list: false, payload_length: self.eip2718_encoded_length() } - } - - /// Get the length of the transaction when network encoded. This is the - /// EIP-2718 encoded length with an outer RLP header. - pub fn network_encoded_length(&self) -> usize { - self.network_header().length_with_payload() - } - - /// Network encode the transaction with the given signature. - pub fn network_encode(&self, out: &mut dyn BufMut) { - self.network_header().encode(out); - self.encode_2718(out); - } - - /// Calculate the transaction hash. - pub fn tx_hash(&self) -> TxHash { - let mut buf = Vec::with_capacity(self.eip2718_encoded_length()); - self.encode_2718(&mut buf); - keccak256(&buf) - } - - /// Returns the signature for the optimism deposit transactions, which don't include a - /// signature. - pub fn signature() -> Signature { - Signature::new(U256::ZERO, U256::ZERO, false) - } -} - -impl Typed2718 for TxDeposit { - fn ty(&self) -> u8 { - OpTxType::Deposit as u8 - } -} - -impl Transaction for TxDeposit { - fn chain_id(&self) -> Option { - None - } - - fn nonce(&self) -> u64 { - 0u64 - } - - fn gas_limit(&self) -> u64 { - self.gas_limit - } - - fn gas_price(&self) -> Option { - None - } - - fn max_fee_per_gas(&self) -> u128 { - 0 - } - - fn max_priority_fee_per_gas(&self) -> Option { - None - } - - fn max_fee_per_blob_gas(&self) -> Option { - None - } - - fn priority_fee_or_price(&self) -> u128 { - 0 - } - - fn effective_gas_price(&self, _: Option) -> u128 { - 0 - } - - fn is_dynamic_fee(&self) -> bool { - false - } - - fn kind(&self) -> TxKind { - self.to - } - - fn is_create(&self) -> bool { - self.to.is_create() - } - - fn value(&self) -> U256 { - self.value - } - - fn input(&self) -> &Bytes { - &self.input - } - - fn access_list(&self) -> Option<&AccessList> { - None - } - - fn blob_versioned_hashes(&self) -> Option<&[B256]> { - None - } - - fn authorization_list(&self) -> Option<&[alloy_eips::eip7702::SignedAuthorization]> { - None - } -} - -impl Encodable2718 for TxDeposit { - fn type_flag(&self) -> Option { - Some(OpTxType::Deposit as u8) - } - - fn encode_2718_len(&self) -> usize { - self.eip2718_encoded_length() - } - - fn encode_2718(&self, out: &mut dyn alloy_rlp::BufMut) { - out.put_u8(self.tx_type() as u8); - self.rlp_encode(out); - } -} - -impl Decodable2718 for TxDeposit { - fn typed_decode(ty: u8, data: &mut &[u8]) -> Eip2718Result { - let ty: OpTxType = ty.try_into().map_err(|_| Eip2718Error::UnexpectedType(ty))?; - if ty != OpTxType::Deposit as u8 { - return Err(Eip2718Error::UnexpectedType(ty as u8)); - } - let tx = Self::decode(data)?; - Ok(tx) - } - - fn fallback_decode(data: &mut &[u8]) -> Eip2718Result { - let tx = Self::decode(data)?; - Ok(tx) - } -} - -impl Encodable for TxDeposit { - fn encode(&self, out: &mut dyn BufMut) { - Header { list: true, payload_length: self.rlp_encoded_fields_length() }.encode(out); - self.rlp_encode_fields(out); - } - - fn length(&self) -> usize { - let payload_length = self.rlp_encoded_fields_length(); - Header { list: true, payload_length }.length() + payload_length - } -} - -impl Decodable for TxDeposit { - fn decode(data: &mut &[u8]) -> alloy_rlp::Result { - Self::rlp_decode(data) - } -} - -impl Sealable for TxDeposit { - fn hash_slow(&self) -> B256 { - self.tx_hash() - } -} - -/// Deposit transactions don't have a signature, however, we include an empty signature in the -/// response for better compatibility. -/// -/// This function can be used as `serialize_with` serde attribute for the [`TxDeposit`] and will -/// flatten [`TxDeposit::signature`] into response. -#[cfg(feature = "serde")] -pub fn serde_deposit_tx_rpc( - value: &T, - serializer: S, -) -> Result { - use serde::Serialize; - - #[derive(Serialize)] - struct SerdeHelper<'a, T> { - #[serde(flatten)] - value: &'a T, - #[serde(flatten)] - signature: Signature, - } - - SerdeHelper { value, signature: TxDeposit::signature() }.serialize(serializer) -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_primitives::hex; - use alloy_rlp::BytesMut; - - #[test] - fn test_deposit_transaction_trait() { - let tx = TxDeposit { - source_hash: B256::with_last_byte(42), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::from(1000), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - assert_eq!(tx.source_hash(), Some(B256::with_last_byte(42))); - assert_eq!(tx.mint(), Some(100)); - assert!(tx.is_system_transaction()); - assert!(tx.is_deposit()); - } - - #[test] - fn test_deposit_transaction_without_mint() { - let tx = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: None, - value: U256::default(), - gas_limit: 50000, - is_system_transaction: false, - input: Bytes::default(), - }; - - assert_eq!(tx.source_hash(), Some(B256::default())); - assert_eq!(tx.mint(), None); - assert!(!tx.is_system_transaction()); - assert!(tx.is_deposit()); - } - - #[test] - fn test_deposit_transaction_to_contract() { - let contract_address = Address::with_last_byte(0xFF); - let tx = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::Call(contract_address), - mint: Some(200), - value: U256::from(500), - gas_limit: 100000, - is_system_transaction: false, - input: Bytes::from_static(&[1, 2, 3]), - }; - - assert_eq!(tx.source_hash(), Some(B256::default())); - assert_eq!(tx.mint(), Some(200)); - assert!(!tx.is_system_transaction()); - assert!(tx.is_deposit()); - assert_eq!(tx.kind(), TxKind::Call(contract_address)); - } - - #[test] - fn test_rlp_roundtrip() { - let bytes = Bytes::from_static(&hex!("7ef9015aa044bae9d41b8380d781187b426c6fe43df5fb2fb57bd4466ef6a701e1f01e015694deaddeaddeaddeaddeaddeaddeaddeaddead000194420000000000000000000000000000000000001580808408f0d18001b90104015d8eb900000000000000000000000000000000000000000000000000000000008057650000000000000000000000000000000000000000000000000000000063d96d10000000000000000000000000000000000000000000000000000000000009f35273d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d1900000000000000000000000000000000000000000000000000000000000000010000000000000000000000002d679b567db6187c0c8323fa982cfb88b74dbcc7000000000000000000000000000000000000000000000000000000000000083400000000000000000000000000000000000000000000000000000000000f4240")); - let tx_a = TxDeposit::decode(&mut bytes[1..].as_ref()).unwrap(); - let mut buf_a = BytesMut::default(); - tx_a.encode(&mut buf_a); - assert_eq!(&buf_a[..], &bytes[1..]); - } - - #[test] - fn test_encode_decode_fields() { - let original = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::default(), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - let mut buffer = BytesMut::new(); - original.rlp_encode_fields(&mut buffer); - let decoded = TxDeposit::rlp_decode_fields(&mut &buffer[..]).expect("Failed to decode"); - - assert_eq!(original, decoded); - } - - #[test] - fn test_encode_with_and_without_header() { - let tx_deposit = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::default(), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - let mut buffer_with_header = BytesMut::new(); - tx_deposit.encode(&mut buffer_with_header); - - let mut buffer_without_header = BytesMut::new(); - tx_deposit.rlp_encode_fields(&mut buffer_without_header); - - assert!(buffer_with_header.len() > buffer_without_header.len()); - } - - #[test] - fn test_payload_length() { - let tx_deposit = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::default(), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - assert!(tx_deposit.size() > tx_deposit.rlp_encoded_fields_length()); - } - - #[test] - fn test_encode_inner_with_and_without_header() { - let tx_deposit = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::default(), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - let mut buffer_with_header = BytesMut::new(); - tx_deposit.network_encode(&mut buffer_with_header); - - let mut buffer_without_header = BytesMut::new(); - tx_deposit.encode_2718(&mut buffer_without_header); - - assert!(buffer_with_header.len() > buffer_without_header.len()); - } - - #[test] - fn test_payload_length_header() { - let tx_deposit = TxDeposit { - source_hash: B256::default(), - from: Address::default(), - to: TxKind::default(), - mint: Some(100), - value: U256::default(), - gas_limit: 50000, - is_system_transaction: true, - input: Bytes::default(), - }; - - let total_len = tx_deposit.network_encoded_length(); - let len_without_header = tx_deposit.eip2718_encoded_length(); - - assert!(total_len > len_without_header); - } -} - -/// Bincode-compatible [`TxDeposit`] serde implementation. -#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))] -pub(super) mod serde_bincode_compat { - use alloc::borrow::Cow; - use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; - use serde::{Deserialize, Deserializer, Serialize, Serializer}; - use serde_with::{DeserializeAs, SerializeAs}; - - /// Bincode-compatible [`super::TxDeposit`] serde implementation. - /// - /// Intended to use with the [`serde_with::serde_as`] macro in the following way: - /// ```rust - /// use op_alloy_consensus::{serde_bincode_compat, TxDeposit}; - /// use serde::{Deserialize, Serialize}; - /// use serde_with::serde_as; - /// - /// #[serde_as] - /// #[derive(Serialize, Deserialize)] - /// struct Data { - /// #[serde_as(as = "serde_bincode_compat::TxDeposit")] - /// transaction: TxDeposit, - /// } - /// ``` - #[derive(Debug, Serialize, Deserialize)] - pub struct TxDeposit<'a> { - source_hash: B256, - from: Address, - #[serde(default)] - to: TxKind, - #[serde(default)] - mint: Option, - value: U256, - gas_limit: u64, - is_system_transaction: bool, - input: Cow<'a, Bytes>, - } - - impl<'a> From<&'a super::TxDeposit> for TxDeposit<'a> { - fn from(value: &'a super::TxDeposit) -> Self { - Self { - source_hash: value.source_hash, - from: value.from, - to: value.to, - mint: value.mint, - value: value.value, - gas_limit: value.gas_limit, - is_system_transaction: value.is_system_transaction, - input: Cow::Borrowed(&value.input), - } - } - } - - impl<'a> From> for super::TxDeposit { - fn from(value: TxDeposit<'a>) -> Self { - Self { - source_hash: value.source_hash, - from: value.from, - to: value.to, - mint: value.mint, - value: value.value, - gas_limit: value.gas_limit, - is_system_transaction: value.is_system_transaction, - input: value.input.into_owned(), - } - } - } - - impl SerializeAs for TxDeposit<'_> { - fn serialize_as(source: &super::TxDeposit, serializer: S) -> Result - where - S: Serializer, - { - TxDeposit::from(source).serialize(serializer) - } - } - - impl<'de> DeserializeAs<'de, super::TxDeposit> for TxDeposit<'de> { - fn deserialize_as(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - TxDeposit::deserialize(deserializer).map(Into::into) - } - } - - #[cfg(test)] - mod tests { - use arbitrary::Arbitrary; - use rand::Rng; - use serde::{Deserialize, Serialize}; - use serde_with::serde_as; - - use super::super::{serde_bincode_compat, TxDeposit}; - - #[test] - fn test_tx_deposit_bincode_roundtrip() { - #[serde_as] - #[derive(Debug, PartialEq, Eq, Serialize, Deserialize)] - struct Data { - #[serde_as(as = "serde_bincode_compat::TxDeposit")] - transaction: TxDeposit, - } - - let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); - let data = Data { - transaction: TxDeposit::arbitrary(&mut arbitrary::Unstructured::new(&bytes)) - .unwrap(), - }; - - let encoded = bincode::serialize(&data).unwrap(); - let decoded: Data = bincode::deserialize(&encoded).unwrap(); - assert_eq!(decoded, data); - } - } -} diff --git a/crates/consensus/src/transaction/envelope.rs b/crates/consensus/src/transaction/envelope.rs deleted file mode 100644 index 42c4e92d..00000000 --- a/crates/consensus/src/transaction/envelope.rs +++ /dev/null @@ -1,628 +0,0 @@ -use alloy_consensus::{ - transaction::RlpEcdsaTx, Sealable, Sealed, Signed, Transaction, TxEip1559, TxEip2930, - TxEip7702, TxLegacy, Typed2718, -}; -use alloy_eips::{ - eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}, - eip2930::AccessList, - eip7702::SignedAuthorization, -}; -use alloy_primitives::{Address, Bytes, TxKind, B256, U256}; -use alloy_rlp::{Decodable, Encodable}; - -use crate::{OpTxType, TxDeposit}; - -/// The Ethereum [EIP-2718] Transaction Envelope, modified for OP Stack chains. -/// -/// # Note: -/// -/// This enum distinguishes between tagged and untagged legacy transactions, as -/// the in-protocol merkle tree may commit to EITHER 0-prefixed or raw. -/// Therefore we must ensure that encoding returns the precise byte-array that -/// was decoded, preserving the presence or absence of the `TransactionType` -/// flag. -/// -/// [EIP-2718]: https://eips.ethereum.org/EIPS/eip-2718 -#[derive(Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "serde", - serde(into = "serde_from::TaggedTxEnvelope", from = "serde_from::MaybeTaggedTxEnvelope") -)] -#[cfg_attr(all(any(test, feature = "arbitrary"), feature = "k256"), derive(arbitrary::Arbitrary))] -#[non_exhaustive] -pub enum OpTxEnvelope { - /// An untagged [`TxLegacy`]. - Legacy(Signed), - /// A [`TxEip2930`] tagged with type 1. - Eip2930(Signed), - /// A [`TxEip1559`] tagged with type 2. - Eip1559(Signed), - /// A [`TxEip7702`] tagged with type 4. - Eip7702(Signed), - /// A [`TxDeposit`] tagged with type 0x7E. - Deposit(Sealed), -} - -impl From> for OpTxEnvelope { - fn from(v: Signed) -> Self { - Self::Legacy(v) - } -} - -impl From> for OpTxEnvelope { - fn from(v: Signed) -> Self { - Self::Eip2930(v) - } -} - -impl From> for OpTxEnvelope { - fn from(v: Signed) -> Self { - Self::Eip1559(v) - } -} - -impl From> for OpTxEnvelope { - fn from(v: Signed) -> Self { - Self::Eip7702(v) - } -} - -impl From for OpTxEnvelope { - fn from(v: TxDeposit) -> Self { - v.seal_slow().into() - } -} - -impl From> for OpTxEnvelope { - fn from(v: Sealed) -> Self { - Self::Deposit(v) - } -} - -impl Typed2718 for OpTxEnvelope { - fn ty(&self) -> u8 { - match self { - Self::Legacy(tx) => tx.tx().ty(), - Self::Eip2930(tx) => tx.tx().ty(), - Self::Eip1559(tx) => tx.tx().ty(), - Self::Eip7702(tx) => tx.tx().ty(), - Self::Deposit(tx) => tx.ty(), - } - } -} - -impl Transaction for OpTxEnvelope { - fn chain_id(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().chain_id(), - Self::Eip2930(tx) => tx.tx().chain_id(), - Self::Eip1559(tx) => tx.tx().chain_id(), - Self::Eip7702(tx) => tx.tx().chain_id(), - Self::Deposit(tx) => tx.chain_id(), - } - } - - fn nonce(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.tx().nonce(), - Self::Eip2930(tx) => tx.tx().nonce(), - Self::Eip1559(tx) => tx.tx().nonce(), - Self::Eip7702(tx) => tx.tx().nonce(), - Self::Deposit(tx) => tx.nonce(), - } - } - - fn gas_limit(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.tx().gas_limit(), - Self::Eip2930(tx) => tx.tx().gas_limit(), - Self::Eip1559(tx) => tx.tx().gas_limit(), - Self::Eip7702(tx) => tx.tx().gas_limit(), - Self::Deposit(tx) => tx.gas_limit(), - } - } - - fn gas_price(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().gas_price(), - Self::Eip2930(tx) => tx.tx().gas_price(), - Self::Eip1559(tx) => tx.tx().gas_price(), - Self::Eip7702(tx) => tx.tx().gas_price(), - Self::Deposit(tx) => tx.gas_price(), - } - } - - fn max_fee_per_gas(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().max_fee_per_gas(), - Self::Eip2930(tx) => tx.tx().max_fee_per_gas(), - Self::Eip1559(tx) => tx.tx().max_fee_per_gas(), - Self::Eip7702(tx) => tx.tx().max_fee_per_gas(), - Self::Deposit(tx) => tx.max_fee_per_gas(), - } - } - - fn max_priority_fee_per_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip2930(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip1559(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip7702(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Deposit(tx) => tx.max_priority_fee_per_gas(), - } - } - - fn max_fee_per_blob_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip2930(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip1559(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip7702(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Deposit(tx) => tx.max_fee_per_blob_gas(), - } - } - - fn priority_fee_or_price(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().priority_fee_or_price(), - Self::Eip2930(tx) => tx.tx().priority_fee_or_price(), - Self::Eip1559(tx) => tx.tx().priority_fee_or_price(), - Self::Eip7702(tx) => tx.tx().priority_fee_or_price(), - Self::Deposit(tx) => tx.priority_fee_or_price(), - } - } - - fn effective_gas_price(&self, base_fee: Option) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip2930(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip1559(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip7702(tx) => tx.tx().effective_gas_price(base_fee), - Self::Deposit(tx) => tx.effective_gas_price(base_fee), - } - } - - fn is_dynamic_fee(&self) -> bool { - match self { - Self::Legacy(tx) => tx.tx().is_dynamic_fee(), - Self::Eip2930(tx) => tx.tx().is_dynamic_fee(), - Self::Eip1559(tx) => tx.tx().is_dynamic_fee(), - Self::Eip7702(tx) => tx.tx().is_dynamic_fee(), - Self::Deposit(tx) => tx.is_dynamic_fee(), - } - } - - fn kind(&self) -> TxKind { - match self { - Self::Legacy(tx) => tx.tx().kind(), - Self::Eip2930(tx) => tx.tx().kind(), - Self::Eip1559(tx) => tx.tx().kind(), - Self::Eip7702(tx) => tx.tx().kind(), - Self::Deposit(tx) => tx.kind(), - } - } - - fn is_create(&self) -> bool { - match self { - Self::Legacy(tx) => tx.tx().is_create(), - Self::Eip2930(tx) => tx.tx().is_create(), - Self::Eip1559(tx) => tx.tx().is_create(), - Self::Eip7702(tx) => tx.tx().is_create(), - Self::Deposit(tx) => tx.is_create(), - } - } - - fn to(&self) -> Option
{ - match self { - Self::Legacy(tx) => tx.tx().to(), - Self::Eip2930(tx) => tx.tx().to(), - Self::Eip1559(tx) => tx.tx().to(), - Self::Eip7702(tx) => tx.tx().to(), - Self::Deposit(tx) => tx.to(), - } - } - - fn value(&self) -> U256 { - match self { - Self::Legacy(tx) => tx.tx().value(), - Self::Eip2930(tx) => tx.tx().value(), - Self::Eip1559(tx) => tx.tx().value(), - Self::Eip7702(tx) => tx.tx().value(), - Self::Deposit(tx) => tx.value(), - } - } - - fn input(&self) -> &Bytes { - match self { - Self::Legacy(tx) => tx.tx().input(), - Self::Eip2930(tx) => tx.tx().input(), - Self::Eip1559(tx) => tx.tx().input(), - Self::Eip7702(tx) => tx.tx().input(), - Self::Deposit(tx) => tx.input(), - } - } - - fn access_list(&self) -> Option<&AccessList> { - match self { - Self::Legacy(tx) => tx.tx().access_list(), - Self::Eip2930(tx) => tx.tx().access_list(), - Self::Eip1559(tx) => tx.tx().access_list(), - Self::Eip7702(tx) => tx.tx().access_list(), - Self::Deposit(tx) => tx.access_list(), - } - } - - fn blob_versioned_hashes(&self) -> Option<&[B256]> { - match self { - Self::Legacy(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip2930(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip1559(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip7702(tx) => tx.tx().blob_versioned_hashes(), - Self::Deposit(tx) => tx.blob_versioned_hashes(), - } - } - - fn authorization_list(&self) -> Option<&[SignedAuthorization]> { - match self { - Self::Legacy(tx) => tx.tx().authorization_list(), - Self::Eip2930(tx) => tx.tx().authorization_list(), - Self::Eip1559(tx) => tx.tx().authorization_list(), - Self::Eip7702(tx) => tx.tx().authorization_list(), - Self::Deposit(tx) => tx.authorization_list(), - } - } -} - -impl OpTxEnvelope { - /// Returns true if the transaction is a legacy transaction. - #[inline] - pub const fn is_legacy(&self) -> bool { - matches!(self, Self::Legacy(_)) - } - - /// Returns true if the transaction is an EIP-2930 transaction. - #[inline] - pub const fn is_eip2930(&self) -> bool { - matches!(self, Self::Eip2930(_)) - } - - /// Returns true if the transaction is an EIP-1559 transaction. - #[inline] - pub const fn is_eip1559(&self) -> bool { - matches!(self, Self::Eip1559(_)) - } - - /// Returns true if the transaction is a deposit transaction. - #[inline] - pub const fn is_deposit(&self) -> bool { - matches!(self, Self::Deposit(_)) - } - - /// Returns true if the transaction is a system transaction. - #[inline] - pub const fn is_system_transaction(&self) -> bool { - match self { - Self::Deposit(tx) => tx.inner().is_system_transaction, - _ => false, - } - } - - /// Returns the [`TxLegacy`] variant if the transaction is a legacy transaction. - pub const fn as_legacy(&self) -> Option<&Signed> { - match self { - Self::Legacy(tx) => Some(tx), - _ => None, - } - } - - /// Returns the [`TxEip2930`] variant if the transaction is an EIP-2930 transaction. - pub const fn as_eip2930(&self) -> Option<&Signed> { - match self { - Self::Eip2930(tx) => Some(tx), - _ => None, - } - } - - /// Returns the [`TxEip1559`] variant if the transaction is an EIP-1559 transaction. - pub const fn as_eip1559(&self) -> Option<&Signed> { - match self { - Self::Eip1559(tx) => Some(tx), - _ => None, - } - } - - /// Returns the [`TxDeposit`] variant if the transaction is a deposit transaction. - pub const fn as_deposit(&self) -> Option<&Sealed> { - match self { - Self::Deposit(tx) => Some(tx), - _ => None, - } - } - - /// Return the [`OpTxType`] of the inner txn. - pub const fn tx_type(&self) -> OpTxType { - match self { - Self::Legacy(_) => OpTxType::Legacy, - Self::Eip2930(_) => OpTxType::Eip2930, - Self::Eip1559(_) => OpTxType::Eip1559, - Self::Eip7702(_) => OpTxType::Eip7702, - Self::Deposit(_) => OpTxType::Deposit, - } - } - - /// Returns the inner transaction hash. - pub fn tx_hash(&self) -> B256 { - match self { - Self::Legacy(tx) => *tx.hash(), - Self::Eip1559(tx) => *tx.hash(), - Self::Eip2930(tx) => *tx.hash(), - Self::Eip7702(tx) => *tx.hash(), - Self::Deposit(tx) => tx.tx_hash(), - } - } - - /// Return the length of the inner txn, including type byte length - pub fn eip2718_encoded_length(&self) -> usize { - match self { - Self::Legacy(t) => t.eip2718_encoded_length(), - Self::Eip2930(t) => t.eip2718_encoded_length(), - Self::Eip1559(t) => t.eip2718_encoded_length(), - Self::Eip7702(t) => t.eip2718_encoded_length(), - Self::Deposit(t) => t.eip2718_encoded_length(), - } - } -} - -impl Encodable for OpTxEnvelope { - fn encode(&self, out: &mut dyn alloy_rlp::BufMut) { - self.network_encode(out) - } - - fn length(&self) -> usize { - self.network_len() - } -} - -impl Decodable for OpTxEnvelope { - fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { - Ok(Self::network_decode(buf)?) - } -} - -impl Decodable2718 for OpTxEnvelope { - fn typed_decode(ty: u8, buf: &mut &[u8]) -> Eip2718Result { - match ty.try_into().map_err(|_| Eip2718Error::UnexpectedType(ty))? { - OpTxType::Eip2930 => Ok(Self::Eip2930(TxEip2930::rlp_decode_signed(buf)?)), - OpTxType::Eip1559 => Ok(Self::Eip1559(TxEip1559::rlp_decode_signed(buf)?)), - OpTxType::Eip7702 => Ok(Self::Eip7702(TxEip7702::rlp_decode_signed(buf)?)), - OpTxType::Deposit => Ok(Self::Deposit(TxDeposit::decode(buf)?.seal_slow())), - OpTxType::Legacy => { - Err(alloy_rlp::Error::Custom("type-0 eip2718 transactions are not supported") - .into()) - } - } - } - - fn fallback_decode(buf: &mut &[u8]) -> Eip2718Result { - Ok(Self::Legacy(TxLegacy::rlp_decode_signed(buf)?)) - } -} - -impl Encodable2718 for OpTxEnvelope { - fn type_flag(&self) -> Option { - match self { - Self::Legacy(_) => None, - Self::Eip2930(_) => Some(OpTxType::Eip2930 as u8), - Self::Eip1559(_) => Some(OpTxType::Eip1559 as u8), - Self::Eip7702(_) => Some(OpTxType::Eip7702 as u8), - Self::Deposit(_) => Some(OpTxType::Deposit as u8), - } - } - - fn encode_2718_len(&self) -> usize { - self.eip2718_encoded_length() - } - - fn encode_2718(&self, out: &mut dyn alloy_rlp::BufMut) { - match self { - // Legacy transactions have no difference between network and 2718 - Self::Legacy(tx) => tx.eip2718_encode(out), - Self::Eip2930(tx) => { - tx.eip2718_encode(out); - } - Self::Eip1559(tx) => { - tx.eip2718_encode(out); - } - Self::Eip7702(tx) => { - tx.eip2718_encode(out); - } - Self::Deposit(tx) => { - tx.encode_2718(out); - } - } - } - - fn trie_hash(&self) -> B256 { - match self { - Self::Legacy(tx) => *tx.hash(), - Self::Eip1559(tx) => *tx.hash(), - Self::Eip2930(tx) => *tx.hash(), - Self::Eip7702(tx) => *tx.hash(), - Self::Deposit(tx) => tx.seal(), - } - } -} - -#[cfg(feature = "serde")] -mod serde_from { - //! NB: Why do we need this? - //! - //! Because the tag may be missing, we need an abstraction over tagged (with - //! type) and untagged (always legacy). This is [`MaybeTaggedTxEnvelope`]. - //! - //! The tagged variant is [`TaggedTxEnvelope`], which always has a type tag. - //! - //! We serialize via [`TaggedTxEnvelope`] and deserialize via - //! [`MaybeTaggedTxEnvelope`]. - use super::*; - - #[derive(Debug, serde::Deserialize)] - #[serde(untagged)] - pub(crate) enum MaybeTaggedTxEnvelope { - Tagged(TaggedTxEnvelope), - #[serde(with = "alloy_consensus::transaction::signed_legacy_serde")] - Untagged(Signed), - } - - #[derive(Debug, serde::Serialize, serde::Deserialize)] - #[serde(tag = "type")] - pub(crate) enum TaggedTxEnvelope { - #[serde( - rename = "0x0", - alias = "0x00", - with = "alloy_consensus::transaction::signed_legacy_serde" - )] - Legacy(Signed), - #[serde(rename = "0x1", alias = "0x01")] - Eip2930(Signed), - #[serde(rename = "0x2", alias = "0x02")] - Eip1559(Signed), - #[serde(rename = "0x4", alias = "0x04")] - Eip7702(Signed), - #[serde(rename = "0x7e", alias = "0x7E", serialize_with = "crate::serde_deposit_tx_rpc")] - Deposit(Sealed), - } - - impl From for OpTxEnvelope { - fn from(value: MaybeTaggedTxEnvelope) -> Self { - match value { - MaybeTaggedTxEnvelope::Tagged(tagged) => tagged.into(), - MaybeTaggedTxEnvelope::Untagged(tx) => Self::Legacy(tx), - } - } - } - - impl From for OpTxEnvelope { - fn from(value: TaggedTxEnvelope) -> Self { - match value { - TaggedTxEnvelope::Legacy(signed) => Self::Legacy(signed), - TaggedTxEnvelope::Eip2930(signed) => Self::Eip2930(signed), - TaggedTxEnvelope::Eip1559(signed) => Self::Eip1559(signed), - TaggedTxEnvelope::Eip7702(signed) => Self::Eip7702(signed), - TaggedTxEnvelope::Deposit(tx) => Self::Deposit(tx), - } - } - } - - impl From for TaggedTxEnvelope { - fn from(value: OpTxEnvelope) -> Self { - match value { - OpTxEnvelope::Legacy(signed) => Self::Legacy(signed), - OpTxEnvelope::Eip2930(signed) => Self::Eip2930(signed), - OpTxEnvelope::Eip1559(signed) => Self::Eip1559(signed), - OpTxEnvelope::Eip7702(signed) => Self::Eip7702(signed), - OpTxEnvelope::Deposit(tx) => Self::Deposit(tx), - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloc::vec; - use alloy_primitives::{hex, Address, Bytes, TxKind, B256, U256}; - - #[test] - fn test_tx_gas_limit() { - let tx = TxDeposit { gas_limit: 1, ..Default::default() }; - let tx_envelope = OpTxEnvelope::Deposit(tx.seal_slow()); - assert_eq!(tx_envelope.gas_limit(), 1); - } - - #[test] - fn test_system_transaction() { - let mut tx = TxDeposit { is_system_transaction: true, ..Default::default() }; - let tx_envelope = OpTxEnvelope::Deposit(tx.clone().seal_slow()); - assert!(tx_envelope.is_system_transaction()); - - tx.is_system_transaction = false; - let tx_envelope = OpTxEnvelope::Deposit(tx.seal_slow()); - assert!(!tx_envelope.is_system_transaction()); - } - - #[test] - fn test_encode_decode_deposit() { - let tx = TxDeposit { - source_hash: B256::left_padding_from(&[0xde, 0xad]), - from: Address::left_padding_from(&[0xbe, 0xef]), - mint: Some(1), - gas_limit: 2, - to: TxKind::Call(Address::left_padding_from(&[3])), - value: U256::from(4_u64), - input: Bytes::from(vec![5]), - is_system_transaction: false, - }; - let tx_envelope = OpTxEnvelope::Deposit(tx.seal_slow()); - let encoded = tx_envelope.encoded_2718(); - let decoded = OpTxEnvelope::decode_2718(&mut encoded.as_ref()).unwrap(); - assert_eq!(encoded.len(), tx_envelope.encode_2718_len()); - assert_eq!(decoded, tx_envelope); - } - - #[test] - #[cfg(feature = "serde")] - fn test_serde_roundtrip_deposit() { - let tx = TxDeposit { - gas_limit: u64::MAX, - to: TxKind::Call(Address::random()), - value: U256::MAX, - input: Bytes::new(), - source_hash: U256::MAX.into(), - from: Address::random(), - mint: Some(u128::MAX), - is_system_transaction: false, - }; - let tx_envelope = OpTxEnvelope::Deposit(tx.seal_slow()); - - let serialized = serde_json::to_string(&tx_envelope).unwrap(); - let deserialized: OpTxEnvelope = serde_json::from_str(&serialized).unwrap(); - - assert_eq!(tx_envelope, deserialized); - } - - #[test] - fn eip2718_deposit_decode() { - // - let b = hex!("7ef8f8a0417d134467f4737fcdf2475f0ecdd2a0ed6d87ecffc888ba9f60ee7e3b8ac26a94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b8a4440a5e20000008dd00101c1200000000000000040000000066c352bb000000000139c4f500000000000000000000000000000000000000000000000000000000c0cff1460000000000000000000000000000000000000000000000000000000000000001d4c88f4065ac9671e8b1329b90773e89b5ddff9cf8675b2b5e9c1b28320609930000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c9"); - - let tx = OpTxEnvelope::decode_2718(&mut b[..].as_ref()).unwrap(); - let deposit = tx.as_deposit().unwrap(); - assert!(deposit.mint.is_none()); - } - - #[test] - fn eip1559_decode() { - use alloy_consensus::SignableTransaction; - use alloy_primitives::PrimitiveSignature; - let tx = TxEip1559 { - chain_id: 1u64, - nonce: 2, - max_fee_per_gas: 3, - max_priority_fee_per_gas: 4, - gas_limit: 5, - to: Address::left_padding_from(&[6]).into(), - value: U256::from(7_u64), - input: vec![8].into(), - access_list: Default::default(), - }; - let sig = PrimitiveSignature::test_signature(); - let tx_signed = tx.into_signed(sig); - let envelope: OpTxEnvelope = tx_signed.into(); - let encoded = envelope.encoded_2718(); - let mut slice = encoded.as_slice(); - let decoded = OpTxEnvelope::decode_2718(&mut slice).unwrap(); - assert!(matches!(decoded, OpTxEnvelope::Eip1559(_))); - } -} diff --git a/crates/consensus/src/transaction/mod.rs b/crates/consensus/src/transaction/mod.rs deleted file mode 100644 index 74a130cd..00000000 --- a/crates/consensus/src/transaction/mod.rs +++ /dev/null @@ -1,60 +0,0 @@ -//! Tramsaction types for Optimism. - -mod deposit; -pub use deposit::TxDeposit; - -mod tx_type; -pub use tx_type::{OpTxType, DEPOSIT_TX_TYPE_ID}; - -mod envelope; -pub use envelope::OpTxEnvelope; - -mod typed; -pub use typed::OpTypedTransaction; - -mod pooled; -pub use pooled::OpPooledTransaction; - -mod source; -pub use source::{ - DepositSourceDomain, DepositSourceDomainIdentifier, L1InfoDepositSource, UpgradeDepositSource, - UserDepositSource, -}; - -#[cfg(feature = "serde")] -pub use deposit::serde_deposit_tx_rpc; - -/// Bincode-compatible serde implementations for transaction types. -#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))] -pub(super) mod serde_bincode_compat { - pub use super::deposit::serde_bincode_compat::TxDeposit; -} - -use alloy_primitives::B256; - -/// A trait representing a deposit transaction with specific attributes. -pub trait DepositTransaction { - /// Returns the hash that uniquely identifies the source of the deposit. - /// - /// # Returns - /// An `Option` containing the source hash if available. - fn source_hash(&self) -> Option; - - /// Returns the optional mint value of the deposit transaction. - /// - /// # Returns - /// An `Option` representing the ETH value to mint on L2, if any. - fn mint(&self) -> Option; - - /// Indicates whether the transaction is exempt from the L2 gas limit. - /// - /// # Returns - /// A `bool` indicating if the transaction is a system transaction. - fn is_system_transaction(&self) -> bool; - - /// Checks if the transaction is a deposit transaction. - /// - /// # Returns - /// A `bool` that is always `true` for deposit transactions. - fn is_deposit(&self) -> bool; -} diff --git a/crates/consensus/src/transaction/pooled.rs b/crates/consensus/src/transaction/pooled.rs deleted file mode 100644 index d3ee5943..00000000 --- a/crates/consensus/src/transaction/pooled.rs +++ /dev/null @@ -1,523 +0,0 @@ -//! Defines the exact transaction variants that are allowed to be propagated over the eth p2p -//! protocol in op. - -use crate::{OpTxEnvelope, OpTxType}; -use alloy_consensus::{ - transaction::{RlpEcdsaTx, TxEip1559, TxEip2930, TxLegacy}, - SignableTransaction, Signed, Transaction, TxEip7702, TxEnvelope, Typed2718, -}; -use alloy_eips::{ - eip2718::{Decodable2718, Eip2718Error, Eip2718Result, Encodable2718}, - eip2930::AccessList, - eip7702::SignedAuthorization, -}; -use alloy_primitives::{ - bytes, Bytes, ChainId, PrimitiveSignature as Signature, TxHash, TxKind, B256, U256, -}; -use alloy_rlp::{Decodable, Encodable, Header}; -use core::hash::{Hash, Hasher}; - -/// All possible transactions that can be included in a response to `GetPooledTransactions`. -/// A response to `GetPooledTransactions`. This can include a typed signed transaction, but cannot -/// include a deposit transaction or EIP-4844 transaction. -/// -/// The difference between this and the [`OpTxEnvelope`] is that this type does not have the deposit -/// transaction variant, which is not expected to be pooled. -#[derive(Clone, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(all(any(test, feature = "arbitrary"), feature = "k256"), derive(arbitrary::Arbitrary))] -pub enum OpPooledTransaction { - /// An untagged [`TxLegacy`]. - Legacy(Signed), - /// A [`TxEip2930`] transaction tagged with type 1. - Eip2930(Signed), - /// A [`TxEip1559`] transaction tagged with type 2. - Eip1559(Signed), - /// A [`TxEip7702`] transaction tagged with type 4. - Eip7702(Signed), -} - -impl OpPooledTransaction { - /// Heavy operation that returns the signature hash over rlp encoded transaction. It is only - /// for signature signing or signer recovery. - pub fn signature_hash(&self) -> B256 { - match self { - Self::Legacy(tx) => tx.signature_hash(), - Self::Eip2930(tx) => tx.signature_hash(), - Self::Eip1559(tx) => tx.signature_hash(), - Self::Eip7702(tx) => tx.signature_hash(), - } - } - - /// Reference to transaction hash. Used to identify transaction. - pub const fn hash(&self) -> &TxHash { - match self { - Self::Legacy(tx) => tx.hash(), - Self::Eip2930(tx) => tx.hash(), - Self::Eip1559(tx) => tx.hash(), - Self::Eip7702(tx) => tx.hash(), - } - } - - /// Returns the signature of the transaction. - pub const fn signature(&self) -> &Signature { - match self { - Self::Legacy(tx) => tx.signature(), - Self::Eip2930(tx) => tx.signature(), - Self::Eip1559(tx) => tx.signature(), - Self::Eip7702(tx) => tx.signature(), - } - } - - /// The length of the 2718 encoded envelope in network format. This is the - /// length of the header + the length of the type flag and inner encoding. - fn network_len(&self) -> usize { - let mut payload_length = self.encode_2718_len(); - if !Encodable2718::is_legacy(self) { - payload_length += Header { list: false, payload_length }.length(); - } - - payload_length - } - - /// Recover the signer of the transaction. - #[cfg(feature = "k256")] - pub fn recover_signer( - &self, - ) -> Result { - match self { - Self::Legacy(tx) => tx.recover_signer(), - Self::Eip2930(tx) => tx.recover_signer(), - Self::Eip1559(tx) => tx.recover_signer(), - Self::Eip7702(tx) => tx.recover_signer(), - } - } - - /// This encodes the transaction _without_ the signature, and is only suitable for creating a - /// hash intended for signing. - pub fn encode_for_signing(&self, out: &mut dyn bytes::BufMut) { - match self { - Self::Legacy(tx) => tx.tx().encode_for_signing(out), - Self::Eip2930(tx) => tx.tx().encode_for_signing(out), - Self::Eip1559(tx) => tx.tx().encode_for_signing(out), - Self::Eip7702(tx) => tx.tx().encode_for_signing(out), - } - } - - /// Converts the transaction into the ethereum [`TxEnvelope`]. - pub fn into_envelope(self) -> TxEnvelope { - match self { - Self::Legacy(tx) => tx.into(), - Self::Eip2930(tx) => tx.into(), - Self::Eip1559(tx) => tx.into(), - Self::Eip7702(tx) => tx.into(), - } - } - - /// Converts the transaction into the optimism [`OpTxEnvelope`]. - pub fn into_op_envelope(self) -> OpTxEnvelope { - match self { - Self::Legacy(tx) => tx.into(), - Self::Eip2930(tx) => tx.into(), - Self::Eip1559(tx) => tx.into(), - Self::Eip7702(tx) => tx.into(), - } - } - - /// Returns the [`TxLegacy`] variant if the transaction is a legacy transaction. - pub const fn as_legacy(&self) -> Option<&TxLegacy> { - match self { - Self::Legacy(tx) => Some(tx.tx()), - _ => None, - } - } - - /// Returns the [`TxEip2930`] variant if the transaction is an EIP-2930 transaction. - pub const fn as_eip2930(&self) -> Option<&TxEip2930> { - match self { - Self::Eip2930(tx) => Some(tx.tx()), - _ => None, - } - } - - /// Returns the [`TxEip1559`] variant if the transaction is an EIP-1559 transaction. - pub const fn as_eip1559(&self) -> Option<&TxEip1559> { - match self { - Self::Eip1559(tx) => Some(tx.tx()), - _ => None, - } - } - - /// Returns the [`TxEip7702`] variant if the transaction is an EIP-7702 transaction. - pub const fn as_eip7702(&self) -> Option<&TxEip7702> { - match self { - Self::Eip7702(tx) => Some(tx.tx()), - _ => None, - } - } -} - -impl From> for OpPooledTransaction { - fn from(v: Signed) -> Self { - Self::Legacy(v) - } -} - -impl From> for OpPooledTransaction { - fn from(v: Signed) -> Self { - Self::Eip2930(v) - } -} - -impl From> for OpPooledTransaction { - fn from(v: Signed) -> Self { - Self::Eip1559(v) - } -} - -impl From> for OpPooledTransaction { - fn from(v: Signed) -> Self { - Self::Eip7702(v) - } -} - -impl Hash for OpPooledTransaction { - fn hash(&self, state: &mut H) { - self.trie_hash().hash(state); - } -} - -impl Encodable for OpPooledTransaction { - /// This encodes the transaction _with_ the signature, and an rlp header. - /// - /// For legacy transactions, it encodes the transaction data: - /// `rlp(tx-data)` - /// - /// For EIP-2718 typed transactions, it encodes the transaction type followed by the rlp of the - /// transaction: - /// `rlp(tx-type || rlp(tx-data))` - fn encode(&self, out: &mut dyn bytes::BufMut) { - self.network_encode(out); - } - - fn length(&self) -> usize { - self.network_len() - } -} - -impl Decodable for OpPooledTransaction { - /// Decodes an enveloped [`OpPooledTransaction`]. - /// - /// CAUTION: this expects that `buf` is `rlp(tx_type || rlp(tx-data))` - fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { - Ok(Self::network_decode(buf)?) - } -} - -impl Encodable2718 for OpPooledTransaction { - fn type_flag(&self) -> Option { - match self { - Self::Legacy(_) => None, - Self::Eip2930(_) => Some(0x01), - Self::Eip1559(_) => Some(0x02), - Self::Eip7702(_) => Some(0x04), - } - } - - fn encode_2718_len(&self) -> usize { - match self { - Self::Legacy(tx) => tx.eip2718_encoded_length(), - Self::Eip2930(tx) => tx.eip2718_encoded_length(), - Self::Eip1559(tx) => tx.eip2718_encoded_length(), - Self::Eip7702(tx) => tx.eip2718_encoded_length(), - } - } - - fn encode_2718(&self, out: &mut dyn alloy_rlp::BufMut) { - match self { - Self::Legacy(tx) => tx.eip2718_encode(out), - Self::Eip2930(tx) => tx.eip2718_encode(out), - Self::Eip1559(tx) => tx.eip2718_encode(out), - Self::Eip7702(tx) => tx.eip2718_encode(out), - } - } - - fn trie_hash(&self) -> B256 { - *self.hash() - } -} - -impl Decodable2718 for OpPooledTransaction { - fn typed_decode(ty: u8, buf: &mut &[u8]) -> Eip2718Result { - match ty.try_into().map_err(|_| alloy_rlp::Error::Custom("unexpected tx type"))? { - OpTxType::Eip2930 => Ok(TxEip2930::rlp_decode_signed(buf)?.into()), - OpTxType::Eip1559 => Ok(TxEip1559::rlp_decode_signed(buf)?.into()), - OpTxType::Eip7702 => Ok(TxEip7702::rlp_decode_signed(buf)?.into()), - OpTxType::Legacy => Err(Eip2718Error::UnexpectedType(OpTxType::Legacy.into())), - OpTxType::Deposit => Err(Eip2718Error::UnexpectedType(OpTxType::Deposit.into())), - } - } - - fn fallback_decode(buf: &mut &[u8]) -> Eip2718Result { - TxLegacy::rlp_decode_signed(buf).map(Into::into).map_err(Into::into) - } -} - -impl Transaction for OpPooledTransaction { - fn chain_id(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().chain_id(), - Self::Eip2930(tx) => tx.tx().chain_id(), - Self::Eip1559(tx) => tx.tx().chain_id(), - Self::Eip7702(tx) => tx.tx().chain_id(), - } - } - - fn nonce(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.tx().nonce(), - Self::Eip2930(tx) => tx.tx().nonce(), - Self::Eip1559(tx) => tx.tx().nonce(), - Self::Eip7702(tx) => tx.tx().nonce(), - } - } - - fn gas_limit(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.tx().gas_limit(), - Self::Eip2930(tx) => tx.tx().gas_limit(), - Self::Eip1559(tx) => tx.tx().gas_limit(), - Self::Eip7702(tx) => tx.tx().gas_limit(), - } - } - - fn gas_price(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().gas_price(), - Self::Eip2930(tx) => tx.tx().gas_price(), - Self::Eip1559(tx) => tx.tx().gas_price(), - Self::Eip7702(tx) => tx.tx().gas_price(), - } - } - - fn max_fee_per_gas(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().max_fee_per_gas(), - Self::Eip2930(tx) => tx.tx().max_fee_per_gas(), - Self::Eip1559(tx) => tx.tx().max_fee_per_gas(), - Self::Eip7702(tx) => tx.tx().max_fee_per_gas(), - } - } - - fn max_priority_fee_per_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip2930(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip1559(tx) => tx.tx().max_priority_fee_per_gas(), - Self::Eip7702(tx) => tx.tx().max_priority_fee_per_gas(), - } - } - - fn max_fee_per_blob_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip2930(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip1559(tx) => tx.tx().max_fee_per_blob_gas(), - Self::Eip7702(tx) => tx.tx().max_fee_per_blob_gas(), - } - } - - fn priority_fee_or_price(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().priority_fee_or_price(), - Self::Eip2930(tx) => tx.tx().priority_fee_or_price(), - Self::Eip1559(tx) => tx.tx().priority_fee_or_price(), - Self::Eip7702(tx) => tx.tx().priority_fee_or_price(), - } - } - - fn effective_gas_price(&self, base_fee: Option) -> u128 { - match self { - Self::Legacy(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip2930(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip1559(tx) => tx.tx().effective_gas_price(base_fee), - Self::Eip7702(tx) => tx.tx().effective_gas_price(base_fee), - } - } - - fn is_dynamic_fee(&self) -> bool { - match self { - Self::Legacy(tx) => tx.tx().is_dynamic_fee(), - Self::Eip2930(tx) => tx.tx().is_dynamic_fee(), - Self::Eip1559(tx) => tx.tx().is_dynamic_fee(), - Self::Eip7702(tx) => tx.tx().is_dynamic_fee(), - } - } - - fn kind(&self) -> TxKind { - match self { - Self::Legacy(tx) => tx.tx().kind(), - Self::Eip2930(tx) => tx.tx().kind(), - Self::Eip1559(tx) => tx.tx().kind(), - Self::Eip7702(tx) => tx.tx().kind(), - } - } - - fn is_create(&self) -> bool { - match self { - Self::Legacy(tx) => tx.tx().is_create(), - Self::Eip2930(tx) => tx.tx().is_create(), - Self::Eip1559(tx) => tx.tx().is_create(), - Self::Eip7702(tx) => tx.tx().is_create(), - } - } - - fn value(&self) -> U256 { - match self { - Self::Legacy(tx) => tx.tx().value(), - Self::Eip2930(tx) => tx.tx().value(), - Self::Eip1559(tx) => tx.tx().value(), - Self::Eip7702(tx) => tx.tx().value(), - } - } - - fn input(&self) -> &Bytes { - match self { - Self::Legacy(tx) => tx.tx().input(), - Self::Eip2930(tx) => tx.tx().input(), - Self::Eip1559(tx) => tx.tx().input(), - Self::Eip7702(tx) => tx.tx().input(), - } - } - - fn access_list(&self) -> Option<&AccessList> { - match self { - Self::Legacy(tx) => tx.tx().access_list(), - Self::Eip2930(tx) => tx.tx().access_list(), - Self::Eip1559(tx) => tx.tx().access_list(), - Self::Eip7702(tx) => tx.tx().access_list(), - } - } - - fn blob_versioned_hashes(&self) -> Option<&[B256]> { - match self { - Self::Legacy(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip2930(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip1559(tx) => tx.tx().blob_versioned_hashes(), - Self::Eip7702(tx) => tx.tx().blob_versioned_hashes(), - } - } - - fn authorization_list(&self) -> Option<&[SignedAuthorization]> { - match self { - Self::Legacy(tx) => tx.tx().authorization_list(), - Self::Eip2930(tx) => tx.tx().authorization_list(), - Self::Eip1559(tx) => tx.tx().authorization_list(), - Self::Eip7702(tx) => tx.tx().authorization_list(), - } - } -} - -impl Typed2718 for OpPooledTransaction { - fn ty(&self) -> u8 { - match self { - Self::Legacy(tx) => tx.tx().ty(), - Self::Eip2930(tx) => tx.tx().ty(), - Self::Eip1559(tx) => tx.tx().ty(), - Self::Eip7702(tx) => tx.tx().ty(), - } - } -} - -impl From for TxEnvelope { - fn from(tx: OpPooledTransaction) -> Self { - tx.into_envelope() - } -} - -impl From for OpTxEnvelope { - fn from(tx: OpPooledTransaction) -> Self { - tx.into_op_envelope() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_primitives::{address, hex}; - use bytes::Bytes; - - #[test] - fn invalid_legacy_pooled_decoding_input_too_short() { - let input_too_short = [ - // this should fail because the payload length is longer than expected - &hex!("d90b0280808bc5cd028083c5cdfd9e407c56565656")[..], - // these should fail decoding - // - // The `c1` at the beginning is a list header, and the rest is a valid legacy - // transaction, BUT the payload length of the list header is 1, and the payload is - // obviously longer than one byte. - &hex!("c10b02808083c5cd028883c5cdfd9e407c56565656"), - &hex!("c10b0280808bc5cd028083c5cdfd9e407c56565656"), - // this one is 19 bytes, and the buf is long enough, but the transaction will not - // consume that many bytes. - &hex!("d40b02808083c5cdeb8783c5acfd9e407c5656565656"), - &hex!("d30102808083c5cd02887dc5cdfd9e64fd9e407c56"), - ]; - - for hex_data in &input_too_short { - let input_rlp = &mut &hex_data[..]; - let res = OpPooledTransaction::decode(input_rlp); - - assert!( - res.is_err(), - "expected err after decoding rlp input: {:x?}", - Bytes::copy_from_slice(hex_data) - ); - - // this is a legacy tx so we can attempt the same test with decode_enveloped - let input_rlp = &mut &hex_data[..]; - let res = OpPooledTransaction::decode_2718(input_rlp); - - assert!( - res.is_err(), - "expected err after decoding enveloped rlp input: {:x?}", - Bytes::copy_from_slice(hex_data) - ); - } - } - - // - #[test] - fn decode_eip1559_enveloped() { - let data = hex!("02f903d382426882ba09832dc6c0848674742682ed9694714b6a4ea9b94a8a7d9fd362ed72630688c8898c80b90364492d24749189822d8512430d3f3ff7a2ede675ac08265c08e2c56ff6fdaa66dae1cdbe4a5d1d7809f3e99272d067364e597542ac0c369d69e22a6399c3e9bee5da4b07e3f3fdc34c32c3d88aa2268785f3e3f8086df0934b10ef92cfffc2e7f3d90f5e83302e31382e302d64657600000000000000000000000000000000000000000000569e75fc77c1a856f6daaf9e69d8a9566ca34aa47f9133711ce065a571af0cfd000000000000000000000000e1e210594771824dad216568b91c9cb4ceed361c00000000000000000000000000000000000000000000000000000000000546e00000000000000000000000000000000000000000000000000000000000e4e1c00000000000000000000000000000000000000000000000000000000065d6750c00000000000000000000000000000000000000000000000000000000000f288000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002cf600000000000000000000000000000000000000000000000000000000000000640000000000000000000000000000000000000000000000000000000000000000f1628e56fa6d8c50e5b984a58c0df14de31c7b857ce7ba499945b99252976a93d06dcda6776fc42167fbe71cb59f978f5ef5b12577a90b132d14d9c6efa528076f0161d7bf03643cfc5490ec5084f4a041db7f06c50bd97efa08907ba79ddcac8b890f24d12d8db31abbaaf18985d54f400449ee0559a4452afe53de5853ce090000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000064ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000c080a01428023fc54a27544abc421d5d017b9a7c5936ad501cbdecd0d9d12d04c1a033a0753104bbf1c87634d6ff3f0ffa0982710612306003eb022363b57994bdef445a" -); - - let res = OpPooledTransaction::decode_2718(&mut &data[..]).unwrap(); - assert_eq!(res.to(), Some(address!("714b6a4ea9b94a8a7d9fd362ed72630688c8898c"))); - } - - #[test] - fn legacy_valid_pooled_decoding() { - // d3 <- payload length, d3 - c0 = 0x13 = 19 - // 0b <- nonce - // 02 <- gas_price - // 80 <- gas_limit - // 80 <- to (Create) - // 83 c5cdeb <- value - // 87 83c5acfd9e407c <- input - // 56 <- v (eip155, so modified with a chain id) - // 56 <- r - // 56 <- s - let data = &hex!("d30b02808083c5cdeb8783c5acfd9e407c565656")[..]; - - let input_rlp = &mut &data[..]; - let res = OpPooledTransaction::decode(input_rlp); - assert!(res.is_ok()); - assert!(input_rlp.is_empty()); - - // we can also decode_enveloped - let res = OpPooledTransaction::decode_2718(&mut &data[..]); - assert!(res.is_ok()); - } -} diff --git a/crates/consensus/src/transaction/source.rs b/crates/consensus/src/transaction/source.rs deleted file mode 100644 index d2d159fd..00000000 --- a/crates/consensus/src/transaction/source.rs +++ /dev/null @@ -1,128 +0,0 @@ -//! Types for identifying the deposit source. - -use alloc::string::String; -use alloy_primitives::{keccak256, B256}; - -/// Source domain identifiers for deposit transactions. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -#[repr(u8)] -pub enum DepositSourceDomainIdentifier { - /// A user deposit source. - User = 0, - /// A L1 info deposit source. - L1Info = 1, - /// An upgrade deposit source. - Upgrade = 2, -} - -/// Source domains for deposit transactions. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub enum DepositSourceDomain { - /// A user deposit source. - User(UserDepositSource), - /// A L1 info deposit source. - L1Info(L1InfoDepositSource), - /// An upgrade deposit source. - Upgrade(UpgradeDepositSource), -} - -impl DepositSourceDomain { - /// Returns the source hash. - pub fn source_hash(&self) -> B256 { - match self { - Self::User(ds) => ds.source_hash(), - Self::L1Info(ds) => ds.source_hash(), - Self::Upgrade(ds) => ds.source_hash(), - } - } -} - -/// A L1 info deposit transaction source. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct L1InfoDepositSource { - /// The L1 block hash. - pub l1_block_hash: B256, - /// The sequence number. - pub seq_number: u64, -} - -impl L1InfoDepositSource { - /// Creates a new [L1InfoDepositSource]. - pub const fn new(l1_block_hash: B256, seq_number: u64) -> Self { - Self { l1_block_hash, seq_number } - } - - /// Returns the source hash. - pub fn source_hash(&self) -> B256 { - let mut input = [0u8; 32 * 2]; - input[..32].copy_from_slice(&self.l1_block_hash[..]); - input[32 * 2 - 8..].copy_from_slice(&self.seq_number.to_be_bytes()); - let deposit_id_hash = keccak256(input); - let mut domain_input = [0u8; 32 * 2]; - let identifier_bytes: [u8; 8] = - (DepositSourceDomainIdentifier::L1Info as u64).to_be_bytes(); - domain_input[32 - 8..32].copy_from_slice(&identifier_bytes); - domain_input[32..].copy_from_slice(&deposit_id_hash[..]); - keccak256(domain_input) - } -} - -/// A deposit transaction source. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub struct UserDepositSource { - /// The L1 block hash. - pub l1_block_hash: B256, - /// The log index. - pub log_index: u64, -} - -impl UserDepositSource { - /// Creates a new [UserDepositSource]. - pub const fn new(l1_block_hash: B256, log_index: u64) -> Self { - Self { l1_block_hash, log_index } - } - - /// Returns the source hash. - pub fn source_hash(&self) -> B256 { - let mut input = [0u8; 32 * 2]; - input[..32].copy_from_slice(&self.l1_block_hash[..]); - input[32 * 2 - 8..].copy_from_slice(&self.log_index.to_be_bytes()); - let deposit_id_hash = keccak256(input); - let mut domain_input = [0u8; 32 * 2]; - let identifier_bytes: [u8; 8] = (DepositSourceDomainIdentifier::User as u64).to_be_bytes(); - domain_input[32 - 8..32].copy_from_slice(&identifier_bytes); - domain_input[32..].copy_from_slice(&deposit_id_hash[..]); - keccak256(domain_input) - } -} - -/// An upgrade deposit transaction source. -/// -/// This implements the translation of upgrade-tx identity information to a deposit source-hash, -/// which makes the deposit uniquely identifiable. -/// System-upgrade transactions have their own domain for source-hashes, -/// to not conflict with user-deposits or deposited L1 information. -/// The intent identifies the upgrade-tx uniquely, in a human-readable way. -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct UpgradeDepositSource { - /// The intent. - pub intent: String, -} - -impl UpgradeDepositSource { - /// Creates a new [UpgradeDepositSource]. - pub const fn new(intent: String) -> Self { - Self { intent } - } - - /// Returns the source hash. - pub fn source_hash(&self) -> B256 { - let intent_hash = keccak256(self.intent.as_bytes()); - let mut domain_input = [0u8; 32 * 2]; - let identifier_bytes: [u8; 8] = - (DepositSourceDomainIdentifier::Upgrade as u64).to_be_bytes(); - domain_input[32 - 8..32].copy_from_slice(&identifier_bytes); - domain_input[32..].copy_from_slice(&intent_hash[..]); - keccak256(domain_input) - } -} diff --git a/crates/consensus/src/transaction/tx_type.rs b/crates/consensus/src/transaction/tx_type.rs deleted file mode 100644 index ef84a084..00000000 --- a/crates/consensus/src/transaction/tx_type.rs +++ /dev/null @@ -1,165 +0,0 @@ -//! Contains the transaction type identifier for Optimism. - -use alloy_consensus::Typed2718; -use alloy_eips::eip2718::Eip2718Error; -use alloy_primitives::{U64, U8}; -use alloy_rlp::{BufMut, Decodable, Encodable}; -use derive_more::Display; - -/// Identifier for an Optimism deposit transaction -pub const DEPOSIT_TX_TYPE_ID: u8 = 126; // 0x7E - -/// Optimism `TransactionType` flags as specified in EIPs [2718], [1559], and -/// [2930], as well as the [deposit transaction spec][deposit-spec] -/// -/// [2718]: https://eips.ethereum.org/EIPS/eip-2718 -/// [1559]: https://eips.ethereum.org/EIPS/eip-1559 -/// [2930]: https://eips.ethereum.org/EIPS/eip-2930 -/// [4844]: https://eips.ethereum.org/EIPS/eip-4844 -/// [deposit-spec]: https://specs.optimism.io/protocol/deposits.html -#[repr(u8)] -#[derive(Debug, Copy, Clone, Eq, Default, PartialEq, PartialOrd, Ord, Hash, Display)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(into = "U8", try_from = "U64"))] -pub enum OpTxType { - /// Legacy transaction type. - #[default] - #[display("legacy")] - Legacy = 0, - /// EIP-2930 transaction type. - #[display("eip2930")] - Eip2930 = 1, - /// EIP-1559 transaction type. - #[display("eip1559")] - Eip1559 = 2, - /// EIP-7702 transaction type. - #[display("eip7702")] - Eip7702 = 4, - /// Optimism Deposit transaction type. - #[display("deposit")] - Deposit = 126, -} - -impl OpTxType { - /// List of all variants. - pub const ALL: [Self; 5] = - [Self::Legacy, Self::Eip2930, Self::Eip1559, Self::Eip7702, Self::Deposit]; -} - -#[cfg(any(test, feature = "arbitrary"))] -impl arbitrary::Arbitrary<'_> for OpTxType { - fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result { - let i = u.choose_index(Self::ALL.len())?; - Ok(Self::ALL[i]) - } -} - -impl From for U8 { - fn from(tx_type: OpTxType) -> Self { - Self::from(u8::from(tx_type)) - } -} - -impl From for u8 { - fn from(v: OpTxType) -> Self { - v as Self - } -} - -impl TryFrom for OpTxType { - type Error = Eip2718Error; - - fn try_from(value: u8) -> Result { - Ok(match value { - 0 => Self::Legacy, - 1 => Self::Eip2930, - 2 => Self::Eip1559, - 4 => Self::Eip7702, - 126 => Self::Deposit, - _ => return Err(Eip2718Error::UnexpectedType(value)), - }) - } -} - -impl TryFrom for OpTxType { - type Error = &'static str; - - fn try_from(value: u64) -> Result { - let err = || "invalid tx type"; - let value: u8 = value.try_into().map_err(|_| err())?; - Self::try_from(value).map_err(|_| err()) - } -} - -impl TryFrom for OpTxType { - type Error = &'static str; - - fn try_from(value: U64) -> Result { - value.to::().try_into() - } -} - -impl PartialEq for OpTxType { - fn eq(&self, other: &u8) -> bool { - (*self as u8) == *other - } -} - -impl PartialEq for u8 { - fn eq(&self, other: &OpTxType) -> bool { - *self == *other as Self - } -} - -impl Encodable for OpTxType { - fn encode(&self, out: &mut dyn BufMut) { - (*self as u8).encode(out); - } - - fn length(&self) -> usize { - 1 - } -} - -impl Decodable for OpTxType { - fn decode(buf: &mut &[u8]) -> alloy_rlp::Result { - let ty = u8::decode(buf)?; - - Self::try_from(ty).map_err(|_| alloy_rlp::Error::Custom("invalid transaction type")) - } -} - -impl Typed2718 for OpTxType { - fn ty(&self) -> u8 { - (*self).into() - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloc::{vec, vec::Vec}; - - #[test] - fn test_all_tx_types() { - assert_eq!(OpTxType::ALL.len(), 5); - let all = vec![ - OpTxType::Legacy, - OpTxType::Eip2930, - OpTxType::Eip1559, - OpTxType::Eip7702, - OpTxType::Deposit, - ]; - assert_eq!(OpTxType::ALL.to_vec(), all); - } - - #[test] - fn tx_type_roundtrip() { - for &tx_type in &OpTxType::ALL { - let mut buf = Vec::new(); - tx_type.encode(&mut buf); - let decoded = OpTxType::decode(&mut &buf[..]).unwrap(); - assert_eq!(tx_type, decoded); - } - } -} diff --git a/crates/consensus/src/transaction/typed.rs b/crates/consensus/src/transaction/typed.rs deleted file mode 100644 index d720fca5..00000000 --- a/crates/consensus/src/transaction/typed.rs +++ /dev/null @@ -1,392 +0,0 @@ -use crate::{OpTxEnvelope, OpTxType, TxDeposit}; -use alloy_consensus::{Transaction, TxEip1559, TxEip2930, TxEip7702, TxLegacy, Typed2718}; -use alloy_eips::eip2930::AccessList; -use alloy_primitives::{Address, Bytes, TxKind}; - -/// The TypedTransaction enum represents all Ethereum transaction request types, modified for the OP -/// Stack. -/// -/// Its variants correspond to specific allowed transactions: -/// 1. Legacy (pre-EIP2718) [`TxLegacy`] -/// 2. EIP2930 (state access lists) [`TxEip2930`] -/// 3. EIP1559 [`TxEip1559`] -/// 4. Deposit [`TxDeposit`] -#[derive(Debug, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr( - feature = "serde", - serde( - from = "serde_from::MaybeTaggedTypedTransaction", - into = "serde_from::TaggedTypedTransaction" - ) -)] -pub enum OpTypedTransaction { - /// Legacy transaction - Legacy(TxLegacy), - /// EIP-2930 transaction - Eip2930(TxEip2930), - /// EIP-1559 transaction - Eip1559(TxEip1559), - /// EIP-7702 transaction - Eip7702(TxEip7702), - /// Optimism deposit transaction - Deposit(TxDeposit), -} - -impl From for OpTypedTransaction { - fn from(tx: TxLegacy) -> Self { - Self::Legacy(tx) - } -} - -impl From for OpTypedTransaction { - fn from(tx: TxEip2930) -> Self { - Self::Eip2930(tx) - } -} - -impl From for OpTypedTransaction { - fn from(tx: TxEip1559) -> Self { - Self::Eip1559(tx) - } -} - -impl From for OpTypedTransaction { - fn from(tx: TxEip7702) -> Self { - Self::Eip7702(tx) - } -} - -impl From for OpTypedTransaction { - fn from(tx: TxDeposit) -> Self { - Self::Deposit(tx) - } -} - -impl From for OpTypedTransaction { - fn from(envelope: OpTxEnvelope) -> Self { - match envelope { - OpTxEnvelope::Legacy(tx) => Self::Legacy(tx.strip_signature()), - OpTxEnvelope::Eip2930(tx) => Self::Eip2930(tx.strip_signature()), - OpTxEnvelope::Eip1559(tx) => Self::Eip1559(tx.strip_signature()), - OpTxEnvelope::Eip7702(tx) => Self::Eip7702(tx.strip_signature()), - OpTxEnvelope::Deposit(tx) => Self::Deposit(tx.into_inner()), - } - } -} - -impl OpTypedTransaction { - /// Return the [`OpTxType`] of the inner txn. - pub const fn tx_type(&self) -> OpTxType { - match self { - Self::Legacy(_) => OpTxType::Legacy, - Self::Eip2930(_) => OpTxType::Eip2930, - Self::Eip1559(_) => OpTxType::Eip1559, - Self::Eip7702(_) => OpTxType::Eip7702, - Self::Deposit(_) => OpTxType::Deposit, - } - } - - /// Return the inner legacy transaction if it exists. - pub const fn legacy(&self) -> Option<&TxLegacy> { - match self { - Self::Legacy(tx) => Some(tx), - _ => None, - } - } - - /// Return the inner EIP-2930 transaction if it exists. - pub const fn eip2930(&self) -> Option<&TxEip2930> { - match self { - Self::Eip2930(tx) => Some(tx), - _ => None, - } - } - - /// Return the inner EIP-1559 transaction if it exists. - pub const fn eip1559(&self) -> Option<&TxEip1559> { - match self { - Self::Eip1559(tx) => Some(tx), - _ => None, - } - } - - /// Return the inner deposit transaction if it exists. - pub const fn deposit(&self) -> Option<&TxDeposit> { - match self { - Self::Deposit(tx) => Some(tx), - _ => None, - } - } -} - -impl Typed2718 for OpTypedTransaction { - fn ty(&self) -> u8 { - match self { - Self::Legacy(_) => OpTxType::Legacy as u8, - Self::Eip2930(_) => OpTxType::Eip2930 as u8, - Self::Eip1559(_) => OpTxType::Eip1559 as u8, - Self::Eip7702(_) => OpTxType::Eip7702 as u8, - Self::Deposit(_) => OpTxType::Deposit as u8, - } - } -} - -impl Transaction for OpTypedTransaction { - fn chain_id(&self) -> Option { - match self { - Self::Legacy(tx) => tx.chain_id(), - Self::Eip2930(tx) => tx.chain_id(), - Self::Eip1559(tx) => tx.chain_id(), - Self::Eip7702(tx) => tx.chain_id(), - Self::Deposit(tx) => tx.chain_id(), - } - } - - fn nonce(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.nonce(), - Self::Eip2930(tx) => tx.nonce(), - Self::Eip1559(tx) => tx.nonce(), - Self::Eip7702(tx) => tx.nonce(), - Self::Deposit(tx) => tx.nonce(), - } - } - - fn gas_limit(&self) -> u64 { - match self { - Self::Legacy(tx) => tx.gas_limit(), - Self::Eip2930(tx) => tx.gas_limit(), - Self::Eip1559(tx) => tx.gas_limit(), - Self::Eip7702(tx) => tx.gas_limit(), - Self::Deposit(tx) => tx.gas_limit(), - } - } - - fn gas_price(&self) -> Option { - match self { - Self::Legacy(tx) => tx.gas_price(), - Self::Eip2930(tx) => tx.gas_price(), - Self::Eip1559(tx) => tx.gas_price(), - Self::Eip7702(tx) => tx.gas_price(), - Self::Deposit(tx) => tx.gas_price(), - } - } - - fn max_fee_per_gas(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.max_fee_per_gas(), - Self::Eip2930(tx) => tx.max_fee_per_gas(), - Self::Eip1559(tx) => tx.max_fee_per_gas(), - Self::Eip7702(tx) => tx.max_fee_per_gas(), - Self::Deposit(tx) => tx.max_fee_per_gas(), - } - } - - fn max_priority_fee_per_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.max_priority_fee_per_gas(), - Self::Eip2930(tx) => tx.max_priority_fee_per_gas(), - Self::Eip1559(tx) => tx.max_priority_fee_per_gas(), - Self::Eip7702(tx) => tx.max_priority_fee_per_gas(), - Self::Deposit(tx) => tx.max_priority_fee_per_gas(), - } - } - - fn max_fee_per_blob_gas(&self) -> Option { - match self { - Self::Legacy(tx) => tx.max_fee_per_blob_gas(), - Self::Eip2930(tx) => tx.max_fee_per_blob_gas(), - Self::Eip1559(tx) => tx.max_fee_per_blob_gas(), - Self::Eip7702(tx) => tx.max_fee_per_blob_gas(), - Self::Deposit(tx) => tx.max_fee_per_blob_gas(), - } - } - - fn priority_fee_or_price(&self) -> u128 { - match self { - Self::Legacy(tx) => tx.priority_fee_or_price(), - Self::Eip2930(tx) => tx.priority_fee_or_price(), - Self::Eip1559(tx) => tx.priority_fee_or_price(), - Self::Eip7702(tx) => tx.priority_fee_or_price(), - Self::Deposit(tx) => tx.priority_fee_or_price(), - } - } - - fn effective_gas_price(&self, base_fee: Option) -> u128 { - match self { - Self::Legacy(tx) => tx.effective_gas_price(base_fee), - Self::Eip2930(tx) => tx.effective_gas_price(base_fee), - Self::Eip1559(tx) => tx.effective_gas_price(base_fee), - Self::Eip7702(tx) => tx.effective_gas_price(base_fee), - Self::Deposit(tx) => tx.effective_gas_price(base_fee), - } - } - - fn is_dynamic_fee(&self) -> bool { - match self { - Self::Legacy(tx) => tx.is_dynamic_fee(), - Self::Eip2930(tx) => tx.is_dynamic_fee(), - Self::Eip1559(tx) => tx.is_dynamic_fee(), - Self::Eip7702(tx) => tx.is_dynamic_fee(), - Self::Deposit(tx) => tx.is_dynamic_fee(), - } - } - - fn kind(&self) -> TxKind { - match self { - Self::Legacy(tx) => tx.kind(), - Self::Eip2930(tx) => tx.kind(), - Self::Eip1559(tx) => tx.kind(), - Self::Eip7702(tx) => tx.kind(), - Self::Deposit(tx) => tx.kind(), - } - } - - fn is_create(&self) -> bool { - match self { - Self::Legacy(tx) => tx.is_create(), - Self::Eip2930(tx) => tx.is_create(), - Self::Eip1559(tx) => tx.is_create(), - Self::Eip7702(tx) => tx.is_create(), - Self::Deposit(tx) => tx.is_create(), - } - } - - fn to(&self) -> Option
{ - match self { - Self::Legacy(tx) => tx.to(), - Self::Eip2930(tx) => tx.to(), - Self::Eip1559(tx) => tx.to(), - Self::Eip7702(tx) => tx.to(), - Self::Deposit(tx) => tx.to(), - } - } - - fn value(&self) -> alloy_primitives::U256 { - match self { - Self::Legacy(tx) => tx.value(), - Self::Eip2930(tx) => tx.value(), - Self::Eip1559(tx) => tx.value(), - Self::Eip7702(tx) => tx.value(), - Self::Deposit(tx) => tx.value(), - } - } - - fn input(&self) -> &Bytes { - match self { - Self::Legacy(tx) => tx.input(), - Self::Eip2930(tx) => tx.input(), - Self::Eip1559(tx) => tx.input(), - Self::Eip7702(tx) => tx.input(), - Self::Deposit(tx) => tx.input(), - } - } - - fn access_list(&self) -> Option<&AccessList> { - match self { - Self::Legacy(tx) => tx.access_list(), - Self::Eip2930(tx) => tx.access_list(), - Self::Eip1559(tx) => tx.access_list(), - Self::Eip7702(tx) => tx.access_list(), - Self::Deposit(tx) => tx.access_list(), - } - } - - fn blob_versioned_hashes(&self) -> Option<&[alloy_primitives::B256]> { - match self { - Self::Legacy(tx) => tx.blob_versioned_hashes(), - Self::Eip2930(tx) => tx.blob_versioned_hashes(), - Self::Eip1559(tx) => tx.blob_versioned_hashes(), - Self::Eip7702(tx) => tx.blob_versioned_hashes(), - Self::Deposit(tx) => tx.blob_versioned_hashes(), - } - } - - fn authorization_list(&self) -> Option<&[alloy_eips::eip7702::SignedAuthorization]> { - match self { - Self::Legacy(tx) => tx.authorization_list(), - Self::Eip2930(tx) => tx.authorization_list(), - Self::Eip1559(tx) => tx.authorization_list(), - Self::Eip7702(tx) => tx.authorization_list(), - Self::Deposit(tx) => tx.authorization_list(), - } - } -} - -#[cfg(feature = "serde")] -mod serde_from { - //! NB: Why do we need this? - //! - //! Because the tag may be missing, we need an abstraction over tagged (with - //! type) and untagged (always legacy). This is - //! [`MaybeTaggedTypedTransaction`]. - //! - //! The tagged variant is [`TaggedTypedTransaction`], which always has a - //! type tag. - //! - //! We serialize via [`TaggedTypedTransaction`] and deserialize via - //! [`MaybeTaggedTypedTransaction`]. - use super::*; - - #[derive(Debug, serde::Deserialize)] - #[serde(untagged)] - pub(crate) enum MaybeTaggedTypedTransaction { - Tagged(TaggedTypedTransaction), - Untagged(TxLegacy), - } - - #[derive(Debug, serde::Serialize, serde::Deserialize)] - #[serde(tag = "type")] - pub(crate) enum TaggedTypedTransaction { - /// Legacy transaction - #[serde(rename = "0x00", alias = "0x0")] - Legacy(TxLegacy), - /// EIP-2930 transaction - #[serde(rename = "0x01", alias = "0x1")] - Eip2930(TxEip2930), - /// EIP-1559 transaction - #[serde(rename = "0x02", alias = "0x2")] - Eip1559(TxEip1559), - /// EIP-7702 transaction - #[serde(rename = "0x04", alias = "0x4")] - Eip7702(TxEip7702), - /// Deposit transaction - #[serde(rename = "0x7e", alias = "0x7E", serialize_with = "crate::serde_deposit_tx_rpc")] - Deposit(TxDeposit), - } - - impl From for OpTypedTransaction { - fn from(value: MaybeTaggedTypedTransaction) -> Self { - match value { - MaybeTaggedTypedTransaction::Tagged(tagged) => tagged.into(), - MaybeTaggedTypedTransaction::Untagged(tx) => Self::Legacy(tx), - } - } - } - - impl From for OpTypedTransaction { - fn from(value: TaggedTypedTransaction) -> Self { - match value { - TaggedTypedTransaction::Legacy(signed) => Self::Legacy(signed), - TaggedTypedTransaction::Eip2930(signed) => Self::Eip2930(signed), - TaggedTypedTransaction::Eip1559(signed) => Self::Eip1559(signed), - TaggedTypedTransaction::Eip7702(signed) => Self::Eip7702(signed), - TaggedTypedTransaction::Deposit(tx) => Self::Deposit(tx), - } - } - } - - impl From for TaggedTypedTransaction { - fn from(value: OpTypedTransaction) -> Self { - match value { - OpTypedTransaction::Legacy(signed) => Self::Legacy(signed), - OpTypedTransaction::Eip2930(signed) => Self::Eip2930(signed), - OpTypedTransaction::Eip1559(signed) => Self::Eip1559(signed), - OpTypedTransaction::Eip7702(signed) => Self::Eip7702(signed), - OpTypedTransaction::Deposit(tx) => Self::Deposit(tx), - } - } - } -} diff --git a/crates/genesis/Cargo.toml b/crates/genesis/Cargo.toml deleted file mode 100644 index d4dcd518..00000000 --- a/crates/genesis/Cargo.toml +++ /dev/null @@ -1,51 +0,0 @@ -[package] -name = "op-alloy-genesis" -description = "Optimism genesis types" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -authors.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Alloy -alloy-sol-types.workspace = true -alloy-primitives.workspace = true -alloy-consensus.workspace = true -alloy-eips.workspace = true - -# Misc -thiserror.workspace = true - -# `arbitrary` feature -arbitrary = { workspace = true, features = ["derive"], optional = true } - -# `serde` feature -serde = { workspace = true, optional = true } -serde_repr = { workspace = true, optional = true } - -[dev-dependencies] -rand.workspace = true -serde_json.workspace = true -arbitrary = { workspace = true, features = ["derive"] } -alloy-primitives = { workspace = true, features = ["rand", "arbitrary"] } - -[features] -default = ["serde", "std"] -std = [] -arbitrary = [ - "std", - "dep:arbitrary", - "alloy-consensus/arbitrary", - "alloy-eips/arbitrary", - "alloy-primitives/rand", - "alloy-primitives/arbitrary", -] -serde = ["dep:serde", "dep:serde_repr", "alloy-primitives/serde", "alloy-eips/serde", "alloy-consensus/serde"] diff --git a/crates/genesis/README.md b/crates/genesis/README.md deleted file mode 100644 index b4c9e243..00000000 --- a/crates/genesis/README.md +++ /dev/null @@ -1,37 +0,0 @@ -## `op-alloy-genesis` - -CI -op-alloy-genesis crate -MIT License -Apache License -Book - - -Genesis types for Optimism. - -### Usage - -_By default, `op-alloy-genesis` enables both `std` and `serde` features._ - -If you're working in a `no_std` environment (like [`kona`][kona]), disable default features like so. - -```toml -[dependencies] -op-alloy-genesis = { version = "x.y.z", default-features = false, features = ["serde"] } -``` - - -#### Rollup Config - -`op-alloy-genesis` exports a `RollupConfig`, the primary genesis type for Optimism Consensus. - - -### Provenance - -This is based off of [alloy-genesis]. - - - - -[alloy-genesis]: https://github.com/alloy-rs -[kona]: https://github.com/anton-rs/kona/blob/main/Cargo.toml#L137 diff --git a/crates/genesis/src/addresses.rs b/crates/genesis/src/addresses.rs deleted file mode 100644 index 3bb71b48..00000000 --- a/crates/genesis/src/addresses.rs +++ /dev/null @@ -1,118 +0,0 @@ -//! Address Types - -use alloy_primitives::Address; - -/// The set of network-specific contracts for a given chain. -#[derive(Debug, Clone, Hash, PartialEq, Eq, Default)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "PascalCase"))] -pub struct AddressList { - /// The address manager - pub address_manager: Address, - /// L1 Cross Domain Messenger proxy address - pub l1_cross_domain_messenger_proxy: Address, - /// L1 ERC721 Bridge proxy address - #[cfg_attr(feature = "serde", serde(alias = "L1ERC721BridgeProxy"))] - pub l1_erc721_bridge_proxy: Address, - /// L1 Standard Bridge proxy address - pub l1_standard_bridge_proxy: Address, - /// L2 Output Oracle Proxy address - pub l2_output_oracle_proxy: Option
, - /// Optimism Mintable ERC20 Factory Proxy address - #[cfg_attr(feature = "serde", serde(alias = "OptimismMintableERC20FactoryProxy"))] - pub optimism_mintable_erc20_factory_proxy: Address, - /// Optimism Portal Proxy address - pub optimism_portal_proxy: Address, - /// System Config Proxy address - pub system_config_proxy: Address, - /// The system config owner - pub system_config_owner: Address, - /// Proxy Admin address - pub proxy_admin: Address, - /// The owner of the Proxy Admin - pub proxy_admin_owner: Address, - /// The guardian address - pub guardian: Address, - - // Fault Proof Contract Addresses - /// Anchor State Registry Proxy address - pub anchor_state_registry_proxy: Option
, - /// Delayed WETH Proxy address - #[cfg_attr(feature = "serde", serde(alias = "DelayedWETHProxy"))] - pub delayed_weth_proxy: Option
, - /// Dispute Game Factory Proxy address - pub dispute_game_factory_proxy: Option
, - /// Fault Dispute Game Proxy address - pub fault_dispute_game: Option
, - /// MIPS Proxy address - #[cfg_attr(feature = "serde", serde(alias = "MIPS"))] - pub mips: Option
, - /// Permissioned Dispute Game Proxy address - pub permissioned_dispute_game: Option
, - /// Preimage Oracle Proxy address - pub preimage_oracle: Option
, - /// The challenger's address - pub challenger: Option
, -} - -impl AddressList { - /// Sets zeroed addresses to [`Option::None`]. - pub fn zero_proof_addresses(&mut self) { - if self.anchor_state_registry_proxy == Some(Address::ZERO) { - self.anchor_state_registry_proxy = None; - } - if self.delayed_weth_proxy == Some(Address::ZERO) { - self.delayed_weth_proxy = None; - } - if self.dispute_game_factory_proxy == Some(Address::ZERO) { - self.dispute_game_factory_proxy = None; - } - if self.fault_dispute_game == Some(Address::ZERO) { - self.fault_dispute_game = None; - } - if self.mips == Some(Address::ZERO) { - self.mips = None; - } - if self.permissioned_dispute_game == Some(Address::ZERO) { - self.permissioned_dispute_game = None; - } - if self.preimage_oracle == Some(Address::ZERO) { - self.preimage_oracle = None; - } - if self.challenger == Some(Address::ZERO) { - self.challenger = None; - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn zero_proof_addresses() { - let mut addresses = AddressList { - anchor_state_registry_proxy: Some(Address::ZERO), - delayed_weth_proxy: Some(Address::ZERO), - dispute_game_factory_proxy: Some(Address::ZERO), - fault_dispute_game: Some(Address::ZERO), - mips: Some(Address::ZERO), - permissioned_dispute_game: Some(Address::ZERO), - preimage_oracle: Some(Address::ZERO), - challenger: Some(Address::ZERO), - ..Default::default() - }; - - addresses.zero_proof_addresses(); - - assert_eq!(addresses.anchor_state_registry_proxy, None); - assert_eq!(addresses.delayed_weth_proxy, None); - assert_eq!(addresses.dispute_game_factory_proxy, None); - assert_eq!(addresses.fault_dispute_game, None); - assert_eq!(addresses.mips, None); - assert_eq!(addresses.permissioned_dispute_game, None); - assert_eq!(addresses.preimage_oracle, None); - assert_eq!(addresses.challenger, None); - } -} diff --git a/crates/genesis/src/chain.rs b/crates/genesis/src/chain.rs deleted file mode 100644 index 6f84d0aa..00000000 --- a/crates/genesis/src/chain.rs +++ /dev/null @@ -1,256 +0,0 @@ -//! Chain Config Types - -use crate::{ - base_fee_params, AddressList, ChainGenesis, OpBaseFeeParams, RollupConfig, - GRANITE_CHANNEL_TIMEOUT, -}; -use alloc::string::String; -use alloy_eips::eip1559::BaseFeeParams; -use alloy_primitives::Address; - -/// Level of integration with the superchain. -#[derive(Debug, Copy, Clone, Default, Hash, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde_repr::Serialize_repr, serde_repr::Deserialize_repr))] -#[repr(u8)] -pub enum SuperchainLevel { - /// Frontier chains are chains with customizations beyond the - /// standard OP Stack configuration and are considered "advanced". - Frontier = 0, - /// Standard chains don't have any customizations beyond the - /// standard OP Stack configuration and are considered "vanilla". - #[default] - Standard = 1, -} - -/// AltDA configuration. -#[derive(Debug, Copy, Clone, Default, Hash, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AltDAConfig { - /// AltDA challenge address - pub da_challenge_address: Option
, - /// AltDA challenge window time (in seconds) - pub da_challenge_window: Option, - /// AltDA resolution window time (in seconds) - pub da_resolve_window: Option, -} - -/// Hardfork configuration. -#[derive(Debug, Copy, Clone, Default, Hash, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct HardForkConfiguration { - /// Canyon hardfork activation time - pub canyon_time: Option, - /// Delta hardfork activation time - pub delta_time: Option, - /// Ecotone hardfork activation time - pub ecotone_time: Option, - /// Fjord hardfork activation time - pub fjord_time: Option, - /// Granite hardfork activation time - pub granite_time: Option, - /// Holocene hardfork activation time - pub holocene_time: Option, - /// Isthmus hardfork activation time - pub isthmus_time: Option, -} - -/// Defines core blockchain settings per block. -/// -/// Tailors unique settings for each network based on -/// its genesis block and superchain configuration. -/// -/// This struct bridges the interface between the [`ChainConfig`][ccr] -/// defined in the [`superchain-registry`][scr] and the [`ChainConfig`][ccg] -/// defined in [`op-geth`][opg]. -/// -/// [opg]: https://github.com/ethereum-optimism/op-geth -/// [scr]: https://github.com/ethereum-optimism/superchain-registry -/// [ccg]: https://github.com/ethereum-optimism/op-geth/blob/optimism/params/config.go#L342 -/// [ccr]: https://github.com/ethereum-optimism/superchain-registry/blob/main/superchain/superchain.go#L80 -#[derive(Debug, Clone, Default, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ChainConfig { - /// Chain name (e.g. "Base") - #[cfg_attr(feature = "serde", serde(rename = "Name", alias = "name"))] - pub name: String, - /// Chain ID - #[cfg_attr(feature = "serde", serde(rename = "l2_chain_id", alias = "chain_id"))] - pub chain_id: u64, - /// L1 chain ID - #[cfg_attr(feature = "serde", serde(skip))] - pub l1_chain_id: u64, - /// Chain public RPC endpoint - #[cfg_attr(feature = "serde", serde(rename = "PublicRPC", alias = "public_rpc"))] - pub public_rpc: String, - /// Chain sequencer RPC endpoint - #[cfg_attr(feature = "serde", serde(rename = "SequencerRPC", alias = "sequencer_rpc"))] - pub sequencer_rpc: String, - /// Chain explorer HTTP endpoint - #[cfg_attr(feature = "serde", serde(rename = "Explorer", alias = "explorer"))] - pub explorer: String, - /// Level of integration with the superchain. - #[cfg_attr(feature = "serde", serde(rename = "SuperchainLevel", alias = "superchain_level"))] - pub superchain_level: SuperchainLevel, - /// Toggles standard chain validation checks on for this chain, even if it is a frontier chain. - #[cfg_attr( - feature = "serde", - serde(rename = "StandardChainCandidate", alias = "standard_chain_candidate") - )] - pub standard_chain_candidate: bool, - /// Time of when a given chain is opted in to the Superchain. - /// If set, hardforks times after the superchain time - /// will be inherited from the superchain-wide config. - #[cfg_attr(feature = "serde", serde(rename = "SuperchainTime", alias = "superchain_time"))] - pub superchain_time: Option, - /// Chain-specific batch inbox address - #[cfg_attr(feature = "serde", serde(rename = "batch_inbox_address"))] - pub batch_inbox_addr: Address, - /// Superchain is a simple string to identify the superchain. - /// This is implied by directory structure, and not encoded in the config file itself. - #[cfg_attr(feature = "serde", serde(rename = "Superchain"))] - pub superchain: String, - /// Chain is a simple string to identify the chain, within its superchain context. - /// This matches the resource filename, it is not encoded in the config file itself. - #[cfg_attr(feature = "serde", serde(skip))] - pub chain: String, - /// Hardfork Configuration. These values may override the superchain-wide defaults. - #[cfg_attr(feature = "serde", serde(flatten))] - pub hardfork_configuration: HardForkConfiguration, - /// The block time in seconds. - #[cfg_attr(feature = "serde", serde(rename = "block_time"))] - pub block_time: u64, - /// The sequencer window size in seconds. - #[cfg_attr(feature = "serde", serde(rename = "seq_window_size"))] - pub seq_window_size: u64, - /// The maximum sequencer drift in seconds. - #[cfg_attr(feature = "serde", serde(rename = "max_sequencer_drift"))] - pub max_sequencer_drift: u64, - /// Data availability type. - #[cfg_attr( - feature = "serde", - serde(rename = "DataAvailabilityType", alias = "data_availability_type") - )] - pub data_availability_type: String, - /// Optimism configuration - #[cfg_attr(feature = "serde", serde(rename = "optimism"))] - pub optimism: Option, - - // -- Optional Features -- - /// Alternative DA configuration - #[cfg_attr(feature = "serde", serde(rename = "alt_da"))] - pub alt_da: Option, - /// Chain-specific genesis information - pub genesis: ChainGenesis, - /// Addresses - #[cfg_attr(feature = "serde", serde(rename = "Addresses", alias = "addresses"))] - pub addresses: Option, - /// Gas paying token metadata. Not consumed by downstream OPStack components. - #[cfg_attr(feature = "serde", serde(rename = "GasPayingToken", alias = "gas_paying_token"))] - pub gas_paying_token: Option
, -} - -impl ChainConfig { - /// Set missing hardfork configurations to the defaults, if the chain has - /// a superchain_time set. Defaults are only used if the chain's hardfork - /// activated after the superchain_time. - pub fn set_missing_fork_configs(&mut self, defaults: &HardForkConfiguration) { - let Some(super_time) = self.superchain_time else { - return; - }; - let cfg = &mut self.hardfork_configuration; - - if cfg.canyon_time.is_none() && defaults.canyon_time.is_some_and(|t| t > super_time) { - cfg.canyon_time = defaults.canyon_time; - } - if cfg.delta_time.is_none() && defaults.delta_time.is_some_and(|t| t > super_time) { - cfg.delta_time = defaults.delta_time; - } - if cfg.ecotone_time.is_none() && defaults.ecotone_time.is_some_and(|t| t > super_time) { - cfg.ecotone_time = defaults.ecotone_time; - } - if cfg.fjord_time.is_none() && defaults.fjord_time.is_some_and(|t| t > super_time) { - cfg.fjord_time = defaults.fjord_time; - } - if cfg.granite_time.is_none() && defaults.granite_time.is_some_and(|t| t > super_time) { - cfg.granite_time = defaults.granite_time; - } - if cfg.holocene_time.is_none() && defaults.holocene_time.is_some_and(|t| t > super_time) { - cfg.holocene_time = defaults.holocene_time; - } - if cfg.isthmus_time.is_none() && defaults.isthmus_time.is_some_and(|t| t > super_time) { - cfg.isthmus_time = defaults.isthmus_time; - } - } - - /// Returns the base fee params for the chain. - pub fn base_fee_params(&self) -> BaseFeeParams { - self.optimism - .as_ref() - .map(|op| op.as_base_fee_params()) - .unwrap_or_else(|| base_fee_params(self.chain_id).as_base_fee_params()) - } - - /// Returns the canyon base fee params for the chain. - pub fn canyon_base_fee_params(&self) -> BaseFeeParams { - self.optimism - .as_ref() - .map(|op| op.as_canyon_base_fee_params()) - .unwrap_or_else(|| base_fee_params(self.chain_id).as_canyon_base_fee_params()) - } - - /// Loads the rollup config for the OP-Stack chain given the chain config and address list. - pub fn load_op_stack_rollup_config(&self) -> RollupConfig { - RollupConfig { - genesis: self.genesis, - l1_chain_id: self.l1_chain_id, - l2_chain_id: self.chain_id, - base_fee_params: self.base_fee_params(), - block_time: self.block_time, - seq_window_size: self.seq_window_size, - max_sequencer_drift: self.max_sequencer_drift, - canyon_base_fee_params: self.canyon_base_fee_params(), - regolith_time: Some(0), - canyon_time: self.hardfork_configuration.canyon_time, - delta_time: self.hardfork_configuration.delta_time, - ecotone_time: self.hardfork_configuration.ecotone_time, - fjord_time: self.hardfork_configuration.fjord_time, - granite_time: self.hardfork_configuration.granite_time, - holocene_time: self.hardfork_configuration.holocene_time, - isthmus_time: self.hardfork_configuration.isthmus_time, - batch_inbox_address: self.batch_inbox_addr, - deposit_contract_address: self - .addresses - .as_ref() - .map(|a| a.optimism_portal_proxy) - .unwrap_or_default(), - l1_system_config_address: self - .addresses - .as_ref() - .map(|a| a.system_config_proxy) - .unwrap_or_default(), - protocol_versions_address: self - .addresses - .as_ref() - .map(|a| a.address_manager) - .unwrap_or_default(), - superchain_config_address: None, - blobs_enabled_l1_timestamp: None, - da_challenge_address: self - .alt_da - .as_ref() - .and_then(|alt_da| alt_da.da_challenge_address), - - // The below chain parameters can be different per OP-Stack chain, - // but since none of the superchain chains differ, it's not represented in the - // superchain-registry yet. This restriction on superchain-chains may change in the - // future. Test/Alt configurations can still load custom rollup-configs when - // necessary. - channel_timeout: 300, - granite_channel_timeout: GRANITE_CHANNEL_TIMEOUT, - } - } -} diff --git a/crates/genesis/src/genesis.rs b/crates/genesis/src/genesis.rs deleted file mode 100644 index fe9854bd..00000000 --- a/crates/genesis/src/genesis.rs +++ /dev/null @@ -1,88 +0,0 @@ -//! Genesis types. - -use crate::SystemConfig; -use alloy_eips::eip1898::BlockNumHash; - -/// Chain genesis information. -#[derive(Debug, Copy, Clone, Default, Hash, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct ChainGenesis { - /// L1 genesis block - pub l1: BlockNumHash, - /// L2 genesis block - pub l2: BlockNumHash, - /// Timestamp of the L2 genesis block - pub l2_time: u64, - /// Optional System configuration - pub system_config: Option, -} - -#[cfg(any(test, feature = "arbitrary"))] -impl<'a> arbitrary::Arbitrary<'a> for ChainGenesis { - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - let system_config = Option::::arbitrary(u)?; - let l1_num_hash = BlockNumHash { - number: u64::arbitrary(u)?, - hash: alloy_primitives::B256::arbitrary(u)?, - }; - let l2_num_hash = BlockNumHash { - number: u64::arbitrary(u)?, - hash: alloy_primitives::B256::arbitrary(u)?, - }; - Ok(Self { l1: l1_num_hash, l2: l2_num_hash, l2_time: u.arbitrary()?, system_config }) - } -} - -#[cfg(test)] -#[cfg(feature = "serde")] -mod tests { - use super::*; - use alloy_primitives::{address, b256, uint}; - - const fn ref_genesis() -> ChainGenesis { - ChainGenesis { - l1: BlockNumHash { - hash: b256!("438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"), - number: 17422590, - }, - l2: BlockNumHash { - hash: b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"), - number: 105235063, - }, - l2_time: 1686068903, - system_config: Some(SystemConfig { - batcher_address: address!("6887246668a3b87F54DeB3b94Ba47a6f63F32985"), - overhead: uint!(0xbc_U256), - scalar: uint!(0xa6fe0_U256), - gas_limit: 30000000, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }), - } - } - - #[test] - fn test_genesis_serde() { - let genesis_str = r#"{ - "l1": { - "hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108", - "number": 17422590 - }, - "l2": { - "hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3", - "number": 105235063 - }, - "l2_time": 1686068903, - "system_config": { - "batcherAddr": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }"#; - let genesis: ChainGenesis = serde_json::from_str(genesis_str).unwrap(); - assert_eq!(genesis, ref_genesis()); - } -} diff --git a/crates/genesis/src/lib.rs b/crates/genesis/src/lib.rs deleted file mode 100644 index 4a840878..00000000 --- a/crates/genesis/src/lib.rs +++ /dev/null @@ -1,44 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -extern crate alloc; - -mod params; -pub use params::{ - base_fee_params, OpBaseFeeParams, BASE_SEPOLIA_BASE_FEE_PARAMS, - BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, OP_MAINNET_BASE_FEE_PARAMS, - OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, OP_SEPOLIA_BASE_FEE_PARAMS, - OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, - OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, -}; - -mod addresses; -pub use addresses::AddressList; - -mod system; -pub use system::{ - BatcherUpdateError, EIP1559UpdateError, GasConfigUpdateError, GasLimitUpdateError, - LogProcessingError, SystemAccounts, SystemConfig, SystemConfigUpdateError, - SystemConfigUpdateType, CONFIG_UPDATE_EVENT_VERSION_0, CONFIG_UPDATE_TOPIC, -}; - -mod chain; -pub use chain::{AltDAConfig, ChainConfig, HardForkConfiguration, SuperchainLevel}; - -mod genesis; -pub use genesis::ChainGenesis; - -mod rollup; -pub use rollup::{ - RollupConfig, FJORD_MAX_SEQUENCER_DRIFT, GRANITE_CHANNEL_TIMEOUT, - MAX_RLP_BYTES_PER_CHANNEL_BEDROCK, MAX_RLP_BYTES_PER_CHANNEL_FJORD, -}; diff --git a/crates/genesis/src/params.rs b/crates/genesis/src/params.rs deleted file mode 100644 index bf4db5de..00000000 --- a/crates/genesis/src/params.rs +++ /dev/null @@ -1,106 +0,0 @@ -//! Module containing fee parameters. - -use alloy_eips::eip1559::BaseFeeParams; - -/// Base fee max change denominator for Optimism Mainnet as defined in the Optimism -/// [transaction costs](https://community.optimism.io/docs/developers/build/differences/#transaction-costs) doc. -pub const OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u128 = 50; - -/// Base fee max change denominator for Optimism Mainnet as defined in the Optimism Canyon -/// hardfork. -pub const OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON: u128 = 250; - -/// Base fee max change denominator for Optimism Mainnet as defined in the Optimism -/// [transaction costs](https://community.optimism.io/docs/developers/build/differences/#transaction-costs) doc. -pub const OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 6; - -/// Base fee max change denominator for Optimism Sepolia as defined in the Optimism -/// [transaction costs](https://community.optimism.io/docs/developers/build/differences/#transaction-costs) doc. -pub const OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR: u128 = 50; - -/// Base fee max change denominator for Optimism Sepolia as defined in the Optimism Canyon -/// hardfork. -pub const OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON: u128 = 250; - -/// Base fee max change denominator for Optimism Sepolia as defined in the Optimism -/// [transaction costs](https://community.optimism.io/docs/developers/build/differences/#transaction-costs) doc. -pub const OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 6; - -/// Base fee max change denominator for Base Sepolia as defined in the Optimism -/// [transaction costs](https://community.optimism.io/docs/developers/build/differences/#transaction-costs) doc. -pub const BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER: u128 = 10; - -/// Get the base fee parameters for Optimism Sepolia. -pub const OP_SEPOLIA_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams { - eip1559_elasticity: OP_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - eip1559_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - eip1559_denominator_canyon: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, -}; - -/// Get the base fee parameters for Base Sepolia. -pub const BASE_SEPOLIA_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams { - eip1559_elasticity: BASE_SEPOLIA_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - eip1559_denominator: OP_SEPOLIA_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - eip1559_denominator_canyon: OP_SEPOLIA_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, -}; - -/// Get the base fee parameters for Optimism Mainnet. -pub const OP_MAINNET_BASE_FEE_PARAMS: OpBaseFeeParams = OpBaseFeeParams { - eip1559_elasticity: OP_MAINNET_EIP1559_DEFAULT_ELASTICITY_MULTIPLIER, - eip1559_denominator: OP_MAINNET_EIP1559_DEFAULT_BASE_FEE_MAX_CHANGE_DENOMINATOR, - eip1559_denominator_canyon: OP_MAINNET_EIP1559_BASE_FEE_MAX_CHANGE_DENOMINATOR_CANYON, -}; - -/// Returns the [BaseFeeParams] for the given chain id. -pub const fn base_fee_params(chain_id: u64) -> OpBaseFeeParams { - match chain_id { - 10 => OP_MAINNET_BASE_FEE_PARAMS, - 11155420 => OP_SEPOLIA_BASE_FEE_PARAMS, - 8453 => OP_MAINNET_BASE_FEE_PARAMS, - 84532 => BASE_SEPOLIA_BASE_FEE_PARAMS, - _ => OP_MAINNET_BASE_FEE_PARAMS, - } -} - -/// Optimism Base Fee Configuration -#[derive(Debug, Copy, Clone, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct OpBaseFeeParams { - /// EIP 1559 Elasticity Parameter - #[cfg_attr( - feature = "serde", - serde(rename = "eip1559Elasticity", alias = "eip1559_elasticity") - )] - pub eip1559_elasticity: u128, - /// EIP 1559 Denominator - #[cfg_attr( - feature = "serde", - serde(rename = "eip1559Denominator", alias = "eip1559_denominator") - )] - pub eip1559_denominator: u128, - /// EIP 1559 Denominator for the Canyon hardfork - #[cfg_attr( - feature = "serde", - serde(rename = "eip1559DenominatorCanyon", alias = "eip1559_denominator_canyon") - )] - pub eip1559_denominator_canyon: u128, -} - -impl OpBaseFeeParams { - /// Returns the inner [BaseFeeParams]. - pub const fn as_base_fee_params(&self) -> BaseFeeParams { - BaseFeeParams { - max_change_denominator: self.eip1559_denominator, - elasticity_multiplier: self.eip1559_elasticity, - } - } - - /// Returns the [BaseFeeParams] for the canyon hardfork. - pub const fn as_canyon_base_fee_params(&self) -> BaseFeeParams { - BaseFeeParams { - max_change_denominator: self.eip1559_denominator_canyon, - elasticity_multiplier: self.eip1559_elasticity, - } - } -} diff --git a/crates/genesis/src/rollup.rs b/crates/genesis/src/rollup.rs deleted file mode 100644 index 7a5c1426..00000000 --- a/crates/genesis/src/rollup.rs +++ /dev/null @@ -1,556 +0,0 @@ -//! Rollup Config Types - -use crate::{base_fee_params, ChainGenesis, HardForkConfiguration}; -use alloy_eips::eip1559::BaseFeeParams; -use alloy_primitives::Address; - -/// The max rlp bytes per channel for the Bedrock hardfork. -pub const MAX_RLP_BYTES_PER_CHANNEL_BEDROCK: u64 = 10_000_000; - -/// The max rlp bytes per channel for the Fjord hardfork. -pub const MAX_RLP_BYTES_PER_CHANNEL_FJORD: u64 = 100_000_000; - -/// The max sequencer drift when the Fjord hardfork is active. -pub const FJORD_MAX_SEQUENCER_DRIFT: u64 = 1800; - -/// The channel timeout once the Granite hardfork is active. -pub const GRANITE_CHANNEL_TIMEOUT: u64 = 50; - -#[cfg(feature = "serde")] -const fn default_granite_channel_timeout() -> u64 { - GRANITE_CHANNEL_TIMEOUT -} - -/// The Rollup configuration. -#[derive(Debug, Clone, Eq, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct RollupConfig { - /// The genesis state of the rollup. - pub genesis: ChainGenesis, - /// The block time of the L2, in seconds. - pub block_time: u64, - /// Sequencer batches may not be more than MaxSequencerDrift seconds after - /// the L1 timestamp of the sequencing window end. - /// - /// Note: When L1 has many 1 second consecutive blocks, and L2 grows at fixed 2 seconds, - /// the L2 time may still grow beyond this difference. - /// - /// Note: After the Fjord hardfork, this value becomes a constant of `1800`. - pub max_sequencer_drift: u64, - /// The sequencer window size. - pub seq_window_size: u64, - /// Number of L1 blocks between when a channel can be opened and when it can be closed. - pub channel_timeout: u64, - /// The channel timeout after the Granite hardfork. - #[cfg_attr(feature = "serde", serde(default = "default_granite_channel_timeout"))] - pub granite_channel_timeout: u64, - /// The L1 chain ID - pub l1_chain_id: u64, - /// The L2 chain ID - pub l2_chain_id: u64, - /// Base Fee Params - #[cfg_attr(feature = "serde", serde(default = "BaseFeeParams::optimism"))] - pub base_fee_params: BaseFeeParams, - /// Base fee params post-canyon hardfork - #[cfg_attr(feature = "serde", serde(default = "BaseFeeParams::optimism_canyon"))] - pub canyon_base_fee_params: BaseFeeParams, - /// `regolith_time` sets the activation time of the Regolith network-upgrade: - /// a pre-mainnet Bedrock change that addresses findings of the Sherlock contest related to - /// deposit attributes. "Regolith" is the loose deposited rock that sits on top of Bedrock. - /// Active if regolith_time != None && L2 block timestamp >= Some(regolith_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub regolith_time: Option, - /// `canyon_time` sets the activation time of the Canyon network upgrade. - /// Active if `canyon_time` != None && L2 block timestamp >= Some(canyon_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub canyon_time: Option, - /// `delta_time` sets the activation time of the Delta network upgrade. - /// Active if `delta_time` != None && L2 block timestamp >= Some(delta_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub delta_time: Option, - /// `ecotone_time` sets the activation time of the Ecotone network upgrade. - /// Active if `ecotone_time` != None && L2 block timestamp >= Some(ecotone_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub ecotone_time: Option, - /// `fjord_time` sets the activation time of the Fjord network upgrade. - /// Active if `fjord_time` != None && L2 block timestamp >= Some(fjord_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub fjord_time: Option, - /// `granite_time` sets the activation time for the Granite network upgrade. - /// Active if `granite_time` != None && L2 block timestamp >= Some(granite_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub granite_time: Option, - /// `holocene_time` sets the activation time for the Holocene network upgrade. - /// Active if `holocene_time` != None && L2 block timestamp >= Some(holocene_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub holocene_time: Option, - /// `isthmus_time` sets the activation time for the Isthmus network upgrade. - /// Active if `isthmus_time` != None && L2 block timestamp >= Some(isthmus_time), inactive - /// otherwise. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub isthmus_time: Option, - /// `batch_inbox_address` is the L1 address that batches are sent to. - pub batch_inbox_address: Address, - /// `deposit_contract_address` is the L1 address that deposits are sent to. - pub deposit_contract_address: Address, - /// `l1_system_config_address` is the L1 address that the system config is stored at. - pub l1_system_config_address: Address, - /// `protocol_versions_address` is the L1 address that the protocol versions are stored at. - pub protocol_versions_address: Address, - /// The superchain config address. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub superchain_config_address: Option
, - /// `blobs_enabled_l1_timestamp` is the timestamp to start reading blobs as a batch data - /// source. Optional. - #[cfg_attr( - feature = "serde", - serde(rename = "blobs_data", skip_serializing_if = "Option::is_none") - )] - pub blobs_enabled_l1_timestamp: Option, - /// `da_challenge_address` is the L1 address that the data availability challenge contract is - /// stored at. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub da_challenge_address: Option
, -} - -#[cfg(any(test, feature = "arbitrary"))] -impl<'a> arbitrary::Arbitrary<'a> for RollupConfig { - fn arbitrary(u: &mut arbitrary::Unstructured<'a>) -> arbitrary::Result { - use crate::{ - BASE_SEPOLIA_BASE_FEE_PARAMS, OP_MAINNET_BASE_FEE_PARAMS, OP_SEPOLIA_BASE_FEE_PARAMS, - }; - let params = match u32::arbitrary(u)? % 3 { - 0 => OP_MAINNET_BASE_FEE_PARAMS, - 1 => OP_SEPOLIA_BASE_FEE_PARAMS, - _ => BASE_SEPOLIA_BASE_FEE_PARAMS, - }; - Ok(Self { - genesis: ChainGenesis::arbitrary(u)?, - block_time: u.arbitrary()?, - max_sequencer_drift: u.arbitrary()?, - seq_window_size: u.arbitrary()?, - channel_timeout: u.arbitrary()?, - granite_channel_timeout: u.arbitrary()?, - l1_chain_id: u.arbitrary()?, - l2_chain_id: u.arbitrary()?, - base_fee_params: params.as_base_fee_params(), - canyon_base_fee_params: params.as_canyon_base_fee_params(), - regolith_time: Option::::arbitrary(u)?, - canyon_time: Option::::arbitrary(u)?, - delta_time: Option::::arbitrary(u)?, - ecotone_time: Option::::arbitrary(u)?, - fjord_time: Option::::arbitrary(u)?, - granite_time: Option::::arbitrary(u)?, - holocene_time: Option::::arbitrary(u)?, - isthmus_time: Option::::arbitrary(u)?, - batch_inbox_address: Address::arbitrary(u)?, - deposit_contract_address: Address::arbitrary(u)?, - l1_system_config_address: Address::arbitrary(u)?, - protocol_versions_address: Address::arbitrary(u)?, - superchain_config_address: Option::
::arbitrary(u)?, - blobs_enabled_l1_timestamp: Option::::arbitrary(u)?, - da_challenge_address: Option::
::arbitrary(u)?, - }) - } -} - -// Need to manually implement Default because [`BaseFeeParams`] has no Default impl. -impl Default for RollupConfig { - fn default() -> Self { - let config = base_fee_params(10); - Self { - genesis: ChainGenesis::default(), - block_time: 0, - max_sequencer_drift: 0, - seq_window_size: 0, - channel_timeout: 0, - granite_channel_timeout: GRANITE_CHANNEL_TIMEOUT, - l1_chain_id: 0, - l2_chain_id: 0, - base_fee_params: config.as_base_fee_params(), - canyon_base_fee_params: config.as_canyon_base_fee_params(), - regolith_time: None, - canyon_time: None, - delta_time: None, - ecotone_time: None, - fjord_time: None, - granite_time: None, - holocene_time: None, - isthmus_time: None, - batch_inbox_address: Address::ZERO, - deposit_contract_address: Address::ZERO, - l1_system_config_address: Address::ZERO, - protocol_versions_address: Address::ZERO, - superchain_config_address: None, - blobs_enabled_l1_timestamp: None, - da_challenge_address: None, - } - } -} - -impl RollupConfig { - /// Returns true if Regolith is active at the given timestamp. - pub fn is_regolith_active(&self, timestamp: u64) -> bool { - self.regolith_time.is_some_and(|t| timestamp >= t) || self.is_canyon_active(timestamp) - } - - /// Returns true if Canyon is active at the given timestamp. - pub fn is_canyon_active(&self, timestamp: u64) -> bool { - self.canyon_time.is_some_and(|t| timestamp >= t) || self.is_delta_active(timestamp) - } - - /// Returns true if Delta is active at the given timestamp. - pub fn is_delta_active(&self, timestamp: u64) -> bool { - self.delta_time.is_some_and(|t| timestamp >= t) || self.is_ecotone_active(timestamp) - } - - /// Returns true if Ecotone is active at the given timestamp. - pub fn is_ecotone_active(&self, timestamp: u64) -> bool { - self.ecotone_time.is_some_and(|t| timestamp >= t) || self.is_fjord_active(timestamp) - } - - /// Returns true if Fjord is active at the given timestamp. - pub fn is_fjord_active(&self, timestamp: u64) -> bool { - self.fjord_time.is_some_and(|t| timestamp >= t) || self.is_granite_active(timestamp) - } - - /// Returns true if Granite is active at the given timestamp. - pub fn is_granite_active(&self, timestamp: u64) -> bool { - self.granite_time.is_some_and(|t| timestamp >= t) || self.is_holocene_active(timestamp) - } - - /// Returns true if Holocene is active at the given timestamp. - pub fn is_holocene_active(&self, timestamp: u64) -> bool { - self.holocene_time.is_some_and(|t| timestamp >= t) || self.is_isthmus_active(timestamp) - } - - /// Returns true if Isthmus is active at the given timestamp. - pub fn is_isthmus_active(&self, timestamp: u64) -> bool { - self.isthmus_time.is_some_and(|t| timestamp >= t) - } - - /// Returns true if a DA Challenge proxy Address is provided in the rollup config and the - /// address is not zero. - pub fn is_alt_da_enabled(&self) -> bool { - self.da_challenge_address.is_some_and(|addr| !addr.is_zero()) - } - - /// Returns the max sequencer drift for the given timestamp. - pub fn max_sequencer_drift(&self, timestamp: u64) -> u64 { - if self.is_fjord_active(timestamp) { - FJORD_MAX_SEQUENCER_DRIFT - } else { - self.max_sequencer_drift - } - } - - /// Returns the max rlp bytes per channel for the given timestamp. - pub fn max_rlp_bytes_per_channel(&self, timestamp: u64) -> u64 { - if self.is_fjord_active(timestamp) { - MAX_RLP_BYTES_PER_CHANNEL_FJORD - } else { - MAX_RLP_BYTES_PER_CHANNEL_BEDROCK - } - } - - /// Returns the channel timeout for the given timestamp. - pub fn channel_timeout(&self, timestamp: u64) -> u64 { - if self.is_granite_active(timestamp) { - self.granite_channel_timeout - } else { - self.channel_timeout - } - } - - /// Returns the [HardForkConfiguration] using [RollupConfig] timestamps. - pub const fn hardfork_config(&self) -> HardForkConfiguration { - HardForkConfiguration { - canyon_time: self.canyon_time, - delta_time: self.delta_time, - ecotone_time: self.ecotone_time, - fjord_time: self.fjord_time, - granite_time: self.granite_time, - holocene_time: self.holocene_time, - isthmus_time: self.isthmus_time, - } - } - - /// Checks the scalar value in Ecotone. - pub fn check_ecotone_l1_system_config_scalar(scalar: [u8; 32]) -> Result<(), &'static str> { - let version_byte = scalar[0]; - match version_byte { - 0 => { - if scalar[1..28] != [0; 27] { - return Err("Bedrock scalar padding not empty"); - } - Ok(()) - } - 1 => { - if scalar[1..24] != [0; 23] { - return Err("Invalid version 1 scalar padding"); - } - Ok(()) - } - _ => { - // ignore the event if it's an unknown scalar format - Err("Unrecognized scalar version") - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::{SystemConfig, OP_MAINNET_BASE_FEE_PARAMS}; - use alloy_eips::BlockNumHash; - #[cfg(feature = "serde")] - use alloy_primitives::U256; - use alloy_primitives::{address, b256}; - use arbitrary::Arbitrary; - use rand::Rng; - - #[test] - fn test_arbitrary_rollup_config() { - let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); - RollupConfig::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(); - } - - #[test] - fn test_regolith_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_regolith_active(0)); - config.regolith_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(!config.is_regolith_active(9)); - } - - #[test] - fn test_canyon_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_canyon_active(0)); - config.canyon_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(!config.is_canyon_active(9)); - } - - #[test] - fn test_delta_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_delta_active(0)); - config.delta_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(!config.is_delta_active(9)); - } - - #[test] - fn test_ecotone_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_ecotone_active(0)); - config.ecotone_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(config.is_ecotone_active(10)); - assert!(!config.is_ecotone_active(9)); - } - - #[test] - fn test_fjord_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_fjord_active(0)); - config.fjord_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(config.is_ecotone_active(10)); - assert!(config.is_fjord_active(10)); - assert!(!config.is_fjord_active(9)); - } - - #[test] - fn test_granite_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_granite_active(0)); - config.granite_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(config.is_ecotone_active(10)); - assert!(config.is_fjord_active(10)); - assert!(config.is_granite_active(10)); - assert!(!config.is_granite_active(9)); - } - - #[test] - fn test_holocene_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_holocene_active(0)); - config.holocene_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(config.is_ecotone_active(10)); - assert!(config.is_fjord_active(10)); - assert!(config.is_granite_active(10)); - assert!(config.is_holocene_active(10)); - assert!(!config.is_holocene_active(9)); - } - - #[test] - fn test_isthmus_active() { - let mut config = RollupConfig::default(); - assert!(!config.is_isthmus_active(0)); - config.isthmus_time = Some(10); - assert!(config.is_regolith_active(10)); - assert!(config.is_canyon_active(10)); - assert!(config.is_delta_active(10)); - assert!(config.is_ecotone_active(10)); - assert!(config.is_fjord_active(10)); - assert!(config.is_granite_active(10)); - assert!(config.is_holocene_active(10)); - assert!(config.is_isthmus_active(10)); - assert!(!config.is_isthmus_active(9)); - } - - #[test] - fn test_alt_da_enabled() { - let mut config = RollupConfig::default(); - assert!(!config.is_alt_da_enabled()); - config.da_challenge_address = Some(Address::ZERO); - assert!(!config.is_alt_da_enabled()); - config.da_challenge_address = Some(address!("0000000000000000000000000000000000000001")); - assert!(config.is_alt_da_enabled()); - } - - #[test] - fn test_granite_channel_timeout() { - let mut config = - RollupConfig { channel_timeout: 100, granite_time: Some(10), ..Default::default() }; - assert_eq!(config.channel_timeout(0), 100); - assert_eq!(config.channel_timeout(10), GRANITE_CHANNEL_TIMEOUT); - config.granite_time = None; - assert_eq!(config.channel_timeout(10), 100); - } - - #[test] - fn test_max_sequencer_drift() { - let mut config = RollupConfig { max_sequencer_drift: 100, ..Default::default() }; - assert_eq!(config.max_sequencer_drift(0), 100); - config.fjord_time = Some(10); - assert_eq!(config.max_sequencer_drift(0), 100); - assert_eq!(config.max_sequencer_drift(10), FJORD_MAX_SEQUENCER_DRIFT); - } - - #[test] - #[cfg(feature = "serde")] - fn test_deserialize_reference_rollup_config() { - // Reference serialized rollup config from the `op-node`. - let ser_cfg = r#" -{ - "genesis": { - "l1": { - "hash": "0x481724ee99b1f4cb71d826e2ec5a37265f460e9b112315665c977f4050b0af54", - "number": 10 - }, - "l2": { - "hash": "0x88aedfbf7dea6bfa2c4ff315784ad1a7f145d8f650969359c003bbed68c87631", - "number": 0 - }, - "l2_time": 1725557164, - "system_config": { - "batcherAddr": "0xc81f87a644b41e49b3221f41251f15c6cb00ce03", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "block_time": 2, - "max_sequencer_drift": 600, - "seq_window_size": 3600, - "channel_timeout": 300, - "l1_chain_id": 3151908, - "l2_chain_id": 1337, - "regolith_time": 0, - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "batch_inbox_address": "0xff00000000000000000000000000000000042069", - "deposit_contract_address": "0x08073dc48dde578137b8af042bcbc1c2491f1eb2", - "l1_system_config_address": "0x94ee52a9d8edd72a85dea7fae3ba6d75e4bf1710", - "protocol_versions_address": "0x0000000000000000000000000000000000000000" -} - "#; - let config: RollupConfig = serde_json::from_str(ser_cfg).unwrap(); - - // Validate standard fields. - assert_eq!( - config.genesis, - ChainGenesis { - l1: BlockNumHash { - hash: b256!("481724ee99b1f4cb71d826e2ec5a37265f460e9b112315665c977f4050b0af54"), - number: 10 - }, - l2: BlockNumHash { - hash: b256!("88aedfbf7dea6bfa2c4ff315784ad1a7f145d8f650969359c003bbed68c87631"), - number: 0 - }, - l2_time: 1725557164, - system_config: Some(SystemConfig { - batcher_address: address!("c81f87a644b41e49b3221f41251f15c6cb00ce03"), - overhead: U256::ZERO, - scalar: U256::from(0xf4240), - gas_limit: 30_000_000, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }) - } - ); - assert_eq!(config.block_time, 2); - assert_eq!(config.max_sequencer_drift, 600); - assert_eq!(config.seq_window_size, 3600); - assert_eq!(config.channel_timeout, 300); - assert_eq!(config.l1_chain_id, 3151908); - assert_eq!(config.l2_chain_id, 1337); - assert_eq!(config.regolith_time, Some(0)); - assert_eq!(config.canyon_time, Some(0)); - assert_eq!(config.delta_time, Some(0)); - assert_eq!(config.ecotone_time, Some(0)); - assert_eq!(config.fjord_time, Some(0)); - assert_eq!( - config.batch_inbox_address, - address!("ff00000000000000000000000000000000042069") - ); - assert_eq!( - config.deposit_contract_address, - address!("08073dc48dde578137b8af042bcbc1c2491f1eb2") - ); - assert_eq!( - config.l1_system_config_address, - address!("94ee52a9d8edd72a85dea7fae3ba6d75e4bf1710") - ); - assert_eq!(config.protocol_versions_address, Address::ZERO); - - // Validate non-standard fields. - assert_eq!(config.granite_channel_timeout, GRANITE_CHANNEL_TIMEOUT); - assert_eq!(config.base_fee_params, OP_MAINNET_BASE_FEE_PARAMS.as_base_fee_params()); - assert_eq!( - config.canyon_base_fee_params, - OP_MAINNET_BASE_FEE_PARAMS.as_canyon_base_fee_params() - ); - } -} diff --git a/crates/genesis/src/system.rs b/crates/genesis/src/system.rs deleted file mode 100644 index d0643f1d..00000000 --- a/crates/genesis/src/system.rs +++ /dev/null @@ -1,768 +0,0 @@ -//! System Config Type - -use crate::RollupConfig; -use alloy_consensus::{Eip658Value, Receipt}; -use alloy_primitives::{address, b256, Address, Log, B256, B64, U256, U64}; -use alloy_sol_types::{sol, SolType}; - -/// `keccak256("ConfigUpdate(uint256,uint8,bytes)")` -pub const CONFIG_UPDATE_TOPIC: B256 = - b256!("1d2b0bda21d56b8bd12d4f94ebacffdfb35f5e226f84b461103bb8beab6353be"); - -/// The initial version of the system config event log. -pub const CONFIG_UPDATE_EVENT_VERSION_0: B256 = B256::ZERO; - -/// System configuration. -#[derive(Debug, Copy, Clone, Default, Hash, Eq, PartialEq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct SystemConfig { - /// Batcher address - #[cfg_attr(feature = "serde", serde(rename = "batcherAddr"))] - pub batcher_address: Address, - /// Fee overhead value - pub overhead: U256, - /// Fee scalar value - pub scalar: U256, - /// Gas limit value - pub gas_limit: u64, - /// Base fee scalar value - pub base_fee_scalar: Option, - /// Blob base fee scalar value - pub blob_base_fee_scalar: Option, - /// EIP-1559 denominator - pub eip1559_denominator: Option, - /// EIP-1559 elasticity - pub eip1559_elasticity: Option, -} - -/// Represents type of update to the system config. -#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] -#[repr(u64)] -pub enum SystemConfigUpdateType { - /// Batcher update type - Batcher = 0, - /// Gas config update type - GasConfig = 1, - /// Gas limit update type - GasLimit = 2, - /// Unsafe block signer update type - UnsafeBlockSigner = 3, - /// EIP-1559 parameters update type - Eip1559 = 4, -} - -impl TryFrom for SystemConfigUpdateType { - type Error = SystemConfigUpdateError; - - fn try_from(value: u64) -> Result { - match value { - 0 => Ok(Self::Batcher), - 1 => Ok(Self::GasConfig), - 2 => Ok(Self::GasLimit), - 3 => Ok(Self::UnsafeBlockSigner), - 4 => Ok(Self::Eip1559), - _ => Err(SystemConfigUpdateError::LogProcessing( - LogProcessingError::InvalidSystemConfigUpdateType(value), - )), - } - } -} - -impl SystemConfig { - /// Filters all L1 receipts to find config updates and applies the config updates. - pub fn update_with_receipts( - &mut self, - receipts: &[Receipt], - l1_system_config_address: Address, - ecotone_active: bool, - ) -> Result<(), SystemConfigUpdateError> { - for receipt in receipts { - if Eip658Value::Eip658(false) == receipt.status { - continue; - } - - receipt.logs.iter().try_for_each(|log| { - let topics = log.topics(); - if log.address == l1_system_config_address - && !topics.is_empty() - && topics[0] == CONFIG_UPDATE_TOPIC - { - // Safety: Error is bubbled up by the trailing `?` - self.process_config_update_log(log, ecotone_active)?; - } - Ok(()) - })?; - } - Ok(()) - } - - /// Returns the eip1559 parameters from a [SystemConfig] encoded as a [B64]. - pub fn eip_1559_params( - &self, - rollup_config: &RollupConfig, - parent_timestamp: u64, - next_timestamp: u64, - ) -> Option { - let is_holocene = rollup_config.is_holocene_active(next_timestamp); - - // For the first holocene block, a zero'd out B64 is returned to signal the - // execution layer to use the canyon base fee parameters. Else, the system - // config's eip1559 parameters are encoded as a B64. - if is_holocene && !rollup_config.is_holocene_active(parent_timestamp) { - Some(B64::ZERO) - } else { - is_holocene.then_some(B64::from_slice( - &[ - self.eip1559_denominator.unwrap_or_default().to_be_bytes(), - self.eip1559_elasticity.unwrap_or_default().to_be_bytes(), - ] - .concat(), - )) - } - } - - /// Decodes an EVM log entry emitted by the system config contract and applies it as a - /// [SystemConfig] change. - /// - /// Parse log data for: - /// - /// ```text - /// event ConfigUpdate( - /// uint256 indexed version, - /// UpdateType indexed updateType, - /// bytes data - /// ); - /// ``` - fn process_config_update_log( - &mut self, - log: &Log, - ecotone_active: bool, - ) -> Result { - // Validate the log - if log.topics().len() < 3 { - return Err(SystemConfigUpdateError::LogProcessing( - LogProcessingError::InvalidTopicLen(log.topics().len()), - )); - } - if log.topics()[0] != CONFIG_UPDATE_TOPIC { - return Err(SystemConfigUpdateError::LogProcessing(LogProcessingError::InvalidTopic)); - } - - // Parse the config update log - let version = log.topics()[1]; - if version != CONFIG_UPDATE_EVENT_VERSION_0 { - return Err(SystemConfigUpdateError::LogProcessing( - LogProcessingError::UnsupportedVersion(version), - )); - } - let Ok(topic_bytes) = <&[u8; 8]>::try_from(&log.topics()[2].as_slice()[24..]) else { - return Err(SystemConfigUpdateError::LogProcessing( - LogProcessingError::UpdateTypeDecodingError, - )); - }; - let update_type = u64::from_be_bytes(*topic_bytes); - let log_data = log.data.data.as_ref(); - - // Apply the update - match update_type.try_into()? { - SystemConfigUpdateType::Batcher => { - self.update_batcher_address(log_data).map_err(SystemConfigUpdateError::Batcher) - } - SystemConfigUpdateType::GasConfig => self - .update_gas_config(log_data, ecotone_active) - .map_err(SystemConfigUpdateError::GasConfig), - SystemConfigUpdateType::GasLimit => { - self.update_gas_limit(log_data).map_err(SystemConfigUpdateError::GasLimit) - } - SystemConfigUpdateType::Eip1559 => { - self.update_eip1559_params(log_data).map_err(SystemConfigUpdateError::Eip1559) - } - // Ignored in derivation - SystemConfigUpdateType::UnsafeBlockSigner => { - Ok(SystemConfigUpdateType::UnsafeBlockSigner) - } - } - } - - /// Updates the batcher address in the [SystemConfig] given the log data. - fn update_batcher_address( - &mut self, - log_data: &[u8], - ) -> Result { - if log_data.len() != 96 { - return Err(BatcherUpdateError::InvalidDataLen(log_data.len())); - } - - let Ok(pointer) = ::abi_decode(&log_data[0..32], true) else { - return Err(BatcherUpdateError::PointerDecodingError); - }; - if pointer != 32 { - return Err(BatcherUpdateError::InvalidDataPointer(pointer)); - } - let Ok(length) = ::abi_decode(&log_data[32..64], true) else { - return Err(BatcherUpdateError::LengthDecodingError); - }; - if length != 32 { - return Err(BatcherUpdateError::InvalidDataLength(length)); - } - - let Ok(batcher_address) = ::abi_decode(&log_data[64..], true) else { - return Err(BatcherUpdateError::BatcherAddressDecodingError); - }; - self.batcher_address = batcher_address; - Ok(SystemConfigUpdateType::Batcher) - } - - /// Updates the [SystemConfig] gas config - both the overhead and scalar values - /// given the log data and rollup config. - fn update_gas_config( - &mut self, - log_data: &[u8], - ecotone_active: bool, - ) -> Result { - if log_data.len() != 128 { - return Err(GasConfigUpdateError::InvalidDataLen(log_data.len())); - } - - let Ok(pointer) = ::abi_decode(&log_data[0..32], true) else { - return Err(GasConfigUpdateError::PointerDecodingError); - }; - if pointer != 32 { - return Err(GasConfigUpdateError::InvalidDataPointer(pointer)); - } - let Ok(length) = ::abi_decode(&log_data[32..64], true) else { - return Err(GasConfigUpdateError::LengthDecodingError); - }; - if length != 64 { - return Err(GasConfigUpdateError::InvalidDataLength(length)); - } - - let Ok(overhead) = ::abi_decode(&log_data[64..96], true) else { - return Err(GasConfigUpdateError::OverheadDecodingError); - }; - let Ok(scalar) = ::abi_decode(&log_data[96..], true) else { - return Err(GasConfigUpdateError::ScalarDecodingError); - }; - - if ecotone_active - && RollupConfig::check_ecotone_l1_system_config_scalar(scalar.to_be_bytes()).is_err() - { - // ignore invalid scalars, retain the old system-config scalar - return Ok(SystemConfigUpdateType::GasConfig); - } - - // Retain the scalar data in encoded form. - self.scalar = scalar; - - // If ecotone is active, set the overhead to zero, otherwise set to the decoded value. - self.overhead = if ecotone_active { U256::ZERO } else { overhead }; - - Ok(SystemConfigUpdateType::GasConfig) - } - - /// Updates the gas limit of the [SystemConfig] given the log data. - fn update_gas_limit( - &mut self, - log_data: &[u8], - ) -> Result { - if log_data.len() != 96 { - return Err(GasLimitUpdateError::InvalidDataLen(log_data.len())); - } - - let Ok(pointer) = ::abi_decode(&log_data[0..32], true) else { - return Err(GasLimitUpdateError::PointerDecodingError); - }; - if pointer != 32 { - return Err(GasLimitUpdateError::InvalidDataPointer(pointer)); - } - let Ok(length) = ::abi_decode(&log_data[32..64], true) else { - return Err(GasLimitUpdateError::LengthDecodingError); - }; - if length != 32 { - return Err(GasLimitUpdateError::InvalidDataLength(length)); - } - - let Ok(gas_limit) = ::abi_decode(&log_data[64..], true) else { - return Err(GasLimitUpdateError::GasLimitDecodingError); - }; - self.gas_limit = U64::from(gas_limit).saturating_to::(); - Ok(SystemConfigUpdateType::GasLimit) - } - - /// Updates the EIP-1559 parameters of the [SystemConfig] given the log data. - fn update_eip1559_params( - &mut self, - log_data: &[u8], - ) -> Result { - if log_data.len() != 96 { - return Err(EIP1559UpdateError::InvalidDataLen(log_data.len())); - } - - let Ok(pointer) = ::abi_decode(&log_data[0..32], true) else { - return Err(EIP1559UpdateError::PointerDecodingError); - }; - if pointer != 32 { - return Err(EIP1559UpdateError::InvalidDataPointer(pointer)); - } - let Ok(length) = ::abi_decode(&log_data[32..64], true) else { - return Err(EIP1559UpdateError::LengthDecodingError); - }; - if length != 32 { - return Err(EIP1559UpdateError::InvalidDataLength(length)); - } - - let Ok(eip1559_params) = ::abi_decode(&log_data[64..], true) else { - return Err(EIP1559UpdateError::EIP1559DecodingError); - }; - - self.eip1559_denominator = Some((eip1559_params >> 32) as u32); - self.eip1559_elasticity = Some(eip1559_params as u32); - - Ok(SystemConfigUpdateType::Eip1559) - } -} - -/// An error for processing the [SystemConfig] update log. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum SystemConfigUpdateError { - /// An error occurred while processing the update log. - #[error("Log processing error: {0}")] - LogProcessing(LogProcessingError), - /// A batcher update error. - #[error("Batcher update error: {0}")] - Batcher(BatcherUpdateError), - /// A gas config update error. - #[error("Gas config update error: {0}")] - GasConfig(GasConfigUpdateError), - /// A gas limit update error. - #[error("Gas limit update error: {0}")] - GasLimit(GasLimitUpdateError), - /// An EIP-1559 parameter update error. - #[error("EIP-1559 parameter update error: {0}")] - Eip1559(EIP1559UpdateError), -} - -/// An error occurred while processing the update log. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum LogProcessingError { - /// Received an incorrect number of log topics. - #[error("Invalid config update log: invalid topic length: {0}")] - InvalidTopicLen(usize), - /// The log topic is invalid. - #[error("Invalid config update log: invalid topic")] - InvalidTopic, - /// The config update log version is unsupported. - #[error("Invalid config update log: unsupported version: {0}")] - UnsupportedVersion(B256), - /// Failed to decode the update type from the config update log. - #[error("Failed to decode config update log: update type")] - UpdateTypeDecodingError, - /// An invalid system config update type. - #[error("Invalid system config update type: {0}")] - InvalidSystemConfigUpdateType(u64), -} - -/// An error for updating the batcher address on the [SystemConfig]. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum BatcherUpdateError { - /// Invalid data length. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLen(usize), - /// Failed to decode the data pointer argument from the batcher update log. - #[error("Failed to decode batcher update log: data pointer")] - PointerDecodingError, - /// The data pointer is invalid. - #[error("Invalid config update log: invalid data pointer: {0}")] - InvalidDataPointer(u64), - /// Failed to decode the data length argument from the batcher update log. - #[error("Failed to decode batcher update log: data length")] - LengthDecodingError, - /// The data length is invalid. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLength(u64), - /// Failed to decode the batcher address argument from the batcher update log. - #[error("Failed to decode batcher update log: batcher address")] - BatcherAddressDecodingError, -} - -/// An error for updating the gas config on the [SystemConfig]. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum GasConfigUpdateError { - /// Invalid data length. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLen(usize), - /// Failed to decode the data pointer argument from the gas config update log. - #[error("Failed to decode gas config update log: data pointer")] - PointerDecodingError, - /// The data pointer is invalid. - #[error("Invalid config update log: invalid data pointer: {0}")] - InvalidDataPointer(u64), - /// Failed to decode the data length argument from the gas config update log. - #[error("Failed to decode gas config update log: data length")] - LengthDecodingError, - /// The data length is invalid. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLength(u64), - /// Failed to decode the overhead argument from the gas config update log. - #[error("Failed to decode gas config update log: overhead")] - OverheadDecodingError, - /// Failed to decode the scalar argument from the gas config update log. - #[error("Failed to decode gas config update log: scalar")] - ScalarDecodingError, -} - -/// An error for updating the gas limit on the [SystemConfig]. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum GasLimitUpdateError { - /// Invalid data length. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLen(usize), - /// Failed to decode the data pointer argument from the gas limit update log. - #[error("Failed to decode gas limit update log: data pointer")] - PointerDecodingError, - /// The data pointer is invalid. - #[error("Invalid config update log: invalid data pointer: {0}")] - InvalidDataPointer(u64), - /// Failed to decode the data length argument from the gas limit update log. - #[error("Failed to decode gas limit update log: data length")] - LengthDecodingError, - /// The data length is invalid. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLength(u64), - /// Failed to decode the gas limit argument from the gas limit update log. - #[error("Failed to decode gas limit update log: gas limit")] - GasLimitDecodingError, -} - -/// An error for updating the EIP-1559 parameters on the [SystemConfig]. -#[derive(Debug, thiserror::Error, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub enum EIP1559UpdateError { - /// Invalid data length. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLen(usize), - /// Failed to decode the data pointer argument from the eip 1559 update log. - #[error("Failed to decode eip1559 parameter update log: data pointer")] - PointerDecodingError, - /// The data pointer is invalid. - #[error("Invalid config update log: invalid data pointer: {0}")] - InvalidDataPointer(u64), - /// Failed to decode the data length argument from the eip 1559 update log. - #[error("Failed to decode eip1559 parameter update log: data length")] - LengthDecodingError, - /// The data length is invalid. - #[error("Invalid config update log: invalid data length: {0}")] - InvalidDataLength(u64), - /// Failed to decode the eip1559 params argument from the eip 1559 update log. - #[error("Failed to decode eip1559 parameter update log: eip1559 parameters")] - EIP1559DecodingError, -} - -/// System accounts -#[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct SystemAccounts { - /// The address that can deposit attributes - pub attributes_depositor: Address, - /// The address of the attributes predeploy - pub attributes_predeploy: Address, - /// The address of the fee vault - pub fee_vault: Address, -} - -impl Default for SystemAccounts { - fn default() -> Self { - Self { - attributes_depositor: address!("deaddeaddeaddeaddeaddeaddeaddeaddead0001"), - attributes_predeploy: address!("4200000000000000000000000000000000000015"), - fee_vault: address!("4200000000000000000000000000000000000011"), - } - } -} - -#[cfg(test)] -mod test { - use super::*; - use alloc::vec; - use alloy_primitives::{b256, hex, LogData, B256}; - use arbitrary::Arbitrary; - use rand::Rng; - - #[test] - fn test_arbitrary_system_config() { - let mut bytes = [0u8; 1024]; - rand::thread_rng().fill(bytes.as_mut_slice()); - SystemConfig::arbitrary(&mut arbitrary::Unstructured::new(&bytes)).unwrap(); - } - - #[test] - fn test_eip_1559_params_from_system_config_none() { - let rollup_config = RollupConfig::default(); - let sys_config = SystemConfig::default(); - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 0), None); - } - - #[test] - fn test_eip_1559_params_from_system_config_some() { - let rollup_config = RollupConfig { holocene_time: Some(0), ..Default::default() }; - let sys_config = SystemConfig { - eip1559_denominator: Some(1), - eip1559_elasticity: None, - ..Default::default() - }; - let expected = Some(B64::from_slice(&[1u32.to_be_bytes(), 0u32.to_be_bytes()].concat())); - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 0), expected); - } - - #[test] - fn test_eip_1559_params_from_system_config() { - let rollup_config = RollupConfig { holocene_time: Some(0), ..Default::default() }; - let sys_config = SystemConfig { - eip1559_denominator: Some(1), - eip1559_elasticity: Some(2), - ..Default::default() - }; - let expected = Some(B64::from_slice(&[1u32.to_be_bytes(), 2u32.to_be_bytes()].concat())); - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 0), expected); - } - - #[test] - fn test_default_eip_1559_params_from_system_config() { - let rollup_config = RollupConfig { holocene_time: Some(0), ..Default::default() }; - let sys_config = SystemConfig { - eip1559_denominator: None, - eip1559_elasticity: None, - ..Default::default() - }; - let expected = Some(B64::ZERO); - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 0), expected); - } - - #[test] - fn test_default_eip_1559_params_from_system_config_pre_holocene() { - let rollup_config = RollupConfig::default(); - let sys_config = SystemConfig { - eip1559_denominator: Some(1), - eip1559_elasticity: Some(2), - ..Default::default() - }; - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 0), None); - } - - #[test] - fn test_default_eip_1559_params_first_block_holocene() { - let rollup_config = RollupConfig { holocene_time: Some(2), ..Default::default() }; - let sys_config = SystemConfig { - eip1559_denominator: Some(1), - eip1559_elasticity: Some(2), - ..Default::default() - }; - assert_eq!(sys_config.eip_1559_params(&rollup_config, 0, 2), Some(B64::ZERO)); - } - - #[test] - #[cfg(feature = "serde")] - fn test_system_config_serde() { - let sc_str = r#"{ - "batcherAddr": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - }"#; - let system_config: SystemConfig = serde_json::from_str(sc_str).unwrap(); - assert_eq!( - system_config.batcher_address, - address!("6887246668a3b87F54DeB3b94Ba47a6f63F32985") - ); - assert_eq!(system_config.overhead, U256::from(0xbc)); - assert_eq!(system_config.scalar, U256::from(0xa6fe0)); - assert_eq!(system_config.gas_limit, 30000000); - } - - #[test] - fn test_system_config_update_with_receipts_unchanged() { - let mut system_config = SystemConfig::default(); - let receipts = vec![]; - let l1_system_config_address = Address::ZERO; - let ecotone_active = false; - - system_config - .update_with_receipts(&receipts, l1_system_config_address, ecotone_active) - .unwrap(); - - assert_eq!(system_config, SystemConfig::default()); - } - - #[test] - fn test_system_config_update_with_receipts_batcher_address() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000000"); - let mut system_config = SystemConfig::default(); - let l1_system_config_address = Address::ZERO; - let ecotone_active = false; - - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000beef").into() - ) - }; - - let receipt = Receipt { - logs: vec![update_log], - status: Eip658Value::Eip658(true), - cumulative_gas_used: 0, - }; - - system_config - .update_with_receipts(&[receipt], l1_system_config_address, ecotone_active) - .unwrap(); - - assert_eq!( - system_config.batcher_address, - address!("000000000000000000000000000000000000bEEF"), - ); - } - - #[test] - fn test_system_config_update_batcher_log() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000000"); - - let mut system_config = SystemConfig::default(); - - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000beef").into() - ) - }; - - // Update the batcher address. - system_config.process_config_update_log(&update_log, false).unwrap(); - - assert_eq!( - system_config.batcher_address, - address!("000000000000000000000000000000000000bEEF") - ); - } - - #[test] - fn test_system_config_update_gas_config_log() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000001"); - - let mut system_config = SystemConfig::default(); - - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000babe000000000000000000000000000000000000000000000000000000000000beef").into() - ) - }; - - // Update the batcher address. - system_config.process_config_update_log(&update_log, false).unwrap(); - - assert_eq!(system_config.overhead, U256::from(0xbabe)); - assert_eq!(system_config.scalar, U256::from(0xbeef)); - } - - #[test] - fn test_system_config_update_gas_config_log_ecotone() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000001"); - - let mut system_config = SystemConfig::default(); - - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000babe000000000000000000000000000000000000000000000000000000000000beef").into() - ) - }; - - // Update the gas limit. - system_config.process_config_update_log(&update_log, true).unwrap(); - - assert_eq!(system_config.overhead, U256::from(0)); - assert_eq!(system_config.scalar, U256::from(0xbeef)); - } - - #[test] - fn test_system_config_update_gas_limit_log() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000002"); - - let mut system_config = SystemConfig::default(); - - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000beef").into() - ) - }; - - // Update the gas limit. - system_config.process_config_update_log(&update_log, false).unwrap(); - - assert_eq!(system_config.gas_limit, 0xbeef_u64); - } - - #[test] - fn test_system_config_update_eip1559_params_log() { - const UPDATE_TYPE: B256 = - b256!("0000000000000000000000000000000000000000000000000000000000000004"); - - let mut system_config = SystemConfig::default(); - let update_log = Log { - address: Address::ZERO, - data: LogData::new_unchecked( - vec![ - CONFIG_UPDATE_TOPIC, - CONFIG_UPDATE_EVENT_VERSION_0, - UPDATE_TYPE, - ], - hex!("000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000babe0000beef").into() - ) - }; - - // Update the EIP-1559 parameters. - system_config.process_config_update_log(&update_log, false).unwrap(); - - assert_eq!(system_config.eip1559_denominator, Some(0xbabe_u32)); - assert_eq!(system_config.eip1559_elasticity, Some(0xbeef_u32)); - } -} diff --git a/crates/network/Cargo.toml b/crates/network/Cargo.toml deleted file mode 100644 index 29de3612..00000000 --- a/crates/network/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "op-alloy-network" -description = "Optimism blockchain RPC behavior abstraction" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -authors.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Workspace -op-alloy-consensus.workspace = true -op-alloy-rpc-types.workspace = true - -# Alloy -alloy-consensus.workspace = true -alloy-network.workspace = true -alloy-primitives.workspace = true -alloy-rpc-types-eth.workspace = true -alloy-signer.workspace = true diff --git a/crates/network/README.md b/crates/network/README.md deleted file mode 100644 index 916d740a..00000000 --- a/crates/network/README.md +++ /dev/null @@ -1,15 +0,0 @@ -## `op-alloy-network` - -CI -op-alloy-network crate -MIT License -Apache License -Book - - -Optimism blockchain RPC behavior abstraction. - -This crate contains a simple abstraction of the RPC behavior of an -Op-stack blockchain. It is intended to be used by the Alloy client to -provide a consistent interface to the rest of the library, regardless of -changes the underlying blockchain makes to the RPC interface. diff --git a/crates/network/src/lib.rs b/crates/network/src/lib.rs deleted file mode 100644 index 0d6c6e0c..00000000 --- a/crates/network/src/lib.rs +++ /dev/null @@ -1,235 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] - -pub use alloy_network::*; - -use alloy_consensus::{TxEnvelope, TxType, TypedTransaction}; -use alloy_primitives::{Address, Bytes, ChainId, TxKind, U256}; -use alloy_rpc_types_eth::AccessList; -use op_alloy_consensus::{OpTxEnvelope, OpTxType, OpTypedTransaction}; -use op_alloy_rpc_types::OpTransactionRequest; - -/// Types for an Op-stack network. -#[derive(Clone, Copy, Debug)] -pub struct Optimism { - _private: (), -} - -impl Network for Optimism { - type TxType = OpTxType; - - type TxEnvelope = op_alloy_consensus::OpTxEnvelope; - - type UnsignedTx = op_alloy_consensus::OpTypedTransaction; - - type ReceiptEnvelope = op_alloy_consensus::OpReceiptEnvelope; - - type Header = alloy_consensus::Header; - - type TransactionRequest = op_alloy_rpc_types::OpTransactionRequest; - - type TransactionResponse = op_alloy_rpc_types::Transaction; - - type ReceiptResponse = op_alloy_rpc_types::OpTransactionReceipt; - - type HeaderResponse = alloy_rpc_types_eth::Header; - - type BlockResponse = - alloy_rpc_types_eth::Block; -} - -impl TransactionBuilder for OpTransactionRequest { - fn chain_id(&self) -> Option { - self.as_ref().chain_id() - } - - fn set_chain_id(&mut self, chain_id: ChainId) { - self.as_mut().set_chain_id(chain_id); - } - - fn nonce(&self) -> Option { - self.as_ref().nonce() - } - - fn set_nonce(&mut self, nonce: u64) { - self.as_mut().set_nonce(nonce); - } - - fn input(&self) -> Option<&Bytes> { - self.as_ref().input() - } - - fn set_input>(&mut self, input: T) { - self.as_mut().set_input(input); - } - - fn from(&self) -> Option
{ - self.as_ref().from() - } - - fn set_from(&mut self, from: Address) { - self.as_mut().set_from(from); - } - - fn kind(&self) -> Option { - self.as_ref().kind() - } - - fn clear_kind(&mut self) { - self.as_mut().clear_kind(); - } - - fn set_kind(&mut self, kind: TxKind) { - self.as_mut().set_kind(kind); - } - - fn value(&self) -> Option { - self.as_ref().value() - } - - fn set_value(&mut self, value: U256) { - self.as_mut().set_value(value); - } - - fn gas_price(&self) -> Option { - self.as_ref().gas_price() - } - - fn set_gas_price(&mut self, gas_price: u128) { - self.as_mut().set_gas_price(gas_price); - } - - fn max_fee_per_gas(&self) -> Option { - self.as_ref().max_fee_per_gas() - } - - fn set_max_fee_per_gas(&mut self, max_fee_per_gas: u128) { - self.as_mut().set_max_fee_per_gas(max_fee_per_gas); - } - - fn max_priority_fee_per_gas(&self) -> Option { - self.as_ref().max_priority_fee_per_gas() - } - - fn set_max_priority_fee_per_gas(&mut self, max_priority_fee_per_gas: u128) { - self.as_mut().set_max_priority_fee_per_gas(max_priority_fee_per_gas); - } - - fn gas_limit(&self) -> Option { - self.as_ref().gas_limit() - } - - fn set_gas_limit(&mut self, gas_limit: u64) { - self.as_mut().set_gas_limit(gas_limit); - } - - fn access_list(&self) -> Option<&AccessList> { - self.as_ref().access_list() - } - - fn set_access_list(&mut self, access_list: AccessList) { - self.as_mut().set_access_list(access_list); - } - - fn complete_type(&self, ty: OpTxType) -> Result<(), Vec<&'static str>> { - match ty { - OpTxType::Deposit => Err(vec!["not implemented for deposit tx"]), - _ => { - let ty = TxType::try_from(ty as u8).unwrap(); - self.as_ref().complete_type(ty) - } - } - } - - fn can_submit(&self) -> bool { - self.as_ref().can_submit() - } - - fn can_build(&self) -> bool { - self.as_ref().can_build() - } - - #[doc(alias = "output_transaction_type")] - fn output_tx_type(&self) -> OpTxType { - match self.as_ref().preferred_type() { - TxType::Eip1559 | TxType::Eip4844 => OpTxType::Eip1559, - TxType::Eip2930 => OpTxType::Eip2930, - TxType::Eip7702 => OpTxType::Eip7702, - TxType::Legacy => OpTxType::Legacy, - } - } - - #[doc(alias = "output_transaction_type_checked")] - fn output_tx_type_checked(&self) -> Option { - self.as_ref().buildable_type().map(|tx_ty| match tx_ty { - TxType::Eip1559 | TxType::Eip4844 => OpTxType::Eip1559, - TxType::Eip2930 => OpTxType::Eip2930, - TxType::Eip7702 => OpTxType::Eip7702, - TxType::Legacy => OpTxType::Legacy, - }) - } - - fn prep_for_submission(&mut self) { - self.as_mut().prep_for_submission(); - } - - fn build_unsigned(self) -> BuildResult { - if let Err((tx_type, missing)) = self.as_ref().missing_keys() { - let tx_type = OpTxType::try_from(tx_type as u8).unwrap(); - return Err(TransactionBuilderError::InvalidTransactionRequest(tx_type, missing) - .into_unbuilt(self)); - } - Ok(self.build_typed_tx().expect("checked by missing_keys")) - } - - async fn build>( - self, - wallet: &W, - ) -> Result<::TxEnvelope, TransactionBuilderError> { - Ok(wallet.sign_request(self).await?) - } -} - -impl NetworkWallet for EthereumWallet { - fn default_signer_address(&self) -> Address { - NetworkWallet::::default_signer_address(self) - } - - fn has_signer_for(&self, address: &Address) -> bool { - NetworkWallet::::has_signer_for(self, address) - } - - fn signer_addresses(&self) -> impl Iterator { - NetworkWallet::::signer_addresses(self) - } - - async fn sign_transaction_from( - &self, - sender: Address, - tx: OpTypedTransaction, - ) -> alloy_signer::Result { - let tx = match tx { - OpTypedTransaction::Legacy(tx) => TypedTransaction::Legacy(tx), - OpTypedTransaction::Eip2930(tx) => TypedTransaction::Eip2930(tx), - OpTypedTransaction::Eip1559(tx) => TypedTransaction::Eip1559(tx), - OpTypedTransaction::Eip7702(tx) => TypedTransaction::Eip7702(tx), - OpTypedTransaction::Deposit(_) => { - return Err(alloy_signer::Error::other("not implemented for deposit tx")) - } - }; - let tx = NetworkWallet::::sign_transaction_from(self, sender, tx).await?; - - Ok(match tx { - TxEnvelope::Eip1559(tx) => OpTxEnvelope::Eip1559(tx), - TxEnvelope::Eip2930(tx) => OpTxEnvelope::Eip2930(tx), - TxEnvelope::Eip7702(tx) => OpTxEnvelope::Eip7702(tx), - TxEnvelope::Legacy(tx) => OpTxEnvelope::Legacy(tx), - _ => unreachable!(), - }) - } -} diff --git a/crates/op-alloy/Cargo.toml b/crates/op-alloy/Cargo.toml deleted file mode 100644 index 68b49b90..00000000 --- a/crates/op-alloy/Cargo.toml +++ /dev/null @@ -1,87 +0,0 @@ -[package] -name = "op-alloy" -description = "Connect applications to the OP Stack" -version.workspace = true -edition.workspace = true -rust-version.workspace = true -authors.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -exclude.workspace = true - -[package.metadata.docs.rs] -all-features = true -rustdoc-args = ["--cfg", "docsrs"] - -[lints] -workspace = true - -[dependencies] -# Workspace -op-alloy-consensus = { workspace = true, optional = true } -op-alloy-genesis = { workspace = true, optional = true } -op-alloy-network = { workspace = true, optional = true } -op-alloy-protocol = { workspace = true, optional = true } -op-alloy-registry = { workspace = true, optional = true } -op-alloy-provider = { workspace = true, optional = true } -op-alloy-rpc-jsonrpsee = { workspace = true, optional = true } -op-alloy-rpc-types-engine = { workspace = true, optional = true } -op-alloy-rpc-types = { workspace = true, optional = true } - -[features] -default = ["std", "k256", "serde"] - -std = [ - "op-alloy-consensus?/std", - "op-alloy-genesis?/std", - "op-alloy-protocol?/std", - "op-alloy-registry?/std", - "op-alloy-rpc-types?/std", - "op-alloy-rpc-types-engine?/std", -] - -full = [ - "consensus", - "genesis", - "provider", - "registry", - "network", - "protocol", - "rpc-types", - "rpc-types-engine", - "rpc-jsonrpsee", -] - -k256 = [ - "op-alloy-consensus?/k256", -] - -arbitrary = [ - "op-alloy-consensus?/arbitrary", - "op-alloy-genesis?/arbitrary", - "op-alloy-protocol?/arbitrary", - "op-alloy-rpc-types?/arbitrary", - "op-alloy-rpc-types-engine?/arbitrary", -] - -serde = [ - "op-alloy-consensus?/serde", - "op-alloy-genesis?/serde", - "op-alloy-protocol?/serde", - "op-alloy-rpc-types-engine?/serde", -] - -# `no_std` support -consensus = ["dep:op-alloy-consensus"] -genesis = ["dep:op-alloy-genesis"] -registry = ["dep:op-alloy-registry"] -protocol = ["dep:op-alloy-protocol"] -rpc-types = ["dep:op-alloy-rpc-types"] -rpc-types-engine = ["dep:op-alloy-rpc-types-engine"] - -# std features -provider = ["dep:op-alloy-provider"] -network = ["dep:op-alloy-network"] -rpc-jsonrpsee = ["dep:op-alloy-rpc-jsonrpsee"] - diff --git a/crates/op-alloy/README.md b/crates/op-alloy/README.md deleted file mode 100644 index 03268089..00000000 --- a/crates/op-alloy/README.md +++ /dev/null @@ -1,96 +0,0 @@ -## `op-alloy` - -CI -op-alloy crate -License -License -Book - - -Built on [Alloy][alloy], `op-alloy` connects applications to the OP Stack. - - -### Usage - -To use `op-alloy`, add the crate as a dependency to a `Cargo.toml`. - -```toml -op-alloy = "0.6" -``` - -### Development Status - -`op-alloy` is currently in active development, and is not yet ready for use in production. - - -### Supported Rust Versions (MSRV) - -The current MSRV (minimum supported rust version) is 1.81. - -Unlike Alloy, op-alloy may use the latest stable release, -to benefit from the latest features. - -The MSRV is not increased automatically, and will be updated -only as part of a patch (pre-1.0) or minor (post-1.0) release. - - -### Contributing - -op-alloy is built by open source contributors like you, thank you for improving the project! - -A [contributing guide][contributing] is available that sets guidelines for contributing. - -Pull requests will not be merged unless CI passes, so please ensure that your contribution follows the -linting rules and passes clippy. - - -### `no_std` - -op-alloy is intended to be `no_std` compatible, initially for use in [kona][kona]. - -The following crates support `no_std`. -Notice, provider crates do not support `no_std` compatibility. - -- [`op-alloy-consensus`][op-alloy-consensus] -- [`op-alloy-genesis`][op-alloy-genesis] -- [`op-alloy-protocol`][op-alloy-protocol] -- [`op-alloy-rpc-types-engine`][op-alloy-rpc-types-engine] -- [`op-alloy-rpc-types`][op-alloy-rpc-types] - -If you would like to add no_std support to a crate, -please make sure to update [scripts/check_no_std.sh][check-no-std]. - - -### Credits - -op-alloy is inspired by the work of several teams and projects, most notably [the Alloy project][alloy]. - -This would not be possible without the hard work from open source contributors. Thank you. - - -### License - -Licensed under either of Apache License, Version -2.0 or MIT license at your option. - -Unless you explicitly state otherwise, any contribution intentionally submitted -for inclusion in these crates by you, as defined in the Apache-2.0 license, -shall be dual licensed as above, without any additional terms or conditions. - - - - -[check-no-std]: https://github.com/alloy-rs/op-alloy/blob/main/scripts/check_no_std.sh - -[kona]: https://github.com/anton-rs/kona -[alloy]: https://github.com/alloy-rs/alloy -[contributing]: https://alloy-rs.github.io/op-alloy - -[op-alloy-consensus]: https://crates.io/crates/op-alloy-consensus -[op-alloy-genesis]: https://crates.io/crates/op-alloy-genesis -[op-alloy-network]: https://crates.io/crates/op-alloy-network -[op-alloy-protocol]: https://crates.io/crates/op-alloy-protocol -[op-alloy-provider]: https://crates.io/crates/op-alloy-provider -[op-alloy-rpc-jsonrpsee]: https://crates.io/crates/op-alloy-rpc-jsonrpsee -[op-alloy-rpc-types-engine]: https://crates.io/crates/op-alloy-rpc-types-engine -[op-alloy-rpc-types]: https://crates.io/crates/op-alloy-rpc-types diff --git a/crates/op-alloy/src/lib.rs b/crates/op-alloy/src/lib.rs deleted file mode 100644 index b009cccf..00000000 --- a/crates/op-alloy/src/lib.rs +++ /dev/null @@ -1,44 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(any(feature = "full", feature = "std")), no_std)] - -#[cfg(feature = "consensus")] -#[doc(inline)] -pub use op_alloy_consensus as consensus; - -#[cfg(feature = "genesis")] -#[doc(inline)] -pub use op_alloy_genesis as genesis; - -#[cfg(feature = "network")] -#[doc(inline)] -pub use op_alloy_network as network; - -#[cfg(feature = "protocol")] -#[doc(inline)] -pub use op_alloy_protocol as protocol; - -#[cfg(feature = "registry")] -#[doc(inline)] -pub use op_alloy_registry as registry; - -#[cfg(feature = "provider")] -#[doc(inline)] -pub use op_alloy_provider as provider; - -#[cfg(feature = "rpc-types")] -#[doc(inline)] -pub use op_alloy_rpc_types as rpc_types; - -#[cfg(feature = "rpc-types-engine")] -#[doc(inline)] -pub use op_alloy_rpc_types_engine as rpc_types_engine; - -#[cfg(feature = "rpc-jsonrpsee")] -#[doc(inline)] -pub use op_alloy_rpc_jsonrpsee as rpc_jsonrpsee; diff --git a/crates/protocol/Cargo.toml b/crates/protocol/Cargo.toml index 1f6179ae..a5a2a44b 100644 --- a/crates/protocol/Cargo.toml +++ b/crates/protocol/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "op-alloy-protocol" +name = "maili-protocol" description = "Optimism protocol-specific types" version.workspace = true @@ -15,7 +15,7 @@ exclude.workspace = true workspace = true [dependencies] -# Workspace +# OP-Alloy op-alloy-genesis.workspace = true op-alloy-consensus.workspace = true diff --git a/crates/protocol/README.md b/crates/protocol/README.md index 8b06869d..8f7a9d88 100644 --- a/crates/protocol/README.md +++ b/crates/protocol/README.md @@ -1,10 +1,10 @@ -## `op-alloy-protocol` +## `maili-protocol` -CI -op-alloy-protocol crate -MIT License -Apache License -Book +CI +maili-protocol crate +MIT License +Apache License +Book Core protocol types for Optimism. @@ -13,6 +13,7 @@ These include types, constants, and methods for derivation as well as batch-subm ### Provenance -This code was initially ported from [kona-primitives] as part of ongoing op-alloy migrations. +This code was initially ported from [kona-primitives] to [op-alloy] as part of ongoing maili migrations. [kona-primitives]: https://github.com/ethereum-optimism/kona/tree/main/crates/kona-primitives +[op-alloy]: https://github.com/alloy-rs/op-alloy \ No newline at end of file diff --git a/crates/protocol/examples/batch_to_frames.rs b/crates/protocol/examples/batch_to_frames.rs index 208fd0e2..fedd1c6e 100644 --- a/crates/protocol/examples/batch_to_frames.rs +++ b/crates/protocol/examples/batch_to_frames.rs @@ -15,10 +15,10 @@ #[cfg(feature = "std")] fn main() { use alloy_primitives::BlockHash; - use op_alloy_genesis::RollupConfig; - use op_alloy_protocol::{ + use maili_protocol::{ Batch, ChannelId, ChannelOut, CompressionAlgo, SingleBatch, VariantCompressor, }; + use op_alloy_genesis::RollupConfig; // Use the example transaction let transactions = example_transactions(); diff --git a/crates/protocol/examples/frames_to_batch.rs b/crates/protocol/examples/frames_to_batch.rs index 19d38ae4..20327ba2 100644 --- a/crates/protocol/examples/frames_to_batch.rs +++ b/crates/protocol/examples/frames_to_batch.rs @@ -3,9 +3,9 @@ use alloy_consensus::{SignableTransaction, TxEip1559}; use alloy_eips::eip2718::{Decodable2718, Encodable2718}; use alloy_primitives::{hex, Address, BlockHash, Bytes, PrimitiveSignature, U256}; +use maili_protocol::{decompress_brotli, Batch, BlockInfo, Channel, Frame, SingleBatch}; use op_alloy_consensus::OpTxEnvelope; use op_alloy_genesis::RollupConfig; -use op_alloy_protocol::{decompress_brotli, Batch, BlockInfo, Channel, Frame, SingleBatch}; fn main() { // Raw frame data taken from the `encode_channel` example. diff --git a/crates/protocol/src/lib.rs b/crates/protocol/src/lib.rs index beccceaa..7c387b84 100644 --- a/crates/protocol/src/lib.rs +++ b/crates/protocol/src/lib.rs @@ -1,7 +1,7 @@ #![doc = include_str!("../README.md")] #![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" + html_logo_url = "https://raw.githubusercontent.com/op-rs/maili/main/assets/square.png", + html_favicon_url = "https://raw.githubusercontent.com/op-rs/maili/main/assets/favicon.ico" )] #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] diff --git a/crates/provider/Cargo.toml b/crates/provider/Cargo.toml index 001703c1..e7334007 100644 --- a/crates/provider/Cargo.toml +++ b/crates/provider/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "op-alloy-provider" +name = "maili-provider" description = "Interface with an OP Stack blockchain" version.workspace = true @@ -15,7 +15,7 @@ exclude.workspace = true workspace = true [dependencies] -# Workspace +# OP-Alloy op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] } # Alloy diff --git a/crates/provider/README.md b/crates/provider/README.md index 4a4f8b01..b32beaec 100644 --- a/crates/provider/README.md +++ b/crates/provider/README.md @@ -1,10 +1,10 @@ -## `op-alloy-provider` +## `maili-provider` -CI -op-alloy-provider crate -MIT License -Apache License -Book +CI +maili-provider crate +MIT License +Apache License +Book Optimism providers to interface with APIs, namely the engine API. diff --git a/crates/provider/src/lib.rs b/crates/provider/src/lib.rs index 2722146f..c44f9138 100644 --- a/crates/provider/src/lib.rs +++ b/crates/provider/src/lib.rs @@ -1,7 +1,7 @@ #![doc = include_str!("../README.md")] #![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" + html_logo_url = "https://raw.githubusercontent.com/op-rs/maili/main/assets/square.png", + html_favicon_url = "https://raw.githubusercontent.com/op-rs/maili/main/assets/favicon.ico" )] #![cfg_attr(not(test), warn(unused_crate_dependencies))] #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] diff --git a/crates/registry/Cargo.toml b/crates/registry/Cargo.toml deleted file mode 100644 index afc3d64a..00000000 --- a/crates/registry/Cargo.toml +++ /dev/null @@ -1,31 +0,0 @@ -[package] -name = "op-alloy-registry" -description = "A registry of superchain configs" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -authors.workspace = true -license.workspace = true -homepage.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -alloy-primitives = { workspace = true, features = ["map"] } -op-alloy-genesis = { workspace = true, features = ["serde"] } -lazy_static = { workspace = true, features = ["spin_no_std"] } -serde = { workspace = true, features = ["derive", "alloc"] } -serde_json = { workspace = true, features = ["raw_value"] } - -[dev-dependencies] -alloy-eips.workspace = true - -[features] -default = ["std", "map-foldhash"] -map-hashbrown = ["alloy-primitives/map-hashbrown"] -map-foldhash = ["alloy-primitives/map-foldhash"] -std = ["op-alloy-genesis/std", "serde_json/std"] diff --git a/crates/registry/Justfile b/crates/registry/Justfile deleted file mode 100644 index a63bd026..00000000 --- a/crates/registry/Justfile +++ /dev/null @@ -1,9 +0,0 @@ -set positional-arguments - -# default recipe to display help information -default: - @just --list - -# Generate file bindings -bind: - ./etc/bind.sh diff --git a/crates/registry/README.md b/crates/registry/README.md deleted file mode 100644 index 0d808d90..00000000 --- a/crates/registry/README.md +++ /dev/null @@ -1,101 +0,0 @@ -## `op-alloy-registry` - -CI -op-alloy-registry -MIT License -Apache License -Book - - -[`op-alloy-registry`][sc] is a `no_std` crate that exports rust type definitions for chains -in the [`superchain-registry`][osr]. Since it reads static files to read configurations for -various chains into instantiated objects, the [`op-alloy-registry`][sc] crate requires -[`serde`][serde] as a dependency. To use the [`op-alloy-registry`][sc] crate, add the crate -as a dependency to a `Cargo.toml`. - -```toml -op-alloy-registry = "0.6.7" -``` - -[`op-alloy-registry`][sc] declares lazy evaluated statics that expose `ChainConfig`s, `RollupConfig`s, -and `Chain` objects for all chains with static definitions in the superchain registry. The way this works -is the golang side of the superchain registry contains an "internal code generation" script that has -been modified to output configuration files to the [`crates/registry`][s] directory in the -`etc` folder that are read by the [`op-alloy-registry`][sc] rust crate. These static config files -contain an up-to-date list of all superchain configurations with their chain configs. It is expected -that if the commit hash of the [`superchain-registry`][osr] pulled in as a git submodule has breaking -changes, the tests in this crate (`op-alloy-registry`) will break and updates will need to be made. - -There are three core statics exposed by the [`op-alloy-registry`][sc]. -- `CHAINS`: A list of chain objects containing the superchain metadata for this chain. -- `OPCHAINS`: A map from chain id to `ChainConfig`. -- `ROLLUP_CONFIGS`: A map from chain id to `RollupConfig`. - -[`op-alloy-registry`][sc] exports the _complete_ list of chains within the superchain, as well as each -chain's `RollupConfig`s and `ChainConfig`s. - - -### Usage - -Add the following to your `Cargo.toml`. - -```toml -[dependencies] -op-alloy-registry = "0.6.7" -``` - -To make `op-alloy-registry` `no_std`, toggle `default-features` off like so. - -```toml -[dependencies] -op-alloy-registry = { version = "0.6.7", default-features = false } -``` - -Below demonstrates getting the `RollupConfig` for OP Mainnet (Chain ID `10`). - -```rust -use op_alloy_registry::ROLLUP_CONFIGS; - -let op_chain_id = 10; -let op_rollup_config = ROLLUP_CONFIGS.get(&op_chain_id); -println!("OP Mainnet Rollup Config: {:?}", op_rollup_config); -``` - -A mapping from chain id to `ChainConfig` is also available. - -```rust -use op_alloy_registry::OPCHAINS; - -let op_chain_id = 10; -let op_chain_config = OPCHAINS.get(&op_chain_id); -println!("OP Mainnet Chain Config: {:?}", op_chain_config); -``` - - -### Feature Flags - -- `std`: Uses the standard library to pull in environment variables. - - -### Credits - -[superchain-registry][osr] contributors for building and maintaining superchain types. - -[alloy] and [op-alloy] for creating and maintaining high quality Ethereum and Optimism types in rust. - - - - -[serde]: https://crates.io/crates/serde -[alloy]: https://github.com/alloy-rs/alloy -[op-alloy]: https://github.com/alloy-rs/op-alloy -[op-superchain]: https://docs.optimism.io/stack/explainer -[osr]: https://github.com/ethereum-optimism/superchain-registry - -[s]: ./crates/registry -[sc]: https://crates.io/crates/op-alloy-registry - -[oag]: https://crates.io/crates/op-alloy-genesis -[chains]: https://docs.rs/op-alloy-registry/latest/superchain/struct.CHAINS.html -[opchains]: https://docs.rs/op-alloy-registry/latest/superchain/struct.OPCHAINS.html -[rollups]: https://docs.rs/op-alloy-registry/latest/superchain/struct.ROLLUP_CONFIGS.html diff --git a/crates/registry/etc/bind.sh b/crates/registry/etc/bind.sh deleted file mode 100755 index 1a8566cc..00000000 --- a/crates/registry/etc/bind.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -CURRENT_SOURE=${BASH_SOURCE[0]} -CURRENT_DIR=$(dirname $CURRENT_SOURE) -REPO_ROOT=$( cd $CURRENT_DIR >/dev/null 2>&1 && pwd ) -REPO_ROOT=$(dirname $REPO_ROOT) -CHAINLIST_JSON=${REPO_ROOT}/superchain-registry/chainList.json -CONFIGS_JSON=${REPO_ROOT}/superchain-registry/superchain/configs/configs.json - -# Attempt to copy over the chainList.json file to etc/chainList.json -if [ -f ${CHAINLIST_JSON} ]; then - cp "${CHAINLIST_JSON}" "${REPO_ROOT}/etc/chainList.json" -else - echo "[ERROR] ${CHAINLIST_JSON} does not exist" - exit 1 -fi - -# Attempt to copy over the configs.json file to etc/configs.json -if [ -f ${CONFIGS_JSON} ]; then - cp "${CONFIGS_JSON}" "${REPO_ROOT}/etc/configs.json" -else - echo "[WARN] ${CONFIGS_JSON} does not exist" - exit 1 -fi diff --git a/crates/registry/etc/chainList.json b/crates/registry/etc/chainList.json deleted file mode 100644 index dd5a91f6..00000000 --- a/crates/registry/etc/chainList.json +++ /dev/null @@ -1,583 +0,0 @@ -[ - { - "name": "OP Mainnet", - "identifier": "mainnet/op", - "chainId": 10, - "rpc": [ - "https://mainnet.optimism.io" - ], - "explorers": [ - "https://explorer.optimism.io" - ], - "superchainLevel": 1, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Automata Mainnet", - "identifier": "mainnet/automata", - "chainId": 65536, - "rpc": [ - "https://rpc.ata.network" - ], - "explorers": [ - "https://explorer.ata.network" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "mainnet" - }, - "gasPayingToken": "0xA2120b9e674d3fC3875f415A7DF52e382F141225" - }, - { - "name": "Base", - "identifier": "mainnet/base", - "chainId": 8453, - "rpc": [ - "https://mainnet.base.org" - ], - "explorers": [ - "https://explorer.base.org" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Cyber Mainnet", - "identifier": "mainnet/cyber", - "chainId": 7560, - "rpc": [ - "https://rpc.cyber.co" - ], - "explorers": [ - "https://cyberscan.co/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Ethernity", - "identifier": "mainnet/ethernity", - "chainId": 183, - "rpc": [ - "https://mainnet.ethernitychain.io" - ], - "explorers": [ - "https://ernscan.io" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Funki", - "identifier": "mainnet/funki", - "chainId": 33979, - "rpc": [ - "https://rpc-mainnet.funkichain.com" - ], - "explorers": [ - "https://funki.superscan.network" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Lisk", - "identifier": "mainnet/lisk", - "chainId": 1135, - "rpc": [ - "https://rpc.api.lisk.com" - ], - "explorers": [ - "https://blockscout.lisk.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Lyra Chain", - "identifier": "mainnet/lyra", - "chainId": 957, - "rpc": [ - "https://rpc.lyra.finance" - ], - "explorers": [ - "https://explorer.lyra.finance" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Metal L2", - "identifier": "mainnet/metal", - "chainId": 1750, - "rpc": [ - "https://rpc.metall2.com" - ], - "explorers": [ - "https://explorer.metall2.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Mode", - "identifier": "mainnet/mode", - "chainId": 34443, - "rpc": [ - "https://mainnet.mode.network" - ], - "explorers": [ - "https://explorer.mode.network" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Orderly Mainnet", - "identifier": "mainnet/orderly", - "chainId": 291, - "rpc": [ - "https://rpc.orderly.network" - ], - "explorers": [ - "https://explorer.orderly.network" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "RACE Mainnet", - "identifier": "mainnet/race", - "chainId": 6805, - "rpc": [ - "https://racemainnet.io" - ], - "explorers": [ - "https://racescan.io/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Shape", - "identifier": "mainnet/shape", - "chainId": 360, - "rpc": [ - "https://mainnet.shape.network/" - ], - "explorers": [ - "https://shape-mainnet.explorer.alchemy.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Swan Chain Mainnet", - "identifier": "mainnet/swan", - "chainId": 254, - "rpc": [ - "https://mainnet-rpc.swanchain.org" - ], - "explorers": [ - "https://swanscan.io" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Binary Mainnet", - "identifier": "mainnet/tbn", - "chainId": 624, - "rpc": [ - "https://rpc.zero.thebinaryholdings.com" - ], - "explorers": [ - "https://explorer.thebinaryholdings.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - }, - "gasPayingToken": "0x04E9D7e336f79Cdab911b06133D3Ca2Cd0721ce3" - }, - { - "name": "World Chain", - "identifier": "mainnet/worldchain", - "chainId": 480, - "rpc": [ - "https://worldchain-mainnet.g.alchemy.com/public" - ], - "explorers": [ - "https://worldchain-mainnet.explorer.alchemy.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "Zora", - "identifier": "mainnet/zora", - "chainId": 7777777, - "rpc": [ - "https://rpc.zora.energy" - ], - "explorers": [ - "https://explorer.zora.energy" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "mainnet" - } - }, - { - "name": "OP Sepolia Testnet", - "identifier": "sepolia/op", - "chainId": 11155420, - "rpc": [ - "https://sepolia.optimism.io" - ], - "explorers": [ - "https://sepolia-optimistic.etherscan.io" - ], - "superchainLevel": 1, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Base Sepolia Testnet", - "identifier": "sepolia/base", - "chainId": 84532, - "rpc": [ - "https://sepolia.base.org" - ], - "explorers": [ - "https://sepolia-explorer.base.org" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Cyber Testnet", - "identifier": "sepolia/cyber", - "chainId": 111557560, - "rpc": [ - "https://rpc.testnet.cyber.co" - ], - "explorers": [ - "https://testnet.cyberscan.co/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Ethernity Testnet", - "identifier": "sepolia/ethernity", - "chainId": 233, - "rpc": [ - "https://testnet.ethernitychain.io" - ], - "explorers": [ - "https://testnet.ernscan.io" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Funki Sepolia Testnet", - "identifier": "sepolia/funki", - "chainId": 3397901, - "rpc": [ - "https://funki-testnet.alt.technology" - ], - "explorers": [ - "https://sepolia-sandbox.funkichain.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "alt-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Lisk Sepolia Testnet", - "identifier": "sepolia/lisk", - "chainId": 4202, - "rpc": [ - "https://rpc.sepolia-api.lisk.com" - ], - "explorers": [ - "https://sepolia-blockscout.lisk.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Metal L2 Testnet", - "identifier": "sepolia/metal", - "chainId": 1740, - "rpc": [ - "https://testnet.rpc.metall2.com" - ], - "explorers": [ - "https://testnet.explorer.metall2.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Minato", - "identifier": "sepolia/minato", - "chainId": 1946, - "rpc": [ - "https://rpc.minato.soneium.org" - ], - "explorers": [ - "https://soneium-minato.blockscout.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Mode Testnet", - "identifier": "sepolia/mode", - "chainId": 919, - "rpc": [ - "https://sepolia.mode.network" - ], - "explorers": [ - "https://sepolia.explorer.mode.network" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "RACE Testnet", - "identifier": "sepolia/race", - "chainId": 6806, - "rpc": [ - "https://racetestnet.io" - ], - "explorers": [ - "https://testnet.racescan.io/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Shape Sepolia Testnet", - "identifier": "sepolia/shape", - "chainId": 11011, - "rpc": [ - "https://sepolia.shape.network/" - ], - "explorers": [ - "https://shape-sepolia.explorer.alchemy.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Binary Sepolia", - "identifier": "sepolia/tbn", - "chainId": 625, - "rpc": [ - "https://rpc.testnet.thebinaryholdings.com" - ], - "explorers": [ - "https://explorer.sepolia.thebinaryholdings.com" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - }, - "gasPayingToken": "0x46d878bf7BF62Ec542953CB89Ac0bF58d991181e" - }, - { - "name": "Unichain Sepolia Testnet", - "identifier": "sepolia/unichain", - "chainId": 1301, - "rpc": [ - "https://sepolia.unichain.org" - ], - "explorers": [ - "https://sepolia.uniscan.xyz" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "World Chain Sepolia Testnet", - "identifier": "sepolia/worldchain", - "chainId": 4801, - "rpc": [ - "https://worldchain-sepolia.g.alchemy.com/public" - ], - "explorers": [ - "https://worldchain-sepolia.explorer.alchemy.com/" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Zora Sepolia Testnet", - "identifier": "sepolia/zora", - "chainId": 999999999, - "rpc": [ - "https://sepolia.rpc.zora.energy" - ], - "explorers": [ - "https://sepolia.explorer.zora.energy" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia" - } - }, - { - "name": "Base devnet 0", - "identifier": "sepolia-dev-0/base-devnet-0", - "chainId": 11763072, - "rpc": [ - "" - ], - "explorers": [ - "" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia-dev-0" - } - }, - { - "name": "OP Labs Sepolia devnet 0", - "identifier": "sepolia-dev-0/oplabs-devnet-0", - "chainId": 11155421, - "rpc": [ - "" - ], - "explorers": [ - "" - ], - "superchainLevel": 0, - "dataAvailabilityType": "eth-da", - "parent": { - "type": "L2", - "chain": "sepolia-dev-0" - } - } -] \ No newline at end of file diff --git a/crates/registry/etc/configs.json b/crates/registry/etc/configs.json deleted file mode 100644 index 9a2e8d2c..00000000 --- a/crates/registry/etc/configs.json +++ /dev/null @@ -1,2336 +0,0 @@ -{ - "superchains": [ - { - "name": "mainnet", - "config": { - "Name": "Mainnet", - "L1": { - "ChainID": 1, - "PublicRPC": "https://ethereum-rpc.publicnode.com", - "Explorer": "https://etherscan.io" - }, - "ProtocolVersionsAddr": "0x8062AbC286f5e7D9428a0Ccb9AbD71e50d93b935", - "SuperchainConfigAddr": "0x95703e0982140D16f8ebA6d158FccEde42f04a4C", - "OPContractsManagerProxyAddr": "0x18CeC91779995AD14c880e4095456B9147160790" - }, - "chains": [ - { - "Name": "OP Mainnet", - "l2_chain_id": 10, - "PublicRPC": "https://mainnet.optimism.io", - "SequencerRPC": "https://mainnet-sequencer.optimism.io", - "Explorer": "https://explorer.optimism.io", - "SuperchainLevel": 1, - "StandardChainCandidate": false, - "SuperchainTime": 0, - "batch_inbox_address": "0xFF00000000000000000000000000000000000010", - "Superchain": "mainnet", - "Chain": "op", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108", - "number": 17422590 - }, - "l2": { - "hash": "0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3", - "number": 105235063 - }, - "l2_time": 1686068903, - "system_config": { - "batcherAddr": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xdE1FCfB0851916CA5101820A69b13a4E276bd81F", - "AnchorStateRegistryProxy": "0x18DAc71c228D1C32c99489B7323d441E1175e443", - "BatchSubmitter": "0x6887246668a3b87F54DeB3b94Ba47a6f63F32985", - "Challenger": "0x9BA6e03D8B90dE867373Db8cF1A58d2F7F006b3A", - "DelayedWETHProxy": "0x82511d494B5C942BE57498a70Fdd7184Ee33B975", - "DisputeGameFactoryProxy": "0xe5965Ab5962eDc7477C8520243A95517CD252fA9", - "FaultDisputeGame": "0xA6f3DFdbf4855a43c529bc42EDE96797252879af", - "Guardian": "0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2", - "L1CrossDomainMessengerProxy": "0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1", - "L1ERC721BridgeProxy": "0x5a7749f83b81B301cAb5f48EB8516B986DAef23D", - "L1StandardBridgeProxy": "0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1", - "MIPS": "0x16e83cE5Ce29BF90AD9Da06D2fE6a15d5f344ce4", - "OptimismMintableERC20FactoryProxy": "0x75505a97BD334E7BD3C476893285569C4136Fa0F", - "OptimismPortalProxy": "0xbEb5Fc579115071764c7423A4f12eDde41f106Ed", - "PermissionedDisputeGame": "0x050ed6F6273c7D836a111E42153BC00D0380b87d", - "PreimageOracle": "0x9c065e11870B891D214Bc2Da7EF1f9DDFA1BE277", - "Proposer": "0x473300df21D047806A082244b417f96b32f13A33", - "ProxyAdmin": "0x543bA4AADBAb8f9025686Bd03993043599c6fB04", - "ProxyAdminOwner": "0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A", - "SystemConfigOwner": "0x847B5c174615B1B7fDF770882256e2D3E95b9D92", - "SystemConfigProxy": "0x229047fed2591dbec1eF1118d64F7aF3dB9EB290", - "UnsafeBlockSigner": "0xAAAA45d9549EDA09E70937013520214382Ffc4A2" - } - }, - { - "Name": "Ethernity", - "l2_chain_id": 183, - "PublicRPC": "https://mainnet.ethernitychain.io", - "SequencerRPC": "https://mainnet.ethernitychain.io", - "Explorer": "https://ernscan.io", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xfF00000000000000000000000000000000000183", - "Superchain": "mainnet", - "Chain": "ethernity", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 20, - "eip1559Denominator": 1000, - "eip1559DenominatorCanyon": 1000 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xbb7ad201b0ab296465865642878e9256e0fa4a3f8d06bca1f3e5c5b54be6be90", - "number": 20519340 - }, - "l2": { - "hash": "0xa5e974a6ace39285b42f92316a9e040e58f8ffc24e3aac124ff6243c28323607", - "number": 0 - }, - "l2_time": 1723547735, - "system_config": { - "batcherAddr": "0x43Ca061Ea80FBB4A2b5515F4be4e953b191147aF", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x464Ca56D40f94E8A50eFa7F5b90c59D956a0efC9", - "AnchorStateRegistryProxy": "0x31EE18F4dbCa6A9C8599508Ec70aB98cb1118e9e", - "BatchSubmitter": "0x43Ca061Ea80FBB4A2b5515F4be4e953b191147aF", - "Challenger": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "DelayedWETHProxy": "0xde1999df1f225D638ad3ca2C9EB5b2E52730D950", - "DisputeGameFactoryProxy": "0xFcdb270B674911D321F1014c347EaBB1c55134FB", - "Guardian": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "L1CrossDomainMessengerProxy": "0x226A1e4A3D8e64A9De8423F9344348c179C72CB2", - "L1ERC721BridgeProxy": "0x00050ae93fBFaf5823A4ae229E4651F7F7A02FfA", - "L1StandardBridgeProxy": "0x908C324c35fF36F64236A7CDa4D50f3003E9C5C3", - "L2OutputOracleProxy": "0x0eB331B615030819464225Ecd373e5FFBE502DC4", - "MIPS": "0x94cE3d0B2243250d3f33dF45FAaEac273CA945fE", - "OptimismMintableERC20FactoryProxy": "0x45BEaf3Bd26b76796692b1Ef1E67469B84ADB914", - "OptimismPortalProxy": "0xDA29f0B4da6c23f6c1aF273945c290C0268c4ea9", - "PreimageOracle": "0xA0455F010561671c640d80f51851D51318aC32aB", - "Proposer": "0xF49212F977986347b73345D382a811e148751eED", - "ProxyAdmin": "0x0bc380347A0B7aF5453492CAF20e1E38bc0Abc2f", - "ProxyAdminOwner": "0xB68361AAac2Bc8a4b8BFe36B8C6d0B429b5930ea", - "SuperchainConfig": "0x14B768F93f256Ad8D2d018930DBdAe61306c4752", - "SystemConfigOwner": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "SystemConfigProxy": "0x20c3035C92bdB4C461242571EeAc59EeD03Df931", - "UnsafeBlockSigner": "0xD1705B4FFFc540EDeD73046ee1F3A8Db10d143f8" - } - }, - { - "Name": "Swan Chain Mainnet", - "l2_chain_id": 254, - "PublicRPC": "https://mainnet-rpc.swanchain.org", - "SequencerRPC": "https://sequencer-mainnet.swanchain.org", - "Explorer": "https://swanscan.io", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xfF00000000000000000000000000000000000254", - "Superchain": "mainnet", - "Chain": "swan", - "canyon_time": 0, - "delta_time": 0, - "block_time": 5, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x90dafe09640e2858bce2675c66da6b0f136215a179d49f5c9274252bd5a1f8a2", - "number": 20112576 - }, - "l2": { - "hash": "0x834c39d79eb75c4c52d745e624750b817b66eb13e483b035c42ec3aa5cfa7429", - "number": 0 - }, - "l2_time": 1718640215, - "system_config": { - "batcherAddr": "0xde794bEc196832474f2F218135bFd0f7cA7fb038", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x55Aec4EE11dA7d655565cCc2EB3bF21a46C94e6f", - "BatchSubmitter": "0xde794bEc196832474f2F218135bFd0f7cA7fb038", - "Challenger": "0x3FcB6E08A960EF52Ec3101A444f71A2Fd964b248", - "DisputeGameFactoryProxy": "0x2069FC7097b7784FCA21aa459e57E95C0046EeCD", - "Guardian": "0x3FcB6E08A960EF52Ec3101A444f71A2Fd964b248", - "L1CrossDomainMessengerProxy": "0x15567C4FfD9109795dFf1D9A5233D10aef0738D2", - "L1ERC721BridgeProxy": "0x1Ccf7e62889E6A93413DEAFC4e390Bd4047bDC32", - "L1StandardBridgeProxy": "0xed7525946A09056C6AaE29941b8323017382050e", - "L2OutputOracleProxy": "0x1c22740A0B4511E11D76434A424487862b593901", - "OptimismMintableERC20FactoryProxy": "0xE9614162C6128ABD7790C65D711CfC43ea842153", - "OptimismPortalProxy": "0xBa50434BC5fCC07406b1baD9AC72a4CDf776db15", - "Proposer": "0xb2a5571C23d13Ce16EF3e993FbE8d225D3f67366", - "ProxyAdmin": "0xCc8c55Ec2Ea3F3001C049eC934e72b55cf52fBf3", - "ProxyAdminOwner": "0x6197f64902b9275e6815F9A5b641Ed2291A5d39c", - "SuperchainConfig": "0xadE916De67511E5C24af4174Be67143d0dA94959", - "SystemConfigOwner": "0x3FcB6E08A960EF52Ec3101A444f71A2Fd964b248", - "SystemConfigProxy": "0x504D56cf68f791B45E3A2e895B0e1562f3431328", - "UnsafeBlockSigner": "0x05a220507e8F4c73a446DbAfC5607016A7D5Eab0" - } - }, - { - "Name": "Orderly Mainnet", - "l2_chain_id": 291, - "PublicRPC": "https://rpc.orderly.network", - "SequencerRPC": "https://rpc.orderly.network", - "Explorer": "https://explorer.orderly.network", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": 0, - "batch_inbox_address": "0x08aA34cC843CeEBcC88A627F18430294aA9780be", - "Superchain": "mainnet", - "Chain": "orderly", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x787d5dd296d63bc6e7a4158d4f109e1260740ee115f5ed5124b35dece1fa3968", - "number": 18292529 - }, - "l2": { - "hash": "0xe53c94ddd42714239429bd132ba2fa080c7e5cc7dca816ec6e482ec0418e6d7f", - "number": 0 - }, - "l2_time": 1696608227, - "system_config": { - "batcherAddr": "0xf8dB8Aba597fF36cCD16fECfbb1B816B3236E9b8", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x87630a802a3789463eC4b00f89b27b1e9f6b92e9", - "BatchSubmitter": "0xf8dB8Aba597fF36cCD16fECfbb1B816B3236E9b8", - "Challenger": "0xcE10372313Ca39Fbf75A09e7f4c0E57F070259f4", - "Guardian": "0xcE10372313Ca39Fbf75A09e7f4c0E57F070259f4", - "L1CrossDomainMessengerProxy": "0xc76543A64666d9a073FaEF4e75F651c88e7DBC08", - "L1ERC721BridgeProxy": "0x934Ab59Ef14b638653b1C0FEf7aB9a72186393DC", - "L1StandardBridgeProxy": "0xe07eA0436100918F157DF35D01dCE5c11b16D1F1", - "L2OutputOracleProxy": "0x5e76821C3c1AbB9fD6E310224804556C61D860e0", - "OptimismMintableERC20FactoryProxy": "0x7a69a90d8ea11E9618855da55D09E6F953730686", - "OptimismPortalProxy": "0x91493a61ab83b62943E6dCAa5475Dd330704Cc84", - "Proposer": "0x74BaD482a7f73C8286F50D8Aa03e53b7d24A5f3B", - "ProxyAdmin": "0xb570F4aD27e7De879A2E4F2F3DE27dBaBc20E9B9", - "ProxyAdminOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigProxy": "0x886B187C3D293B1449A3A0F23Ca9e2269E0f2664", - "UnsafeBlockSigner": "0xceED24B1Fd4A4393f6A9D2B137D9597dd5482569" - } - }, - { - "Name": "Shape", - "l2_chain_id": 360, - "PublicRPC": "https://mainnet.shape.network/", - "SequencerRPC": "https://shape-mainnet-sequencer.g.alchemy.com", - "Explorer": "https://shape-mainnet.explorer.alchemy.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xfF00000000000000000000000000000000000360", - "Superchain": "mainnet", - "Chain": "shape", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "granite_time": 1727370000, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x64772c7ca14e37ca9f0662b7d16b250f486218656012c0da994396608584b2b1", - "number": 20369793 - }, - "l2": { - "hash": "0xf17c665ffdebe214ec214bcd798c725141e7b5c29799500abd6a8738d15bdebe", - "number": 0 - }, - "l2_time": 1721744471, - "system_config": { - "batcherAddr": "0xF7ca543d652E38692fD12f989eb55b5327eC9A20", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xcee78437aE9e15cee9c78E63757E0153c0FD7479", - "AnchorStateRegistryProxy": "0x02987E7294379B9DDa99d593b0C94c68266222D1", - "BatchSubmitter": "0xF7ca543d652E38692fD12f989eb55b5327eC9A20", - "Challenger": "0xee1Af3f99AF8C5b93512FbE2A3f0dD5568CE087f", - "DelayedWETHProxy": "0xfEc7865DAc5139886585F03146Ff61D9b31c2d57", - "DisputeGameFactoryProxy": "0x575Aecd84083f93877291901907698F7db0Bd8b0", - "Guardian": "0xee1Af3f99AF8C5b93512FbE2A3f0dD5568CE087f", - "L1CrossDomainMessengerProxy": "0x2b18602877181C3cB72C687E2A771E123A3788E3", - "L1ERC721BridgeProxy": "0xe9d3E49b0636016c5fE9eaA2347948D0bA9f15Af", - "L1StandardBridgeProxy": "0x62Edd5f4930Ea92dCa3fB81689bDD9b9d076b57B", - "L2OutputOracleProxy": "0x6Ef8c69CfE4635d866e3E02732068022c06e724D", - "MIPS": "0xD30c2Cd3cd6112E61FDfb03e4b232564d7e5C91f", - "OptimismMintableERC20FactoryProxy": "0x319322906beAdf69dF5d4607169c63D692B1aDC1", - "OptimismPortalProxy": "0xEB06fFa16011B5628BaB98E29776361c83741dd3", - "PreimageOracle": "0xDF6a16a71d0BC7a1Bbe8FffB33700eC3d9448A5B", - "Proposer": "0x0D8a607F3d2de86adD04Df00f06794cB339A40de", - "ProxyAdmin": "0x11B190Ae661c6d6884dFEE48E215691E0DdB842e", - "ProxyAdminOwner": "0xacAF178b5048CB56712dc59E95fBA72F7990A005", - "SuperchainConfig": "0x125664BEf08177ca43f6f301E63118b1e4cCDe09", - "SystemConfigOwner": "0xee1Af3f99AF8C5b93512FbE2A3f0dD5568CE087f", - "SystemConfigProxy": "0xfF11e41D5C4F522E423Ff6C064Ff8D55AF8f7355", - "UnsafeBlockSigner": "0x9C66333c504F3A4f5593D0e9739434744cCC5B5d" - } - }, - { - "Name": "World Chain", - "l2_chain_id": 480, - "PublicRPC": "https://worldchain-mainnet.g.alchemy.com/public", - "SequencerRPC": "https://worldchain-mainnet-sequencer.g.alchemy.com", - "Explorer": "https://worldchain-mainnet.explorer.alchemy.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xff00000000000000000000000000000000000480", - "Superchain": "mainnet", - "Chain": "worldchain", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1721826000, - "granite_time": 1727780400, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x793daed4743301e00143be5533cd1dce0a741519e9e9c96588a9ad7dbb4d8db4", - "number": 20170118 - }, - "l2": { - "hash": "0x70d316d2e0973b62332ba2e9768dd7854298d7ffe77f0409ffdb8d859f2d3fa3", - "number": 0 - }, - "l2_time": 1719335639, - "system_config": { - "batcherAddr": "0xdBBE3D8c2d2b22A2611c5A94A9a12C2fCD49Eb29", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 100000000 - } - }, - "Addresses": { - "AddressManager": "0x5891090d5085679714cb0e62f74950a3c19146a8", - "AnchorStateRegistryProxy": "0x1325C4966d17038C5592fb38416AeE85EE73c0cb", - "BatchSubmitter": "0xdBBE3D8c2d2b22A2611c5A94A9a12C2fCD49Eb29", - "Challenger": "0xB2aa0C2C4fD6BFCBF699d4c787CD6Cc0dC461a9d", - "DelayedWETHProxy": "0xF9adF7c9502C5C60352C20a4d22683422DbD061F", - "DisputeGameFactoryProxy": "0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52", - "Guardian": "0xB2aa0C2C4fD6BFCBF699d4c787CD6Cc0dC461a9d", - "L1CrossDomainMessengerProxy": "0xf931a81D18B1766d15695ffc7c1920a62b7e710a", - "L1ERC721BridgeProxy": "0x1Df436AfDb2fBB40F1fE8bEd4Fc89A0D0990a8E9", - "L1StandardBridgeProxy": "0x470458C91978D2d929704489Ad730DC3E3001113", - "L2OutputOracleProxy": "0x19A6d1E9034596196295CF148509796978343c5D", - "MIPS": "0x267b2FFfA613c246Ef995390Ea0a2BaAA16a80Ba", - "OptimismMintableERC20FactoryProxy": "0x82Cb528466cF22412d89bdBE9bCF04856790dD0e", - "OptimismPortalProxy": "0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C", - "PreimageOracle": "0x3941778243E3E80a6a46D149F083825dEdc534BB", - "Proposer": "0x2307278fC8aB0005974A6DeD2FA6d1187333a223", - "ProxyAdmin": "0xd7405BE7f3e63b094Af6C7C23D5eE33Fd82F872D", - "ProxyAdminOwner": "0xA4fB12D15Eb85dc9284a7df0AdBC8B696EdbbF1d", - "SuperchainConfig": "0xa231f8be37e583f276f93dF516D88a043bfe47E3", - "SystemConfigOwner": "0xB2aa0C2C4fD6BFCBF699d4c787CD6Cc0dC461a9d", - "SystemConfigProxy": "0x6ab0777fD0e609CE58F939a7F70Fe41F5Aa6300A", - "UnsafeBlockSigner": "0x2270d6eC8E760daA317DD978cFB98C8f144B1f3A" - } - }, - { - "Name": "Binary Mainnet", - "l2_chain_id": 624, - "PublicRPC": "https://rpc.zero.thebinaryholdings.com", - "SequencerRPC": "https://sequencer.bnry.mainnet.zeeve.net", - "Explorer": "https://explorer.thebinaryholdings.com", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xFF00000000000000000000000000000000000624", - "Superchain": "mainnet", - "Chain": "tbn", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1725536344, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": "0x04E9D7e336f79Cdab911b06133D3Ca2Cd0721ce3", - "genesis": { - "l1": { - "hash": "0xdcc5838ee3dd0af995c87bec9614a09f08dd8979014876b42fd7e3ae044dd8c4", - "number": 20175246 - }, - "l2": { - "hash": "0xe222b4b07ee9c885d13ee341823c92aa449f9769ac68fb5f1e1d4e602a990a4a", - "number": 0 - }, - "l2_time": 1719397463, - "system_config": { - "batcherAddr": "0x7f9D9c1BCE1062E1077845eA39a0303429600a06", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x010000000000000000000000000000000000000000000000000c5fc500000558", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x8173904703995c6BbA59a42B8bBf8405F978758a", - "AnchorStateRegistryProxy": "0x275Abd1eB1FBaAB40Dcef5f3A588e2dF65801edc", - "BatchSubmitter": "0x7f9D9c1BCE1062E1077845eA39a0303429600a06", - "Challenger": "0x79DdF0745D14783cDC2a05624c585Ddce07F4A02", - "DelayedWETHProxy": "0x161914F701d090824c1A8a0f4e5666938f12848d", - "DisputeGameFactoryProxy": "0x0D7e0590c58e4aC9B14B3eD6163CF55223931699", - "Guardian": "0x87aab081Ac9F8ce80fb048f23280DF019036BA1d", - "L1CrossDomainMessengerProxy": "0x807d21e416434ae92c8E5bcA4d506781aFbBa380", - "L1ERC721BridgeProxy": "0x1b396e4dC6ECB0be33CF01C5a34E1a3a7D03c378", - "L1StandardBridgeProxy": "0xD1B30378CBF968E5525e8835219A5726A1e71D10", - "L2OutputOracleProxy": "0x012f4baa6e0F5Ac4dFDF47BDdd9CF68a2B17821e", - "MIPS": "0x4e66D89DDF5A9d86836ABb1d05Ff8fDb5aD32c9A", - "OptimismMintableERC20FactoryProxy": "0xa641e14B685b5E652865e14A4fBc07e51371D124", - "OptimismPortalProxy": "0x5ff88fcF8e9947f45F4cAf8FFd5231B5DdF05e0A", - "PreimageOracle": "0xB9fF3A5835144b0d2F4267A21e0c74458907c870", - "Proposer": "0x2b6cD940ABE0CAF2fd89155b99522548c00EBaB1", - "ProxyAdmin": "0x38593Cce8FaB9887Ef9760f5F6aB3d6C595143cF", - "ProxyAdminOwner": "0x48EC051349dDc7E8baBafCBfe27696ECF2A8a8B3", - "SuperchainConfig": "0x34bb53D7C525114A27F0FE2aF91bdDAd186abb12", - "SystemConfigOwner": "0x25A6E7c6f3d0fE89A656Fcf065614B74E55099fF", - "SystemConfigProxy": "0x7aC7e5989EaC278B7BbfeF560871a2026baD472c", - "UnsafeBlockSigner": "0xDbad225D1C0DaBc27f6a9d250dBb136413C0DFb4" - } - }, - { - "Name": "Lyra Chain", - "l2_chain_id": 957, - "PublicRPC": "https://rpc.lyra.finance", - "SequencerRPC": "https://rpc.lyra.finance", - "Explorer": "https://explorer.lyra.finance", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": 0, - "batch_inbox_address": "0x5f7f7f6DB967F0ef10BdA0678964DBA185d16c50", - "Superchain": "mainnet", - "Chain": "lyra", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x00b06b23108483a0b6af8ff726b5ed3f508b7986f72c12679b10d72c05839716", - "number": 18574841 - }, - "l2": { - "hash": "0x047f535b3da7ad4f96d353b5a439740b7591413daee0e2f27dd3aabb24581af2", - "number": 0 - }, - "l2_time": 1700021615, - "system_config": { - "batcherAddr": "0x14e4E97bDc195d399Ad8E7FC14451C279FE04c8e", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xC845F9C4004EB35a8bde8ad89C4760a9c0e65CAB", - "BatchSubmitter": "0x14e4E97bDc195d399Ad8E7FC14451C279FE04c8e", - "Challenger": "0x91F4be0C264FAFA1fEd75c4440910Cba2cAd98e8", - "Guardian": "0x91F4be0C264FAFA1fEd75c4440910Cba2cAd98e8", - "L1CrossDomainMessengerProxy": "0x5456f02c08e9A018E42C39b351328E5AA864174A", - "L1ERC721BridgeProxy": "0x6CC3268794c5d3E3d9d52adEfC748B59d536cb22", - "L1StandardBridgeProxy": "0x61E44dC0dae6888B5a301887732217d5725B0bFf", - "L2OutputOracleProxy": "0x1145E7848c8B64c6cab86Fd6D378733385c5C3Ba", - "OptimismMintableERC20FactoryProxy": "0x08Dea366F26C25a08C8D1C3568ad07d1e587136d", - "OptimismPortalProxy": "0x85eA9c11cf3D4786027F7FD08F4406b15777e5f8", - "Proposer": "0x03e820562ffd2e0390787caD706EaF1FF98C2608", - "ProxyAdmin": "0x35d5D43271548c984662d4879FBc8e041Bc1Ff93", - "ProxyAdminOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigProxy": "0x0e4C4CDd01ceCB01070E9Fdfe7600871e4ae996e", - "UnsafeBlockSigner": "0xB71B58FfE538628557433dbBfA08d45ee5a69B44" - } - }, - { - "Name": "Lisk", - "l2_chain_id": 1135, - "PublicRPC": "https://rpc.api.lisk.com", - "SequencerRPC": "https://rpc.api.lisk.com", - "Explorer": "https://blockscout.lisk.com", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000001135", - "Superchain": "mainnet", - "Chain": "lisk", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 20, - "eip1559Denominator": 1000, - "eip1559DenominatorCanyon": 1000 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xd580bdbd001908860f225c16ddaa08ada64471a68435694760c111253d97ffce", - "number": 19788720 - }, - "l2": { - "hash": "0x5a693d1d8ee27b8e62868d0349af430a2d2e173c8c8988e7b0c9ef91893cbf00", - "number": 0 - }, - "l2_time": 1714728791, - "system_config": { - "batcherAddr": "0xa6Ea2f3299b63c53143c993d2d5E60A69Cd6Fe24", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x2dF7057d3F25212E51aFEA8dA628668229Ea423f", - "BatchSubmitter": "0xa6Ea2f3299b63c53143c993d2d5E60A69Cd6Fe24", - "Challenger": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "DisputeGameFactoryProxy": "0x0479e6757eb4743843b309DDDF78E6bA242F38BE", - "Guardian": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "L1CrossDomainMessengerProxy": "0x31B72D76FB666844C41EdF08dF0254875Dbb7edB", - "L1ERC721BridgeProxy": "0x3A44A3b263FB631cdbf25f339e2D29497511A81f", - "L1StandardBridgeProxy": "0x2658723Bf70c7667De6B25F99fcce13A16D25d08", - "L2OutputOracleProxy": "0x113cB99283AF242Da0A0C54347667edF531Aa7d6", - "OptimismMintableERC20FactoryProxy": "0xc1dA06CC5DD5cE23bABa924463de7F762039252d", - "OptimismPortalProxy": "0x26dB93F8b8b4f7016240af62F7730979d353f9A7", - "Proposer": "0x0AbD6da1cE10D1cD6c7C9C14b905786D20f3EB23", - "ProxyAdmin": "0xeC432c4F1d0E12737f3a42a459B84848Af979b2d", - "ProxyAdminOwner": "0xECd4150ABbb1EBff13f74e42Fb43C3d78B4E0b45", - "SuperchainConfig": "0x26C7bFB430d68Bf74d2d52497836d4336b555dE7", - "SystemConfigOwner": "0xBeA2Bc852a160B8547273660E22F4F08C2fa9Bbb", - "SystemConfigProxy": "0x05f23282FFDCA8286E4738C1aF79079f3d843750", - "UnsafeBlockSigner": "0xb9DE90a90c5E441C483e754FE7341100D5fbaEcA" - } - }, - { - "Name": "Metal L2", - "l2_chain_id": 1750, - "PublicRPC": "https://rpc.metall2.com", - "SequencerRPC": "https://rpc.metall2.com", - "Explorer": "https://explorer.metall2.com", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0xc83f7D9F2D4A76E81145849381ABA02602373723", - "Superchain": "mainnet", - "Chain": "metal", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x2493565ce8472656b7c22377c8d4d8ef5d17f78392c799ca5f2429b01e2c159c", - "number": 19527340 - }, - "l2": { - "hash": "0xd31c12ffff2d563897ad9a041c0d26790d635911bdbbfa589347fa955f75281e", - "number": 0 - }, - "l2_time": 1711563515, - "system_config": { - "batcherAddr": "0xC94C243f8fb37223F3EB2f7961F7072602A51B8B", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xd4b1EC0DEc3C7F12abD3ec27B7514880ae1C3a37", - "BatchSubmitter": "0xC94C243f8fb37223F3EB2f7961F7072602A51B8B", - "Challenger": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "Guardian": "0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2", - "L1CrossDomainMessengerProxy": "0x0a47A44f1B2bb753474f8c830322554A96C9934D", - "L1ERC721BridgeProxy": "0x50D700e97967F9115e3f999bDB263d69F6704680", - "L1StandardBridgeProxy": "0x6d0f65D59b55B0FEC5d2d15365154DcADC140BF3", - "L2OutputOracleProxy": "0x3B1F7aDa0Fcc26B13515af752Dd07fB1CAc11426", - "OptimismMintableERC20FactoryProxy": "0x1aaab4E20d2e4Bb992b5BCA2125e8bd3588c8730", - "OptimismPortalProxy": "0x3F37aBdE2C6b5B2ed6F8045787Df1ED1E3753956", - "Proposer": "0xC8187d40AD440328104A52BBed2D8Efc5ab1F1F6", - "ProxyAdmin": "0x37Ff0ae34dadA1A95A4251d10ef7Caa868c7AC99", - "ProxyAdminOwner": "0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A", - "SystemConfigOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigProxy": "0x7BD909970B0EEdcF078De6Aeff23ce571663b8aA", - "UnsafeBlockSigner": "0x4a65F5da5e80DEFfEA844eAa15CE130e80605dc5" - } - }, - { - "Name": "RACE Mainnet", - "l2_chain_id": 6805, - "PublicRPC": "https://racemainnet.io", - "SequencerRPC": "https://racemainnet.io", - "Explorer": "https://racescan.io/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xFF00000000000000000000000000000000006805", - "Superchain": "mainnet", - "Chain": "race", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xb6fd41e6c3515172c36d3912046264475eaad84c2c56e99d74f4abd1a75b63c9", - "number": 20260129 - }, - "l2": { - "hash": "0xa864791943836c37b40ea688f3853f2198afb683a3e168d48bfa76c9896e3e65", - "number": 0 - }, - "l2_time": 1720421591, - "system_config": { - "batcherAddr": "0x8CDa8351236199AF7532baD53D683Ddd9B275d89", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x3d2BdE87466Cae97011702D2C305fd40EEBbbF0a", - "BatchSubmitter": "0x8CDa8351236199AF7532baD53D683Ddd9B275d89", - "Challenger": "0x2E7B9465B25C081c07274A31DbD05C6146f67961", - "Guardian": "0x2E7B9465B25C081c07274A31DbD05C6146f67961", - "L1CrossDomainMessengerProxy": "0xf54B2BAEF894cfF5511A5722Acaac0409F2F2d89", - "L1ERC721BridgeProxy": "0x0f33D824d74180598311b3025095727BeA61f219", - "L1StandardBridgeProxy": "0x680969A6c58183987c8126ca4DE6b59C6540Cd2a", - "L2OutputOracleProxy": "0x8bF8442d49d52377d735a90F19657a29f29aA83c", - "OptimismMintableERC20FactoryProxy": "0x1d1c4C89AD5FF486c3C67E3DD84A22CF05420711", - "OptimismPortalProxy": "0x0485Ca8A73682B3D3f5ae98cdca1E5b512E728e9", - "Proposer": "0x88D58BFbCD70c25409b67117fC1CDfeFDA113a78", - "ProxyAdmin": "0x9B3C6D1d33F1fd82Ebb8dFbE38dA162B329De191", - "ProxyAdminOwner": "0x5A669B2193718F189b0576c0cdcedfEd6f40F9Ea", - "SuperchainConfig": "0xCB73B7348705a9F925643150Eb00350719380FF8", - "SystemConfigOwner": "0xBac1ad52745162c0aA3711fe88Df1Cc67034a3B9", - "SystemConfigProxy": "0xCf6A32dB8b3313b3d439CE6909511c2c3415fa32", - "UnsafeBlockSigner": "0x9b5639D472D6764b70F5046Ac0B13438718398E0" - } - }, - { - "Name": "Cyber Mainnet", - "l2_chain_id": 7560, - "PublicRPC": "https://rpc.cyber.co", - "SequencerRPC": "https://cyber.alt.technology/", - "Explorer": "https://cyberscan.co/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xfF00000000000000000000000000000000001d88", - "Superchain": "mainnet", - "Chain": "cyber", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "alt_da": { - "da_challenge_contract_address": "0x10E34EfE14E4D270C0f77Bf1aF01b6C832161B49", - "da_challenge_window": 3600, - "da_resolve_window": 3600, - "da_commitment_type": "KeccakCommitment" - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x8fa2a34b37420b863aa33da7661a8929af8bd7a436b9e612c727eb5e63da3879", - "number": 19681125 - }, - "l2": { - "hash": "0x0bbf36c47db3b42b40b2e6cadc183612337d1ac8602eb9e57071ae0043e70fc7", - "number": 0 - }, - "l2_time": 1713428567, - "system_config": { - "batcherAddr": "0xf0748C52EDC23135d9845CDFB91279Cf61ee14b4", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000b4", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x19b5804B88F10262A55ac731f28A3BbC4209853a", - "BatchSubmitter": "0xf0748C52EDC23135d9845CDFB91279Cf61ee14b4", - "Challenger": "0x87bD2cFf3b59d615b1Eac7A7f809B5e5f0Ee6752", - "DAChallengeAddress": "0x10E34EfE14E4D270C0f77Bf1aF01b6C832161B49", - "DelayedWETHProxy": "0x588dAd44201885ff23068f1142e303D52d103919", - "DisputeGameFactoryProxy": "0xbF4676f21a7889E0Fd61BcDc9b98E60b01C1B36F", - "Guardian": "0x0C883f622b4ccbF1e8ce86217998f87e6d36BCE4", - "L1CrossDomainMessengerProxy": "0x3c01ebF22e9c111528c1E027D68944eDaB08Dfc9", - "L1ERC721BridgeProxy": "0x4F4B716627D2Ba0439327Ce8B563b4443aF47Dbd", - "L1StandardBridgeProxy": "0x12a580c05466eefb2c467C6b115844cDaF55B255", - "L2OutputOracleProxy": "0xa669A743b065828682eE16109273F5CFeF5e676d", - "MIPS": "0x0048defcA9F0Da952CFD1Ae9F8e962937d3E4143", - "OptimismMintableERC20FactoryProxy": "0x51A00470Eb50D758EcFF3B96DB0bF4A8e86268F4", - "OptimismPortalProxy": "0x1d59bc9fcE6B8E2B1bf86D4777289FFd83D24C99", - "PreimageOracle": "0x0747ef2570e3dbF65F0a12B371F19ca4a66a8DdE", - "Proposer": "0xF2987f0A626c8D29dFB2E0A21144ca3026d6F1E1", - "ProxyAdmin": "0x7E54107731EC43e78DA678DFa5fB6222Ad036e03", - "ProxyAdminOwner": "0xc2259E7Fb719411f97aBdCdf449f6Ba3B9D75398", - "SuperchainConfig": "0x1aeC4c3BE47C30d0BEfa7514Cf9D99EaC596959D", - "SystemConfigOwner": "0xc76C563185d01284AdbC9cF5bb909162dD2F15e7", - "SystemConfigProxy": "0x5D1F4bbaF6D484fA9D5D9705f92dE6063bff6055", - "UnsafeBlockSigner": "0xa7A4D6d5920b93D0FE590f9524Ef17f24EE1F5B8" - } - }, - { - "Name": "Base", - "l2_chain_id": 8453, - "PublicRPC": "https://mainnet.base.org", - "SequencerRPC": "https://mainnet-sequencer.base.org", - "Explorer": "https://explorer.base.org", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0xFf00000000000000000000000000000000008453", - "Superchain": "mainnet", - "Chain": "base", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771", - "number": 17481768 - }, - "l2": { - "hash": "0xf712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd", - "number": 0 - }, - "l2_time": 1686789347, - "system_config": { - "batcherAddr": "0x5050F69a9786F081509234F1a7F4684b5E5b76C9", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x8EfB6B5c4767B09Dc9AA6Af4eAA89F749522BaE2", - "AnchorStateRegistryProxy": "0xdB9091e48B1C42992A1213e6916184f9eBDbfEDf", - "BatchSubmitter": "0x5050F69a9786F081509234F1a7F4684b5E5b76C9", - "Challenger": "0x6F8C5bA3F59ea3E76300E3BEcDC231D656017824", - "DelayedWETHProxy": "0xa2f2aC6F5aF72e494A227d79Db20473Cf7A1FFE8", - "DisputeGameFactoryProxy": "0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e", - "FaultDisputeGame": "0xCd3c0194db74C23807D4B90A5181e1B28cF7007C", - "Guardian": "0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2", - "L1CrossDomainMessengerProxy": "0x866E82a600A1414e583f7F13623F1aC5d58b0Afa", - "L1ERC721BridgeProxy": "0x608d94945A64503E642E6370Ec598e519a2C1E53", - "L1StandardBridgeProxy": "0x3154Cf16ccdb4C6d922629664174b904d80F2C35", - "L2OutputOracleProxy": "0x56315b90c40730925ec5485cf004d835058518A0", - "MIPS": "0x16e83cE5Ce29BF90AD9Da06D2fE6a15d5f344ce4", - "OptimismMintableERC20FactoryProxy": "0x05cc379EBD9B30BbA19C6fA282AB29218EC61D84", - "OptimismPortalProxy": "0x49048044D57e1C92A77f79988d21Fa8fAF74E97e", - "PermissionedDisputeGame": "0x19009dEBF8954B610f207D5925EEDe827805986e", - "PreimageOracle": "0x9c065e11870B891D214Bc2Da7EF1f9DDFA1BE277", - "Proposer": "0x642229f238fb9dE03374Be34B0eD8D9De80752c5", - "ProxyAdmin": "0x0475cBCAebd9CE8AfA5025828d5b98DFb67E059E", - "ProxyAdminOwner": "0x7bB41C3008B3f03FE483B28b8DB90e19Cf07595c", - "SystemConfigOwner": "0x14536667Cd30e52C0b458BaACcB9faDA7046E056", - "SystemConfigProxy": "0x73a79Fab69143498Ed3712e519A88a918e1f4072", - "UnsafeBlockSigner": "0xAf6E19BE0F9cE7f8afd49a1824851023A8249e8a" - } - }, - { - "Name": "Funki", - "l2_chain_id": 33979, - "PublicRPC": "https://rpc-mainnet.funkichain.com", - "SequencerRPC": "https://rpc-mainnet.funkichain.com", - "Explorer": "https://funki.superscan.network", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xfF00000000000000000000000000000084BB84Bb", - "Superchain": "mainnet", - "Chain": "funki", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "block_time": 2, - "seq_window_size": 8400, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "alt_da": { - "da_challenge_contract_address": "0xF40b807c2407e1d7dabb85f3ceefd5EACc7bF3CD", - "da_challenge_window": 3600, - "da_resolve_window": 3600, - "da_commitment_type": "KeccakCommitment" - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xa0768467271297b618c4306469577fd14ba5b0c0488d6e9710a24762cbfe2928", - "number": 20325568 - }, - "l2": { - "hash": "0x7d2831dd811c616d073342a3074f2ce737c6b200b8192f9528e8bf32b1fac83e", - "number": 0 - }, - "l2_time": 1721211095, - "system_config": { - "batcherAddr": "0x73c98Cf34AF1f7D798e8e6f34b16037530Bffc41", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x0100000000000000000000000000000000000000000000000000000000003138", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x5a4ebF927338EA6af377caEee99C85088908f57D", - "AnchorStateRegistryProxy": "0x48eB5A81CC3a8955d0DabD6eEd45ac09C7c1889f", - "BatchSubmitter": "0x73c98Cf34AF1f7D798e8e6f34b16037530Bffc41", - "Challenger": "0x9f8b2470ffECbca2FFda20B9e10f6a12F33BC2Ce", - "DAChallengeAddress": "0xF40b807c2407e1d7dabb85f3ceefd5EACc7bF3CD", - "DelayedWETHProxy": "0x7992352f723d1209CDd9B786dEF1fBd8DC6511DB", - "DisputeGameFactoryProxy": "0x2Dc9d2Cb1Ba0b8A46AE252ab4FBE1ad5C5c3B795", - "Guardian": "0x052a8cd5967bc3Bdb5660c989a3A68bCA683A077", - "L1CrossDomainMessengerProxy": "0x8F56a665c376A08b604DD32ee6E88667A6093172", - "L1ERC721BridgeProxy": "0x94519dD4BA8ba20Aaad14f7C6cD00fa1bB0192E9", - "L1StandardBridgeProxy": "0xA2C1C1A473250094a6244F2bcf6Cb51F670Ad3aC", - "L2OutputOracleProxy": "0x1A9aE6486caEc0504657351ac473B3dF8A1367cb", - "MIPS": "0x29564D1B96A1308E6930F88665576763Ed4837E2", - "OptimismMintableERC20FactoryProxy": "0x87e75DcC1BB4e5B42cB5c52eB5832d6eCC3bFeF4", - "OptimismPortalProxy": "0x5C9C7f98eD153a2deAA981eB5C97B31744AccF22", - "PreimageOracle": "0xd8f66eFeC53CeA76C597827ba5Bf3F68D29f2fA8", - "Proposer": "0x7a7690bBAb496537Ac59B45B4c59d789233BcA16", - "ProxyAdmin": "0xD069C4724f9bC15FA53b3b2516594512AEf8c957", - "ProxyAdminOwner": "0x89CB6669f87c165E7128F4a57476EE4Daa7ffbCD", - "SuperchainConfig": "0xD3B2Ee457Cf8F05f00c17BFe509b43BA04c9e5a2", - "SystemConfigOwner": "0xc0CE2761d5cC92d25dB6ccD95e4b9483eD22D11B", - "SystemConfigProxy": "0xD39a6CcCFa23cb741bB530497e42EC337f1215a8", - "UnsafeBlockSigner": "0x843458b6De651E02dFD5bFFea0e9cfb3eca293EF" - } - }, - { - "Name": "Mode", - "l2_chain_id": 34443, - "PublicRPC": "https://mainnet.mode.network", - "SequencerRPC": "https://mainnet-sequencer.mode.network", - "Explorer": "https://explorer.mode.network", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0x24E59d9d3Bd73ccC28Dc54062AF7EF7bFF58Bd67", - "Superchain": "mainnet", - "Chain": "mode", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xf9b1b22a7ef9d13f063ea467bcb70fb6e9f29698ecb7366a2cdf5af2165cacee", - "number": 18586927 - }, - "l2": { - "hash": "0xb0f682e12fc555fd5ce8fce51a59a67d66a5b46be28611a168260a549dac8a9b", - "number": 0 - }, - "l2_time": 1700167583, - "system_config": { - "batcherAddr": "0x99199a22125034c808ff20f377d91187E8050F2E", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x50eF494573f28Cad6B64C31b7a00Cdaa48306e15", - "BatchSubmitter": "0x99199a22125034c808ff20f377d91187E8050F2E", - "Challenger": "0x309Fe2536d01867018D120b40e4676723C53A14C", - "Guardian": "0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2", - "L1CrossDomainMessengerProxy": "0x95bDCA6c8EdEB69C98Bd5bd17660BaCef1298A6f", - "L1ERC721BridgeProxy": "0x2901dA832a4D0297FF0691100A8E496626cc626D", - "L1StandardBridgeProxy": "0x735aDBbE72226BD52e818E7181953f42E3b0FF21", - "L2OutputOracleProxy": "0x4317ba146D4933D889518a3e5E11Fe7a53199b04", - "OptimismMintableERC20FactoryProxy": "0x69216395A62dFb243C05EF4F1C27AF8655096a95", - "OptimismPortalProxy": "0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07", - "Proposer": "0x674F64D64Ddc198db83cd9047dF54BF89cCD0ddB", - "ProxyAdmin": "0x470d87b1dae09a454A43D1fD772A561a03276aB7", - "ProxyAdminOwner": "0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A", - "SystemConfigOwner": "0x4a4962275DF8C60a80d3a25faEc5AA7De116A746", - "SystemConfigProxy": "0x5e6432F18Bc5d497B1Ab2288a025Fbf9D69E2221", - "UnsafeBlockSigner": "0xa7fA9CA4ac88686A542C0f830d7378eAB4A0278F" - } - }, - { - "Name": "Automata Mainnet", - "l2_chain_id": 65536, - "PublicRPC": "https://rpc.ata.network", - "SequencerRPC": "https://automata-mainnet.alt.technology/", - "Explorer": "https://explorer.ata.network", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xff00000000000000000000000000000001111111", - "Superchain": "mainnet", - "Chain": "automata", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "block_time": 2, - "seq_window_size": 7200, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "alt_da": { - "da_challenge_contract_address": "0x08c5DCDD5e46d31CC1591ee15b084663507597f3", - "da_challenge_window": 3600, - "da_resolve_window": 3600, - "da_commitment_type": "KeccakCommitment" - }, - "GasPayingToken": "0xA2120b9e674d3fC3875f415A7DF52e382F141225", - "genesis": { - "l1": { - "hash": "0x2f2ea5358078fdc01d978ff85a3a8fb2efff470b624ba95c5eef0ecd75a6e81d", - "number": 20323239 - }, - "l2": { - "hash": "0x11bb44203634fd85571a9971e6f09d633cbf22826681f809283081ff4e1b5192", - "number": 0 - }, - "l2_time": 1721183063, - "system_config": { - "batcherAddr": "0x5BEF09f138921eF7985d83AAB97da1dB6E4dd190", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x0100000000000000000000000000000000000000000000000000000000013880", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xF1C911e0c1E6dd08c8a7C80c9890e2037e0504c6", - "AnchorStateRegistryProxy": "0x4dAA22Ec75406E8ea2c70610115850912A770A3a", - "BatchSubmitter": "0x5BEF09f138921eF7985d83AAB97da1dB6E4dd190", - "Challenger": "0x34Faa77b4D1686E399c96deF0de31D30572eaa9F", - "DAChallengeAddress": "0x08c5DCDD5e46d31CC1591ee15b084663507597f3", - "DelayedWETHProxy": "0xd015f61F3CB26560507D758a726c77d18Bf849bB", - "DisputeGameFactoryProxy": "0xB52337F38747D6931f2976eEa24A3f3F6B7CDEA2", - "Guardian": "0xa5822fb7E3Fb516E518e2629E6786e93858e41F4", - "L1CrossDomainMessengerProxy": "0x825C858149F1E775a0f4Aeb172037B970bE7B736", - "L1ERC721BridgeProxy": "0x00bd00c5C7F60e222D9CB8040270Ba929241A280", - "L1StandardBridgeProxy": "0xE639919b92AB6DD238aEACc6F2A8d6e355D17bd5", - "L2OutputOracleProxy": "0xdbf381984c4515Fe3285D3C55fDfb3054C52c261", - "MIPS": "0x2B0293A059a2715935fA9459C9F3a4dcE2BC6331", - "OptimismMintableERC20FactoryProxy": "0xa74b7baF04867E62B7824268e96144E503A23666", - "OptimismPortalProxy": "0xD52ba64CBE1e3B44167f810622fBef36bE24d95c", - "PreimageOracle": "0x4a7bd533Be022E7a2911c3C61e7E11e7a32Ee77d", - "Proposer": "0x8c6F6580C846634C5DA08c40AE308DE23006a679", - "ProxyAdmin": "0x7617f4a55d62b9EE49578D9C90593e58E607415F", - "ProxyAdminOwner": "0x03eC1C43434E2f910A2fb984906cd2470fdb39c8", - "SuperchainConfig": "0xDf87154Ed6cF332931b70014bA3d9dF423074FfF", - "SystemConfigOwner": "0x49eC5Bd8C9cC35Ce26b87E534d2E36980621dDD2", - "SystemConfigProxy": "0x72934D7AEDC1A2d889ca89Aaf064CD9455E64d00", - "UnsafeBlockSigner": "0xA940a669DAe672111FD02Df597Cf7De7Cf758fAD" - } - }, - { - "Name": "Zora", - "l2_chain_id": 7777777, - "PublicRPC": "https://rpc.zora.energy", - "SequencerRPC": "https://rpc.zora.energy", - "Explorer": "https://explorer.zora.energy", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0x6F54Ca6F6EdE96662024Ffd61BFd18f3f4e34DFf", - "Superchain": "mainnet", - "Chain": "zora", - "canyon_time": 1704992401, - "delta_time": 1708560000, - "ecotone_time": 1710374401, - "fjord_time": 1720627201, - "granite_time": 1726070401, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xbdbd2847f7aa5f7cd1bd4c9f904057f4ba0b498c7e380199c01d240e3a41a84f", - "number": 17473923 - }, - "l2": { - "hash": "0x47555a45a1af8d4728ca337a1e48375a83919b1ea16591e070a07388b7364e29", - "number": 0 - }, - "l2_time": 1686693839, - "system_config": { - "batcherAddr": "0x625726c858dBF78c0125436C943Bf4b4bE9d9033", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xEF8115F2733fb2033a7c756402Fc1deaa56550Ef", - "BatchSubmitter": "0x625726c858dBF78c0125436C943Bf4b4bE9d9033", - "Challenger": "0xcA4571b1ecBeC86Ea2E660d242c1c29FcB55Dc72", - "Guardian": "0x09f7150D8c019BeF34450d6920f6B3608ceFdAf2", - "L1CrossDomainMessengerProxy": "0xdC40a14d9abd6F410226f1E6de71aE03441ca506", - "L1ERC721BridgeProxy": "0x83A4521A3573Ca87f3a971B169C5A0E1d34481c3", - "L1StandardBridgeProxy": "0x3e2Ea9B92B7E48A52296fD261dc26fd995284631", - "L2OutputOracleProxy": "0x9E6204F750cD866b299594e2aC9eA824E2e5f95c", - "OptimismMintableERC20FactoryProxy": "0xc52BC7344e24e39dF1bf026fe05C4e6E23CfBcFf", - "OptimismPortalProxy": "0x1a0ad011913A150f69f6A19DF447A0CfD9551054", - "Proposer": "0x48247032092e7b0ecf5dEF611ad89eaf3fC888Dd", - "ProxyAdmin": "0xD4ef175B9e72cAEe9f1fe7660a6Ec19009903b49", - "ProxyAdminOwner": "0x5a0Aae59D09fccBdDb6C6CcEB07B7279367C3d2A", - "SystemConfigOwner": "0xC72aE5c7cc9a332699305E29F68Be66c73b60542", - "SystemConfigProxy": "0xA3cAB0126d5F504B071b81a3e8A2BBBF17930d86", - "UnsafeBlockSigner": "0x3Dc8Dfd0709C835cAd15a6A27e089FF4cF4C9228" - } - } - ] - }, - { - "name": "sepolia", - "config": { - "Name": "Sepolia", - "L1": { - "ChainID": 11155111, - "PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com", - "Explorer": "https://sepolia.etherscan.io" - }, - "ProtocolVersionsAddr": "0x79ADD5713B383DAa0a138d3C4780C7A1804a8090", - "SuperchainConfigAddr": "0xC2Be75506d5724086DEB7245bd260Cc9753911Be", - "OPContractsManagerProxyAddr": "0xF564eEA7960EA244bfEbCBbB17858748606147bf" - }, - "chains": [ - { - "Name": "Ethernity Testnet", - "l2_chain_id": 233, - "PublicRPC": "https://testnet.ethernitychain.io", - "SequencerRPC": "https://testnet.ethernitychain.io", - "Explorer": "https://testnet.ernscan.io", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000000233", - "Superchain": "sepolia", - "Chain": "ethernity", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "granite_time": 1723478400, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x2d9c0b883cfc901f509bd94953c283c477adc57c8a20e234029244e68f00142a", - "number": 6037466 - }, - "l2": { - "hash": "0x4715665848c513c54d71a3e60700743f2b37ec21df9b9d0b8eefee4c30cd557a", - "number": 0 - }, - "l2_time": 1717499232, - "system_config": { - "batcherAddr": "0x973A9E30D6D11355A459A69E7CbFBa61C7627736", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x2d34a143D7BeAD8F75479C841e3AAbF6c4AFdeC8", - "AnchorStateRegistryProxy": "0xB065B32927C3114c0e0Df16d3887F4Fd12eF7117", - "BatchSubmitter": "0x973A9E30D6D11355A459A69E7CbFBa61C7627736", - "Challenger": "0x097955A7aa7966d55D781688Aa1493493AB513Af", - "DelayedWETHProxy": "0x21676D682F11f3e46cCe1797B19205Dda78f0f6C", - "DisputeGameFactoryProxy": "0x64d0Bce6eD7c16CAC7817F3597758E31AFacD01B", - "Guardian": "0x097955A7aa7966d55D781688Aa1493493AB513Af", - "L1CrossDomainMessengerProxy": "0x1c8b6a6F3E3612c79E62460a6e44C24D1EfF2FDa", - "L1ERC721BridgeProxy": "0xBf0D43e12eF74dC21917e1D6175702AD673e1283", - "L1StandardBridgeProxy": "0xFd1a12b7a04B13c031d8b075BA5b9080a2CF246f", - "L2OutputOracleProxy": "0x11118536F94Bc7C98bBaf9194bE13FC1987293cd", - "MIPS": "0xfed5EDD40bfbEFC99432BBb4F2cEcd450c4c8675", - "OptimismMintableERC20FactoryProxy": "0x0D085b528E1F9F48018b46f9aC3696f16B7007F9", - "OptimismPortalProxy": "0x1F24d471Ef7291c7F97DBD2f76299b30D3e3B6E3", - "PreimageOracle": "0x4abd4d6D11c5D7cE392b2b0544E37314710F53c2", - "Proposer": "0xBf1374D8c2E98074368326786343f1aDE19d5ccD", - "ProxyAdmin": "0x7eA23A9Df2E3E491757a9FF6c32083a44BE560e6", - "ProxyAdminOwner": "0x5a19d3Afd327Bd01D390eb52c11C2A9a79BcFB32", - "SuperchainConfig": "0x62e4d37aB459A65298DBedF17d35Bf0f958A97Bd", - "SystemConfigOwner": "0x097955A7aa7966d55D781688Aa1493493AB513Af", - "SystemConfigProxy": "0x7C957fec1F6B3d1024442E989cB08b8f2285686C", - "UnsafeBlockSigner": "0xdb0C6821a033eb9Dc152bB008f42ebad0EAdDcA3" - } - }, - { - "Name": "Binary Sepolia", - "l2_chain_id": 625, - "PublicRPC": "https://rpc.testnet.thebinaryholdings.com", - "SequencerRPC": "https://sequencer.rpc.bnry.testnet.zeeve.net", - "Explorer": "https://explorer.sepolia.thebinaryholdings.com", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000042069", - "Superchain": "sepolia", - "Chain": "tbn", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1723204838, - "granite_time": 1723545055, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": "0x46d878bf7BF62Ec542953CB89Ac0bF58d991181e", - "genesis": { - "l1": { - "hash": "0x8d457519705ad17cf812d7cd4cfe5726eca8249f9e5f40a1d19992b07c2521ce", - "number": 6092340 - }, - "l2": { - "hash": "0xf1c38d92222758e1ea0c9c7ae1f7f2dfd0e3e747609f1c2d5a41ecfc5e84aba9", - "number": 0 - }, - "l2_time": 1718195040, - "system_config": { - "batcherAddr": "0x9CF89F8cB7cC94C579426f967d9517cd2e9adf29", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x010000000000000000000000000000000000000000000000000c5fc500000558", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xd1d82d6FC94962fe25912C181375352D4A10c6f0", - "AnchorStateRegistryProxy": "0xb86eC23019C6c3f2FbC38502D26b7009d2A300Be", - "BatchSubmitter": "0x9CF89F8cB7cC94C579426f967d9517cd2e9adf29", - "Challenger": "0xD7E60cd8fBeA5142a207042c477e1359Df5FA688", - "DelayedWETHProxy": "0x017e8A21e37AE4bFC482170656B1eBF8390BF880", - "DisputeGameFactoryProxy": "0x096b38bDC80B5BF5B5Fb4e1A75Ae38BDa520474A", - "Guardian": "0xD7E60cd8fBeA5142a207042c477e1359Df5FA688", - "L1CrossDomainMessengerProxy": "0x33Dc556A5df0B8998dC2640c78E531Ae1dB7925d", - "L1ERC721BridgeProxy": "0x7c95EebEA6f68875b4093D9c2211Fd26067a808F", - "L1StandardBridgeProxy": "0x3B78C3B41b3e3fC6bdf0bD3060C9E2471401C098", - "L2OutputOracleProxy": "0xF3699f96cBdD3868B64352669805D96d1Fb6431d", - "MIPS": "0xb51FFE0a519291Cbc0080A4F497A2bb4ac0A1C04", - "OptimismMintableERC20FactoryProxy": "0xD47e937d602FFba8597b4F042c7A49E1149392fC", - "OptimismPortalProxy": "0xFBEd910ca54F013bfeA67Bd4DC836263bdd0b46C", - "PreimageOracle": "0x029E58272e3B5f7B69AA4455473FcC8C8B8DEAC3", - "Proposer": "0x6087Ec0371C2950d018ec97D8A1573d412DFbDBE", - "ProxyAdmin": "0xF42CfF60b92a151911D99F3Ed36ba1266511fd43", - "ProxyAdminOwner": "0x5A11a7a6ca68819C601A4136BFbDFBa26D5f043e", - "SuperchainConfig": "0x981A2D45d870BD5E6B011907650fE86b89DCaBc3", - "SystemConfigOwner": "0xD7E60cd8fBeA5142a207042c477e1359Df5FA688", - "SystemConfigProxy": "0x1a6D0312FaaaCa2BF818660F164450176C6205C9", - "UnsafeBlockSigner": "0x0F68fC933D50f719aBfBD680f56C22277e2f307c" - } - }, - { - "Name": "Mode Testnet", - "l2_chain_id": 919, - "PublicRPC": "https://sepolia.mode.network", - "SequencerRPC": "https://sepolia.mode.network", - "Explorer": "https://sepolia.explorer.mode.network", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 1703203200, - "batch_inbox_address": "0xcDDaE6148dA1E003C230E4527f9baEdc8a204e7E", - "Superchain": "sepolia", - "Chain": "mode", - "canyon_time": 1703203200, - "delta_time": 1703203200, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "holocene_time": 1732633200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x4370cafe528a1b8f2aaffc578094731daf69ff82fd9edc30d2d842d3763f3410", - "number": 3778382 - }, - "l2": { - "hash": "0x13c352562289a88ed33087a51b6b6c859a27709c8555c9def7cb9757c043acad", - "number": 0 - }, - "l2_time": 1687867932, - "system_config": { - "batcherAddr": "0x4e6BD53883107B063c502dDd49F9600Dc51b3DDc", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x83D45725d6562d8CD717673D6bb4c67C07dC1905", - "BatchSubmitter": "0x4e6BD53883107B063c502dDd49F9600Dc51b3DDc", - "Challenger": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0xc19a60d9E8C27B9A43527c3283B4dd8eDC8bE15C", - "L1ERC721BridgeProxy": "0x015a8c2e0a5fEd579dbb05fd290e413Adc6FC24A", - "L1StandardBridgeProxy": "0xbC5C679879B2965296756CD959C3C739769995E2", - "L2OutputOracleProxy": "0x2634BD65ba27AB63811c74A63118ACb312701Bfa", - "OptimismMintableERC20FactoryProxy": "0x00F7ab8c72D32f55cFf15e8901C2F9f2BF29A3C0", - "OptimismPortalProxy": "0x320e1580effF37E008F1C92700d1eBa47c1B23fD", - "Proposer": "0xe9e08A478e3a773c1B5D59014A0FDb901e6d1d69", - "ProxyAdmin": "0xE7413127F29E050Df65ac3FC9335F85bB10091AE", - "ProxyAdminOwner": "0x1Eb2fFc903729a0F03966B917003800b145F56E2", - "SystemConfigOwner": "0x23BA22Dd7923F3a3f2495bB32a6f3c9b9CD1EC6C", - "SystemConfigProxy": "0x15cd4f6e0CE3B4832B33cB9c6f6Fe6fc246754c2", - "UnsafeBlockSigner": "0x93A14E6894eEB4FF6a373E1Ad4f498c3a207afe4" - } - }, - { - "Name": "Unichain Sepolia Testnet", - "l2_chain_id": 1301, - "PublicRPC": "https://sepolia.unichain.org", - "SequencerRPC": "https://sepolia-sequencer.unichain.org", - "Explorer": "https://sepolia.uniscan.xyz", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000001301", - "Superchain": "sepolia", - "Chain": "unichain", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 0, - "granite_time": 0, - "block_time": 1, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x81719966c43c08d616a832331500633db68006f5e8c0b575a6faf1704ad350c0", - "number": 6728364 - }, - "l2": { - "hash": "0xb7fe0bc9f98ca03294ca0094ff9374cc3e64130b6ec85850d6e260191f48bfe7", - "number": 0 - }, - "l2_time": 1726852428, - "system_config": { - "batcherAddr": "0x4AB3387810eF500bfe05a49dc53A44C222cbab3e", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x010000000000000000000000000000000000000000000000000dbba0000007d0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0xEf1295ED471DFEC101691b946fb6B4654E88f98A", - "AnchorStateRegistryProxy": "0xf971F1b0D80eb769577135b490b913825BfcF00B", - "BatchSubmitter": "0x4AB3387810eF500bfe05a49dc53A44C222cbab3e", - "Challenger": "0x921D59f383E9B86b3161a356013b6F8b40CF43C4", - "DisputeGameFactoryProxy": "0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b", - "Guardian": "0xD032D9E1F3b3ca6362EC56FbC9d689565F759825", - "L1CrossDomainMessengerProxy": "0x448A37330A60494E666F6DD60aD48d930AEbA381", - "L1ERC721BridgeProxy": "0x4696b5e042755103fe558738Bcd1ecEe7A45eBfe", - "L1StandardBridgeProxy": "0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2", - "MIPS": "0x1cEc5b1954302F6FAf45515145C72d7f7266546c", - "OptimismMintableERC20FactoryProxy": "0xDf7977C3005730329A160637E8CB9f1675A4d9Be", - "OptimismPortalProxy": "0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD", - "PermissionedDisputeGame": "0x2A82958845ddc647cE1D45F44a7038d6A2D363Ac", - "PreimageOracle": "0xAd0a6f4F1503048C34D90dF845c37c876407355a", - "Proposer": "0xA25B0eF1CC3ee12a0a167B5BF44dB1a9c166474e", - "ProxyAdmin": "0x2BF403E5353A7a082ef6bb3Ae2Be3B866D8D3ea4", - "ProxyAdminOwner": "0xd363339eE47775888Df411A163c586a8BdEA9dbf", - "SuperchainConfig": "0xe7e23eBa32A6FD2aC79dd5EC72FE7f6217b41BDC", - "SystemConfigOwner": "0xB6185370E3db2472EC7Ec4A2826954D2d4923B9f", - "SystemConfigProxy": "0xaeE94b9aB7752D3F7704bDE212c0C6A0b701571D", - "UnsafeBlockSigner": "0x565B71025Ab4de80AcA33c62E51439af56301493" - } - }, - { - "Name": "Metal L2 Testnet", - "l2_chain_id": 1740, - "PublicRPC": "https://testnet.rpc.metall2.com", - "SequencerRPC": "https://testnet.rpc.metall2.com", - "Explorer": "https://testnet.explorer.metall2.com", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 1708534800, - "batch_inbox_address": "0x24567B64a86A4c966655fba6502a93dFb701E316", - "Superchain": "sepolia", - "Chain": "metal", - "canyon_time": 1708129622, - "delta_time": 1708385400, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "holocene_time": 1732633200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x6a10927c70985f75898c48235b620acb2a48e9c777a40022f9dbad1b0c96a9c1", - "number": 5304030 - }, - "l2": { - "hash": "0xd24cf8e46b189b0c128dab4e46168520e3a4cdd390b239e8cc1e5abd22a629ae", - "number": 0 - }, - "l2_time": 1708129620, - "system_config": { - "batcherAddr": "0xdb80Eca386AC72a55510e33CF9CF7533e75916eE", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x394f844B9A0FC876935d1b0b791D9e94Ad905e8b", - "BatchSubmitter": "0xdb80Eca386AC72a55510e33CF9CF7533e75916eE", - "Challenger": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0x5D335Aa7d93102110879e3B54985c5F08146091E", - "L1ERC721BridgeProxy": "0x5d6cE6917dBeeacF010c96BfFdaBE89e33a30309", - "L1StandardBridgeProxy": "0x21530aAdF4DCFb9c477171400E40d4ef615868BE", - "L2OutputOracleProxy": "0x75a6B961c8da942Ee03CA641B09C322549f6FA98", - "OptimismMintableERC20FactoryProxy": "0x49Ff2C4be882298e8CA7DeCD195c207c42B45F66", - "OptimismPortalProxy": "0x01D4dfC994878682811b2980653D03E589f093cB", - "ProxyAdmin": "0xF7Bc4b3a78C7Dd8bE9B69B3128EEB0D6776Ce18A", - "ProxyAdminOwner": "0x1Eb2fFc903729a0F03966B917003800b145F56E2", - "SystemConfigOwner": "0x23BA22Dd7923F3a3f2495bB32a6f3c9b9CD1EC6C", - "SystemConfigProxy": "0x5D63A8Dc2737cE771aa4a6510D063b6Ba2c4f6F2" - } - }, - { - "Name": "Minato", - "l2_chain_id": 1946, - "PublicRPC": "https://rpc.minato.soneium.org", - "SequencerRPC": "https://rpc.minato.soneium.org", - "Explorer": "https://soneium-minato.blockscout.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0x00Ca81E019a5312d404aE7fe8367D30DE4c11365", - "Superchain": "sepolia", - "Chain": "minato", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1730106000, - "granite_time": 1730106000, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x87e648e8d219737526cbcbc03dc914256d4f8e13ae13dc0a2ad377d831cd6473", - "number": 6465975 - }, - "l2": { - "hash": "0x7ec49d93fa8f47c00e98cc5965cd3903a8faa9238743d2eba0e0550ab4c45c43", - "number": 0 - }, - "l2_time": 1723194336, - "system_config": { - "batcherAddr": "0xF0AB0441c8f4B89b561aE685B98c6aD5175e0CAB", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000000", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x6e8A77673109783001150DFA770E6c662f473DA9", - "AnchorStateRegistryProxy": "0xa4AbebA1612Cf731843460791e1A925c84d0991C", - "BatchSubmitter": "0xF0AB0441c8f4B89b561aE685B98c6aD5175e0CAB", - "Challenger": "0xB278818732E5BEbb742dc4Aa0617ccd1Dec76b65", - "DisputeGameFactoryProxy": "0xB3Ad2c38E6e0640d7ce6aA952AB3A60E81bf7a01", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0x0184245D202724dc28a2b688952Cb56C882c226F", - "L1ERC721BridgeProxy": "0x2bfb22cd534a462028771a1cA9D6240166e450c4", - "L1StandardBridgeProxy": "0x5f5a404A5edabcDD80DB05E8e54A78c9EBF000C2", - "L2OutputOracleProxy": "0x710e5286C746eC38beeB7538d0146f60D27be343", - "MIPS": "0x4e3Db3fa21566FF2AD6E11D1ADC129ECf649e47F", - "OptimismMintableERC20FactoryProxy": "0x6069BC38c6185f2db0d161f08eC8d1657F6078Df", - "OptimismPortalProxy": "0x65ea1489741A5D72fFdD8e6485B216bBdcC15Af3", - "PermissionedDisputeGame": "0x55bC868c07c8Cd48446A76966894F4d87844839C", - "PreimageOracle": "0xBFEbcF9b8855C3E1d01b2AD28DB9F59BC6CB6965", - "Proposer": "0xa759A2C80Ec4C6421829862da30dD34436114502", - "ProxyAdmin": "0xff9d236641962Cebf9DBFb54E7b8e91F99f10Db0", - "ProxyAdminOwner": "0x4d59CccA765E1211Bd32Aa6F2A037fD37E519a25", - "SuperchainConfig": "0xC2Be75506d5724086DEB7245bd260Cc9753911Be", - "SystemConfigOwner": "0xB278818732E5BEbb742dc4Aa0617ccd1Dec76b65", - "SystemConfigProxy": "0x4Ca9608Fef202216bc21D543798ec854539bAAd3", - "UnsafeBlockSigner": "0x55930859CD7003F32A2ba171297408476532E535" - } - }, - { - "Name": "Lisk Sepolia Testnet", - "l2_chain_id": 4202, - "PublicRPC": "https://rpc.sepolia-api.lisk.com", - "SequencerRPC": "https://rpc.sepolia-api.lisk.com", - "Explorer": "https://sepolia-blockscout.lisk.com", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xff00000000000000000000000000000000004202", - "Superchain": "sepolia", - "Chain": "lisk", - "canyon_time": 1705312994, - "delta_time": 1705312994, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x7d9d6dcec39efe182119f41b1bd2aa7b35b82e43927522afea86d210a4eace4b", - "number": 5089851 - }, - "l2": { - "hash": "0xead3e6ddd08ae7e27fd952b74ceb468ba889047ac96b351dd13bd55e5faf3372", - "number": 0 - }, - "l2_time": 1705312992, - "system_config": { - "batcherAddr": "0x246E119a5BcC2875161b23E4e602e25cEcE96E37", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x27Bb4A7cd8FB20cb816BF4Aac668BF841bb3D5d3", - "BatchSubmitter": "0x246E119a5BcC2875161b23E4e602e25cEcE96E37", - "Challenger": "0x19De6D30Bf43654B7244B8adA135E1AA639bF091", - "DisputeGameFactoryProxy": "0x9AA3890a87E6BD2CB85Dad1A5D8B0A9D669e658a", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0x857824E6234f7733ecA4e9A76804fd1afa1A3A2C", - "L1ERC721BridgeProxy": "0xb4E988CF1aD8C361D56118437502A8f11C7FaA01", - "L1StandardBridgeProxy": "0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5", - "L2OutputOracleProxy": "0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348", - "OptimismMintableERC20FactoryProxy": "0x269d632C1E518a922C30C749cFD3f82Eb5C779B0", - "OptimismPortalProxy": "0xe3d90F21490686Ec7eF37BE788E02dfC12787264", - "Proposer": "0xBbD3a1D90B0Ef416581ACdC6a72046b38D3af9AD", - "ProxyAdmin": "0x5Db9F05921d8d5a6a157F6f49c411cc0e46c6330", - "ProxyAdminOwner": "0x465874903125F26316c730aE84862606a3326cA5", - "SuperchainConfig": "0xC2Be75506d5724086DEB7245bd260Cc9753911Be", - "SystemConfigOwner": "0x19De6D30Bf43654B7244B8adA135E1AA639bF091", - "SystemConfigProxy": "0xF54791059df4a12BA461b881B4080Ae81a1d0AC0", - "UnsafeBlockSigner": "0x99804980804e9EbE78db89C049fFe36ceaaEF654" - } - }, - { - "Name": "World Chain Sepolia Testnet", - "l2_chain_id": 4801, - "PublicRPC": "https://worldchain-sepolia.g.alchemy.com/public", - "SequencerRPC": "https://worldchain-sepolia-sequencer.g.alchemy.com", - "Explorer": "https://worldchain-sepolia.explorer.alchemy.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000484752", - "Superchain": "sepolia", - "Chain": "worldchain", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1721739600, - "granite_time": 1726570800, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xd220bbdf24df6d1611f4ece1d08c64feae914ce6299ab2806c864e30a5289201", - "number": 6278018 - }, - "l2": { - "hash": "0xf1deb67ee953f94d8545d2647918687fa8ba1f30fa6103771f11b7c483984070", - "number": 0 - }, - "l2_time": 1720547424, - "system_config": { - "batcherAddr": "0x0f3ff4731D7a10B89ED79AD1Fd97844d7F66B96d", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 100000000 - } - }, - "Addresses": { - "AddressManager": "0xc50Ba0767A1c0Ef69Cf1D9cd44De52b08589F691", - "AnchorStateRegistryProxy": "0x1517FDD5A31B35f790eA8a3c6cC2F595B1BD4742", - "BatchSubmitter": "0x0f3ff4731D7a10B89ED79AD1Fd97844d7F66B96d", - "Challenger": "0xe78a0A96C5D6aE6C606418ED4A9Ced378cb030A0", - "DelayedWETHProxy": "0x4F4B8Adf1af4b61bb62F68b7aF1c37f8A6311663", - "DisputeGameFactoryProxy": "0x8cF97Ee616C986a070F5020d973b456D0120C253", - "Guardian": "0xe78a0A96C5D6aE6C606418ED4A9Ced378cb030A0", - "L1CrossDomainMessengerProxy": "0x7768c821200554d8F359A8902905Ba9eDe5659a9", - "L1ERC721BridgeProxy": "0x3580505c56f8560E3777E92Fb27f70fD20c5B493", - "L1StandardBridgeProxy": "0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE", - "L2OutputOracleProxy": "0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e", - "MIPS": "0xCEd5c6ca2f32dE7bf43DB981E1cac398D7A978F2", - "OptimismMintableERC20FactoryProxy": "0x2D272eF54Ee8EF5c2Ff3523559186580b158cd57", - "OptimismPortalProxy": "0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4", - "PreimageOracle": "0x954C0Fb8083047f37c8Fe954c114f8138614131C", - "Proposer": "0x77a95104e4025fC8B88A6a0F5FB7Fae20851E414", - "ProxyAdmin": "0x3a987FE1cb587B0A1808cf9bB7Cbe0E341838319", - "ProxyAdminOwner": "0x945185C01fb641bA3E63a9bdF66575e35a407837", - "SuperchainConfig": "0x4642C5eD3B1568e0F05d73B10d02e6Fb2595aF9a", - "SystemConfigOwner": "0xe78a0A96C5D6aE6C606418ED4A9Ced378cb030A0", - "SystemConfigProxy": "0x166F9406e79A656f12F05247fb8F5DfA6155bCBF", - "UnsafeBlockSigner": "0x3241A7D28eA74E807A5087BA637fB58D8dDcd078" - } - }, - { - "Name": "RACE Testnet", - "l2_chain_id": 6806, - "PublicRPC": "https://racetestnet.io", - "SequencerRPC": "https://racetestnet.io", - "Explorer": "https://testnet.racescan.io/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xff00000000000000000000000000000000006806", - "Superchain": "sepolia", - "Chain": "race", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x28dd1dd74080560ef0b02f8f1ae31d1be75b01a70a5be6ef22e673cec538770f", - "number": 6210400 - }, - "l2": { - "hash": "0x994d67464c3368b8eb6f9770087399486b25d721a1868b95bb37de327b49ab89", - "number": 0 - }, - "l2_time": 1719646560, - "system_config": { - "batcherAddr": "0x584D61A30C7Ef1E8D547eE02099dADC487f49889", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x1B573Db1000eA419B6dE8eB482C6d394179Bd1A3", - "BatchSubmitter": "0x584D61A30C7Ef1E8D547eE02099dADC487f49889", - "Challenger": "0xE6869aF6c871614df04902870Bb13d4505E1586c", - "Guardian": "0xE6869aF6c871614df04902870Bb13d4505E1586c", - "L1CrossDomainMessengerProxy": "0xdaeab17598938A4f27E50AC771249Ad7df12Ea7D", - "L1ERC721BridgeProxy": "0xBafb1a6e54e7750aF29489D65888d1c96Dfd66Df", - "L1StandardBridgeProxy": "0x289179e9d43A35D47239456251F9c2fdbf9fbeA2", - "L2OutputOracleProxy": "0xccac2B8FFc4f778242105F3a9E6B3Ae3F827fC6a", - "OptimismMintableERC20FactoryProxy": "0xbd023e7F08AE0274dCEd397D4B6630D697aC738A", - "OptimismPortalProxy": "0xF2891fc6819CDd6BD9221874619BB03A6277d72A", - "Proposer": "0x5a145E3F466FD6cC095214C700359df7894BaD21", - "ProxyAdmin": "0x4a0E8415e3eB85E7393445FD8E588283b62216C8", - "ProxyAdminOwner": "0xAc78E9B3Aa9373AE4bE2Ba5Bc9F716d7A746A65E", - "SuperchainConfig": "0x1696a64C7F170E46D32088E8eC29193300C35817", - "SystemConfigOwner": "0xE6869aF6c871614df04902870Bb13d4505E1586c", - "SystemConfigProxy": "0x07e7A3F25aA73dA15bc19B71FEF8f5511342a409", - "UnsafeBlockSigner": "0x89eA88ef4AC23f4C7Fdc611Fc9cD1c50DF702C2C" - } - }, - { - "Name": "Shape Sepolia Testnet", - "l2_chain_id": 11011, - "PublicRPC": "https://sepolia.shape.network/", - "SequencerRPC": "https://shape-sepolia-sequencer.g.alchemy.com", - "Explorer": "https://shape-sepolia.explorer.alchemy.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": null, - "batch_inbox_address": "0xFF00000000000000000000000000000000011011", - "Superchain": "sepolia", - "Chain": "shape", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "fjord_time": 1721732400, - "granite_time": 1727197200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 1800, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x0e1156bae935f43af44f8d3e011275b8aeab57acd83cbd71d92903d3c9b29cf3", - "number": 6151675 - }, - "l2": { - "hash": "0xcb3558db049390808cbde6b82a48d06ed98d3fe959e088ac20ae56174595cfce", - "number": 0 - }, - "l2_time": 1718936160, - "system_config": { - "batcherAddr": "0x6fF556Fa7CaFEc55aE77C5C1d58A010be75f9991", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x42721d8512d62aA26B2Cfa1AE18bEEd5a9Ab1337", - "AnchorStateRegistryProxy": "0x41ea3c370896632121Cdde1b94a4eCcf23DA4532", - "BatchSubmitter": "0x6fF556Fa7CaFEc55aE77C5C1d58A010be75f9991", - "Challenger": "0xa9ABe4af69BEA2f381ca600f625Eb3E6b7559266", - "DelayedWETHProxy": "0x7cc9cA91BA4f92F4C967E93a1AAd97beB18d3877", - "DisputeGameFactoryProxy": "0x93eaa7A1E7d7af7eD9D612F9957988C8631c33e8", - "Guardian": "0xa9ABe4af69BEA2f381ca600f625Eb3E6b7559266", - "L1CrossDomainMessengerProxy": "0xF9F730650e1AB4D23E2ac983934271ca7c5EF293", - "L1ERC721BridgeProxy": "0x19f02c55254d2644eF94f30C74A932D64e1D4F86", - "L1StandardBridgeProxy": "0x341ab1DAFdfB73b3D6D075ef10b29e3cACB2A653", - "L2OutputOracleProxy": "0x532dDCed3440Eab81c529Ac8b0d7e429B5C05c52", - "MIPS": "0xaCf1Ed7357E41f652407ae6cFE1024705c758C38", - "OptimismMintableERC20FactoryProxy": "0x46085E2e648488e49FBeaF6544b8e9Dc96df8BDd", - "OptimismPortalProxy": "0xfF8Ca2B4d8122E41441F7ccDCf61b8692198Bd1E", - "PreimageOracle": "0x8F3B1c59eD4439ebF564604aA4B93130DA4CD1D5", - "Proposer": "0xf8Ed03b83c15aa3d0b52095F3c9971225948B777", - "ProxyAdmin": "0xd60a706Bf6108F090d055787B9B353FA7EEE1355", - "ProxyAdminOwner": "0x4c4526C8C55c4e1a6F2aaf91e37f07c97786e0f5", - "SuperchainConfig": "0xe5b3692266FF4Ab8A96A9C7Da6EeEe532CCc7916", - "SystemConfigOwner": "0xa9ABe4af69BEA2f381ca600f625Eb3E6b7559266", - "SystemConfigProxy": "0xa1aC91ED91EbE40E00d61E233c8026318b4da5fb", - "UnsafeBlockSigner": "0xbB4f4B3a46361653BE9DB255D8ff2D004F0FB248" - } - }, - { - "Name": "Base Sepolia Testnet", - "l2_chain_id": 84532, - "PublicRPC": "https://sepolia.base.org", - "SequencerRPC": "https://sepolia-sequencer.base.org", - "Explorer": "https://sepolia-explorer.base.org", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0xfF00000000000000000000000000000000084532", - "Superchain": "sepolia", - "Chain": "base", - "canyon_time": 1699981200, - "delta_time": 1703203200, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "holocene_time": 1732633200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xcac9a83291d4dec146d6f7f69ab2304f23f5be87b1789119a0c5b1e4482444ed", - "number": 4370868 - }, - "l2": { - "hash": "0x0dcc9e089e30b90ddfc55be9a37dd15bc551aeee999d2e2b51414c54eaf934e4", - "number": 0 - }, - "l2_time": 1695768288, - "system_config": { - "batcherAddr": "0x6CDEbe940BC0F26850285cacA097C11c33103E47", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 25000000 - } - }, - "Addresses": { - "AddressManager": "0x709c2B8ef4A9feFc629A8a2C1AF424Dc5BD6ad1B", - "AnchorStateRegistryProxy": "0x4C8BA32A5DAC2A720bb35CeDB51D6B067D104205", - "BatchSubmitter": "0xfc56E7272EEBBBA5bC6c544e159483C4a38f8bA3", - "Challenger": "0xDa3037Ff70Ac92CD867c683BD807e5A484857405", - "DelayedWETHProxy": "0x7698b262B7a534912c8366dD8a531672deEC634e", - "DisputeGameFactoryProxy": "0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1", - "FaultDisputeGame": "0x8A9bA50a785c3868bEf1FD4924b640A5e0ed54CF", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0xC34855F4De64F1840e5686e64278da901e261f20", - "L1ERC721BridgeProxy": "0x21eFD066e581FA55Ef105170Cc04d74386a09190", - "L1StandardBridgeProxy": "0xfd0Bf71F60660E2f608ed56e1659C450eB113120", - "MIPS": "0xFF760A87E41144b336E29b6D4582427dEBdB6dee", - "OptimismMintableERC20FactoryProxy": "0xb1efB9650aD6d0CC1ed3Ac4a0B7f1D5732696D37", - "OptimismPortalProxy": "0x49f53e41452C74589E85cA1677426Ba426459e85", - "PermissionedDisputeGame": "0x593D20C4c69485B95D11507239BE2C725ea2A6fD", - "PreimageOracle": "0x627F825CBd48c4102d36f287be71f4234426b9e4", - "Proposer": "0x037637067c1DbE6d2430616d8f54Cb774Daa5999", - "ProxyAdmin": "0x0389E59Aa0a41E4A413Ae70f0008e76CAA34b1F3", - "ProxyAdminOwner": "0x0fe884546476dDd290eC46318785046ef68a0BA9", - "SystemConfigOwner": "0x0fe884546476dDd290eC46318785046ef68a0BA9", - "SystemConfigProxy": "0xf272670eb55e895584501d564AfEB048bEd26194", - "UnsafeBlockSigner": "0xb830b99c95Ea32300039624Cb567d324D4b1D83C" - } - }, - { - "Name": "Funki Sepolia Testnet", - "l2_chain_id": 3397901, - "PublicRPC": "https://funki-testnet.alt.technology", - "SequencerRPC": "https://funki-testnet.alt.technology", - "Explorer": "https://sepolia-sandbox.funkichain.com/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xff000000000000000000000000000000000084bB", - "Superchain": "sepolia", - "Chain": "funki", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "block_time": 2, - "seq_window_size": 28800, - "max_sequencer_drift": 600, - "DataAvailabilityType": "alt-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "alt_da": { - "da_challenge_contract_address": "0x12C6A7dB25b20347CA6F5d47E56D5E8219871C6d", - "da_challenge_window": 1, - "da_resolve_window": 1, - "da_commitment_type": "KeccakCommitment" - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x6bc7182e10df2bf35d76362989e10e2c6799c4ceff2eb32741cb804dfab9dd06", - "number": 5853286 - }, - "l2": { - "hash": "0xcebbf8fc7d0fab412866fe1e7df73c721104550ec35e55d173064acb2c0aeac9", - "number": 0 - }, - "l2_time": 1715060436, - "system_config": { - "batcherAddr": "0xDa19a4E4d1DbC69bACf13435f08F76cED9B3C245", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000b4", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x6ECc4a306cD20f8041d63B3Db8ecA46b713cDEcC", - "BatchSubmitter": "0xDa19a4E4d1DbC69bACf13435f08F76cED9B3C245", - "Challenger": "0x542A7142093d536Bf277FA3B0410883ac4e121dc", - "DAChallengeAddress": "0x12C6A7dB25b20347CA6F5d47E56D5E8219871C6d", - "DelayedWETHProxy": "0x31D0D1D3Fc27B3f174E544364e7Bb836980162d1", - "DisputeGameFactoryProxy": "0xEc7C6E35f4e5361D279d5Fe7222F3F45A8A83352", - "Guardian": "0xdf3d6FA42Fe4225E6A042C4eD191d7E5D8252E6f", - "L1CrossDomainMessengerProxy": "0x6F82D895E223Dde65DA28a8bbD14f3eF79cBF3b8", - "L1ERC721BridgeProxy": "0x598D245Ea85FBfBceCe6c62232bbCAB688D3F68b", - "L1StandardBridgeProxy": "0x1ba82f688eF3C5B4363Ff667254ed4DC59E97477", - "L2OutputOracleProxy": "0xB25812386D1Cb976b50de7387F5CBc10Fec3F27c", - "MIPS": "0x71483031c5D2927Ea83807d5C88bd8EccFaF292d", - "OptimismMintableERC20FactoryProxy": "0x8eE8eB6B829C382cA395D35C40Dcd2ef8AE57c68", - "OptimismPortalProxy": "0xCeE7ef4dDF482447FE14c605Ea94B37cBE87Ca9D", - "PreimageOracle": "0x2DE051316aaD761A3eBd6fF008D714805bD02c56", - "Proposer": "0x0b8AA7c355917016496e999a80F1737ef9c0C962", - "ProxyAdmin": "0xB3E1F3ab2A22049Cc155ebA7089Ea20A5EAB99ca", - "ProxyAdminOwner": "0x814973b1ec9Eb9172996931dE7BF1380bd64a824", - "SuperchainConfig": "0x00df2E8EfbE6ad2538D940a2cCAAE65112bd0437", - "SystemConfigOwner": "0xCDAf106c5531fd27Bf27536E4696E325de9F52b8", - "SystemConfigProxy": "0xd6A01f1Ef51D65F023433992a8F62fEeAD35b172", - "UnsafeBlockSigner": "0x5359050ACb96c515562896BA71089487138e4bDe" - } - }, - { - "Name": "OP Sepolia Testnet", - "l2_chain_id": 11155420, - "PublicRPC": "https://sepolia.optimism.io", - "SequencerRPC": "https://sepolia-sequencer.optimism.io", - "Explorer": "https://sepolia-optimistic.etherscan.io", - "SuperchainLevel": 1, - "StandardChainCandidate": false, - "SuperchainTime": 0, - "batch_inbox_address": "0xff00000000000000000000000000000011155420", - "Superchain": "sepolia", - "Chain": "op", - "canyon_time": 1699981200, - "delta_time": 1703203200, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "holocene_time": 1732633200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b", - "number": 4071408 - }, - "l2": { - "hash": "0x102de6ffb001480cc9b8b548fd05c34cd4f46ae4aa91759393db90ea0409887d", - "number": 0 - }, - "l2_time": 1691802540, - "system_config": { - "batcherAddr": "0x8F23BB38F531600e5d8FDDaAEC41F13FaB46E98c", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x9bFE9c5609311DF1c011c47642253B78a4f33F4B", - "AnchorStateRegistryProxy": "0x218CD9489199F321E1177b56385d333c5B598629", - "BatchSubmitter": "0x8F23BB38F531600e5d8FDDaAEC41F13FaB46E98c", - "Challenger": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301", - "DelayedWETHProxy": "0xcdFdC692a53B4aE9F81E0aEBd26107Da4a71dB84", - "DisputeGameFactoryProxy": "0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1", - "FaultDisputeGame": "0xD9d616E4a03a8e7cC962396C9f8D4e3d306097D3", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef", - "L1ERC721BridgeProxy": "0xd83e03D576d23C9AEab8cC44Fa98d058D2176D1f", - "L1StandardBridgeProxy": "0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1", - "MIPS": "0x47B0E34C1054009e696BaBAAd56165e1e994144d", - "OptimismMintableERC20FactoryProxy": "0x868D59fF9710159C2B330Cc0fBDF57144dD7A13b", - "OptimismPortalProxy": "0x16Fc5058F25648194471939df75CF27A2fdC48BC", - "PermissionedDisputeGame": "0x98E3F752c7224F8322Afa935a4CaEC3832bB25c9", - "PreimageOracle": "0x92240135b46fc1142dA181f550aE8f595B858854", - "Proposer": "0x49277EE36A024120Ee218127354c4a3591dc90A9", - "ProxyAdmin": "0x189aBAAaa82DfC015A588A7dbaD6F13b1D3485Bc", - "ProxyAdminOwner": "0x1Eb2fFc903729a0F03966B917003800b145F56E2", - "SystemConfigOwner": "0xfd1D2e729aE8eEe2E146c033bf4400fE75284301", - "SystemConfigProxy": "0x034edD2A225f7f429A63E0f1D2084B9E0A93b538", - "UnsafeBlockSigner": "0x57CACBB0d30b01eb2462e5dC940c161aff3230D3" - } - }, - { - "Name": "Cyber Testnet", - "l2_chain_id": 111557560, - "PublicRPC": "https://rpc.testnet.cyber.co", - "SequencerRPC": "https://cyber.alt.technology/", - "Explorer": "https://testnet.cyberscan.co/", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": null, - "batch_inbox_address": "0xFf00000000000000000000000000000000042069", - "Superchain": "sepolia", - "Chain": "cyber", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 0, - "block_time": 10, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 10, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x0ad7012996ee943369fe592424821845ab115e43a9bc5d4e17bf9493869f98e3", - "number": 5488109 - }, - "l2": { - "hash": "0xd61aa9a43cba806375bec108aba488f00cf784a53a6e5164bc3ef9eb8b169eaf", - "number": 0 - }, - "l2_time": 1710470112, - "system_config": { - "batcherAddr": "0x90BB84339856530192CD002533cd7f1290Fc5142", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x4E9874640d6a670B7F4c7A1370bC303Bb46F360f", - "BatchSubmitter": "0x90BB84339856530192CD002533cd7f1290Fc5142", - "Challenger": "0x66530799037b46913e52e9e0144D15ab6ed954f5", - "DisputeGameFactoryProxy": "0x99f0f9B0E7B16B10042E0935CE34F2fCebBE13C1", - "Guardian": "0x66530799037b46913e52e9e0144D15ab6ed954f5", - "L1CrossDomainMessengerProxy": "0xB88ee11d822bEc8055f19711458dE8593E7117A3", - "L1ERC721BridgeProxy": "0x524e85D2B49497561c53EFEB4B126Aa63883B480", - "L1StandardBridgeProxy": "0xAA1bD6D4d8cFD37330a917bc678CB38BEFAf44E6", - "L2OutputOracleProxy": "0xD94Ce9E4886A6dcEbC7cF993f4b38F5276516643", - "MIPS": "0xD0E6c40D8462466633BAa2d24796d788A08b2e9F", - "OptimismMintableERC20FactoryProxy": "0xCfc893490072F14F19ed6dF2b0d985f908ACEE50", - "OptimismPortalProxy": "0x06C9Cadb0346c8E142fb8299cEF3EB5120d4c9b6", - "PreimageOracle": "0xceF1e04Fd7413C4a7287DF9099Ac57EEd48fB8f2", - "Proposer": "0x69ffD6a97141B632631Ef7f56cCeA6a36f02bD7F", - "ProxyAdmin": "0x6FcE62e16720BE713e77C954d6f1e6bC8B8d9F48", - "ProxyAdminOwner": "0x642A102cD63f039930f99b4657f41Fd4AD7699d6", - "SuperchainConfig": "0x3BB614Da92A136Aa14912713F713b3Fa6d6176fE", - "SystemConfigOwner": "0x66530799037b46913e52e9e0144D15ab6ed954f5", - "SystemConfigProxy": "0x43b838Aa237B27c4fC953E591594CEBb1CA2817F", - "UnsafeBlockSigner": "0xf6C6d69ad0eC617593BDDae9702b3F912621C6fe" - } - }, - { - "Name": "Zora Sepolia Testnet", - "l2_chain_id": 999999999, - "PublicRPC": "https://sepolia.rpc.zora.energy", - "SequencerRPC": "https://sepolia.rpc.zora.energy", - "Explorer": "https://sepolia.explorer.zora.energy", - "SuperchainLevel": 0, - "StandardChainCandidate": true, - "SuperchainTime": 0, - "batch_inbox_address": "0xCd734290E4bd0200dAC631c7D4b9E8a33234e91f", - "Superchain": "sepolia", - "Chain": "zora", - "canyon_time": 1699981200, - "delta_time": 1703203200, - "ecotone_time": 1708534800, - "fjord_time": 1716998400, - "granite_time": 1723478400, - "holocene_time": 1732633200, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0xf782446a2487d900addb5d466a8597c7c543b59fa9aaa154d413830238f8798a", - "number": 4548041 - }, - "l2": { - "hash": "0x8b17d2d52564a5a90079d9c860e1386272579e87b17ea27a3868513f53facd74", - "number": 0 - }, - "l2_time": 1698080004, - "system_config": { - "batcherAddr": "0x3Cd868E221A3be64B161D596A7482257a99D857f", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x27c9392144DFcB6dab113F737356C32435cD1D55", - "BatchSubmitter": "0x3Cd868E221A3be64B161D596A7482257a99D857f", - "Challenger": "0x45eFFbD799Ab49122eeEAB75B78D9C56A187F9A7", - "Guardian": "0x7a50f00e8D05b95F98fE38d8BeE366a7324dCf7E", - "L1CrossDomainMessengerProxy": "0x1bDBC0ae22bEc0c2f08B4dd836944b3E28fe9b7A", - "L1ERC721BridgeProxy": "0x16B0a4f451c4CB567703367e587E15Ac108e4311", - "L1StandardBridgeProxy": "0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB", - "L2OutputOracleProxy": "0x2615B481Bd3E5A1C0C7Ca3Da1bdc663E8615Ade9", - "OptimismMintableERC20FactoryProxy": "0x5F3bdd57f01e88cE2F88f00685D30D6eb51A187c", - "OptimismPortalProxy": "0xeffE2C6cA9Ab797D418f0D91eA60807713f3536f", - "Proposer": "0xe8326a5839175dE7f467e66D8bB443aa70DA1c3e", - "ProxyAdmin": "0xE17071F4C216Eb189437fbDBCc16Bb79c4efD9c2", - "ProxyAdminOwner": "0x1Eb2fFc903729a0F03966B917003800b145F56E2", - "SystemConfigOwner": "0x23BA22Dd7923F3a3f2495bB32a6f3c9b9CD1EC6C", - "SystemConfigProxy": "0xB54c7BFC223058773CF9b739cC5bd4095184Fb08", - "UnsafeBlockSigner": "0x3609513933100689bd1f84782529A99239842344" - } - } - ] - }, - { - "name": "sepolia-dev-0", - "config": { - "Name": "Sepolia Dev 0", - "L1": { - "ChainID": 11155111, - "PublicRPC": "https://ethereum-sepolia-rpc.publicnode.com", - "Explorer": "https://sepolia.etherscan.io" - }, - "ProtocolVersionsAddr": "0x252CbE9517F731C618961D890D534183822dcC8d", - "SuperchainConfigAddr": "0x02d91Cf852423640d93920BE0CAdceC0E7A00FA7", - "OPContractsManagerProxyAddr": null - }, - "chains": [ - { - "Name": "OP Labs Sepolia devnet 0", - "l2_chain_id": 11155421, - "PublicRPC": "", - "SequencerRPC": "", - "Explorer": "", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": 0, - "batch_inbox_address": "0xFf00000000000000000000000000000011155421", - "Superchain": "sepolia-dev-0", - "Chain": "oplabs-devnet-0", - "canyon_time": 0, - "delta_time": 0, - "ecotone_time": 1706634000, - "fjord_time": 1715961600, - "granite_time": 1723046400, - "holocene_time": 1731682800, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x5639be97000fec7131a880b19b664cae43f975c773f628a08a9bb658c2a68df0", - "number": 5173577 - }, - "l2": { - "hash": "0x027ae1f4f9a441f9c8a01828f3b6d05803a0f524c07e09263264a38b755f804b", - "number": 0 - }, - "l2_time": 1706484048, - "system_config": { - "batcherAddr": "0x19CC7073150D9f5888f09E0e9016d2a39667df14", - "overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0", - "gasLimit": 30000000 - } - }, - "Addresses": { - "AddressManager": "0x3eb579b25F6b9547e0073c848389a768FD382296", - "AnchorStateRegistryProxy": "0x03b82AE60989863BCEb0BbD442A70568e5AefB85", - "BatchSubmitter": "0x19CC7073150D9f5888f09E0e9016d2a39667df14", - "Challenger": "0x8c20c40180751d93E939DDDee3517AE0d1EBeAd2", - "DelayedWETHProxy": "0xE99696a028171e31a72828A196C27c2Dd670E1aa", - "DisputeGameFactoryProxy": "0x2419423C72998eb1c6c15A235de2f112f8E38efF", - "FaultDisputeGame": "0x54416A2E28E8cbC761fbce0C7f107307991282e5", - "Guardian": "0x8c20c40180751d93E939DDDee3517AE0d1EBeAd2", - "L1CrossDomainMessengerProxy": "0x18e72C15FEE4e995454b919EfaA61D8f116F82dd", - "L1ERC721BridgeProxy": "0x1bb726658E039E8a9A4ac21A41fE5a0704760461", - "L1StandardBridgeProxy": "0x6D8bC564EF04AaF355a10c3eb9b00e349dd077ea", - "MIPS": "0xceDE5949A189aC60F41F1385a86DBce7Bd3B1943", - "OptimismMintableERC20FactoryProxy": "0xA16b8db3b5Cdbaf75158F34034B0537e528E17e2", - "OptimismPortalProxy": "0x76114bd29dFcC7a9892240D317E6c7C2A281Ffc6", - "PermissionedDisputeGame": "0x50573970b291726B881b204eD9F3c1D507e504cD", - "PreimageOracle": "0xB73342DdD69620e5Ab2Cc604Dad46434C2338025", - "Proposer": "0x95014c45078354Ff839f14192228108Eac82E00A", - "ProxyAdmin": "0x18d890A46A3556e7F36f28C79F6157BC7a59f867", - "ProxyAdminOwner": "0x4377BB0F0103992b31eC12b4d796a8687B8dC8E9", - "SystemConfigOwner": "0x8c20c40180751d93E939DDDee3517AE0d1EBeAd2", - "SystemConfigProxy": "0xa6b72407e2dc9EBF84b839B69A24C88929cf20F7", - "UnsafeBlockSigner": "0xa95B83e39AA78B00F12fe431865B563793D97AF5" - } - }, - { - "Name": "Base devnet 0", - "l2_chain_id": 11763072, - "PublicRPC": "", - "SequencerRPC": "", - "Explorer": "", - "SuperchainLevel": 0, - "StandardChainCandidate": false, - "SuperchainTime": 1706634000, - "batch_inbox_address": "0xfF00000000000000000000000000000011763072", - "Superchain": "sepolia-dev-0", - "Chain": "base-devnet-0", - "canyon_time": 1698436800, - "delta_time": 1706555000, - "ecotone_time": 1706634000, - "fjord_time": 1715961600, - "granite_time": 1723046400, - "holocene_time": 1731682800, - "block_time": 2, - "seq_window_size": 3600, - "max_sequencer_drift": 600, - "DataAvailabilityType": "eth-da", - "optimism": { - "eip1559Elasticity": 6, - "eip1559Denominator": 50, - "eip1559DenominatorCanyon": 250 - }, - "GasPayingToken": null, - "genesis": { - "l1": { - "hash": "0x86252c512dc5bd7201d0532b31d50696ba84344a7cda545e04a98073a8e13d87", - "number": 4344216 - }, - "l2": { - "hash": "0x1ab91449a7c65b8cd6c06f13e2e7ea2d10b6f9cbf5def79f362f2e7e501d2928", - "number": 0 - }, - "l2_time": 1695433056, - "system_config": { - "batcherAddr": "0x212dD524932bC43478688F91045F2682913ad8EE", - "overhead": "0x0000000000000000000000000000000000000000000000000000000000000834", - "scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240", - "gasLimit": 25000000 - } - }, - "Addresses": { - "AddressManager": "0x882a60911d00867Fe4ea632C479cc48e583A8D69", - "BatchSubmitter": "0x7A43fD33e42054C965eE7175dd4590D2BDba79cB", - "Challenger": "0x5a533AaAC6cd81605b301a1077BC393A94658B6D", - "Guardian": "0x4F43c7422a9b2AC4BC6145Bd4eE206EA73cF8266", - "L1CrossDomainMessengerProxy": "0x2cbD403d5BA3949D24ee4dF57805eaC612C2662f", - "L1ERC721BridgeProxy": "0xc3016ED03E087d092d576B585F5222fFD9cadc10", - "L1StandardBridgeProxy": "0x5638e55db5Fcf7A58df525F1098E8569C8DbA80c", - "L2OutputOracleProxy": "0xB5901509329307E3f910f333Fa9C4B4A8EE7CE1A", - "OptimismMintableERC20FactoryProxy": "0xEAa11178375e6B1078d815d6F9F85cBbb69b09Cd", - "OptimismPortalProxy": "0x579c82A835B884336B632eeBeCC78FA08D3291Ec", - "Proposer": "0xf99C2Da4822Af652fe1BF55F99713980efe5D261", - "ProxyAdmin": "0xC5aE9023bFA79124ffA50169E1423E733D0166f1", - "ProxyAdminOwner": "0xAf6E0E871f38c7B653700F7CbAEDafaa2784D430", - "SystemConfigOwner": "0xAf6E0E871f38c7B653700F7CbAEDafaa2784D430", - "SystemConfigProxy": "0x7F67DC4959cb3E532B10A99F41bDD906C46FdFdE", - "UnsafeBlockSigner": "0xfd7bc3C58Fe4D4296F11F7843ebbA84D729A24B9" - } - } - ] - } - ] -} \ No newline at end of file diff --git a/crates/registry/src/chain_list.rs b/crates/registry/src/chain_list.rs deleted file mode 100644 index 6c562a5e..00000000 --- a/crates/registry/src/chain_list.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! List of OP Stack chains. - -use alloc::{string::String, vec::Vec}; - -/// List of Chains. -#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct ChainList { - /// List of Chains. - pub chains: Vec, -} - -/// A Chain Definition. -#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Chain { - /// The name of the chain. - pub name: String, - /// Chain identifier. - pub identifier: String, - /// Chain ID. - pub chain_id: u64, - /// List of RPC Endpoints. - pub rpc: Vec, - /// List of Explorer Endpoints. - pub explorers: Vec, - /// The Superchain Level. - pub superchain_level: u64, - /// The data avilability type. - pub data_availability_type: String, - /// The Superchain Parent. - pub parent: SuperchainParent, -} - -/// A Chain Parent -#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SuperchainParent { - /// The parent type. - pub r#type: String, - /// The chain identifier. - pub chain: String, -} - -impl SuperchainParent { - /// Returns the chain id for the parent. - pub fn chain_id(&self) -> u64 { - match self.chain.as_ref() { - "mainnet" => 1, - "sepolia" => 11155111, - "sepolia-dev-0" => 11155421, - _ => 10, - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn read_chain_list_file() { - let chain_list = include_str!("../etc/chainList.json"); - let chains: Vec = serde_json::from_str(chain_list).unwrap(); - let base_chain = chains.iter().find(|c| c.name == "Base").unwrap(); - assert_eq!(base_chain.chain_id, 8453); - } -} diff --git a/crates/registry/src/lib.rs b/crates/registry/src/lib.rs deleted file mode 100644 index 9991cf28..00000000 --- a/crates/registry/src/lib.rs +++ /dev/null @@ -1,56 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -extern crate alloc; - -pub use alloy_primitives::map::{DefaultHashBuilder, HashMap}; -pub use op_alloy_genesis::{ChainConfig, RollupConfig}; - -pub mod chain_list; -pub use chain_list::{Chain, ChainList}; - -pub mod superchain; -pub use superchain::Registry; - -#[cfg(test)] -pub mod test_utils; - -lazy_static::lazy_static! { - /// Private initializer that loads the superchain configurations. - static ref _INIT: Registry = Registry::from_chain_list(); - - /// Chain configurations exported from the registry - pub static ref CHAINS: alloc::vec::Vec = _INIT.chains.clone(); - - /// OP Chain configurations exported from the registry - pub static ref OPCHAINS: HashMap = _INIT.op_chains.clone(); - - /// Rollup configurations exported from the registry - pub static ref ROLLUP_CONFIGS: HashMap = _INIT.rollup_configs.clone(); -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_hardcoded_rollup_configs() { - let test_cases = vec![ - (10, test_utils::OP_MAINNET_CONFIG), - (8453, test_utils::BASE_MAINNET_CONFIG), - (11155420, test_utils::OP_SEPOLIA_CONFIG), - (84532, test_utils::BASE_SEPOLIA_CONFIG), - ]; - - for (chain_id, expected) in test_cases { - let derived = super::ROLLUP_CONFIGS.get(&chain_id).unwrap(); - assert_eq!(expected, *derived); - } - } -} diff --git a/crates/registry/src/superchain.rs b/crates/registry/src/superchain.rs deleted file mode 100644 index 16dcd422..00000000 --- a/crates/registry/src/superchain.rs +++ /dev/null @@ -1,190 +0,0 @@ -//! Contains the full superchain data. - -use super::Chain; -use alloc::{string::String, vec::Vec}; -use alloy_primitives::{ - map::{DefaultHashBuilder, HashMap}, - Address, -}; -use op_alloy_genesis::{ChainConfig, HardForkConfiguration, RollupConfig}; - -/// A superchain configuration. -#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -pub struct Superchain { - /// Superchain identifier, without capitalization or display changes. - pub name: String, - /// Superchain configuration file contents. - pub config: SuperchainConfig, - /// Chain IDs of chains that are part of this superchain. - pub chains: Vec, -} - -/// A superchain configuration file format -#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SuperchainConfig { - /// Superchain name (e.g. "Mainnet") - pub name: String, - /// Superchain L1 anchor information - pub l1: SuperchainL1Info, - /// Optional addresses for the superchain-wide default protocol versions contract. - pub protocol_versions_addr: Option
, - /// Optional address for the superchain-wide default superchain config contract. - pub superchain_config_addr: Option
, - /// Hardfork Configuration. These values may be overridden by individual chains. - #[serde(flatten)] - pub hardfork_defaults: HardForkConfiguration, -} - -/// Superchain L1 anchor information -#[derive(Debug, Clone, Default, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "PascalCase")] -pub struct SuperchainL1Info { - /// L1 chain ID - #[serde(rename = "ChainID")] - pub chain_id: u64, - /// L1 chain public RPC endpoint - #[serde(rename = "PublicRPC")] - pub public_rpc: String, - /// L1 chain explorer RPC endpoint - pub explorer: String, -} - -/// A list of Hydrated Superchain Configs. -#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Superchains { - /// A list of superchain configs. - pub superchains: Vec, -} - -/// The registry containing all the superchain configurations. -#[derive(Debug, Clone, Default, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct Registry { - /// The list of chains. - pub chains: Vec, - /// Map of chain IDs to their chain configuration. - pub op_chains: HashMap, - /// Map of chain IDs to their rollup configurations. - pub rollup_configs: HashMap, -} - -impl Registry { - /// Read the chain list. - pub fn read_chain_list() -> Vec { - let chain_list = include_str!("../etc/chainList.json"); - serde_json::from_str(chain_list).expect("Failed to read chain list") - } - - /// Read superchain configs. - pub fn read_superchain_configs() -> Superchains { - let superchain_configs = include_str!("../etc/configs.json"); - serde_json::from_str(superchain_configs).expect("Failed to read superchain configs") - } - - /// Initialize the superchain configurations from the chain list. - pub fn from_chain_list() -> Self { - let chains = Self::read_chain_list(); - let superchains = Self::read_superchain_configs(); - let mut op_chains = HashMap::default(); - let mut rollup_configs = HashMap::default(); - - for superchain in superchains.superchains { - for mut chain_config in superchain.chains { - chain_config.l1_chain_id = superchain.config.l1.chain_id; - if let Some(a) = &mut chain_config.addresses { - a.zero_proof_addresses(); - } - let mut rollup = chain_config.load_op_stack_rollup_config(); - rollup.protocol_versions_address = superchain - .config - .protocol_versions_addr - .expect("Missing protocol versions address"); - rollup.superchain_config_address = superchain.config.superchain_config_addr; - rollup_configs.insert(chain_config.chain_id, rollup); - op_chains.insert(chain_config.chain_id, chain_config); - } - } - - Self { chains, op_chains, rollup_configs } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_primitives::address; - use op_alloy_genesis::{AddressList, SuperchainLevel, OP_MAINNET_BASE_FEE_PARAMS}; - - #[test] - fn test_read_chain_configs() { - let superchains = Registry::from_chain_list(); - assert!(superchains.chains.len() > 1); - let base_config = ChainConfig { - name: String::from("Base"), - chain_id: 8453, - l1_chain_id: 1, - public_rpc: String::from("https://mainnet.base.org"), - sequencer_rpc: String::from("https://mainnet-sequencer.base.org"), - explorer: String::from("https://explorer.base.org"), - superchain_level: SuperchainLevel::Frontier, - standard_chain_candidate: true, - superchain_time: Some(0), - batch_inbox_addr: address!("ff00000000000000000000000000000000008453"), - superchain: String::from("mainnet"), - chain: String::new(), - hardfork_configuration: crate::test_utils::BASE_MAINNET_CONFIG.hardfork_config(), - block_time: 2, - seq_window_size: 3600, - max_sequencer_drift: 600, - data_availability_type: "eth-da".to_string(), - optimism: Some(OP_MAINNET_BASE_FEE_PARAMS), - alt_da: None, - genesis: crate::test_utils::BASE_MAINNET_CONFIG.genesis, - addresses: Some(AddressList { - address_manager: address!("8EfB6B5c4767B09Dc9AA6Af4eAA89F749522BaE2"), - l1_cross_domain_messenger_proxy: address!( - "866E82a600A1414e583f7F13623F1aC5d58b0Afa" - ), - l1_erc721_bridge_proxy: address!("608d94945A64503E642E6370Ec598e519a2C1E53"), - l1_standard_bridge_proxy: address!("3154Cf16ccdb4C6d922629664174b904d80F2C35"), - l2_output_oracle_proxy: Some(address!("56315b90c40730925ec5485cf004d835058518A0")), - optimism_mintable_erc20_factory_proxy: address!( - "05cc379EBD9B30BbA19C6fA282AB29218EC61D84" - ), - optimism_portal_proxy: address!("49048044D57e1C92A77f79988d21Fa8fAF74E97e"), - system_config_proxy: address!("73a79Fab69143498Ed3712e519A88a918e1f4072"), - system_config_owner: address!("14536667Cd30e52C0b458BaACcB9faDA7046E056"), - proxy_admin: address!("0475cBCAebd9CE8AfA5025828d5b98DFb67E059E"), - proxy_admin_owner: address!("7bB41C3008B3f03FE483B28b8DB90e19Cf07595c"), - challenger: Some(address!("6F8C5bA3F59ea3E76300E3BEcDC231D656017824")), - guardian: address!("09f7150d8c019bef34450d6920f6b3608cefdaf2"), - anchor_state_registry_proxy: Some(address!( - "db9091e48b1c42992a1213e6916184f9ebdbfedf" - )), - delayed_weth_proxy: Some(address!("a2f2ac6f5af72e494a227d79db20473cf7a1ffe8")), - dispute_game_factory_proxy: Some(address!( - "43edb88c4b80fdd2adff2412a7bebf9df42cb40e" - )), - fault_dispute_game: Some(address!("cd3c0194db74c23807d4b90a5181e1b28cf7007c")), - mips: Some(address!("16e83ce5ce29bf90ad9da06d2fe6a15d5f344ce4")), - permissioned_dispute_game: Some(address!( - "19009debf8954b610f207d5925eede827805986e" - )), - preimage_oracle: Some(address!("9c065e11870b891d214bc2da7ef1f9ddfa1be277")), - }), - gas_paying_token: None, - }; - assert_eq!(*superchains.op_chains.get(&8453).unwrap(), base_config); - } - - #[test] - fn test_read_rollup_configs() { - let superchains = Registry::from_chain_list(); - assert_eq!( - *superchains.rollup_configs.get(&10).unwrap(), - crate::test_utils::OP_MAINNET_CONFIG - ); - } -} diff --git a/crates/registry/src/test_utils/base_mainnet.rs b/crates/registry/src/test_utils/base_mainnet.rs deleted file mode 100644 index 4a07f949..00000000 --- a/crates/registry/src/test_utils/base_mainnet.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! Base Mainnet Rollup Config. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{address, b256, uint}; -use op_alloy_genesis::{ChainGenesis, RollupConfig, SystemConfig, OP_MAINNET_BASE_FEE_PARAMS}; - -/// The [RollupConfig] for Base Mainnet. -pub const BASE_MAINNET_CONFIG: RollupConfig = RollupConfig { - genesis: ChainGenesis { - l1: BlockNumHash { - hash: b256!("5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771"), - number: 17_481_768_u64, - }, - l2: BlockNumHash { - hash: b256!("f712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd"), - number: 0_u64, - }, - l2_time: 1686789347_u64, - system_config: Some(SystemConfig { - batcher_address: address!("5050f69a9786f081509234f1a7f4684b5e5b76c9"), - overhead: uint!(0xbc_U256), - scalar: uint!(0xa6fe0_U256), - gas_limit: 30_000_000_u64, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }), - }, - block_time: 2, - max_sequencer_drift: 600, - seq_window_size: 3600, - channel_timeout: 300, - granite_channel_timeout: 50, - l1_chain_id: 1, - l2_chain_id: 8453, - base_fee_params: OP_MAINNET_BASE_FEE_PARAMS.as_base_fee_params(), - canyon_base_fee_params: OP_MAINNET_BASE_FEE_PARAMS.as_canyon_base_fee_params(), - regolith_time: Some(0_u64), - canyon_time: Some(1704992401), - delta_time: Some(1708560000), - ecotone_time: Some(1710374401), - fjord_time: Some(1720627201), - granite_time: Some(1_726_070_401_u64), - holocene_time: None, - isthmus_time: None, - batch_inbox_address: address!("ff00000000000000000000000000000000008453"), - deposit_contract_address: address!("49048044d57e1c92a77f79988d21fa8faf74e97e"), - l1_system_config_address: address!("73a79fab69143498ed3712e519a88a918e1f4072"), - protocol_versions_address: address!("8062abc286f5e7d9428a0ccb9abd71e50d93b935"), - superchain_config_address: Some(address!("95703e0982140D16f8ebA6d158FccEde42f04a4C")), - da_challenge_address: None, - blobs_enabled_l1_timestamp: None, -}; diff --git a/crates/registry/src/test_utils/base_sepolia.rs b/crates/registry/src/test_utils/base_sepolia.rs deleted file mode 100644 index b70f94c4..00000000 --- a/crates/registry/src/test_utils/base_sepolia.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! Base Sepolia Rollup Config. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{address, b256, uint}; -use op_alloy_genesis::{ChainGenesis, RollupConfig, SystemConfig, BASE_SEPOLIA_BASE_FEE_PARAMS}; - -/// The [RollupConfig] for Base Sepolia. -pub const BASE_SEPOLIA_CONFIG: RollupConfig = RollupConfig { - genesis: ChainGenesis { - l1: BlockNumHash { - hash: b256!("cac9a83291d4dec146d6f7f69ab2304f23f5be87b1789119a0c5b1e4482444ed"), - number: 4370868, - }, - l2: BlockNumHash { - hash: b256!("0dcc9e089e30b90ddfc55be9a37dd15bc551aeee999d2e2b51414c54eaf934e4"), - number: 0, - }, - l2_time: 1695768288, - system_config: Some(SystemConfig { - batcher_address: address!("6cdebe940bc0f26850285caca097c11c33103e47"), - overhead: uint!(0x834_U256), - scalar: uint!(0xf4240_U256), - gas_limit: 25000000, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }), - }, - block_time: 2, - max_sequencer_drift: 600, - seq_window_size: 3600, - channel_timeout: 300, - granite_channel_timeout: 50, - l1_chain_id: 11155111, - l2_chain_id: 84532, - base_fee_params: BASE_SEPOLIA_BASE_FEE_PARAMS.as_base_fee_params(), - canyon_base_fee_params: BASE_SEPOLIA_BASE_FEE_PARAMS.as_canyon_base_fee_params(), - regolith_time: Some(0), - canyon_time: Some(1699981200), - delta_time: Some(1703203200), - ecotone_time: Some(1708534800), - fjord_time: Some(1716998400), - granite_time: Some(1723478400), - holocene_time: Some(1732633200), - isthmus_time: None, - batch_inbox_address: address!("ff00000000000000000000000000000000084532"), - deposit_contract_address: address!("49f53e41452c74589e85ca1677426ba426459e85"), - l1_system_config_address: address!("f272670eb55e895584501d564afeb048bed26194"), - protocol_versions_address: address!("79add5713b383daa0a138d3c4780c7a1804a8090"), - superchain_config_address: Some(address!("C2Be75506d5724086DEB7245bd260Cc9753911Be")), - da_challenge_address: None, - blobs_enabled_l1_timestamp: None, -}; diff --git a/crates/registry/src/test_utils/mod.rs b/crates/registry/src/test_utils/mod.rs deleted file mode 100644 index 3f18b58e..00000000 --- a/crates/registry/src/test_utils/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! Test-only module containing hardcoded configs for testing. - -mod op_mainnet; -pub use op_mainnet::OP_MAINNET_CONFIG; - -mod base_mainnet; -pub use base_mainnet::BASE_MAINNET_CONFIG; - -mod op_sepolia; -pub use op_sepolia::OP_SEPOLIA_CONFIG; - -mod base_sepolia; -pub use base_sepolia::BASE_SEPOLIA_CONFIG; diff --git a/crates/registry/src/test_utils/op_mainnet.rs b/crates/registry/src/test_utils/op_mainnet.rs deleted file mode 100644 index 00228d6c..00000000 --- a/crates/registry/src/test_utils/op_mainnet.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! OP Mainnet Rollup Config. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{address, b256, uint}; -use op_alloy_genesis::{ChainGenesis, RollupConfig, SystemConfig, OP_MAINNET_BASE_FEE_PARAMS}; - -/// The [RollupConfig] for OP Mainnet. -pub const OP_MAINNET_CONFIG: RollupConfig = RollupConfig { - genesis: ChainGenesis { - l1: BlockNumHash { - hash: b256!("438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108"), - number: 17_422_590_u64, - }, - l2: BlockNumHash { - hash: b256!("dbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3"), - number: 105_235_063_u64, - }, - l2_time: 1_686_068_903_u64, - system_config: Some(SystemConfig { - batcher_address: address!("6887246668a3b87f54deb3b94ba47a6f63f32985"), - overhead: uint!(0xbc_U256), - scalar: uint!(0xa6fe0_U256), - gas_limit: 30_000_000_u64, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }), - }, - block_time: 2_u64, - max_sequencer_drift: 600_u64, - seq_window_size: 3600_u64, - channel_timeout: 300_u64, - granite_channel_timeout: 50, - l1_chain_id: 1_u64, - l2_chain_id: 10_u64, - base_fee_params: OP_MAINNET_BASE_FEE_PARAMS.as_base_fee_params(), - canyon_base_fee_params: OP_MAINNET_BASE_FEE_PARAMS.as_canyon_base_fee_params(), - regolith_time: Some(0_u64), - canyon_time: Some(1_704_992_401_u64), - delta_time: Some(1_708_560_000_u64), - ecotone_time: Some(1_710_374_401_u64), - fjord_time: Some(1_720_627_201_u64), - granite_time: Some(1_726_070_401_u64), - holocene_time: None, - isthmus_time: None, - batch_inbox_address: address!("ff00000000000000000000000000000000000010"), - deposit_contract_address: address!("beb5fc579115071764c7423a4f12edde41f106ed"), - l1_system_config_address: address!("229047fed2591dbec1ef1118d64f7af3db9eb290"), - protocol_versions_address: address!("8062abc286f5e7d9428a0ccb9abd71e50d93b935"), - superchain_config_address: Some(address!("95703e0982140D16f8ebA6d158FccEde42f04a4C")), - da_challenge_address: None, - blobs_enabled_l1_timestamp: None, -}; diff --git a/crates/registry/src/test_utils/op_sepolia.rs b/crates/registry/src/test_utils/op_sepolia.rs deleted file mode 100644 index 08044223..00000000 --- a/crates/registry/src/test_utils/op_sepolia.rs +++ /dev/null @@ -1,54 +0,0 @@ -//! OP Sepolia Rollup Config. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{address, b256, uint}; -use op_alloy_genesis::{ChainGenesis, RollupConfig, SystemConfig, OP_SEPOLIA_BASE_FEE_PARAMS}; - -/// The [RollupConfig] for OP Sepolia. -pub const OP_SEPOLIA_CONFIG: RollupConfig = RollupConfig { - genesis: ChainGenesis { - l1: BlockNumHash { - hash: b256!("48f520cf4ddaf34c8336e6e490632ea3cf1e5e93b0b2bc6e917557e31845371b"), - number: 4071408, - }, - l2: BlockNumHash { - hash: b256!("102de6ffb001480cc9b8b548fd05c34cd4f46ae4aa91759393db90ea0409887d"), - number: 0, - }, - l2_time: 1691802540, - system_config: Some(SystemConfig { - batcher_address: address!("8f23bb38f531600e5d8fddaaec41f13fab46e98c"), - overhead: uint!(0xbc_U256), - scalar: uint!(0xa6fe0_U256), - gas_limit: 30_000_000, - base_fee_scalar: None, - blob_base_fee_scalar: None, - eip1559_denominator: None, - eip1559_elasticity: None, - }), - }, - block_time: 2, - max_sequencer_drift: 600, - seq_window_size: 3600, - channel_timeout: 300, - granite_channel_timeout: 50, - l1_chain_id: 11155111, - l2_chain_id: 11155420, - base_fee_params: OP_SEPOLIA_BASE_FEE_PARAMS.as_base_fee_params(), - canyon_base_fee_params: OP_SEPOLIA_BASE_FEE_PARAMS.as_canyon_base_fee_params(), - regolith_time: Some(0), - canyon_time: Some(1699981200), - delta_time: Some(1703203200), - ecotone_time: Some(1708534800), - fjord_time: Some(1716998400), - granite_time: Some(1723478400), - holocene_time: Some(1732633200), - isthmus_time: None, - batch_inbox_address: address!("ff00000000000000000000000000000011155420"), - deposit_contract_address: address!("16fc5058f25648194471939df75cf27a2fdc48bc"), - l1_system_config_address: address!("034edd2a225f7f429a63e0f1d2084b9e0a93b538"), - protocol_versions_address: address!("79add5713b383daa0a138d3c4780c7a1804a8090"), - superchain_config_address: Some(address!("C2Be75506d5724086DEB7245bd260Cc9753911Be")), - da_challenge_address: None, - blobs_enabled_l1_timestamp: None, -}; diff --git a/crates/registry/superchain-registry b/crates/registry/superchain-registry deleted file mode 160000 index 58ab8df7..00000000 --- a/crates/registry/superchain-registry +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 58ab8df79925126e6b2ad55daae74a3be7f8b1f3 diff --git a/crates/rpc-jsonrpsee/Cargo.toml b/crates/rpc-jsonrpsee/Cargo.toml deleted file mode 100644 index b6622913..00000000 --- a/crates/rpc-jsonrpsee/Cargo.toml +++ /dev/null @@ -1,38 +0,0 @@ -[package] -name = "op-alloy-rpc-jsonrpsee" -description = "Optimism RPC Client" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -authors.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Alloy -op-alloy-rpc-types.workspace = true -op-alloy-rpc-types-engine = { workspace = true, features = ["serde"] } -alloy-eips.workspace = true -alloy-primitives.workspace = true - -# rpc -jsonrpsee.workspace = true - -[features] -default = ["std"] -std = [ - "op-alloy-rpc-types/std", - "op-alloy-rpc-types-engine/std", - "alloy-eips/std", - "alloy-primitives/std", -] -client = [ - "jsonrpsee/client", - "jsonrpsee/async-client", -] diff --git a/crates/rpc-jsonrpsee/README.md b/crates/rpc-jsonrpsee/README.md deleted file mode 100644 index 6eb7eb9e..00000000 --- a/crates/rpc-jsonrpsee/README.md +++ /dev/null @@ -1,10 +0,0 @@ -## `op-alloy-rpc-jsonrpsee` - -CI -op-alloy-rpc-jsonrpsee crate -MIT License -Apache License -Book - - -Low-level Optimism JSON-RPC server and client implementations. diff --git a/crates/rpc-jsonrpsee/src/lib.rs b/crates/rpc-jsonrpsee/src/lib.rs deleted file mode 100644 index dd08fe38..00000000 --- a/crates/rpc-jsonrpsee/src/lib.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(feature = "std"), no_std)] - -extern crate alloc; - -pub mod traits; diff --git a/crates/rpc-jsonrpsee/src/traits.rs b/crates/rpc-jsonrpsee/src/traits.rs deleted file mode 100644 index 4fa14a53..00000000 --- a/crates/rpc-jsonrpsee/src/traits.rs +++ /dev/null @@ -1,149 +0,0 @@ -#![allow(missing_docs)] - -//! Rollup Node - -use alloc::{boxed::Box, string::String, vec::Vec}; -use core::net::IpAddr; - -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{B256, U64}; -use jsonrpsee::{core::RpcResult, proc_macros::rpc}; -use op_alloy_rpc_types::{ - OutputResponse, PeerDump, PeerInfo, PeerStats, RollupConfig, SafeHeadResponse, SyncStatus, -}; -use op_alloy_rpc_types_engine::{ProtocolVersion, SuperchainSignal}; - -/// Optimism specified rpc interface. -/// -/// https://docs.optimism.io/builders/node-operators/json-rpc -/// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/node/api.go#L114 -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "optimism"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "optimism"))] -pub trait RollupNode { - /// Get the output root at a specific block. - #[method(name = "outputAtBlock")] - async fn op_output_at_block(&self, block_number: BlockNumberOrTag) - -> RpcResult; - - /// Gets the safe head at an L1 block height. - #[method(name = "safeHeadAtL1Block")] - async fn op_safe_head_at_l1_block( - &self, - block_number: BlockNumberOrTag, - ) -> RpcResult; - - /// Get the synchronization status. - #[method(name = "syncStatus")] - async fn op_sync_status(&self) -> RpcResult; - - /// Get the rollup configuration parameters. - #[method(name = "rollupConfig")] - async fn op_rollup_config(&self) -> RpcResult; - - /// Get the software version. - #[method(name = "version")] - async fn op_version(&self) -> RpcResult; -} - -/// The opp2p namespace handles peer interactions. -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "opp2p"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "opp2p"))] -pub trait OpP2PApi { - /// Returns information of node - #[method(name = "self")] - async fn opp2p_self(&self) -> RpcResult; - - #[method(name = "peers")] - async fn opp2p_peers(&self) -> RpcResult; - - #[method(name = "peerStats")] - async fn opp2p_peer_stats(&self) -> RpcResult; - - #[method(name = "discoveryTable")] - async fn opp2p_discovery_table(&self) -> RpcResult>; - - #[method(name = "blockPeer")] - async fn opp2p_block_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "listBlockedPeers")] - async fn opp2p_list_blocked_peers(&self) -> RpcResult>; - - #[method(name = "blocAddr")] - async fn opp2p_block_addr(&self, ip: IpAddr) -> RpcResult<()>; - - #[method(name = "unblockAddr")] - async fn opp2p_unblock_addr(&self, ip: IpAddr) -> RpcResult<()>; - - #[method(name = "listBlockedAddrs")] - async fn opp2p_list_blocked_addrs(&self) -> RpcResult>; - - /// todo: should be IPNet? - #[method(name = "blockSubnet")] - async fn opp2p_block_subnet(&self, subnet: String) -> RpcResult<()>; - - /// todo: should be IPNet? - #[method(name = "unblockSubnet")] - async fn opp2p_unblock_subnet(&self, subnet: String) -> RpcResult<()>; - - /// todo: should be IPNet? - #[method(name = "listBlockedSubnets")] - async fn opp2p_list_blocked_subnets(&self) -> RpcResult>; - - #[method(name = "protectPeer")] - async fn opp2p_protect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "unprotectPeer")] - async fn opp2p_unprotect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "connectPeer")] - async fn opp2p_connect_peer(&self, peer: String) -> RpcResult<()>; - - #[method(name = "disconnectPeer")] - async fn opp2p_disconnect_peer(&self, peer: String) -> RpcResult<()>; -} - -/// The admin namespace endpoints -/// https://github.com/ethereum-optimism/optimism/blob/c7ad0ebae5dca3bf8aa6f219367a95c15a15ae41/op-node/node/api.go#L28-L36 -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "admin"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "admin"))] -pub trait OpAdminApi { - #[method(name = "resetDerivationPipeline")] - async fn admin_reset_derivation_pipeline(&self) -> RpcResult<()>; - - #[method(name = "startSequencer")] - async fn admin_start_sequencer(&self, block_hash: B256) -> RpcResult<()>; - - #[method(name = "stopSequencer")] - async fn admin_stop_sequencer(&self) -> RpcResult; - - #[method(name = "sequencerActive")] - async fn admin_sequencer_active(&self) -> RpcResult; -} - -/// Engine API extension for Optimism superchain signaling -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "engine"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "engine"))] -pub trait EngineApiExt { - /// Signal superchain v1 message - /// - /// The execution engine SHOULD warn when the recommended version is newer than the current - /// version. The execution engine SHOULD take safety precautions if it does not meet - /// the required version. - /// - /// # Returns - /// The latest supported OP-Stack protocol version of the execution engine. - /// - /// See: - #[method(name = "signalSuperchainV1")] - async fn signal_superchain_v1(&self, signal: SuperchainSignal) -> RpcResult; -} - -/// Op API extension for controlling the miner. -#[cfg_attr(not(feature = "client"), rpc(server, namespace = "miner"))] -#[cfg_attr(feature = "client", rpc(server, client, namespace = "miner"))] -pub trait MinerApiExt { - /// Sets the maximum data availability size of any tx allowed in a block, and the total max l1 - /// data size of the block. 0 means no maximum. - #[method(name = "setMaxDASize")] - async fn set_max_da_size(&self, max_tx_size: U64, max_block_size: U64) -> RpcResult; -} diff --git a/crates/rpc-types-engine/Cargo.toml b/crates/rpc-types-engine/Cargo.toml deleted file mode 100644 index 40743c4b..00000000 --- a/crates/rpc-types-engine/Cargo.toml +++ /dev/null @@ -1,68 +0,0 @@ -[package] -name = "op-alloy-rpc-types-engine" -description = "Optimism RPC types for the `engine` namespace" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -authors.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Workspace -op-alloy-consensus.workspace = true -op-alloy-protocol.workspace = true - -# Alloy -alloy-primitives.workspace = true -alloy-eips.workspace = true -alloy-rpc-types-engine.workspace = true - -# Encoding -snap = { workspace = true, optional = true } -ethereum_ssz = { workspace = true, optional = true } - -# serde -serde = { workspace = true, optional = true } -alloy-serde = { workspace = true, optional = true } - -# misc -thiserror.workspace = true -derive_more = { workspace = true, features = ["display"] } -arbitrary = { workspace = true, features = ["derive"], optional = true } - -[dev-dependencies] -arbtest.workspace = true -serde_json.workspace = true -arbitrary = { workspace = true, features = ["derive"] } -alloy-primitives = { workspace = true, features = ["arbitrary"] } - -[features] -default = ["std", "serde"] -std = [ - "dep:snap", - "dep:ethereum_ssz", - "alloy-rpc-types-engine/ssz", - "alloy-primitives/std", - "alloy-rpc-types-engine/std", - "op-alloy-consensus/std", - "op-alloy-protocol/std", -] -serde = [ - "dep:serde", - "dep:alloy-serde", - "op-alloy-protocol/serde", - "alloy-rpc-types-engine/serde", -] -arbitrary = [ - "std", - "dep:arbitrary", - "alloy-primitives/arbitrary", - "alloy-primitives/rand", -] diff --git a/crates/rpc-types-engine/README.md b/crates/rpc-types-engine/README.md deleted file mode 100644 index 9a0a84f0..00000000 --- a/crates/rpc-types-engine/README.md +++ /dev/null @@ -1,10 +0,0 @@ -## `op-alloy-rpc-types-engine` - -CI -op-alloy-rpc-types-engine crate -MIT License -Apache License -Book - - -Optimism RPC types for the `engine` namespace. diff --git a/crates/rpc-types-engine/src/attributes.rs b/crates/rpc-types-engine/src/attributes.rs deleted file mode 100644 index 3f90e7e5..00000000 --- a/crates/rpc-types-engine/src/attributes.rs +++ /dev/null @@ -1,164 +0,0 @@ -//! Optimism-specific payload attributes. - -use alloc::vec::Vec; -use alloy_eips::eip1559::BaseFeeParams; -use alloy_primitives::{Bytes, B64}; -use alloy_rpc_types_engine::PayloadAttributes; -use op_alloy_consensus::{decode_eip_1559_params, encode_holocene_extra_data, EIP1559ParamError}; -use op_alloy_protocol::L2BlockInfo; - -/// Optimism Payload Attributes -#[derive(Clone, Debug, Default, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct OpPayloadAttributes { - /// The payload attributes - #[cfg_attr(feature = "serde", serde(flatten))] - pub payload_attributes: PayloadAttributes, - /// Transactions is a field for rollups: the transactions list is forced into the block - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub transactions: Option>, - /// If true, the no transactions are taken out of the tx-pool, only transactions from the above - /// Transactions list will be included. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub no_tx_pool: Option, - /// If set, this sets the exact gas limit the block produced with. - #[cfg_attr( - feature = "serde", - serde(skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt") - )] - pub gas_limit: Option, - /// If set, this sets the EIP-1559 parameters for the block. - /// - /// Prior to Holocene activation, this field should always be [None]. - #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] - pub eip_1559_params: Option, -} - -impl OpPayloadAttributes { - /// Encodes the `eip1559` parameters for the payload. - pub fn get_holocene_extra_data( - &self, - default_base_fee_params: BaseFeeParams, - ) -> Result { - self.eip_1559_params - .map(|params| encode_holocene_extra_data(params, default_base_fee_params)) - .ok_or(EIP1559ParamError::NoEIP1559Params)? - } - - /// Extracts the Holocene 1599 parameters from the encoded form: - /// - /// - /// Returns (`elasticity`, `denominator`) - pub fn decode_eip_1559_params(&self) -> Option<(u32, u32)> { - self.eip_1559_params.map(decode_eip_1559_params) - } -} - -/// Optimism Payload Attributes with parent block reference. -#[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct OpAttributesWithParent { - /// The payload attributes. - pub attributes: OpPayloadAttributes, - /// The parent block reference. - pub parent: L2BlockInfo, - /// Whether the current batch is the last in its span. - pub is_last_in_span: bool, -} - -impl OpAttributesWithParent { - /// Create a new [OpAttributesWithParent] instance. - pub const fn new( - attributes: OpPayloadAttributes, - parent: L2BlockInfo, - is_last_in_span: bool, - ) -> Self { - Self { attributes, parent, is_last_in_span } - } - - /// Returns the payload attributes. - pub const fn attributes(&self) -> &OpPayloadAttributes { - &self.attributes - } - - /// Returns the parent block reference. - pub const fn parent(&self) -> &L2BlockInfo { - &self.parent - } - - /// Returns whether the current batch is the last in its span. - pub const fn is_last_in_span(&self) -> bool { - self.is_last_in_span - } -} - -#[cfg(all(test, feature = "serde"))] -mod test { - use super::*; - use alloy_primitives::{b64, Address, B256}; - use alloy_rpc_types_engine::PayloadAttributes; - use core::str::FromStr; - - #[test] - fn test_serde_roundtrip_attributes_pre_holocene() { - let attributes = OpPayloadAttributes { - payload_attributes: PayloadAttributes { - timestamp: 0x1337, - prev_randao: B256::ZERO, - suggested_fee_recipient: Address::ZERO, - withdrawals: Default::default(), - parent_beacon_block_root: Some(B256::ZERO), - }, - transactions: Some(vec![b"hello".to_vec().into()]), - no_tx_pool: Some(true), - gas_limit: Some(42), - eip_1559_params: None, - }; - - let ser = serde_json::to_string(&attributes).unwrap(); - let de: OpPayloadAttributes = serde_json::from_str(&ser).unwrap(); - - assert_eq!(attributes, de); - } - - #[test] - fn test_serde_roundtrip_attributes_post_holocene() { - let attributes = OpPayloadAttributes { - payload_attributes: PayloadAttributes { - timestamp: 0x1337, - prev_randao: B256::ZERO, - suggested_fee_recipient: Address::ZERO, - withdrawals: Default::default(), - parent_beacon_block_root: Some(B256::ZERO), - }, - transactions: Some(vec![b"hello".to_vec().into()]), - no_tx_pool: Some(true), - gas_limit: Some(42), - eip_1559_params: Some(b64!("0000dead0000beef")), - }; - - let ser = serde_json::to_string(&attributes).unwrap(); - let de: OpPayloadAttributes = serde_json::from_str(&ser).unwrap(); - - assert_eq!(attributes, de); - } - - #[test] - fn test_get_extra_data_post_holocene() { - let attributes = OpPayloadAttributes { - eip_1559_params: Some(B64::from_str("0x0000000800000008").unwrap()), - ..Default::default() - }; - let extra_data = attributes.get_holocene_extra_data(BaseFeeParams::new(80, 60)); - assert_eq!(extra_data.unwrap(), Bytes::copy_from_slice(&[0, 0, 0, 0, 8, 0, 0, 0, 8])); - } - - #[test] - fn test_get_extra_data_post_holocene_default() { - let attributes = - OpPayloadAttributes { eip_1559_params: Some(B64::ZERO), ..Default::default() }; - let extra_data = attributes.get_holocene_extra_data(BaseFeeParams::new(80, 60)); - assert_eq!(extra_data.unwrap(), Bytes::copy_from_slice(&[0, 0, 0, 0, 80, 0, 0, 0, 60])); - } -} diff --git a/crates/rpc-types-engine/src/envelope.rs b/crates/rpc-types-engine/src/envelope.rs deleted file mode 100644 index a05ac599..00000000 --- a/crates/rpc-types-engine/src/envelope.rs +++ /dev/null @@ -1,213 +0,0 @@ -//! Optimism execution payload envelope in network format and related types. -//! -//! This module uses the `snappy` compression algorithm to decompress the payload. -//! The license for snappy can be found in the `SNAPPY-LICENSE` at the root of the repository. - -use alloy_primitives::{keccak256, PrimitiveSignature as Signature, B256}; -use alloy_rpc_types_engine::ExecutionPayload; - -/// Optimism execution payload envelope in network format. -/// -/// This struct is used to represent payloads that are sent over the Optimism -/// CL p2p network in a snappy-compressed format. -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct OpNetworkPayloadEnvelope { - /// The execution payload. - pub payload: ExecutionPayload, - /// A signature for the payload. - pub signature: Signature, - /// The hash of the payload. - pub payload_hash: PayloadHash, - /// The parent beacon block root. - pub parent_beacon_block_root: Option, -} - -impl OpNetworkPayloadEnvelope { - /// Decode a payload envelope from a snappy-compressed byte array. - /// The payload version decoded is `ExecutionPayloadV1` from SSZ bytes. - #[cfg(feature = "std")] - pub fn decode_v1(data: &[u8]) -> Result { - use ssz::Decode; - let mut decoder = snap::raw::Decoder::new(); - let decompressed = decoder.decompress_vec(data)?; - - if decompressed.len() < 66 { - return Err(PayloadEnvelopeError::InvalidLength); - } - - let sig_data = &decompressed[..65]; - let block_data = &decompressed[65..]; - - let signature = Signature::try_from(sig_data)?; - let hash = PayloadHash::from(block_data); - - let payload = ExecutionPayload::from( - alloy_rpc_types_engine::ExecutionPayloadV1::from_ssz_bytes(block_data)?, - ); - - Ok(Self { payload, signature, payload_hash: hash, parent_beacon_block_root: None }) - } - - /// Decode a payload envelope from a snappy-compressed byte array. - /// The payload version decoded is `ExecutionPayloadV2` from SSZ bytes. - #[cfg(feature = "std")] - pub fn decode_v2(data: &[u8]) -> Result { - use ssz::Decode; - let mut decoder = snap::raw::Decoder::new(); - let decompressed = decoder.decompress_vec(data)?; - - if decompressed.len() < 66 { - return Err(PayloadEnvelopeError::InvalidLength); - } - - let sig_data = &decompressed[..65]; - let block_data = &decompressed[65..]; - - let signature = Signature::try_from(sig_data)?; - let hash = PayloadHash::from(block_data); - - let payload = ExecutionPayload::from( - alloy_rpc_types_engine::ExecutionPayloadV2::from_ssz_bytes(block_data)?, - ); - - Ok(Self { payload, signature, payload_hash: hash, parent_beacon_block_root: None }) - } - - /// Decode a payload envelope from a snappy-compressed byte array. - /// The payload version decoded is `ExecutionPayloadV3` from SSZ bytes. - #[cfg(feature = "std")] - pub fn decode_v3(data: &[u8]) -> Result { - use ssz::Decode; - let mut decoder = snap::raw::Decoder::new(); - let decompressed = decoder.decompress_vec(data)?; - - if decompressed.len() < 98 { - return Err(PayloadEnvelopeError::InvalidLength); - } - - let sig_data = &decompressed[..65]; - let parent_beacon_block_root = &decompressed[65..97]; - let block_data = &decompressed[97..]; - - let signature = Signature::try_from(sig_data)?; - let parent_beacon_block_root = Some(B256::from_slice(parent_beacon_block_root)); - let hash = PayloadHash::from(block_data); - - let payload = ExecutionPayload::from( - alloy_rpc_types_engine::ExecutionPayloadV3::from_ssz_bytes(block_data)?, - ); - - Ok(Self { payload, signature, payload_hash: hash, parent_beacon_block_root }) - } -} - -/// Errors that can occur when decoding a payload envelope. -#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)] -pub enum PayloadEnvelopeError { - /// The snappy encoding is broken. - #[error("Broken snappy encoding")] - BrokenSnappyEncoding, - /// The signature is invalid. - #[error("Invalid signature")] - InvalidSignature, - /// The SSZ encoding is broken. - #[error("Broken SSZ encoding")] - BrokenSszEncoding, - /// The payload envelope is of invalid length. - #[error("Invalid length")] - InvalidLength, -} - -impl From for PayloadEnvelopeError { - fn from(_: alloy_primitives::SignatureError) -> Self { - Self::InvalidSignature - } -} - -#[cfg(feature = "std")] -impl From for PayloadEnvelopeError { - fn from(_: snap::Error) -> Self { - Self::BrokenSnappyEncoding - } -} - -#[cfg(feature = "std")] -impl From for PayloadEnvelopeError { - fn from(_: ssz::DecodeError) -> Self { - Self::BrokenSszEncoding - } -} - -/// Represents the Keccak256 hash of the block -#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] -#[cfg_attr(any(test, feature = "arbitrary"), derive(arbitrary::Arbitrary))] -pub struct PayloadHash(pub B256); - -impl From<&[u8]> for PayloadHash { - /// Returns the Keccak256 hash of a sequence of bytes - fn from(value: &[u8]) -> Self { - Self(keccak256(value)) - } -} - -impl PayloadHash { - /// The expected message that should be signed by the unsafe block signer. - pub fn signature_message(&self, chain_id: u64) -> B256 { - let domain = B256::ZERO.as_slice(); - let chain_id = B256::left_padding_from(&chain_id.to_be_bytes()[..]); - let payload_hash = self.0.as_slice(); - keccak256([domain, chain_id.as_slice(), payload_hash].concat()) - } -} - -#[cfg(test)] -mod tests { - use super::*; - use alloy_primitives::b256; - - #[test] - fn test_signature_message() { - let inner = b256!("9999999999999999999999999999999999999999999999999999999999999999"); - let hash = PayloadHash::from(inner.as_slice()); - let chain_id = 10; - let expected = b256!("44a0e2b1aba1aae1771eddae1dcd2ad18a8cdac8891517153f03253e49d3f206"); - assert_eq!(hash.signature_message(chain_id), expected); - } - - #[test] - fn test_inner_payload_hash() { - arbtest::arbtest(|u| { - let inner = B256::from(u.arbitrary::<[u8; 32]>()?); - let hash = PayloadHash::from(inner.as_slice()); - assert_eq!(hash.0, keccak256(inner.as_slice())); - Ok(()) - }); - } - - #[test] - #[cfg(feature = "std")] - fn decode_payload_v1() { - use alloy_primitives::hex; - let data = hex::decode("0xbd04f043128457c6ccf35128497167442bcc0f8cce78cda8b366e6a12e526d938d1e4c1046acffffbfc542a7e212bb7d80d3a4b2f84f7b196d935398a24eb84c519789b401000000fe0300fe0300fe0300fe0300fe0300fe0300a203000c4a8fd56621ad04fc0101067601008ce60be0005b220117c32c0f3b394b346c2aa42cfa8157cd41f891aa0bec485a62fc010000").unwrap(); - let payload_envelop = OpNetworkPayloadEnvelope::decode_v1(&data).unwrap(); - assert_eq!(1725271882, payload_envelop.payload.timestamp()); - } - - #[test] - #[cfg(feature = "std")] - fn decode_payload_v2() { - use alloy_primitives::hex; - let data = hex::decode("0xc104f0433805080eb36c0b130a7cc1dc74c3f721af4e249aa6f61bb89d1557143e971bb738a3f3b98df7c457e74048e9d2d7e5cd82bb45e3760467e2270e9db86d1271a700000000fe0300fe0300fe0300fe0300fe0300fe0300a203000c6b89d46525ad000205067201009cda69cb5b9b73fc4eb2458b37d37f04ff507fe6c9cd2ab704a05ea9dae3cd61760002000000020000").unwrap(); - let payload_envelop = OpNetworkPayloadEnvelope::decode_v2(&data).unwrap(); - assert_eq!(1708427627, payload_envelop.payload.timestamp()); - } - - #[test] - #[cfg(feature = "std")] - fn decode_payload_v3() { - use alloy_primitives::hex; - let data = hex::decode("0xf104f0434442b9eb38b259f5b23826e6b623e829d2fb878dac70187a1aecf42a3f9bedfd29793d1fcb5822324be0d3e12340a95855553a65d64b83e5579dffb31470df5d010000006a03000412346a1d00fe0100fe0100fe0100fe0100fe0100fe01004201000cc588d465219504100201067601007cfece77b89685f60e3663b6e0faf2de0734674eb91339700c4858c773a8ff921e014401043e0100").unwrap(); - let payload_envelop = OpNetworkPayloadEnvelope::decode_v3(&data).unwrap(); - assert_eq!(1708427461, payload_envelop.payload.timestamp()); - } -} diff --git a/crates/rpc-types-engine/src/lib.rs b/crates/rpc-types-engine/src/lib.rs deleted file mode 100644 index fe13334a..00000000 --- a/crates/rpc-types-engine/src/lib.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -extern crate alloc; - -pub use alloy_rpc_types_engine::ForkchoiceUpdateVersion; - -mod attributes; -pub use attributes::{OpAttributesWithParent, OpPayloadAttributes}; - -mod envelope; -pub use envelope::{OpNetworkPayloadEnvelope, PayloadEnvelopeError, PayloadHash}; - -mod payload_v3; -pub use payload_v3::OpExecutionPayloadEnvelopeV3; - -mod payload_v4; -pub use payload_v4::OpExecutionPayloadEnvelopeV4; - -mod superchain; -pub use superchain::{ - ProtocolVersion, ProtocolVersionError, ProtocolVersionFormatV0, SuperchainSignal, -}; diff --git a/crates/rpc-types-engine/src/payload_v3.rs b/crates/rpc-types-engine/src/payload_v3.rs deleted file mode 100644 index e747acd0..00000000 --- a/crates/rpc-types-engine/src/payload_v3.rs +++ /dev/null @@ -1,41 +0,0 @@ -//! Optimism execution payload envelope V3. - -use alloy_primitives::{B256, U256}; -use alloy_rpc_types_engine::{BlobsBundleV1, ExecutionPayloadV3}; - -/// This structure maps for the return value of `engine_getPayload` of the beacon chain spec, for -/// V3. -/// -/// See also: -/// [Optimism execution payload envelope v3] -#[derive(Clone, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct OpExecutionPayloadEnvelopeV3 { - /// Execution payload V3 - pub execution_payload: ExecutionPayloadV3, - /// The expected value to be received by the feeRecipient in wei - pub block_value: U256, - /// The blobs, commitments, and proofs associated with the executed payload. - pub blobs_bundle: BlobsBundleV1, - /// Introduced in V3, this represents a suggestion from the execution layer if the payload - /// should be used instead of an externally provided one. - pub should_override_builder: bool, - /// Ecotone parent beacon block root - pub parent_beacon_block_root: B256, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - #[cfg(feature = "serde")] - fn serde_roundtrip_execution_payload_envelope_v3() { - // pulled from a geth response getPayloadV3 in hive tests, modified to add a mock parent - // beacon block root. - let response = r#"{"executionPayload":{"parentHash":"0xe927a1448525fb5d32cb50ee1408461a945ba6c39bd5cf5621407d500ecc8de9","feeRecipient":"0x0000000000000000000000000000000000000000","stateRoot":"0x10f8a0830000e8edef6d00cc727ff833f064b1950afd591ae41357f97e543119","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","prevRandao":"0xe0d8b4521a7da1582a713244ffb6a86aa1726932087386e2dc7973f43fc6cb24","blockNumber":"0x1","gasLimit":"0x2ffbd2","gasUsed":"0x0","timestamp":"0x1235","extraData":"0xd883010d00846765746888676f312e32312e30856c696e7578","baseFeePerGas":"0x342770c0","blockHash":"0x44d0fa5f2f73a938ebb96a2a21679eb8dea3e7b7dd8fd9f35aa756dda8bf0a8a","transactions":[],"withdrawals":[],"blobGasUsed":"0x0","excessBlobGas":"0x0"},"blockValue":"0x0","blobsBundle":{"commitments":[],"proofs":[],"blobs":[]},"shouldOverrideBuilder":false,"parentBeaconBlockRoot":"0xdead00000000000000000000000000000000000000000000000000000000beef"}"#; - let envelope: OpExecutionPayloadEnvelopeV3 = serde_json::from_str(response).unwrap(); - assert_eq!(serde_json::to_string(&envelope).unwrap(), response); - } -} diff --git a/crates/rpc-types-engine/src/payload_v4.rs b/crates/rpc-types-engine/src/payload_v4.rs deleted file mode 100644 index a9e0db8d..00000000 --- a/crates/rpc-types-engine/src/payload_v4.rs +++ /dev/null @@ -1,46 +0,0 @@ -//! Optimism execution payload envelope V3. - -use alloc::vec::Vec; -use alloy_primitives::{Bytes, B256, U256}; -use alloy_rpc_types_engine::{BlobsBundleV1, ExecutionPayloadV3}; - -/// This structure maps for the return value of `engine_getPayload` of the beacon chain spec, for -/// V4. -/// -/// See also: -/// [Optimism execution payload envelope v4] -#[derive(Clone, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct OpExecutionPayloadEnvelopeV4 { - /// Execution payload V4 - pub execution_payload: ExecutionPayloadV3, - /// The expected value to be received by the feeRecipient in wei - pub block_value: U256, - /// The blobs, commitments, and proofs associated with the executed payload. - pub blobs_bundle: BlobsBundleV1, - /// Introduced in V3, this represents a suggestion from the execution layer if the payload - /// should be used instead of an externally provided one. - pub should_override_builder: bool, - /// Ecotone parent beacon block root - pub parent_beacon_block_root: B256, - /// A list of opaque [EIP-7685][eip7685] requests. - /// - /// [eip7685]: https://eips.ethereum.org/EIPS/eip-7685 - pub execution_requests: Vec, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - #[cfg(feature = "serde")] - fn serde_roundtrip_execution_payload_envelope_v4() { - // modified execution payload envelope v3 with empty deposit, withdrawal, and consolidation - // requests. - let response = r#"{"executionPayload":{"parentHash":"0xe927a1448525fb5d32cb50ee1408461a945ba6c39bd5cf5621407d500ecc8de9","feeRecipient":"0x0000000000000000000000000000000000000000","stateRoot":"0x10f8a0830000e8edef6d00cc727ff833f064b1950afd591ae41357f97e543119","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","prevRandao":"0xe0d8b4521a7da1582a713244ffb6a86aa1726932087386e2dc7973f43fc6cb24","blockNumber":"0x1","gasLimit":"0x2ffbd2","gasUsed":"0x0","timestamp":"0x1235","extraData":"0xd883010d00846765746888676f312e32312e30856c696e7578","baseFeePerGas":"0x342770c0","blockHash":"0x44d0fa5f2f73a938ebb96a2a21679eb8dea3e7b7dd8fd9f35aa756dda8bf0a8a","transactions":[],"withdrawals":[],"blobGasUsed":"0x0","excessBlobGas":"0x0"},"blockValue":"0x0","blobsBundle":{"commitments":[],"proofs":[],"blobs":[]},"shouldOverrideBuilder":false,"parentBeaconBlockRoot":"0xdead00000000000000000000000000000000000000000000000000000000beef","executionRequests":["0xdeadbeef"]}"#; - let envelope: OpExecutionPayloadEnvelopeV4 = serde_json::from_str(response).unwrap(); - assert_eq!(serde_json::to_string(&envelope).unwrap(), response); - } -} diff --git a/crates/rpc-types-engine/src/superchain.rs b/crates/rpc-types-engine/src/superchain.rs deleted file mode 100644 index 044ec13e..00000000 --- a/crates/rpc-types-engine/src/superchain.rs +++ /dev/null @@ -1,410 +0,0 @@ -use alloc::{ - format, - string::{String, ToString}, -}; -use core::array::TryFromSliceError; - -use alloy_primitives::{B256, B64}; -use derive_more::derive::{Display, From}; - -/// Superchain Signal information. -/// -/// The execution engine SHOULD warn the user when the recommended version is newer than the current -/// version supported by the execution engine. -/// -/// The execution engine SHOULD take safety precautions if it does not meet the required protocol -/// version. This may include halting the engine, with consent of the execution engine operator. -/// -/// See also: -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] -pub struct SuperchainSignal { - /// The recommended Supercain Protocol Version. - pub recommended: ProtocolVersion, - /// The minimum Supercain Protocol Version required. - pub required: ProtocolVersion, -} - -/// Formatted Superchain Protocol Version. -/// -/// The Protocol Version documents the progression of the total set of canonical OP-Stack -/// specifications. Components of the OP-Stack implement the subset of their respective protocol -/// component domain, up to a given Protocol Version of the OP-Stack. -/// -/// The Protocol Version **is NOT a hardfork identifier**, but rather indicates software-support for -/// a well-defined set of features introduced in past and future hardforks, not the activation of -/// said hardforks. -/// -/// The Protocol Version is Semver-compatible. It is encoded as a single 32 bytes long -/// protocol version. The version must be encoded as 32 bytes of DATA in JSON RPC usage. -/// -/// See also: -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -#[non_exhaustive] -pub enum ProtocolVersion { - /// Version-type 0. - V0(ProtocolVersionFormatV0), -} - -impl core::fmt::Display for ProtocolVersion { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - match self { - Self::V0(value) => write!(f, "{}", value), - } - } -} - -/// An error that can occur when encoding or decoding a ProtocolVersion. -#[derive(Copy, Clone, Debug, Display, From)] -pub enum ProtocolVersionError { - /// An unsupported version was encountered. - #[display("Unsupported version: {_0}")] - UnsupportedVersion(u8), - /// An invalid length was encountered. - #[display("Invalid length: got {}, expected {}", got, expected)] - InvalidLength { - /// The length that was encountered. - got: usize, - /// The expected length. - expected: usize, - }, - /// Failed to convert slice to array. - #[display("Failed to convert slice to array")] - #[from(TryFromSliceError)] - TryFromSlice, -} - -impl ProtocolVersion { - /// Version-type 0 byte encoding: - /// - /// ```text - /// ::= - /// ::= - /// ::= <31 bytes> - /// ``` - pub fn encode(&self) -> B256 { - let mut bytes = [0u8; 32]; - - match self { - Self::V0(value) => { - bytes[0] = 0x00; // this is not necessary, but addded for clarity - bytes[1..].copy_from_slice(&value.encode()); - B256::from_slice(&bytes) - } - } - } - - /// Version-type 0 byte decoding: - /// - /// ```text - /// ::= - /// ::= - /// ::= <31 bytes> - /// ``` - pub fn decode(value: B256) -> Result { - let version_type = value[0]; - let typed_payload = &value[1..]; - - match version_type { - 0 => Ok(Self::V0(ProtocolVersionFormatV0::decode(typed_payload)?)), - other => Err(ProtocolVersionError::UnsupportedVersion(other)), - } - } - - /// Returns the inner value of the ProtocolVersion enum - pub const fn inner(&self) -> ProtocolVersionFormatV0 { - match self { - Self::V0(value) => *value, - } - } - - /// Returns the inner value of the ProtocolVersion enum if it is V0, otherwise None - pub const fn as_v0(&self) -> Option { - match self { - Self::V0(value) => Some(*value), - } - } - - /// Differentiates forks and custom-builds of standard protocol - pub const fn build(&self) -> B64 { - match self { - Self::V0(value) => value.build, - } - } - - /// Incompatible API changes - pub const fn major(&self) -> u32 { - match self { - Self::V0(value) => value.major, - } - } - - /// Identifies additional functionality in backwards compatible manner - pub const fn minor(&self) -> u32 { - match self { - Self::V0(value) => value.minor, - } - } - - /// Identifies backward-compatible bug-fixes - pub const fn patch(&self) -> u32 { - match self { - Self::V0(value) => value.patch, - } - } - - /// Identifies unstable versions that may not satisfy the above - pub const fn pre_release(&self) -> u32 { - match self { - Self::V0(value) => value.pre_release, - } - } - - /// Returns a human-readable string representation of the ProtocolVersion - pub fn display(&self) -> String { - match self { - Self::V0(value) => format!("{}", value), - } - } -} - -#[cfg(feature = "serde")] -impl serde::Serialize for ProtocolVersion { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - self.encode().serialize(serializer) - } -} - -#[cfg(feature = "serde")] -impl<'de> serde::Deserialize<'de> for ProtocolVersion { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let value = alloy_primitives::B256::deserialize(deserializer)?; - Self::decode(value).map_err(serde::de::Error::custom) - } -} - -/// The Protocol Version V0 format. -/// Encoded as 31 bytes with the following structure: -/// -/// ```text -/// -/// ::= <7 zeroed bytes> -/// ::= <8 bytes> -/// ::= -/// ::= -/// ::= -/// ::= -/// ``` -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct ProtocolVersionFormatV0 { - /// Differentiates forks and custom-builds of standard protocol - pub build: B64, - /// Incompatible API changes - pub major: u32, - /// Identifies additional functionality in backwards compatible manner - pub minor: u32, - /// Identifies backward-compatible bug-fixes - pub patch: u32, - /// Identifies unstable versions that may not satisfy the above - pub pre_release: u32, -} - -impl core::fmt::Display for ProtocolVersionFormatV0 { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - let build_tag = if self.build.0.iter().any(|&byte| byte != 0) { - if is_human_readable_build_tag(self.build) { - let full = format!("+{}", String::from_utf8_lossy(&self.build.0)); - full.trim_end_matches('\0').to_string() - } else { - format!("+{}", self.build) - } - } else { - String::new() - }; - - let pre_release_tag = - if self.pre_release != 0 { format!("-{}", self.pre_release) } else { String::new() }; - - write!(f, "v{}.{}.{}{}{}", self.major, self.minor, self.patch, pre_release_tag, build_tag) - } -} - -impl ProtocolVersionFormatV0 { - /// Version-type 0 byte encoding: - /// - /// ```text - /// - /// ::= <7 zeroed bytes> - /// ::= <8 bytes> - /// ::= - /// ::= - /// ::= - /// ::= - /// ``` - pub fn encode(&self) -> [u8; 31] { - let mut bytes = [0u8; 31]; - bytes[0..7].copy_from_slice(&[0u8; 7]); - bytes[7..15].copy_from_slice(&self.build.0); - bytes[15..19].copy_from_slice(&self.major.to_be_bytes()); - bytes[19..23].copy_from_slice(&self.minor.to_be_bytes()); - bytes[23..27].copy_from_slice(&self.patch.to_be_bytes()); - bytes[27..31].copy_from_slice(&self.pre_release.to_be_bytes()); - bytes - } - - /// Version-type 0 byte encoding: - /// - /// ```text - /// - /// ::= <7 zeroed bytes> - /// ::= <8 bytes> - /// ::= - /// ::= - /// ::= - /// ::= - /// ``` - fn decode(value: &[u8]) -> Result { - if value.len() != 31 { - return Err(ProtocolVersionError::InvalidLength { got: value.len(), expected: 31 }); - } - - Ok(Self { - build: B64::from_slice(&value[7..15]), - major: u32::from_be_bytes(value[15..19].try_into()?), - minor: u32::from_be_bytes(value[19..23].try_into()?), - patch: u32::from_be_bytes(value[23..27].try_into()?), - pre_release: u32::from_be_bytes(value[27..31].try_into()?), - }) - } -} - -/// Returns true if the build tag is human-readable, false otherwise. -fn is_human_readable_build_tag(build: B64) -> bool { - for (i, &c) in build.iter().enumerate() { - if c == 0 { - // Trailing zeros are allowed - if build[i..].iter().any(|&d| d != 0) { - return false; - } - return true; - } - - // following semver.org advertised regex, alphanumeric with '-' and '.', except leading '.'. - if !(c.is_ascii_alphanumeric() || c == b'-' || (c == b'.' && i > 0)) { - return false; - } - } - true -} - -#[cfg(test)] -mod tests { - use alloy_primitives::b256; - - use super::*; - - #[test] - fn test_protocol_version_encode_decode() { - let test_cases = vec![ - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[0x61, 0x62, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), - major: 42, - minor: 0, - patch: 2, - pre_release: 0, - }), - "v42.0.2+0x6162010000000000", - b256!("000000000000000061620100000000000000002a000000000000000200000000"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[0x61, 0x62, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), - major: 42, - minor: 0, - patch: 2, - pre_release: 1, - }), - "v42.0.2-1+0x6162010000000000", - b256!("000000000000000061620100000000000000002a000000000000000200000001"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08]), - major: 42, - minor: 0, - patch: 2, - pre_release: 0, - }), - "v42.0.2+0x0102030405060708", - b256!("000000000000000001020304050607080000002a000000000000000200000000"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]), - major: 0, - minor: 100, - patch: 2, - pre_release: 0, - }), - "v0.100.2", - b256!("0000000000000000000000000000000000000000000000640000000200000000"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[b'O', b'P', b'-', b'm', b'o', b'd', 0x00, 0x00]), - major: 42, - minor: 0, - patch: 2, - pre_release: 1, - }), - "v42.0.2-1+OP-mod", - b256!("00000000000000004f502d6d6f6400000000002a000000000000000200000001"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(&[b'a', b'b', 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]), - major: 42, - minor: 0, - patch: 2, - pre_release: 0, - }), - "v42.0.2+0x6162010000000000", // do not render invalid alpha numeric - b256!("000000000000000061620100000000000000002a000000000000000200000000"), - ), - ( - ProtocolVersion::V0(ProtocolVersionFormatV0 { - build: B64::from_slice(b"beta.123"), - major: 1, - minor: 0, - patch: 0, - pre_release: 0, - }), - "v1.0.0+beta.123", - b256!("0000000000000000626574612e31323300000001000000000000000000000000"), - ), - ]; - - for (decoded_exp, formatted_exp, encoded_exp) in test_cases { - encode_decode_v0(encoded_exp, formatted_exp, decoded_exp); - } - } - - fn encode_decode_v0(encoded_exp: B256, formatted_exp: &str, decoded_exp: ProtocolVersion) { - let decoded = ProtocolVersion::decode(encoded_exp).unwrap(); - assert_eq!(decoded, decoded_exp); - - let encoded = decoded.encode(); - assert_eq!(encoded, encoded_exp); - - let formatted = decoded.display(); - assert_eq!(formatted, formatted_exp); - } -} diff --git a/crates/rpc-types/Cargo.toml b/crates/rpc-types/Cargo.toml deleted file mode 100644 index 20a497ba..00000000 --- a/crates/rpc-types/Cargo.toml +++ /dev/null @@ -1,64 +0,0 @@ -[package] -name = "op-alloy-rpc-types" -description = "Optimism RPC types" - -version.workspace = true -edition.workspace = true -rust-version.workspace = true -license.workspace = true -homepage.workspace = true -authors.workspace = true -repository.workspace = true -exclude.workspace = true - -[lints] -workspace = true - -[dependencies] -# Workspace -op-alloy-consensus = { workspace = true, features = ["serde"] } - -# Alloy -alloy-serde.workspace = true -alloy-consensus.workspace = true -alloy-network-primitives.workspace = true -alloy-eips = { workspace = true, features = ["serde"] } -alloy-rpc-types-eth = { workspace = true, features = ["serde"] } -alloy-primitives = { workspace = true, features = ["map", "rlp", "serde"] } - -# Serde -serde_json.workspace = true -serde = { workspace = true, features = ["derive"] } - -# arbitrary -arbitrary = { workspace = true, features = ["derive"], optional = true } - -derive_more.workspace = true - -[dev-dependencies] -rand.workspace = true -arbitrary = { workspace = true, features = ["derive"] } -alloy-consensus = { workspace = true, features = ["arbitrary"] } -alloy-primitives = { workspace = true, features = ["arbitrary"] } -alloy-rpc-types-eth = { workspace = true, features = ["arbitrary"] } -similar-asserts.workspace = true - -[features] -default = ["std"] -std = [ - "alloy-network-primitives/std", - "alloy-eips/std", - "alloy-primitives/std", - "alloy-rpc-types-eth/std", -] -arbitrary = [ - "std", - "dep:arbitrary", - "alloy-primitives/arbitrary", - "alloy-rpc-types-eth/arbitrary", - "op-alloy-consensus/arbitrary", -] -k256 = [ - "alloy-rpc-types-eth/k256", - "op-alloy-consensus/k256", -] diff --git a/crates/rpc-types/README.md b/crates/rpc-types/README.md deleted file mode 100644 index 1c522076..00000000 --- a/crates/rpc-types/README.md +++ /dev/null @@ -1,10 +0,0 @@ -## `op-alloy-rpc-types` - -CI -op-alloy-rpc-types crate -MIT License -Apache License -Book - - -Optimism RPC-related types. diff --git a/crates/rpc-types/src/config.rs b/crates/rpc-types/src/config.rs deleted file mode 100644 index d1a825cb..00000000 --- a/crates/rpc-types/src/config.rs +++ /dev/null @@ -1,83 +0,0 @@ -#![allow(missing_docs)] -//! OP rollup config types. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{Address, B256}; -use serde::{Deserialize, Serialize}; - -// https://github.com/ethereum-optimism/optimism/blob/c7ad0ebae5dca3bf8aa6f219367a95c15a15ae41/op-service/eth/types.go#L371 -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SystemConfig { - pub batcher_addr: Address, - pub overhead: B256, - pub scalar: B256, - pub gas_limit: u64, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct Genesis { - pub l1: BlockNumHash, - pub l2: BlockNumHash, - pub l2_time: u64, - pub system_config: SystemConfig, -} - -// -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct RollupConfig { - pub genesis: Genesis, - pub block_time: u64, - pub max_sequencer_drift: u64, - pub seq_window_size: u64, - - #[serde(rename = "channel_timeout")] - pub channel_timeout_bedrock: u64, - pub channel_timeout_granite: u64, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub l1_chain_id: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub l2_chain_id: Option, - - #[serde(default, skip_serializing_if = "Option::is_none")] - pub regolith_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub canyon_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub delta_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub ecotone_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub fjord_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub granite_time: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub interop_time: Option, - pub batch_inbox_address: Address, - pub deposit_contract_address: Address, - pub l1_system_config_address: Address, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub protocol_versions_address: Option
, - #[serde(default, skip_serializing_if = "Option::is_none")] - pub da_challenge_address: Option
, - pub da_challenge_window: u64, - pub da_resolve_window: u64, - pub use_plasma: bool, -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_rollup_config() { - let s = r#"{"genesis":{"l1":{"hash":"0x438335a20d98863a4c0c97999eb2481921ccd28553eac6f913af7c12aec04108", "number": 424242 },"l2":{"hash":"0xdbf6a80fef073de06add9b0d14026d6e5a86c85f6d102c36d3d8e9cf89c2afd3", "number": 1337 },"l2_time":1686068903,"system_config":{"batcherAddr":"0x6887246668a3b87f54deb3b94ba47a6f63f32985","overhead":"0x00000000000000000000000000000000000000000000000000000000000000bc","scalar":"0x00000000000000000000000000000000000000000000000000000000000a6fe0","gasLimit":30000000}},"block_time":2,"max_sequencer_drift":600,"seq_window_size":3600,"channel_timeout":300,"channel_timeout_granite":50,"l1_chain_id":1,"l2_chain_id":10,"regolith_time":0,"canyon_time":1704992401,"delta_time":1708560000,"ecotone_time":1710374401,"batch_inbox_address":"0xff00000000000000000000000000000000000010","deposit_contract_address":"0xbeb5fc579115071764c7423a4f12edde41f106ed","l1_system_config_address":"0x229047fed2591dbec1ef1118d64f7af3db9eb290","protocol_versions_address":"0x8062abc286f5e7d9428a0ccb9abd71e50d93b935","da_challenge_address":"0x0000000000000000000000000000000000000000","da_challenge_window":0,"da_resolve_window":0,"use_plasma":false}"#; - - let deserialize = serde_json::from_str::(s).unwrap(); - - assert_eq!( - serde_json::from_str::(s).unwrap(), - serde_json::to_value(&deserialize).unwrap() - ); - } -} diff --git a/crates/rpc-types/src/genesis.rs b/crates/rpc-types/src/genesis.rs deleted file mode 100644 index 7e1dd6a7..00000000 --- a/crates/rpc-types/src/genesis.rs +++ /dev/null @@ -1,259 +0,0 @@ -//! OP types for genesis data. - -use alloy_serde::OtherFields; -use serde::de::Error; - -/// Container type for all Optimism specific fields in a genesis file. -#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct OpChainInfo { - /// Genesis information - pub genesis_info: Option, - /// Base fee information - pub base_fee_info: Option, -} - -impl OpChainInfo { - /// Extracts the Optimism specific fields from a genesis file. These fields are expected to be - /// contained in the `genesis.config` under `extra_fields` property. - pub fn extract_from(others: &OtherFields) -> Option { - Self::try_from(others).ok() - } -} - -impl TryFrom<&OtherFields> for OpChainInfo { - type Error = serde_json::Error; - - fn try_from(others: &OtherFields) -> Result { - let genesis_info = OpGenesisInfo::try_from(others).ok(); - let base_fee_info = OpBaseFeeInfo::try_from(others).ok(); - - Ok(Self { genesis_info, base_fee_info }) - } -} - -/// The Optimism-specific genesis block specification. -#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct OpGenesisInfo { - /// bedrock block number - pub bedrock_block: Option, - /// regolith hardfork timestamp - pub regolith_time: Option, - /// canyon hardfork timestamp - pub canyon_time: Option, - /// ecotone hardfork timestamp - pub ecotone_time: Option, - /// fjord hardfork timestamp - pub fjord_time: Option, - /// granite hardfork timestamp - pub granite_time: Option, - /// holocene hardfork timestamp - pub holocene_time: Option, - /// isthmus hardfork timestamp - pub isthmus_time: Option, -} - -impl OpGenesisInfo { - /// Extract the Optimism-specific genesis info from a genesis file. - pub fn extract_from(others: &OtherFields) -> Option { - Self::try_from(others).ok() - } -} - -impl TryFrom<&OtherFields> for OpGenesisInfo { - type Error = serde_json::Error; - - fn try_from(others: &OtherFields) -> Result { - others.deserialize_as() - } -} - -/// The Optimism-specific base fee specification. -#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, serde::Serialize, serde::Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct OpBaseFeeInfo { - /// EIP-1559 elasticity - pub eip1559_elasticity: Option, - /// EIP-1559 denominator - pub eip1559_denominator: Option, - /// EIP-1559 denominator after canyon - pub eip1559_denominator_canyon: Option, -} - -impl OpBaseFeeInfo { - /// Extracts the Optimism base fee info by looking for the `optimism` key. It is intended to be - /// parsed from a genesis file. - pub fn extract_from(others: &OtherFields) -> Option { - Self::try_from(others).ok() - } -} - -impl TryFrom<&OtherFields> for OpBaseFeeInfo { - type Error = serde_json::Error; - - fn try_from(others: &OtherFields) -> Result { - if let Some(Ok(optimism_base_fee_info)) = others.get_deserialized::("optimism") { - Ok(optimism_base_fee_info) - } else { - Err(serde_json::Error::missing_field("optimism")) - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_extract_optimism_genesis_info() { - let genesis_info = r#" - { - "bedrockBlock": 10, - "regolithTime": 12, - "canyonTime": 0, - "ecotoneTime": 0 - } - "#; - - let others: OtherFields = serde_json::from_str(genesis_info).unwrap(); - let genesis_info = OpGenesisInfo::extract_from(&others).unwrap(); - - assert_eq!( - genesis_info, - OpGenesisInfo { - bedrock_block: Some(10), - regolith_time: Some(12), - canyon_time: Some(0), - ecotone_time: Some(0), - fjord_time: None, - granite_time: None, - holocene_time: None, - isthmus_time: None, - } - ); - } - - #[test] - fn test_extract_optimism_base_fee_info() { - let base_fee_info = r#" - { - "optimism": { - "eip1559Elasticity": 0, - "eip1559Denominator": 8, - "eip1559DenominatorCanyon": 8 - } - } - "#; - - let others: OtherFields = serde_json::from_str(base_fee_info).unwrap(); - let base_fee_info = OpBaseFeeInfo::extract_from(&others).unwrap(); - - assert_eq!( - base_fee_info, - OpBaseFeeInfo { - eip1559_elasticity: Some(0), - eip1559_denominator: Some(8), - eip1559_denominator_canyon: Some(8), - } - ); - } - - #[test] - fn test_extract_optimism_chain_info() { - let chain_info = r#" - { - "bedrockBlock": 10, - "regolithTime": 12, - "canyonTime": 0, - "ecotoneTime": 0, - "optimism": { - "eip1559Denominator": 8, - "eip1559DenominatorCanyon": 8 - } - } - "#; - - let others: OtherFields = serde_json::from_str(chain_info).unwrap(); - let chain_info = OpChainInfo::extract_from(&others).unwrap(); - - assert_eq!( - chain_info, - OpChainInfo { - genesis_info: Some(OpGenesisInfo { - bedrock_block: Some(10), - regolith_time: Some(12), - canyon_time: Some(0), - ecotone_time: Some(0), - fjord_time: None, - granite_time: None, - holocene_time: None, - isthmus_time: None, - }), - base_fee_info: Some(OpBaseFeeInfo { - eip1559_elasticity: None, - eip1559_denominator: Some(8), - eip1559_denominator_canyon: Some(8), - }), - } - ); - - let chain_info = OpChainInfo::try_from(&others).unwrap(); - - assert_eq!( - chain_info, - OpChainInfo { - genesis_info: Some(OpGenesisInfo { - bedrock_block: Some(10), - regolith_time: Some(12), - canyon_time: Some(0), - ecotone_time: Some(0), - fjord_time: None, - granite_time: None, - holocene_time: None, - isthmus_time: None, - }), - base_fee_info: Some(OpBaseFeeInfo { - eip1559_elasticity: None, - eip1559_denominator: Some(8), - eip1559_denominator_canyon: Some(8), - }), - } - ); - } - - #[test] - fn test_extract_optimism_chain_info_no_base_fee() { - let chain_info = r#" - { - "bedrockBlock": 10, - "regolithTime": 12, - "canyonTime": 0, - "ecotoneTime": 0, - "fjordTime": 0, - "graniteTime": 0, - "holoceneTime": 0 - } - "#; - - let others: OtherFields = serde_json::from_str(chain_info).unwrap(); - let chain_info = OpChainInfo::extract_from(&others).unwrap(); - - assert_eq!( - chain_info, - OpChainInfo { - genesis_info: Some(OpGenesisInfo { - bedrock_block: Some(10), - regolith_time: Some(12), - canyon_time: Some(0), - ecotone_time: Some(0), - fjord_time: Some(0), - granite_time: Some(0), - holocene_time: Some(0), - isthmus_time: None, - }), - base_fee_info: None, - } - ); - } -} diff --git a/crates/rpc-types/src/lib.rs b/crates/rpc-types/src/lib.rs deleted file mode 100644 index b07336ca..00000000 --- a/crates/rpc-types/src/lib.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![doc = include_str!("../README.md")] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/alloy.jpg", - html_favicon_url = "https://raw.githubusercontent.com/alloy-rs/core/main/assets/favicon.ico" -)] -#![cfg_attr(not(test), warn(unused_crate_dependencies))] -#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] -#![cfg_attr(not(any(test, feature = "std")), no_std)] - -extern crate alloc; - -mod config; -pub use config::{Genesis, RollupConfig, SystemConfig}; - -mod genesis; -pub use genesis::{OpBaseFeeInfo, OpChainInfo, OpGenesisInfo}; - -mod net; -pub use net::{ - Connectedness, Direction, GossipScores, PeerDump, PeerInfo, PeerScores, PeerStats, - ReqRespScores, TopicScores, -}; - -mod output; -pub use output::OutputResponse; - -mod receipt; -pub use receipt::{L1BlockInfo, OpTransactionReceipt, OpTransactionReceiptFields}; - -mod safe_head; -pub use safe_head::SafeHeadResponse; - -mod sync; -pub use sync::{L1BlockRef, L2BlockRef, SyncStatus}; - -mod transaction; -pub use transaction::{OpTransactionFields, OpTransactionRequest, Transaction}; diff --git a/crates/rpc-types/src/net.rs b/crates/rpc-types/src/net.rs deleted file mode 100644 index 8c569260..00000000 --- a/crates/rpc-types/src/net.rs +++ /dev/null @@ -1,305 +0,0 @@ -#![allow(missing_docs)] -//! Network RPC types - -use alloc::{string::String, vec::Vec}; -use alloy_primitives::{map::HashMap, ChainId}; -use core::net::IpAddr; -use serde::{ - de::{self, Unexpected}, - Deserialize, Deserializer, Serialize, Serializer, -}; - -// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/p2p/store/iface.go#L13 -#[derive(Clone, Debug, Copy, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct TopicScores { - pub time_in_mesh: f64, - pub first_message_deliveries: f64, - pub mesh_message_deliveries: f64, - pub invalid_message_deliveries: f64, -} - -// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/p2p/store/iface.go#L20C6-L20C18 -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct GossipScores { - pub total: f64, - pub blocks: TopicScores, - #[serde(rename = "IPColocationFactor")] - pub ip_colocation_factor: f64, - pub behavioral_penalty: f64, -} - -// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/p2p/store/iface.go#L31C1-L35C2 -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct ReqRespScores { - pub valid_responses: f64, - pub error_responses: f64, - pub rejected_payloads: f64, -} - -// https://github.com/ethereum-optimism/optimism/blob/8dd17a7b114a7c25505cd2e15ce4e3d0f7e3f7c1/op-node/p2p/store/iface.go#L81 -#[derive(Clone, Debug, Copy, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PeerScores { - pub gossip: GossipScores, - pub req_resp: ReqRespScores, -} - -// https://github.com/ethereum-optimism/optimism/blob/develop/op-node/p2p/rpc_api.go#L15 -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PeerInfo { - #[serde(rename = "peerID")] - pub peer_id: String, - #[serde(rename = "nodeID")] - pub node_id: String, - pub user_agent: String, - pub protocol_version: String, - #[serde(rename = "ENR")] - pub enr: String, - pub addresses: Vec, - pub protocols: Option>, - /// 0: "`NotConnected`", 1: "Connected", - /// 2: "`CanConnect`" (gracefully disconnected) - /// 3: "`CannotConnect`" (tried but failed) - pub connectedness: Connectedness, - /// 0: "Unknown", 1: "Inbound" (if the peer contacted us) - /// 2: "Outbound" (if we connected to them) - pub direction: Direction, - pub protected: bool, - #[serde(rename = "chainID")] - pub chain_id: ChainId, - /// nanosecond - pub latency: u64, - pub gossip_blocks: bool, - #[serde(rename = "scores")] - pub peer_scores: PeerScores, -} -// https://github.com/ethereum-optimism/optimism/blob/40750a58e7a4a6f06370d18dfe6c6eab309012d9/op-node/p2p/rpc_api.go#L36 -#[derive(Clone, Debug, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct PeerDump { - pub total_connected: u32, - pub peers: HashMap, - pub banned_peers: Vec, - #[serde(rename = "bannedIPS")] - pub banned_ips: Vec, - // todo: should be IPNet - pub banned_subnets: Vec, -} - -// https://github.com/ethereum-optimism/optimism/blob/develop/op-node/p2p/rpc_server.go#L203 -#[derive(Clone, Debug, Copy, Serialize, Deserialize)] -pub struct PeerStats { - pub connected: u32, - pub table: u32, - #[serde(rename = "blocksTopic")] - pub blocks_topic: u32, - #[serde(rename = "blocksTopicV2")] - pub blocks_topic_v2: u32, - #[serde(rename = "blocksTopicV3")] - pub blocks_topic_v3: u32, - pub banned: u32, - pub known: u32, -} - -/// Represents the connectivity state of a peer in a network, indicating the reachability and -/// interaction status of a node with its peers. -#[derive(Clone, Debug, PartialEq, Copy, Default, Serialize, Deserialize)] -#[repr(u8)] -pub enum Connectedness { - /// No current connection to the peer, and no recent history of a successful connection. - #[default] - NotConnected = 0, - - /// An active, open connection to the peer exists. - Connected = 1, - - /// Connection to the peer is possible but not currently established; usually implies a past - /// successful connection. - CanConnect = 2, - - /// Recent attempts to connect to the peer failed, indicating potential issues in reachability - /// or peer status. - CannotConnect = 3, - - /// Connection to the peer is limited; may not have full capabilities. - Limited = 4, -} - -impl core::fmt::Display for Connectedness { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - match self { - Self::NotConnected => write!(f, "Not Connected"), - Self::Connected => write!(f, "Connected"), - Self::CanConnect => write!(f, "Can Connect"), - Self::CannotConnect => write!(f, "Cannot Connect"), - Self::Limited => write!(f, "Limited"), - } - } -} - -impl From for Connectedness { - fn from(value: u8) -> Self { - match value { - 0 => Self::NotConnected, - 1 => Self::Connected, - 2 => Self::CanConnect, - 3 => Self::CannotConnect, - 4 => Self::Limited, - _ => Self::NotConnected, - } - } -} -/// Direction represents the direction of a connection. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] -pub enum Direction { - /// Unknown is the default direction when the direction is not specified. - #[default] - Unknown = 0, - /// Inbound is for when the remote peer initiated the connection. - Inbound = 1, - /// Outbound is for when the local peer initiated the connection. - Outbound = 2, -} - -impl Serialize for Direction { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_u8(*self as u8) - } -} - -impl<'de> Deserialize<'de> for Direction { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - let value = u8::deserialize(deserializer)?; - match value { - 0 => Ok(Self::Unknown), - 1 => Ok(Self::Inbound), - 2 => Ok(Self::Outbound), - _ => Err(de::Error::invalid_value( - Unexpected::Unsigned(value as u64), - &"a value between 0 and 2", - )), - } - } -} -impl core::fmt::Display for Direction { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!( - f, - "{}", - match self { - Self::Unknown => "Unknown", - Self::Inbound => "Inbound", - Self::Outbound => "Outbound", - } - ) - } -} -#[cfg(test)] -mod tests { - use super::*; - use serde_json::{self}; - - #[test] - fn test_direction_serialization() { - assert_eq!( - serde_json::to_string(&Direction::Unknown).unwrap(), - "0", - "Serialization failed for Direction::Unknown" - ); - assert_eq!( - serde_json::to_string(&Direction::Inbound).unwrap(), - "1", - "Serialization failed for Direction::Inbound" - ); - assert_eq!( - serde_json::to_string(&Direction::Outbound).unwrap(), - "2", - "Serialization failed for Direction::Outbound" - ); - } - - #[test] - fn test_direction_deserialization() { - let unknown: Direction = serde_json::from_str("0").unwrap(); - let inbound: Direction = serde_json::from_str("1").unwrap(); - let outbound: Direction = serde_json::from_str("2").unwrap(); - - assert_eq!(unknown, Direction::Unknown, "Deserialization mismatch for Direction::Unknown"); - assert_eq!(inbound, Direction::Inbound, "Deserialization mismatch for Direction::Inbound"); - assert_eq!( - outbound, - Direction::Outbound, - "Deserialization mismatch for Direction::Outbound" - ); - } - #[test] - fn test_peer_info_connectedness_serialization() { - let peer_info = PeerInfo { - peer_id: String::from("peer123"), - node_id: String::from("node123"), - user_agent: String::from("MyUserAgent"), - protocol_version: String::from("v1"), - enr: String::from("enr123"), - addresses: vec![String::from("127.0.0.1")], - protocols: Some(vec![String::from("eth"), String::from("p2p")]), - connectedness: Connectedness::Connected, - direction: Direction::Outbound, - protected: true, - chain_id: 1, - latency: 100, - gossip_blocks: true, - peer_scores: PeerScores { - gossip: GossipScores { - total: 1.0, - blocks: TopicScores { - time_in_mesh: 10.0, - first_message_deliveries: 5.0, - mesh_message_deliveries: 2.0, - invalid_message_deliveries: 0.0, - }, - ip_colocation_factor: 0.5, - behavioral_penalty: 0.1, - }, - req_resp: ReqRespScores { - valid_responses: 10.0, - error_responses: 1.0, - rejected_payloads: 0.0, - }, - }, - }; - - let serialized = serde_json::to_string(&peer_info).expect("Serialization failed"); - - let deserialized: PeerInfo = - serde_json::from_str(&serialized).expect("Deserialization failed"); - - assert_eq!(peer_info.peer_id, deserialized.peer_id); - assert_eq!(peer_info.node_id, deserialized.node_id); - assert_eq!(peer_info.user_agent, deserialized.user_agent); - assert_eq!(peer_info.protocol_version, deserialized.protocol_version); - assert_eq!(peer_info.enr, deserialized.enr); - assert_eq!(peer_info.addresses, deserialized.addresses); - assert_eq!(peer_info.protocols, deserialized.protocols); - assert_eq!(peer_info.connectedness, deserialized.connectedness); - assert_eq!(peer_info.direction, deserialized.direction); - assert_eq!(peer_info.protected, deserialized.protected); - assert_eq!(peer_info.chain_id, deserialized.chain_id); - assert_eq!(peer_info.latency, deserialized.latency); - assert_eq!(peer_info.gossip_blocks, deserialized.gossip_blocks); - assert_eq!(peer_info.peer_scores.gossip.total, deserialized.peer_scores.gossip.total); - assert_eq!( - peer_info.peer_scores.req_resp.valid_responses, - deserialized.peer_scores.req_resp.valid_responses - ); - } -} diff --git a/crates/rpc-types/src/output.rs b/crates/rpc-types/src/output.rs deleted file mode 100644 index d4f8cebe..00000000 --- a/crates/rpc-types/src/output.rs +++ /dev/null @@ -1,25 +0,0 @@ -//! Output Types - -use crate::sync::{L2BlockRef, SyncStatus}; -use alloy_primitives::B256; -use serde::{Deserialize, Serialize}; - -/// An [output response][or] for Optimism Rollup. -/// -/// [or]: https://github.com/ethereum-optimism/optimism/blob/f20b92d3eb379355c876502c4f28e72a91ab902f/op-service/eth/output.go#L10-L17 -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct OutputResponse { - /// The output version. - pub version: B256, - /// The output root hash. - pub output_root: B256, - /// A reference to the L2 block. - pub block_ref: L2BlockRef, - /// The withdrawal storage root. - pub withdrawal_storage_root: B256, - /// The state root. - pub state_root: B256, - /// The status of the node sync. - pub sync_status: SyncStatus, -} diff --git a/crates/rpc-types/src/receipt.rs b/crates/rpc-types/src/receipt.rs deleted file mode 100644 index dd274d50..00000000 --- a/crates/rpc-types/src/receipt.rs +++ /dev/null @@ -1,316 +0,0 @@ -//! Receipt types for RPC - -use alloy_consensus::{Receipt, ReceiptWithBloom}; -use alloy_serde::OtherFields; -use op_alloy_consensus::{OpDepositReceipt, OpDepositReceiptWithBloom, OpReceiptEnvelope}; -use serde::{Deserialize, Serialize}; - -/// OP Transaction Receipt type -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[doc(alias = "OpTxReceipt")] -pub struct OpTransactionReceipt { - /// Regular eth transaction receipt including deposit receipts - #[serde(flatten)] - pub inner: alloy_rpc_types_eth::TransactionReceipt>, - /// L1 block info of the transaction. - #[serde(flatten)] - pub l1_block_info: L1BlockInfo, -} - -impl alloy_network_primitives::ReceiptResponse for OpTransactionReceipt { - fn contract_address(&self) -> Option { - self.inner.contract_address - } - - fn status(&self) -> bool { - self.inner.inner.status() - } - - fn block_hash(&self) -> Option { - self.inner.block_hash - } - - fn block_number(&self) -> Option { - self.inner.block_number - } - - fn transaction_hash(&self) -> alloy_primitives::TxHash { - self.inner.transaction_hash - } - - fn transaction_index(&self) -> Option { - self.inner.transaction_index() - } - - fn gas_used(&self) -> u64 { - self.inner.gas_used() - } - - fn effective_gas_price(&self) -> u128 { - self.inner.effective_gas_price() - } - - fn blob_gas_used(&self) -> Option { - self.inner.blob_gas_used() - } - - fn blob_gas_price(&self) -> Option { - self.inner.blob_gas_price() - } - - fn from(&self) -> alloy_primitives::Address { - self.inner.from() - } - - fn to(&self) -> Option { - self.inner.to() - } - - fn authorization_list(&self) -> Option<&[alloy_eips::eip7702::SignedAuthorization]> { - self.inner.authorization_list() - } - - fn cumulative_gas_used(&self) -> u64 { - self.inner.cumulative_gas_used() - } - - fn state_root(&self) -> Option { - self.inner.state_root() - } -} - -/// Additional fields for Optimism transaction receipts: -#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -#[doc(alias = "OptimismTxReceiptFields")] -pub struct OpTransactionReceiptFields { - /// L1 block info. - #[serde(flatten)] - pub l1_block_info: L1BlockInfo, - /* --------------------------------------- Regolith --------------------------------------- */ - /// Deposit nonce for deposit transactions. - /// - /// Always null prior to the Regolith hardfork. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub deposit_nonce: Option, - /* ---------------------------------------- Canyon ---------------------------------------- */ - /// Deposit receipt version for deposit transactions. - /// - /// Always null prior to the Canyon hardfork. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub deposit_receipt_version: Option, -} - -/// Serialize/Deserialize l1FeeScalar to/from string -mod l1_fee_scalar_serde { - use serde::{de, Deserialize}; - - pub(super) fn serialize(value: &Option, s: S) -> Result - where - S: serde::Serializer, - { - use alloc::string::ToString; - if let Some(v) = value { - return s.serialize_str(&v.to_string()); - } - s.serialize_none() - } - - pub(super) fn deserialize<'de, D>(deserializer: D) -> Result, D::Error> - where - D: serde::Deserializer<'de>, - { - use alloc::string::String; - let s: Option = Option::deserialize(deserializer)?; - if let Some(s) = s { - return Ok(Some(s.parse::().map_err(de::Error::custom)?)); - } - - Ok(None) - } -} - -impl From for OtherFields { - fn from(value: OpTransactionReceiptFields) -> Self { - serde_json::to_value(value).unwrap().try_into().unwrap() - } -} - -/// L1 block info extracted from inout of first transaction in every block. -/// -/// The subset of [`OpTransactionReceiptFields`], that encompasses L1 block -/// info: -/// -#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct L1BlockInfo { - /// L1 base fee is the minimum price per unit of gas. - /// - /// Present from pre-bedrock as de facto L1 price per unit of gas. L1 base fee after Bedrock. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_gas_price: Option, - /// L1 gas used. - /// - /// Present from pre-bedrock, deprecated as of Fjord. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_gas_used: Option, - /// L1 fee for the transaction. - /// - /// Present from pre-bedrock. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_fee: Option, - /// L1 fee scalar for the transaction - /// - /// Present from pre-bedrock to Ecotone. Null after Ecotone. - #[serde(default, skip_serializing_if = "Option::is_none", with = "l1_fee_scalar_serde")] - pub l1_fee_scalar: Option, - /* ---------------------------------------- Ecotone ---------------------------------------- */ - /// L1 base fee scalar. Applied to base fee to compute weighted gas price multiplier. - /// - /// Always null prior to the Ecotone hardfork. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_base_fee_scalar: Option, - /// L1 blob base fee. - /// - /// Always null prior to the Ecotone hardfork. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_blob_base_fee: Option, - /// L1 blob base fee scalar. Applied to blob base fee to compute weighted gas price multiplier. - /// - /// Always null prior to the Ecotone hardfork. - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub l1_blob_base_fee_scalar: Option, -} - -impl Eq for L1BlockInfo {} - -impl From for OpReceiptEnvelope { - fn from(value: OpTransactionReceipt) -> Self { - let inner_envelope = value.inner.inner; - - /// Helper function to convert the inner logs within a [ReceiptWithBloom] from RPC to - /// consensus types. - #[inline(always)] - fn convert_standard_receipt( - receipt: ReceiptWithBloom>, - ) -> ReceiptWithBloom> { - let ReceiptWithBloom { logs_bloom, receipt } = receipt; - - let consensus_logs = receipt.logs.into_iter().map(|log| log.inner).collect(); - ReceiptWithBloom { - receipt: Receipt { - status: receipt.status, - cumulative_gas_used: receipt.cumulative_gas_used, - logs: consensus_logs, - }, - logs_bloom, - } - } - - match inner_envelope { - OpReceiptEnvelope::Legacy(receipt) => Self::Legacy(convert_standard_receipt(receipt)), - OpReceiptEnvelope::Eip2930(receipt) => Self::Eip2930(convert_standard_receipt(receipt)), - OpReceiptEnvelope::Eip1559(receipt) => Self::Eip1559(convert_standard_receipt(receipt)), - OpReceiptEnvelope::Eip7702(receipt) => Self::Eip7702(convert_standard_receipt(receipt)), - OpReceiptEnvelope::Deposit(OpDepositReceiptWithBloom { logs_bloom, receipt }) => { - let consensus_logs = receipt.inner.logs.into_iter().map(|log| log.inner).collect(); - let consensus_receipt = OpDepositReceiptWithBloom { - receipt: OpDepositReceipt { - inner: Receipt { - status: receipt.inner.status, - cumulative_gas_used: receipt.inner.cumulative_gas_used, - logs: consensus_logs, - }, - deposit_nonce: receipt.deposit_nonce, - deposit_receipt_version: receipt.deposit_receipt_version, - }, - logs_bloom, - }; - Self::Deposit(consensus_receipt) - } - _ => unreachable!("Unsupported OpReceiptEnvelope variant"), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use serde_json::{json, Value}; - - // - #[test] - fn parse_rpc_receipt() { - let s = r#"{ - "blockHash": "0x9e6a0fb7e22159d943d760608cc36a0fb596d1ab3c997146f5b7c55c8c718c67", - "blockNumber": "0x6cfef89", - "contractAddress": null, - "cumulativeGasUsed": "0xfa0d", - "depositNonce": "0x8a2d11", - "effectiveGasPrice": "0x0", - "from": "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001", - "gasUsed": "0xfa0d", - "logs": [], - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "status": "0x1", - "to": "0x4200000000000000000000000000000000000015", - "transactionHash": "0xb7c74afdeb7c89fb9de2c312f49b38cb7a850ba36e064734c5223a477e83fdc9", - "transactionIndex": "0x0", - "type": "0x7e", - "l1GasPrice": "0x3ef12787", - "l1GasUsed": "0x1177", - "l1Fee": "0x5bf1ab43d", - "l1BaseFeeScalar": "0x1", - "l1BlobBaseFee": "0x600ab8f05e64", - "l1BlobBaseFeeScalar": "0x1" - }"#; - - let receipt: OpTransactionReceipt = serde_json::from_str(s).unwrap(); - let value = serde_json::to_value(&receipt).unwrap(); - let expected_value = serde_json::from_str::(s).unwrap(); - assert_eq!(value, expected_value); - } - - #[test] - fn serialize_empty_optimism_transaction_receipt_fields_struct() { - let op_fields = OpTransactionReceiptFields::default(); - - let json = serde_json::to_value(op_fields).unwrap(); - assert_eq!(json, json!({})); - } - - #[test] - fn serialize_l1_fee_scalar() { - let op_fields = OpTransactionReceiptFields { - l1_block_info: L1BlockInfo { l1_fee_scalar: Some(0.678), ..Default::default() }, - ..Default::default() - }; - - let json = serde_json::to_value(op_fields).unwrap(); - - assert_eq!(json["l1FeeScalar"], serde_json::Value::String("0.678".to_string())); - } - - #[test] - fn deserialize_l1_fee_scalar() { - let json = json!({ - "l1FeeScalar": "0.678" - }); - - let op_fields: OpTransactionReceiptFields = serde_json::from_value(json).unwrap(); - assert_eq!(op_fields.l1_block_info.l1_fee_scalar, Some(0.678f64)); - - let json = json!({ - "l1FeeScalar": Value::Null - }); - - let op_fields: OpTransactionReceiptFields = serde_json::from_value(json).unwrap(); - assert_eq!(op_fields.l1_block_info.l1_fee_scalar, None); - - let json = json!({}); - - let op_fields: OpTransactionReceiptFields = serde_json::from_value(json).unwrap(); - assert_eq!(op_fields.l1_block_info.l1_fee_scalar, None); - } -} diff --git a/crates/rpc-types/src/safe_head.rs b/crates/rpc-types/src/safe_head.rs deleted file mode 100644 index 9523af97..00000000 --- a/crates/rpc-types/src/safe_head.rs +++ /dev/null @@ -1,29 +0,0 @@ -//! Contains the response for a safe head request. - -use alloy_eips::BlockNumHash; -use serde::{Deserialize, Serialize}; - -/// The safe head response. -/// -/// -/// Note: the optimism "eth.BlockID" type is number,hash -#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct SafeHeadResponse { - /// The L1 block. - pub l1_block: BlockNumHash, - /// The safe head. - pub safe_head: BlockNumHash, -} - -#[cfg(test)] -mod tests { - use super::*; - - // - #[test] - fn test_safe_head_response() { - let s = r#"{"l1Block":{"hash":"0x7de331305c2bb3e5642a2adcb9c003cc67cefc7b05a3da5a6a4b12cf3af15407","number":6834391},"safeHead":{"hash":"0xa5e5ec1ade7d6fef209f73861bf0080950cde74c4b0c07823983eb5225e282a8","number":18266679}}"#; - let _response: SafeHeadResponse = serde_json::from_str(s).unwrap(); - } -} diff --git a/crates/rpc-types/src/sync.rs b/crates/rpc-types/src/sync.rs deleted file mode 100644 index 28bb252e..00000000 --- a/crates/rpc-types/src/sync.rs +++ /dev/null @@ -1,67 +0,0 @@ -//! Op types related to sync. - -use alloy_eips::BlockNumHash; -use alloy_primitives::{BlockNumber, B256}; -use serde::{Deserialize, Serialize}; - -/// The block reference for an L2 block. -/// -/// See: -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct L2BlockRef { - /// The block hash. - pub hash: B256, - /// The block number. - pub number: BlockNumber, - /// The parent hash. - pub parent_hash: B256, - /// The timestamp. - pub timestamp: u64, - /// The L1 origin. - #[serde(rename = "l1origin")] - pub l1_origin: BlockNumHash, - /// The sequence number. - pub sequence_number: u64, -} - -/// The block reference for an L1 block. -/// -/// See: -#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -pub struct L1BlockRef { - /// The block hash. - pub hash: B256, - /// The block number. - pub number: BlockNumber, - /// The parent hash. - pub parent_hash: B256, - /// The timestamp. - pub timestamp: u64, -} - -/// The [`SyncStatus`][ss] of an Optimism Rollup Node. -/// -/// [ss]: https://github.com/ethereum-optimism/optimism/blob/develop/op-service/eth/sync_status.go#L5 -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct SyncStatus { - /// The current L1 block. - pub current_l1: L1BlockRef, - /// The current L1 finalized block. - pub current_l1_finalized: L1BlockRef, - /// The L1 head block ref. - pub head_l1: L1BlockRef, - /// The L1 safe head block ref. - pub safe_l1: L1BlockRef, - /// The finalized L1 block ref. - pub finalized_l1: L1BlockRef, - /// The unsafe L2 block ref. - pub unsafe_l2: L2BlockRef, - /// The safe L2 block ref. - pub safe_l2: L2BlockRef, - /// The finalized L2 block ref. - pub finalized_l2: L2BlockRef, - /// The pending safe L2 block ref. - pub pending_safe_l2: L2BlockRef, -} diff --git a/crates/rpc-types/src/transaction.rs b/crates/rpc-types/src/transaction.rs deleted file mode 100644 index 81504d5b..00000000 --- a/crates/rpc-types/src/transaction.rs +++ /dev/null @@ -1,320 +0,0 @@ -//! Optimism specific types related to transactions. - -use alloy_consensus::{Transaction as _, Typed2718}; -use alloy_eips::{eip2930::AccessList, eip7702::SignedAuthorization}; -use alloy_primitives::{Address, BlockHash, Bytes, ChainId, TxKind, B256, U256}; -use alloy_serde::OtherFields; -use op_alloy_consensus::OpTxEnvelope; -use serde::{Deserialize, Serialize}; - -mod request; -pub use request::OpTransactionRequest; - -/// OP Transaction type -#[derive( - Clone, Debug, PartialEq, Eq, Serialize, Deserialize, derive_more::Deref, derive_more::DerefMut, -)] -#[serde(try_from = "tx_serde::TransactionSerdeHelper", into = "tx_serde::TransactionSerdeHelper")] -#[cfg_attr(all(any(test, feature = "arbitrary"), feature = "k256"), derive(arbitrary::Arbitrary))] -pub struct Transaction { - /// Ethereum Transaction Types - #[deref] - #[deref_mut] - pub inner: alloy_rpc_types_eth::Transaction, - - /// Nonce for deposit transactions. Only present in RPC responses. - pub deposit_nonce: Option, - - /// Deposit receipt version for deposit transactions post-canyon - pub deposit_receipt_version: Option, -} - -impl Typed2718 for Transaction { - fn ty(&self) -> u8 { - self.inner.ty() - } -} - -impl alloy_consensus::Transaction for Transaction { - fn chain_id(&self) -> Option { - self.inner.chain_id() - } - - fn nonce(&self) -> u64 { - self.inner.nonce() - } - - fn gas_limit(&self) -> u64 { - self.inner.gas_limit() - } - - fn gas_price(&self) -> Option { - self.inner.gas_price() - } - - fn max_fee_per_gas(&self) -> u128 { - self.inner.max_fee_per_gas() - } - - fn max_priority_fee_per_gas(&self) -> Option { - self.inner.max_priority_fee_per_gas() - } - - fn max_fee_per_blob_gas(&self) -> Option { - self.inner.max_fee_per_blob_gas() - } - - fn priority_fee_or_price(&self) -> u128 { - self.inner.priority_fee_or_price() - } - - fn effective_gas_price(&self, base_fee: Option) -> u128 { - self.inner.effective_gas_price(base_fee) - } - - fn is_dynamic_fee(&self) -> bool { - self.inner.is_dynamic_fee() - } - - fn kind(&self) -> TxKind { - self.inner.kind() - } - - fn is_create(&self) -> bool { - self.inner.is_create() - } - - fn to(&self) -> Option
{ - self.inner.to() - } - - fn value(&self) -> U256 { - self.inner.value() - } - - fn input(&self) -> &Bytes { - self.inner.input() - } - - fn access_list(&self) -> Option<&AccessList> { - self.inner.access_list() - } - - fn blob_versioned_hashes(&self) -> Option<&[B256]> { - self.inner.blob_versioned_hashes() - } - - fn authorization_list(&self) -> Option<&[SignedAuthorization]> { - self.inner.authorization_list() - } -} - -impl alloy_network_primitives::TransactionResponse for Transaction { - fn tx_hash(&self) -> alloy_primitives::TxHash { - self.inner.tx_hash() - } - - fn block_hash(&self) -> Option { - self.inner.block_hash() - } - - fn block_number(&self) -> Option { - self.inner.block_number() - } - - fn transaction_index(&self) -> Option { - self.inner.transaction_index() - } - - fn from(&self) -> Address { - self.inner.from() - } -} - -/// Optimism specific transaction fields -#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] -#[doc(alias = "OptimismTxFields")] -#[serde(rename_all = "camelCase")] -pub struct OpTransactionFields { - /// The ETH value to mint on L2 - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub mint: Option, - /// Hash that uniquely identifies the source of the deposit. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub source_hash: Option, - /// Field indicating whether the transaction is a system transaction, and therefore - /// exempt from the L2 gas limit. - #[serde(default, skip_serializing_if = "Option::is_none")] - pub is_system_tx: Option, - /// Deposit receipt version for deposit transactions post-canyon - #[serde(default, skip_serializing_if = "Option::is_none", with = "alloy_serde::quantity::opt")] - pub deposit_receipt_version: Option, -} - -impl From for OtherFields { - fn from(value: OpTransactionFields) -> Self { - serde_json::to_value(value).unwrap().try_into().unwrap() - } -} - -impl AsRef for Transaction { - fn as_ref(&self) -> &OpTxEnvelope { - self.inner.as_ref() - } -} - -mod tx_serde { - //! Helper module for serializing and deserializing OP [`Transaction`]. - //! - //! This is needed because we might need to deserialize the `from` field into both - //! [`alloy_rpc_types_eth::Transaction::from`] and [`op_alloy_consensus::TxDeposit::from`]. - //! - //! Additionaly, we need similar logic for the `gasPrice` field - use super::*; - use serde::de::Error; - - /// Helper struct which will be flattened into the transaction and will only contain `from` - /// field if inner [`OpTxEnvelope`] did not consume it. - #[derive(Serialize, Deserialize)] - struct OptionalFields { - #[serde(default, skip_serializing_if = "Option::is_none")] - from: Option
, - #[serde( - default, - rename = "gasPrice", - skip_serializing_if = "Option::is_none", - with = "alloy_serde::quantity::opt" - )] - effective_gas_price: Option, - #[serde( - default, - rename = "nonce", - skip_serializing_if = "Option::is_none", - with = "alloy_serde::quantity::opt" - )] - deposit_nonce: Option, - } - - #[derive(Serialize, Deserialize)] - #[serde(rename_all = "camelCase")] - pub(crate) struct TransactionSerdeHelper { - #[serde(flatten)] - inner: OpTxEnvelope, - #[serde(default)] - block_hash: Option, - #[serde(default, with = "alloy_serde::quantity::opt")] - block_number: Option, - #[serde(default, with = "alloy_serde::quantity::opt")] - transaction_index: Option, - #[serde( - default, - skip_serializing_if = "Option::is_none", - with = "alloy_serde::quantity::opt" - )] - deposit_receipt_version: Option, - - #[serde(flatten)] - other: OptionalFields, - } - - impl From for TransactionSerdeHelper { - fn from(value: Transaction) -> Self { - let Transaction { - inner: - alloy_rpc_types_eth::Transaction { - inner, - block_hash, - block_number, - transaction_index, - effective_gas_price, - from, - }, - deposit_receipt_version, - deposit_nonce, - } = value; - - // if inner transaction is a deposit, then don't serialize `from` directly - let from = if matches!(inner, OpTxEnvelope::Deposit(_)) { None } else { Some(from) }; - - // if inner transaction has its own `gasPrice` don't serialize it in this struct. - let effective_gas_price = effective_gas_price.filter(|_| inner.gas_price().is_none()); - - Self { - inner, - block_hash, - block_number, - transaction_index, - deposit_receipt_version, - other: OptionalFields { from, effective_gas_price, deposit_nonce }, - } - } - } - - impl TryFrom for Transaction { - type Error = serde_json::Error; - - fn try_from(value: TransactionSerdeHelper) -> Result { - let TransactionSerdeHelper { - inner, - block_hash, - block_number, - transaction_index, - deposit_receipt_version, - other, - } = value; - - // Try to get `from` field from inner envelope or from `MaybeFrom`, otherwise return - // error - let from = if let Some(from) = other.from { - from - } else if let OpTxEnvelope::Deposit(tx) = &inner { - tx.from - } else { - return Err(serde_json::Error::custom("missing `from` field")); - }; - - // Only serialize deposit_nonce if inner transaction is deposit to avoid duplicated keys - let deposit_nonce = other.deposit_nonce.filter(|_| inner.is_deposit()); - - let effective_gas_price = other.effective_gas_price.or(inner.gas_price()); - - Ok(Self { - inner: alloy_rpc_types_eth::Transaction { - inner, - block_hash, - block_number, - transaction_index, - from, - effective_gas_price, - }, - deposit_receipt_version, - deposit_nonce, - }) - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn can_deserialize_deposit() { - // cast rpc eth_getTransactionByHash - // 0xbc9329afac05556497441e2b3ee4c5d4da7ca0b2a4c212c212d0739e94a24df9 --rpc-url optimism - let rpc_tx = r#"{"blockHash":"0x9d86bb313ebeedf4f9f82bf8a19b426be656a365648a7c089b618771311db9f9","blockNumber":"0x798ad0b","hash":"0xbc9329afac05556497441e2b3ee4c5d4da7ca0b2a4c212c212d0739e94a24df9","transactionIndex":"0x0","type":"0x7e","nonce":"0x152ea95","input":"0x440a5e200000146b000f79c50000000000000003000000006725333f000000000141e287000000000000000000000000000000000000000000000000000000012439ee7e0000000000000000000000000000000000000000000000000000000063f363e973e96e7145ff001c81b9562cba7b6104eeb12a2bc4ab9f07c27d45cd81a986620000000000000000000000006887246668a3b87f54deb3b94ba47a6f63f32985","mint":"0x0","sourceHash":"0x04e9a69416471ead93b02f0c279ab11ca0b635db5c1726a56faf22623bafde52","r":"0x0","s":"0x0","v":"0x0","yParity":"0x0","gas":"0xf4240","from":"0xdeaddeaddeaddeaddeaddeaddeaddeaddead0001","to":"0x4200000000000000000000000000000000000015","depositReceiptVersion":"0x1","value":"0x0","gasPrice":"0x0"}"#; - - let tx = serde_json::from_str::(rpc_tx).unwrap(); - - let OpTxEnvelope::Deposit(inner) = tx.as_ref() else { - panic!("Expected deposit transaction"); - }; - assert_eq!(tx.from, inner.from); - assert_eq!(tx.deposit_nonce, Some(22211221)); - assert_eq!(tx.inner.effective_gas_price, Some(0)); - - let deserialized = serde_json::to_value(&tx).unwrap(); - let expected = serde_json::from_str::(rpc_tx).unwrap(); - similar_asserts::assert_eq!(deserialized, expected); - } -} diff --git a/crates/rpc-types/src/transaction/request.rs b/crates/rpc-types/src/transaction/request.rs deleted file mode 100644 index 881e77bf..00000000 --- a/crates/rpc-types/src/transaction/request.rs +++ /dev/null @@ -1,202 +0,0 @@ -use alloc::vec::Vec; -use alloy_consensus::{ - Sealed, SignableTransaction, Signed, TxEip1559, TxEip4844, TypedTransaction, -}; -use alloy_eips::eip7702::SignedAuthorization; -use alloy_network_primitives::TransactionBuilder7702; -use alloy_primitives::{Address, PrimitiveSignature as Signature, TxKind, U256}; -use alloy_rpc_types_eth::{AccessList, TransactionInput, TransactionRequest}; -use op_alloy_consensus::{OpTxEnvelope, OpTypedTransaction, TxDeposit}; -use serde::{Deserialize, Serialize}; - -/// Builder for [`OpTypedTransaction`]. -#[derive( - Clone, - Debug, - Default, - PartialEq, - Eq, - Hash, - derive_more::From, - derive_more::AsRef, - derive_more::AsMut, - Serialize, - Deserialize, -)] -#[serde(transparent)] -pub struct OpTransactionRequest(TransactionRequest); - -impl OpTransactionRequest { - /// Sets the `from` field in the call to the provided address - #[inline] - pub const fn from(mut self, from: Address) -> Self { - self.0.from = Some(from); - self - } - - /// Sets the transactions type for the transactions. - #[doc(alias = "tx_type")] - pub const fn transaction_type(mut self, transaction_type: u8) -> Self { - self.0.transaction_type = Some(transaction_type); - self - } - - /// Sets the gas limit for the transaction. - pub const fn gas_limit(mut self, gas_limit: u64) -> Self { - self.0.gas = Some(gas_limit); - self - } - - /// Sets the nonce for the transaction. - pub const fn nonce(mut self, nonce: u64) -> Self { - self.0.nonce = Some(nonce); - self - } - - /// Sets the maximum fee per gas for the transaction. - pub const fn max_fee_per_gas(mut self, max_fee_per_gas: u128) -> Self { - self.0.max_fee_per_gas = Some(max_fee_per_gas); - self - } - - /// Sets the maximum priority fee per gas for the transaction. - pub const fn max_priority_fee_per_gas(mut self, max_priority_fee_per_gas: u128) -> Self { - self.0.max_priority_fee_per_gas = Some(max_priority_fee_per_gas); - self - } - - /// Sets the recipient address for the transaction. - #[inline] - pub const fn to(mut self, to: Address) -> Self { - self.0.to = Some(TxKind::Call(to)); - self - } - - /// Sets the value (amount) for the transaction. - pub const fn value(mut self, value: U256) -> Self { - self.0.value = Some(value); - self - } - - /// Sets the access list for the transaction. - pub fn access_list(mut self, access_list: AccessList) -> Self { - self.0.access_list = Some(access_list); - self - } - - /// Sets the input data for the transaction. - pub fn input(mut self, input: TransactionInput) -> Self { - self.0.input = input; - self - } - - /// Builds [`OpTypedTransaction`] from this builder. See [`TransactionRequest::build_typed_tx`] - /// for more info. - /// - /// Note that EIP-4844 transactions are not supported by Optimism and will be converted into - /// EIP-1559 transactions. - pub fn build_typed_tx(self) -> Result { - let tx = self.0.build_typed_tx().map_err(Self)?; - match tx { - TypedTransaction::Legacy(tx) => Ok(OpTypedTransaction::Legacy(tx)), - TypedTransaction::Eip1559(tx) => Ok(OpTypedTransaction::Eip1559(tx)), - TypedTransaction::Eip2930(tx) => Ok(OpTypedTransaction::Eip2930(tx)), - TypedTransaction::Eip4844(tx) => { - let tx: TxEip4844 = tx.into(); - Ok(OpTypedTransaction::Eip1559(TxEip1559 { - chain_id: tx.chain_id, - nonce: tx.nonce, - gas_limit: tx.gas_limit, - max_priority_fee_per_gas: tx.max_priority_fee_per_gas, - max_fee_per_gas: tx.max_fee_per_gas, - to: TxKind::Call(tx.to), - value: tx.value, - access_list: tx.access_list, - input: tx.input, - })) - } - TypedTransaction::Eip7702(tx) => Ok(OpTypedTransaction::Eip7702(tx)), - } - } -} - -impl From for OpTransactionRequest { - fn from(tx: TxDeposit) -> Self { - let TxDeposit { - source_hash: _, - from, - to, - mint: _, - value, - gas_limit, - is_system_transaction: _, - input, - } = tx; - - Self(TransactionRequest { - from: Some(from), - to: Some(to), - value: Some(value), - gas: Some(gas_limit), - input: input.into(), - ..Default::default() - }) - } -} - -impl From> for OpTransactionRequest { - fn from(value: Sealed) -> Self { - value.into_inner().into() - } -} - -impl From> for OpTransactionRequest -where - T: SignableTransaction + Into, -{ - fn from(value: Signed) -> Self { - #[cfg(feature = "k256")] - let from = value.recover_signer().ok(); - #[cfg(not(feature = "k256"))] - let from = None; - - let mut inner: TransactionRequest = value.strip_signature().into(); - inner.from = from; - - Self(inner) - } -} - -impl From for OpTransactionRequest { - fn from(tx: OpTypedTransaction) -> Self { - match tx { - OpTypedTransaction::Legacy(tx) => Self(tx.into()), - OpTypedTransaction::Eip2930(tx) => Self(tx.into()), - OpTypedTransaction::Eip1559(tx) => Self(tx.into()), - OpTypedTransaction::Eip7702(tx) => Self(tx.into()), - OpTypedTransaction::Deposit(tx) => tx.into(), - } - } -} - -impl From for OpTransactionRequest { - fn from(value: OpTxEnvelope) -> Self { - match value { - OpTxEnvelope::Eip2930(tx) => tx.into(), - OpTxEnvelope::Eip1559(tx) => tx.into(), - OpTxEnvelope::Eip7702(tx) => tx.into(), - OpTxEnvelope::Deposit(tx) => tx.into(), - _ => Default::default(), - } - } -} - -impl TransactionBuilder7702 for OpTransactionRequest { - fn authorization_list(&self) -> Option<&Vec> { - self.as_ref().authorization_list() - } - - fn set_authorization_list(&mut self, authorization_list: Vec) { - self.as_mut().set_authorization_list(authorization_list); - } -} diff --git a/scripts/check_no_std.sh b/scripts/check_no_std.sh index 34950af6..139ac418 100755 --- a/scripts/check_no_std.sh +++ b/scripts/check_no_std.sh @@ -2,13 +2,7 @@ set -eo pipefail no_std_packages=( - op-alloy - op-alloy-consensus - op-alloy-protocol - op-alloy-registry - op-alloy-genesis - op-alloy-rpc-types - op-alloy-rpc-types-engine + maili-protocol ) for package in "${no_std_packages[@]}"; do