diff --git a/Cargo.lock b/Cargo.lock index 48851ff..4bca8f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed961a48297c732a5d97ee321aa8bb5009ecadbcb077d8bec90cb54e651629" +checksum = "54bba85233b8cd6bad2dccba685af6836bfcb539202731091eb40c474ba6fa12" dependencies = [ "alloy-eips", "alloy-primitives", @@ -66,6 +66,7 @@ dependencies = [ "auto_impl", "c-kzg", "derive_more", + "k256", "serde", ] @@ -82,9 +83,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ffc577390ce50234e02d841214b3dc0bea6aaaae8e04bbf3cb82e9a45da9eb" +checksum = "69fb9fd842fdf10a524bbf2c4de6942ad869c1c8c3d128a1b09e67ed5f7cedbd" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -95,9 +96,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b69e06cf9c37be824b9d26d6d101114fdde6af0c87de2828b414c05c4b3daa71" +checksum = "655929ddc3cd1af9f7f8a3a401e40eb67113edd0aa308d7071ec7375a74d1cc6" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -113,9 +114,9 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dde15e14944a88bd6a57d325e9a49b75558746fe16aaccc79713ae50a6a9574c" +checksum = "09ff9ecd6f59d42894fbe1c5bab069b6a37980d95b2a94ac7db656a7c594aa42" dependencies = [ "alloy-primitives", "alloy-serde", @@ -124,9 +125,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af5979e0d5a7bf9c7eb79749121e8256e59021af611322aee56e77e20776b4b3" +checksum = "2cb5c84eddbcdc61f310778fda03d925a6a321f642a988b1ee71f6ec32c5f21d" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -138,9 +139,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "204237129086ce5dc17a58025e93739b01b45313841f98fa339eb1d780511e57" +checksum = "d7f7b36f32cd9d6a1eff3a969fcb131e3d8190b7c38177645b5e6262a9da68e4" dependencies = [ "alloy-consensus", "alloy-eips", @@ -154,14 +155,16 @@ dependencies = [ "async-trait", "auto_impl", "futures-utils-wasm", + "serde", + "serde_json", "thiserror", ] [[package]] name = "alloy-network-primitives" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514f70ee2a953db21631cd817b13a1571474ec77ddc03d47616d5e8203489fde" +checksum = "b14a13d3869e3a1c011165136d489b5f57fee0329964b7bfebc8d55e38572c02" dependencies = [ "alloy-consensus", "alloy-eips", @@ -172,9 +175,9 @@ dependencies = [ [[package]] name = "alloy-node-bindings" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27444ea67d360508753022807cdd0b49a95c878924c9c5f8f32668b7d7768245" +checksum = "906d513e181a203783b3eea1821bb42d188f5c99a370e69e9ddf44bc4fb4b568" dependencies = [ "alloy-genesis", "alloy-primitives", @@ -217,9 +220,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4814d141ede360bb6cd1b4b064f1aab9de391e7c4d0d4d50ac89ea4bc1e25fbd" +checksum = "c8a0398d7fe6a4141739bfaf57ad8db15d76a65fd8c7df859773fc65ac24ba2f" dependencies = [ "alloy-chains", "alloy-consensus", @@ -276,9 +279,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc2bd1e7403463a5f2c61e955bcc9d3072b63aa177442b0f9aa6a6d22a941e3" +checksum = "db566ff5b504fc16f2e6943b103d26a243438e74c8515efcd2e10c82101fafae" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -299,9 +302,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-beacon" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45357a642081c8ce235c0ad990c4e9279f5f18a723545076b38cfcc05cc25234" +checksum = "277f84f4b36534b48278e6581c267202b6186a32ce472e7e0d0a6c27a7cddce0" dependencies = [ "alloy-eips", "alloy-primitives", @@ -313,9 +316,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "886d22d41992287a235af2f3af4299b5ced2bcafb81eb835572ad35747476946" +checksum = "6c5a591c9b2a58d5168867083d4c81a78089d6a90669b57b125800c07ee1dd6d" dependencies = [ "alloy-consensus", "alloy-eips", @@ -329,9 +332,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b034779a4850b4b03f5be5ea674a1cf7d746b2da762b34d1860ab45e48ca27" +checksum = "87af056add05e5cf6994424725354d02d1587098831b59748365c79fd3896d2c" dependencies = [ "alloy-consensus", "alloy-eips", @@ -348,9 +351,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "028e72eaa9703e4882344983cfe7636ce06d8cce104a78ea62fd19b46659efc4" +checksum = "ed60ee9deecc68565aa74d810129c45009fad7ec4317b99859f45f8608fa4fb4" dependencies = [ "alloy-primitives", "serde", @@ -359,9 +362,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592c185d7100258c041afac51877660c7bf6213447999787197db4842f0e938e" +checksum = "e31bfec8f78014a8c9ebc1d6ddcc951f8aa598fd0d061e0971a3a5f90bcabfdc" dependencies = [ "alloy-primitives", "async-trait", @@ -431,9 +434,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be77579633ebbc1266ae6fd7694f75c408beb1aeb6865d0b18f22893c265a061" +checksum = "6102fe2d5d812e0ad9da1997f534cf79a37e930f8bf8c9cd3fd30f817ccdf6da" dependencies = [ "alloy-json-rpc", "base64", @@ -451,9 +454,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fd1a5d0827939847983b46f2f79510361f901dc82f8e3c38ac7397af142c6e" +checksum = "02d15dcba0b43725f293ce5d3383b50d112a4f4eb15f197ff791b266335ac18b" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -1834,7 +1837,7 @@ dependencies = [ [[package]] name = "kona-derive" version = "0.0.5" -source = "git+https://github.com/anton-rs/kona?branch=main#71e35a7c34491d50135f870c7e1215ab527b3dcf" +source = "git+https://github.com/anton-rs/kona?branch=main#7c5567b3125c44bffa73e83defaf87dd2369accb" dependencies = [ "alloc-no-stdlib", "alloy-consensus", @@ -1850,7 +1853,6 @@ dependencies = [ "op-alloy-genesis", "op-alloy-protocol", "op-alloy-rpc-types-engine", - "serde", "spin", "tracing", "tracing-subscriber", @@ -2056,9 +2058,9 @@ checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "op-alloy-consensus" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26c3b35b7b3e36d15e0563eebffe13c1d9ca16b7aaffcb6a64354633547e16b" +checksum = "dabf6e7d7d63b2c6ed746b24d334e16388c6c3921bc50172440c72aa923c6b4a" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2072,9 +2074,9 @@ dependencies = [ [[package]] name = "op-alloy-genesis" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccacc2efed3d60d98ea581bddb885df1c6c62a592e55de049cfefd94116112cd" +checksum = "f901aa077832e22820c644d63d2e5e48601eed0f06e40f2a26d1b2a89bd17dec" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2086,9 +2088,9 @@ dependencies = [ [[package]] name = "op-alloy-protocol" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e6ec6b91c6aaeb20860b455a52fd8e300acfe5d534e96e9073a24f853e74" +checksum = "b9226c7618f45f1d1e1f1112230818d5cfa719da9f5ca05fa28eaeb44d024181" dependencies = [ "alloy-consensus", "alloy-eips", @@ -2106,14 +2108,16 @@ dependencies = [ [[package]] name = "op-alloy-rpc-types-engine" -version = "0.5.2" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b52ee59c86537cff83e8c7f2a6aa287a94f3608bb40c06d442aafd0c2e807a4" +checksum = "59a5b505325e343b299b1c574b2b8542f6ac3101e0d92a1c909b2d7dd74665f1" dependencies = [ + "alloy-eips", "alloy-primitives", "alloy-rpc-types-engine", "alloy-serde", "derive_more", + "op-alloy-consensus", "op-alloy-protocol", "serde", ] @@ -2997,6 +3001,14 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "superchain" +version = "0.9.2" +dependencies = [ + "superchain-derive", + "superchain-registry", +] + [[package]] name = "superchain-derive" version = "0.9.2" @@ -3602,9 +3614,9 @@ checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasmtimer" -version = "0.2.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7ed9d8b15c7fb594d72bfb4b5a276f3d2029333cd93a932f376f5937f6f80ee" +checksum = "bb4f099acbc1043cc752b91615b24b02d7f6fcd975bd781fed9f50b3c3e15bf7" dependencies = [ "futures", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 72a9abe..0be1a03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,35 +40,39 @@ rustdoc-args = ["--cfg", "docsrs"] kona-derive = { git = "https://github.com/anton-rs/kona", branch = "main" } [workspace.dependencies] +# Workspace +superchain-derive = { version = "0.9.2", path = "crates/derive", default-features = false } +superchain-registry = { version = "0.9.2", path = "crates/registry", default-features = false } + # Kona kona-derive = { version = "0.0.5", default-features = false } # Alloy alloy-rlp = { version = "0.3.9", default-features = false } -alloy-eips = { version = "0.5.4", default-features = false } -alloy-serde = { version = "0.5.4", default-features = false } -alloy-provider = { version = "0.5.4", default-features = false } -alloy-primitives = { version = "0.8.9", default-features = false } -alloy-consensus = { version = "0.5.4", default-features = false } -alloy-transport = { version = "0.5.4", default-features = false } -alloy-rpc-client = { version = "0.5.4", default-features = false } -alloy-node-bindings = { version = "0.5.4", default-features = false } -alloy-transport-http = { version = "0.5.4", default-features = false } -alloy-rpc-types-beacon = { version = "0.5.4", default-features = false } +alloy-eips = { version = "0.6.1", default-features = false } +alloy-serde = { version = "0.6.1", default-features = false } +alloy-provider = { version = "0.6.1", default-features = false } +alloy-primitives = { version = "0.8.11", default-features = false } +alloy-consensus = { version = "0.6.1", default-features = false } +alloy-transport = { version = "0.6.1", default-features = false } +alloy-rpc-client = { version = "0.6.1", default-features = false } +alloy-node-bindings = { version = "0.6.1", default-features = false } +alloy-transport-http = { version = "0.6.1", default-features = false } +alloy-rpc-types-beacon = { version = "0.6.1", default-features = false } # OP Alloy -op-alloy-genesis = { version = "0.5.2", default-features = false } -op-alloy-protocol = { version = "0.5.2", default-features = false } -op-alloy-consensus = { version = "0.5.2", default-features = false } +op-alloy-genesis = { version = "0.6.2", default-features = false } +op-alloy-protocol = { version = "0.6.2", default-features = false } +op-alloy-consensus = { version = "0.6.2", default-features = false } # Serialization -serde = { version = "1.0.213", default-features = false } +serde = { version = "1.0.214", default-features = false } serde_json = { version = "1.0.132", default-features = false } # Misc -lru = "0.12.4" -tokio = "1.40.0" -reqwest = "0.12.8" +lru = "0.12.5" +tokio = "1.41.0" +reqwest = "0.12.9" async-trait = "0.1.83" tracing = { version = "0.1.40", default-features = false } derive_more = { version = "1.0.0", default-features = false } diff --git a/crates/derive/src/alloy_providers.rs b/crates/derive/src/alloy_providers.rs index 73bb7bf..85f4790 100644 --- a/crates/derive/src/alloy_providers.rs +++ b/crates/derive/src/alloy_providers.rs @@ -150,7 +150,8 @@ impl ChainProvider for AlloyChainProvider { .raw_request("debug_getRawBlock".into(), [hash]) .await .map_err(AlloyProviderError::Rpc)?; - let block = Block::decode(&mut raw_block.as_ref()).map_err(AlloyProviderError::Rlp)?; + let block: Block = + Block::decode(&mut raw_block.as_ref()).map_err(AlloyProviderError::Rlp)?; let block_info = BlockInfo { hash: block.header.hash_slow(), diff --git a/crates/derive/src/beacon_client.rs b/crates/derive/src/beacon_client.rs index 0447b92..9f6b847 100644 --- a/crates/derive/src/beacon_client.rs +++ b/crates/derive/src/beacon_client.rs @@ -1,8 +1,8 @@ //! Contains an online implementation of the `BeaconClient` trait. +use alloy_eips::eip4844::IndexedBlobHash; use alloy_rpc_types_beacon::sidecar::{BeaconBlobBundle, BlobData}; use async_trait::async_trait; -use kona_derive::sources::IndexedBlobHash; use reqwest::Client; /// The config spec engine api method. @@ -128,7 +128,7 @@ impl BeaconClient for OnlineBeaconClient { let mut sidecars = Vec::with_capacity(hashes.len()); hashes.iter().for_each(|hash| { if let Some(sidecar) = - raw_response.data.iter().find(|sidecar| sidecar.index == hash.index as u64) + raw_response.data.iter().find(|sidecar| sidecar.index == hash.index) { sidecars.push(sidecar.clone()); } diff --git a/crates/derive/src/blob_provider.rs b/crates/derive/src/blob_provider.rs index c7e5f97..c02a742 100644 --- a/crates/derive/src/blob_provider.rs +++ b/crates/derive/src/blob_provider.rs @@ -1,10 +1,10 @@ //! Contains an online implementation of the `BlobProvider` trait. use crate::{BeaconClient, OnlineBeaconClient}; -use alloy_eips::eip4844::{Blob, BlobTransactionSidecarItem}; +use alloy_eips::eip4844::{Blob, BlobTransactionSidecarItem, IndexedBlobHash}; use alloy_rpc_types_beacon::sidecar::BlobData; use async_trait::async_trait; -use kona_derive::{errors::BlobProviderError, sources::IndexedBlobHash, traits::BlobProvider}; +use kona_derive::{errors::BlobProviderError, traits::BlobProvider}; use op_alloy_protocol::BlockInfo; use tracing::warn; @@ -103,7 +103,7 @@ impl OnlineBlobProvider { let sidecars = self.fetch_sidecars(slot, blob_hashes).await?; // Filter blob sidecars that match the indicies in the specified list. - let blob_hash_indicies = blob_hashes.iter().map(|b| b.index as u64).collect::>(); + let blob_hash_indicies = blob_hashes.iter().map(|b| b.index).collect::>(); let filtered = sidecars .into_iter() .filter(|s| blob_hash_indicies.contains(&s.index)) @@ -159,10 +159,7 @@ where let hash = blob_hashes .get(i) .ok_or(BlobProviderError::Backend("Missing blob hash".to_string()))?; - match sidecar.verify_blob(&alloy_eips::eip1898::NumHash { - hash: hash.hash, - number: hash.index as u64, - }) { + match sidecar.verify_blob(&IndexedBlobHash { hash: hash.hash, index: hash.index }) { Ok(_) => Ok(sidecar.blob), Err(e) => Err(BlobProviderError::Backend(e.to_string())), } @@ -253,7 +250,7 @@ impl OnlineBlobProviderWithFallback>(); + let blob_hash_indicies = blob_hashes.iter().map(|b| b.index).collect::>(); let filtered = sidecars .into_iter() .filter(|s| blob_hash_indicies.contains(&s.index)) @@ -318,10 +315,9 @@ where let hash = blob_hashes.get(i).ok_or(BlobProviderError::Backend( "fallback: failed to get blob hash".to_string(), ))?; - match sidecar.verify_blob(&alloy_eips::eip1898::NumHash { - hash: hash.hash, - number: hash.index as u64, - }) { + match sidecar + .verify_blob(&IndexedBlobHash { hash: hash.hash, index: hash.index }) + { Ok(_) => Ok(sidecar.blob), Err(e) => Err(BlobProviderError::Backend(e.to_string())), } diff --git a/crates/derive/src/test_utils.rs b/crates/derive/src/test_utils.rs index 43c3e6d..988324c 100644 --- a/crates/derive/src/test_utils.rs +++ b/crates/derive/src/test_utils.rs @@ -1,13 +1,13 @@ //! Test Utilities for Online Providers use crate::{APIConfigResponse, APIGenesisResponse}; +use alloy_eips::eip4844::IndexedBlobHash; use alloy_node_bindings::{Anvil, AnvilInstance}; use alloy_provider::{network::Ethereum, ReqwestProvider}; use alloy_rpc_client::RpcClient; use alloy_rpc_types_beacon::sidecar::{BeaconBlobBundle, BlobData}; use alloy_transport_http::Http; use async_trait::async_trait; -use kona_derive::sources::IndexedBlobHash; use reqwest::Client; /// Spawns an Anvil instance and returns a provider and the instance. diff --git a/crates/superchain/Cargo.toml b/crates/superchain/Cargo.toml new file mode 100644 index 0000000..1ee2649 --- /dev/null +++ b/crates/superchain/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "superchain" +description = "Components for the Superchain" + +version.workspace = true +edition.workspace = true +authors.workspace = true +license.workspace = true +homepage.workspace = true +keywords.workspace = true +categories.workspace = true +repository.workspace = true +rust-version.workspace = true + +[lints] +workspace = true + +[dependencies] +superchain-derive = { workspace = true, optional = true } +superchain-registry = { workspace = true, optional = true } + +[features] +default = ["std", "full"] + +std = ["superchain-registry?/std"] + +full = [ + "derive", + "registry", +] + +derive = ["dep:superchain-derive"] +registry = ["dep:superchain-registry"] + +test-utils = ["superchain-derive?/test-utils"] diff --git a/crates/superchain/README.md b/crates/superchain/README.md new file mode 100644 index 0000000..29ce222 --- /dev/null +++ b/crates/superchain/README.md @@ -0,0 +1,3 @@ +# `superchain` + +A suite of `std` components for the `superchain` diff --git a/crates/superchain/src/lib.rs b/crates/superchain/src/lib.rs new file mode 100644 index 0000000..d1cf667 --- /dev/null +++ b/crates/superchain/src/lib.rs @@ -0,0 +1,15 @@ +#![doc = include_str!("../README.md")] +#![doc( + html_logo_url = "https://raw.githubusercontent.com/anton-rs/superchain/main/assets/alloy.jpg", + html_favicon_url = "https://raw.githubusercontent.com/anton-rs/superchain/main/assets/favicon.ico" +)] +#![cfg_attr(not(test), warn(unused_crate_dependencies))] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + +#[cfg(feature = "derive")] +#[doc(inline)] +pub use superchain_derive as derive; + +#[cfg(feature = "registry")] +#[doc(inline)] +pub use superchain_registry as registry;