Skip to content

Commit

Permalink
chore: alloy v11 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Jan 31, 2025
1 parent 32e5211 commit a33542e
Show file tree
Hide file tree
Showing 10 changed files with 147 additions and 145 deletions.
200 changes: 98 additions & 102 deletions Cargo.lock

Large diffs are not rendered by default.

32 changes: 19 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ panic = "abort"
codegen-units = 1
lto = "fat"

[patch.crates-io]
maili-rpc = { git = "https://github.com/op-rs/maili", branch = "matt/bump-alloy11" }
maili-protocol = { git = "https://github.com/op-rs/maili", branch = "matt/bump-alloy11" }
maili-registry = { git = "https://github.com/op-rs/maili", branch = "matt/bump-alloy11" }
maili-genesis = { git = "https://github.com/op-rs/maili", branch = "matt/bump-alloy11" }

[workspace.dependencies]
# Workspace
kona-host = { path = "bin/host", version = "0.1.0", default-features = false }
Expand All @@ -87,23 +93,23 @@ maili-genesis = { version = "0.1.11", default-features = false }
# Alloy
alloy-rlp = { version = "0.3.11", default-features = false }
alloy-trie = { version = "0.7.8", default-features = false }
alloy-eips = { version = "0.9.2", default-features = false }
alloy-serde = { version = "0.9.2", default-features = false }
alloy-provider = { version = "0.9.2", default-features = false }
alloy-consensus = { version = "0.9.2", default-features = false }
alloy-transport = { version = "0.9.2", default-features = false }
alloy-rpc-types = { version = "0.9.2", default-features = false }
alloy-rpc-client = { version = "0.9.2", default-features = false }
alloy-eips = { version = "0.11.0", default-features = false }
alloy-serde = { version = "0.11.0", default-features = false }
alloy-provider = { version = "0.11.0", default-features = false }
alloy-consensus = { version = "0.11.0", default-features = false }
alloy-transport = { version = "0.11.0", default-features = false }
alloy-rpc-types = { version = "0.11.0", default-features = false }
alloy-rpc-client = { version = "0.11.0", default-features = false }
alloy-primitives = { version = "0.8.19", default-features = false }
alloy-node-bindings = { version = "0.9.2", default-features = false }
alloy-transport-http = { version = "0.9.2", default-features = false }
alloy-rpc-types-engine = { version = "0.9.2", default-features = false }
alloy-rpc-types-beacon = { version = "0.9.2", default-features = false }
alloy-node-bindings = { version = "0.11.0", default-features = false }
alloy-transport-http = { version = "0.11.0", default-features = false }
alloy-rpc-types-engine = { version = "0.11.0", default-features = false }
alloy-rpc-types-beacon = { version = "0.11.0", default-features = false }
alloy-sol-types = { version = "0.8.19", default-features = false }

# OP Alloy
op-alloy-consensus = { version = "0.9.6", default-features = false }
op-alloy-rpc-types-engine = { version = "0.9.6", default-features = false }
op-alloy-consensus = { version = "0.10.0", default-features = false }
op-alloy-rpc-types-engine = { version = "0.10.0", default-features = false }

# General
lru = "0.13.0"
Expand Down
6 changes: 3 additions & 3 deletions bin/host/src/eth/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Ethereum utilities for the host binary.
use alloy_provider::ReqwestProvider;
use alloy_provider::RootProvider;
use alloy_rpc_client::RpcClient;
use alloy_transport_http::Http;
use reqwest::Client;
Expand All @@ -9,8 +9,8 @@ mod precompiles;
pub(crate) use precompiles::execute;

/// Returns an HTTP provider for the given URL.
pub fn http_provider(url: &str) -> ReqwestProvider {
pub fn http_provider(url: &str) -> RootProvider {
let url = url.parse().unwrap();
let http = Http::<Client>::new(url);
ReqwestProvider::new(RpcClient::new(http, true))
RootProvider::new(RpcClient::new(http, true))
}
10 changes: 5 additions & 5 deletions bin/host/src/interop/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use alloy_eips::{
BlockId,
};
use alloy_primitives::{address, keccak256, map::HashMap, Address, Bytes, B256};
use alloy_provider::{Provider, ReqwestProvider};
use alloy_provider::{Provider, RootProvider};
use alloy_rlp::{Decodable, Encodable, EMPTY_STRING_CODE};
use alloy_rpc_types::{
Block, BlockNumberOrTag, BlockTransactions, BlockTransactionsKind, Transaction,
Expand Down Expand Up @@ -51,11 +51,11 @@ where
/// Key-value store for preimages.
kv_store: Arc<RwLock<KV>>,
/// L1 chain provider.
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
/// The blob provider
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
/// L2 chain providers, keyed by chain ID.
l2_providers: HashMap<u64, ReqwestProvider>,
l2_providers: HashMap<u64, RootProvider>,
/// The cached active L2 chain ID.
active_l2_chain_id: u64,
/// The last hint that was received. [None] if no hint has been received yet.
Expand All @@ -70,9 +70,9 @@ where
pub fn new(
cfg: InteropHostCli,
kv_store: Arc<RwLock<KV>>,
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
l2_providers: HashMap<u64, ReqwestProvider>,
l2_providers: HashMap<u64, RootProvider>,
) -> Self {
let active_l2_chain_id = cfg.active_l2_chain_id().expect("No active L2 chain ID");
Self {
Expand Down
6 changes: 3 additions & 3 deletions bin/host/src/interop/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use super::{InteropFetcher, InteropHostCli, LocalKeyValueStore};
use crate::eth::http_provider;
use alloy_primitives::map::HashMap;
use alloy_provider::{Provider, ReqwestProvider};
use alloy_provider::{Provider, RootProvider};
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use kona_host::{
Expand All @@ -19,11 +19,11 @@ use tokio::sync::RwLock;
#[derive(Debug)]
pub struct InteropProviders {
/// The L1 EL provider.
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
/// The L1 beacon node provider.
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
/// The L2 EL providers, keyed by chain ID.
l2_providers: HashMap<u64, ReqwestProvider>,
l2_providers: HashMap<u64, RootProvider>,
}

#[async_trait]
Expand Down
10 changes: 5 additions & 5 deletions bin/host/src/single/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use alloy_eips::{
BlockId,
};
use alloy_primitives::{address, keccak256, map::HashMap, Address, Bytes, B256};
use alloy_provider::{Provider, ReqwestProvider};
use alloy_provider::{Provider, RootProvider};
use alloy_rlp::{Decodable, EMPTY_STRING_CODE};
use alloy_rpc_types::{
debug::ExecutionWitness, Block, BlockNumberOrTag, BlockTransactions, BlockTransactionsKind,
Expand Down Expand Up @@ -37,11 +37,11 @@ where
/// Key-value store for preimages.
kv_store: Arc<RwLock<KV>>,
/// L1 chain provider.
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
/// The blob provider
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
/// L2 chain provider.
l2_provider: ReqwestProvider,
l2_provider: RootProvider,
/// L2 head
l2_head: B256,
/// The last hint that was received. [None] if no hint has been received yet.
Expand All @@ -55,9 +55,9 @@ where
/// Create a new [SingleChainFetcher] with the given [KeyValueStore].
pub fn new(
kv_store: Arc<RwLock<KV>>,
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
l2_provider: ReqwestProvider,
l2_provider: RootProvider,
l2_head: B256,
) -> Self {
Self {
Expand Down
6 changes: 3 additions & 3 deletions bin/host/src/single/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use super::{LocalKeyValueStore, SingleChainFetcher, SingleChainHostCli};
use crate::eth::http_provider;
use alloy_provider::ReqwestProvider;
use alloy_provider::RootProvider;
use anyhow::{anyhow, Result};
use async_trait::async_trait;
use kona_host::{
Expand All @@ -18,11 +18,11 @@ use tokio::sync::RwLock;
#[derive(Debug)]
pub struct SingleChainProviders {
/// The L1 EL provider.
l1_provider: ReqwestProvider,
l1_provider: RootProvider,
/// The L1 beacon node provider.
blob_provider: OnlineBlobProvider<OnlineBeaconClient>,
/// The L2 EL provider.
l2_provider: ReqwestProvider,
l2_provider: RootProvider,
}

#[async_trait]
Expand Down
6 changes: 3 additions & 3 deletions crates/executor/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use alloy_consensus::Header;
use alloy_primitives::{Bytes, Sealable, B256};
use alloy_provider::{
network::primitives::{BlockTransactions, BlockTransactionsKind},
Provider, ReqwestProvider,
Provider, RootProvider,
};
use alloy_rlp::Decodable;
use alloy_rpc_client::RpcClient;
Expand Down Expand Up @@ -47,7 +47,7 @@ pub(crate) struct ExecutorTestFixture {
#[derive(Debug)]
pub(crate) struct ExecutorTestFixtureCreator {
/// The RPC provider for the L2 execution layer.
pub(crate) provider: ReqwestProvider,
pub(crate) provider: RootProvider,
/// The block number to create the test fixture for.
pub(crate) block_number: u64,
/// The key value store for the test fixture.
Expand All @@ -66,7 +66,7 @@ impl ExecutorTestFixtureCreator {

let url = provider_url.parse().expect("Invalid provider URL");
let http = Http::<Client>::new(url);
let provider = ReqwestProvider::new(RpcClient::new(http, false));
let provider = RootProvider::new(RpcClient::new(http, false));

Self {
provider,
Expand Down
8 changes: 4 additions & 4 deletions crates/providers-alloy/src/chain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use alloy_consensus::{Block, Header, Receipt, ReceiptWithBloom, TxEnvelope, TxType};
use alloy_primitives::{Bytes, B256, U64};
use alloy_provider::{Provider, ReqwestProvider};
use alloy_provider::{Provider, RootProvider};
use alloy_rlp::{Buf, Decodable};
use alloy_transport::{RpcError, TransportErrorKind};
use async_trait::async_trait;
Expand All @@ -25,7 +25,7 @@ const CACHE_SIZE: usize = 16;
#[derive(Debug, Clone)]
pub struct AlloyChainProvider {
/// The inner Ethereum JSON-RPC provider.
inner: ReqwestProvider,
inner: RootProvider,
/// `header_by_hash` LRU cache.
header_by_hash_cache: LruCache<B256, Header>,
/// `receipts_by_hash_cache` LRU cache.
Expand All @@ -36,7 +36,7 @@ pub struct AlloyChainProvider {

impl AlloyChainProvider {
/// Creates a new [AlloyChainProvider] with the given alloy provider.
pub fn new(inner: ReqwestProvider) -> Self {
pub fn new(inner: RootProvider) -> Self {
Self {
inner,
header_by_hash_cache: LruCache::new(NonZeroUsize::new(CACHE_SIZE).unwrap()),
Expand All @@ -49,7 +49,7 @@ impl AlloyChainProvider {

/// Creates a new [AlloyChainProvider] from the provided [reqwest::Url].
pub fn new_http(url: reqwest::Url) -> Self {
let inner = ReqwestProvider::new_http(url);
let inner = RootProvider::new_http(url);
Self::new(inner)
}

Expand Down
8 changes: 4 additions & 4 deletions crates/providers-alloy/src/l2_chain_provider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Providers that use alloy provider types on the backend.
use alloy_primitives::{Bytes, U64};
use alloy_provider::{Provider, ReqwestProvider};
use alloy_provider::{Provider, RootProvider};
use alloy_rlp::Decodable;
use alloy_transport::{RpcError, TransportErrorKind};
use async_trait::async_trait;
Expand All @@ -23,14 +23,14 @@ use std::sync::Arc;
#[derive(Debug, Clone)]
pub struct AlloyL2ChainProvider {
/// The inner Ethereum JSON-RPC provider.
inner: ReqwestProvider,
inner: RootProvider,
/// The rollup configuration.
rollup_config: Arc<RollupConfig>,
}

impl AlloyL2ChainProvider {
/// Creates a new [AlloyL2ChainProvider] with the given alloy provider and [RollupConfig].
pub fn new(inner: ReqwestProvider, rollup_config: Arc<RollupConfig>) -> Self {
pub fn new(inner: RootProvider, rollup_config: Arc<RollupConfig>) -> Self {
Self { inner, rollup_config }
}

Expand All @@ -46,7 +46,7 @@ impl AlloyL2ChainProvider {

/// Creates a new [AlloyL2ChainProvider] from the provided [reqwest::Url].
pub fn new_http(url: reqwest::Url, rollup_config: Arc<RollupConfig>) -> Self {
let inner = ReqwestProvider::new_http(url);
let inner = RootProvider::new_http(url);
Self::new(inner, rollup_config)
}
}
Expand Down

0 comments on commit a33542e

Please sign in to comment.