From d86061cee7b0af04dcbd3fdc3aa375989fd69dd5 Mon Sep 17 00:00:00 2001 From: Naman Garg <0708ng@gmail.com> Date: Thu, 18 Jul 2024 19:38:11 +0530 Subject: [PATCH] feat(sidecar): use alloy as single dependency --- bolt-sidecar/Cargo.lock | 179 ++++++++++++++++++-- bolt-sidecar/Cargo.toml | 20 +-- bolt-sidecar/bin/sidecar.rs | 2 +- bolt-sidecar/src/builder/compat.rs | 12 +- bolt-sidecar/src/builder/mod.rs | 4 +- bolt-sidecar/src/builder/payload_builder.rs | 21 ++- bolt-sidecar/src/builder/signature.rs | 2 +- bolt-sidecar/src/builder/template.rs | 2 +- bolt-sidecar/src/client/commit_boost.rs | 2 +- bolt-sidecar/src/client/pubsub.rs | 16 +- bolt-sidecar/src/client/rpc.rs | 37 ++-- bolt-sidecar/src/common.rs | 2 +- bolt-sidecar/src/config/chain.rs | 2 +- bolt-sidecar/src/config/mod.rs | 2 +- bolt-sidecar/src/crypto/bls.rs | 2 +- bolt-sidecar/src/json_rpc/api.rs | 4 +- bolt-sidecar/src/primitives/commitment.rs | 2 +- bolt-sidecar/src/primitives/constraint.rs | 2 +- bolt-sidecar/src/primitives/mod.rs | 2 +- bolt-sidecar/src/state/execution.rs | 22 ++- bolt-sidecar/src/state/fetcher.rs | 8 +- bolt-sidecar/src/state/head_tracker.rs | 2 +- bolt-sidecar/src/test_util.rs | 20 ++- 23 files changed, 258 insertions(+), 109 deletions(-) diff --git a/bolt-sidecar/Cargo.lock b/bolt-sidecar/Cargo.lock index e51cf22bf..e63b6f79b 100644 --- a/bolt-sidecar/Cargo.lock +++ b/bolt-sidecar/Cargo.lock @@ -44,6 +44,31 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45855eb65e9cc70294ebea1279f6d8ee0636bf2ed3897683ebbae2739975ae8c" +dependencies = [ + "alloy-consensus 0.2.0", + "alloy-contract", + "alloy-core", + "alloy-eips 0.2.0", + "alloy-genesis 0.2.0", + "alloy-network 0.2.0", + "alloy-provider 0.2.0", + "alloy-pubsub", + "alloy-rpc-client 0.2.0", + "alloy-rpc-types 0.2.0", + "alloy-serde 0.2.0", + "alloy-signer 0.2.0", + "alloy-signer-local", + "alloy-transport 0.2.0", + "alloy-transport-http 0.2.0", + "alloy-transport-ipc", + "alloy-transport-ws", +] + [[package]] name = "alloy-chains" version = "0.1.22" @@ -96,6 +121,55 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-contract" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa5d42d9f87896536234b0fac1a84ad9d9dc7a4b27839cac35d0899e64ddf083" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network 0.2.0", + "alloy-primitives", + "alloy-provider 0.2.0", + "alloy-pubsub", + "alloy-rpc-types-eth 0.2.0", + "alloy-sol-types", + "alloy-transport 0.2.0", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "529fc6310dc1126c8de51c376cbc59c79c7f662bd742be7dc67055d5421a81b4" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413902aa18a97569e60f679c23f46a18db1656d87ab4d4e49d0e1e52042f66df" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "const-hex", + "itoa", + "serde", + "serde_json", + "winnow 0.6.13", +] + [[package]] name = "alloy-eips" version = "0.1.0" @@ -164,6 +238,18 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-json-abi" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc05b04ac331a9f07e3a4036ef7926e49a8bf84a99a1ccfc7e2ab55a5fcbb372" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + [[package]] name = "alloy-json-rpc" version = "0.1.2" @@ -316,9 +402,12 @@ dependencies = [ "alloy-primitives", "alloy-pubsub", "alloy-rpc-client 0.2.0", + "alloy-rpc-types-engine 0.2.0", "alloy-rpc-types-eth 0.2.0", + "alloy-rpc-types-trace", "alloy-transport 0.2.0", "alloy-transport-http 0.2.0", + "alloy-transport-ipc", "alloy-transport-ws", "async-stream", "async-trait", @@ -409,6 +498,7 @@ dependencies = [ "alloy-pubsub", "alloy-transport 0.2.0", "alloy-transport-http 0.2.0", + "alloy-transport-ipc", "alloy-transport-ws", "futures", "pin-project", @@ -456,7 +546,10 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e5d76f1e8b22f48b7b8f985782b68e7eb3938780e50e8b646a53e41a598cdf5" dependencies = [ + "alloy-rpc-types-beacon 0.2.0", + "alloy-rpc-types-engine 0.2.0", "alloy-rpc-types-eth 0.2.0", + "alloy-rpc-types-trace", "alloy-serde 0.2.0", "serde", ] @@ -669,6 +762,7 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" dependencies = [ + "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck 0.5.0", @@ -687,24 +781,38 @@ version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" dependencies = [ + "alloy-json-abi", "const-hex", "dunce", "heck 0.5.0", "proc-macro2", "quote", + "serde_json", "syn 2.0.67", "syn-solidity", ] +[[package]] +name = "alloy-sol-type-parser" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbcba3ca07cf7975f15d871b721fb18031eec8bce51103907f6dcce00b255d98" +dependencies = [ + "serde", + "winnow 0.6.13", +] + [[package]] name = "alloy-sol-types" version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" dependencies = [ + "alloy-json-abi", "alloy-primitives", "alloy-sol-macro", "const-hex", + "serde", ] [[package]] @@ -774,6 +882,25 @@ dependencies = [ "url", ] +[[package]] +name = "alloy-transport-ipc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31007c56dc65bd81392112dda4a14c20ac7e30bb4cb2e9176192e8d9fab1983f" +dependencies = [ + "alloy-json-rpc 0.2.0", + "alloy-pubsub", + "alloy-transport 0.2.0", + "bytes", + "futures", + "interprocess", + "pin-project", + "serde_json", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "alloy-transport-ws" version = "0.2.0" @@ -1349,25 +1476,8 @@ dependencies = [ name = "bolt-sidecar" version = "0.1.0" dependencies = [ - "alloy-consensus 0.2.0", - "alloy-eips 0.2.0", - "alloy-json-rpc 0.2.0", - "alloy-network 0.2.0", + "alloy", "alloy-node-bindings", - "alloy-primitives", - "alloy-provider 0.2.0", - "alloy-pubsub", - "alloy-rlp", - "alloy-rpc-client 0.2.0", - "alloy-rpc-types 0.2.0", - "alloy-rpc-types-beacon 0.2.0", - "alloy-rpc-types-engine 0.2.0", - "alloy-rpc-types-trace", - "alloy-signer 0.2.0", - "alloy-signer-local", - "alloy-transport 0.2.0", - "alloy-transport-http 0.2.0", - "alloy-transport-ws", "async-trait", "axum", "beacon-api-client", @@ -1911,6 +2021,12 @@ dependencies = [ "subtle", ] +[[package]] +name = "doctest-file" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" + [[package]] name = "dotenvy" version = "0.15.7" @@ -2929,6 +3045,21 @@ dependencies = [ "num-traits", ] +[[package]] +name = "interprocess" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67bafc2f5dbdad79a6d925649758d5472647b416028099f0b829d1b67fdd47d3" +dependencies = [ + "doctest-file", + "futures-core", + "libc", + "recvmsg", + "tokio", + "widestring", + "windows-sys 0.52.0", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -3954,6 +4085,12 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "recvmsg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" + [[package]] name = "redox_syscall" version = "0.5.2" @@ -5877,6 +6014,12 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "widestring" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7219d36b6eac893fa81e84ebe06485e7dcbb616177469b142df14f1f4deb1311" + [[package]] name = "winapi" version = "0.3.9" diff --git a/bolt-sidecar/Cargo.toml b/bolt-sidecar/Cargo.toml index 0d307d6a8..81ccf6635 100644 --- a/bolt-sidecar/Cargo.toml +++ b/bolt-sidecar/Cargo.toml @@ -19,25 +19,7 @@ tree_hash_derive = "0.5" secp256k1 = { version = "0.29.0", features = ["rand"] } # alloy -alloy-rpc-client = { version = "0.2.0", features = ["reqwest", "ws", "pubsub"] } -alloy-consensus = { version = "0.2.0", features = ["k256"] } -alloy-provider = { version = "0.2.0", features = ["ws"] } -alloy-signer = { version = "0.2.0" } -alloy-signer-local = { version = "0.2.0" } -alloy-transport = { version = "0.2.0" } -alloy-eips = { version = "0.2.0" } -alloy-transport-http = { version = "0.2.0" } -alloy-transport-ws = { version = "0.2.0" } -alloy-pubsub = { version = "0.2.0" } -alloy-rpc-types = { version = "0.2.0" } -alloy-rpc-types-engine = { version = "0.2.0" } -alloy-rpc-types-beacon = { version = "0.2.0" } -alloy-rpc-types-trace = { version = "0.2.0" } -alloy-json-rpc = { version = "0.2.0" } -alloy-network = { version = "0.2.0" } -alloy-primitives = { version = "0.7.7" } -alloy-rlp = { version = "0.3.7" } - +alloy = { version = "0.2.0", features = ["full", "provider-trace-api", "rpc-types-beacon", "rpc-types-engine"] } # alloy-rpc-types = { git = "https://github.com/chainbound/alloy", branch = "fix/account-override-serialize" } diff --git a/bolt-sidecar/bin/sidecar.rs b/bolt-sidecar/bin/sidecar.rs index 66d22d48d..01e3020e7 100644 --- a/bolt-sidecar/bin/sidecar.rs +++ b/bolt-sidecar/bin/sidecar.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_rpc_types_beacon::events::HeadEvent; +use alloy::rpc::types::beacon::events::HeadEvent; use tokio::sync::mpsc; use bolt_sidecar::{ diff --git a/bolt-sidecar/src/builder/compat.rs b/bolt-sidecar/src/builder/compat.rs index 126bcaf82..f79d7f56b 100644 --- a/bolt-sidecar/src/builder/compat.rs +++ b/bolt-sidecar/src/builder/compat.rs @@ -1,8 +1,10 @@ -use alloy_eips::eip4895::Withdrawal; -use alloy_primitives::{Address, Bloom, B256, U256}; -use alloy_rpc_types_engine::{ - ExecutionPayload as AlloyExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, - ExecutionPayloadV3, +use alloy::{ + eips::eip4895::Withdrawal, + primitives::{Address, Bloom, B256, U256}, + rpc::types::engine::{ + ExecutionPayload as AlloyExecutionPayload, ExecutionPayloadV1, ExecutionPayloadV2, + ExecutionPayloadV3, + }, }; use ethereum_consensus::{ bellatrix::mainnet::Transaction, diff --git a/bolt-sidecar/src/builder/mod.rs b/bolt-sidecar/src/builder/mod.rs index 53a08d5a2..d52d49236 100644 --- a/bolt-sidecar/src/builder/mod.rs +++ b/bolt-sidecar/src/builder/mod.rs @@ -1,4 +1,4 @@ -use alloy_primitives::U256; +use alloy::primitives::U256; use blst::min_pk::SecretKey; use ethereum_consensus::{ crypto::PublicKey, @@ -47,7 +47,7 @@ pub enum BuilderError { #[error("Failed HTTP request: {0}")] Reqwest(#[from] reqwest::Error), #[error("Failed while fetching from RPC: {0}")] - Transport(#[from] alloy_transport::TransportError), + Transport(#[from] alloy::transports::TransportError), #[error("Failed in SSZ merkleization: {0}")] Merkleization(#[from] MerkleizationError), #[error("Failed while interacting with beacon client: {0}")] diff --git a/bolt-sidecar/src/builder/payload_builder.rs b/bolt-sidecar/src/builder/payload_builder.rs index 1178ecab0..8226ad5ce 100644 --- a/bolt-sidecar/src/builder/payload_builder.rs +++ b/bolt-sidecar/src/builder/payload_builder.rs @@ -1,7 +1,8 @@ -use alloy_eips::{calc_excess_blob_gas, calc_next_block_base_fee, eip1559::BaseFeeParams}; -use alloy_primitives::{Address, Bytes, B256, U256}; -use alloy_rpc_types::Block; -use alloy_rpc_types_engine::ExecutionPayload as AlloyExecutionPayload; +use alloy::{ + eips::{calc_excess_blob_gas, calc_next_block_base_fee, eip1559::BaseFeeParams}, + primitives::{Address, Bytes, B256, U256}, + rpc::types::{engine::ExecutionPayload as AlloyExecutionPayload, Block}, +}; use beacon_api_client::{BlockId, StateId}; use hex::FromHex; use regex::Regex; @@ -390,11 +391,13 @@ pub(crate) fn build_header_with_hints_and_context( #[cfg(test)] mod tests { - use alloy_eips::eip2718::Encodable2718; - use alloy_network::{EthereumWallet, TransactionBuilder}; - use alloy_primitives::{hex, Address}; - use alloy_signer::k256::ecdsa::SigningKey; - use alloy_signer_local::PrivateKeySigner; + use alloy::{ + eips::eip2718::Encodable2718, + network::{EthereumWallet, TransactionBuilder}, + primitives::{hex, Address}, + signers::k256::ecdsa::SigningKey, + signers::local::PrivateKeySigner, + }; use reth_primitives::TransactionSigned; use crate::{ diff --git a/bolt-sidecar/src/builder/signature.rs b/bolt-sidecar/src/builder/signature.rs index 1c7a77eb8..04ebcb6d2 100644 --- a/bolt-sidecar/src/builder/signature.rs +++ b/bolt-sidecar/src/builder/signature.rs @@ -1,4 +1,4 @@ -use alloy_rpc_types_beacon::{constants::BLS_DST_SIG, BlsSignature}; +use alloy::rpc::types::beacon::{constants::BLS_DST_SIG, BlsSignature}; use blst::min_pk::{PublicKey, SecretKey}; use blst::BLST_ERROR; use ethereum_consensus::crypto::Signature; diff --git a/bolt-sidecar/src/builder/template.rs b/bolt-sidecar/src/builder/template.rs index f424c431d..91fb3d371 100644 --- a/bolt-sidecar/src/builder/template.rs +++ b/bolt-sidecar/src/builder/template.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; -use alloy_primitives::{Address, U256}; +use alloy::primitives::{Address, U256}; use ethereum_consensus::{ crypto::{KzgCommitment, KzgProof}, deneb::mainnet::{Blob, BlobsBundle}, diff --git a/bolt-sidecar/src/client/commit_boost.rs b/bolt-sidecar/src/client/commit_boost.rs index b4c689ace..f41066768 100644 --- a/bolt-sidecar/src/client/commit_boost.rs +++ b/bolt-sidecar/src/client/commit_boost.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use alloy_rpc_types_beacon::{BlsPublicKey, BlsSignature}; +use alloy::rpc::types::beacon::{BlsPublicKey, BlsSignature}; use cb_common::pbs::{COMMIT_BOOST_API, PUBKEYS_PATH, SIGN_REQUEST_PATH}; use cb_crypto::types::SignRequest; use ethereum_consensus::ssz::prelude::ssz_rs; diff --git a/bolt-sidecar/src/client/pubsub.rs b/bolt-sidecar/src/client/pubsub.rs index 6e9feac2c..6db1f0b4c 100644 --- a/bolt-sidecar/src/client/pubsub.rs +++ b/bolt-sidecar/src/client/pubsub.rs @@ -3,16 +3,18 @@ use std::{ str::FromStr, }; -use alloy::{ClientBuilder, WsConnect}; -use alloy_json_rpc::RpcError; -use alloy_pubsub::PubSubFrontend; -use alloy_rpc_client as alloy; -use alloy_transport::TransportError; +use alloy::{ + pubsub::PubSubFrontend, + rpc::client::{self as alloyClient, ClientBuilder, WsConnect}, + transports::RpcError, + transports::TransportError, +}; + use reqwest::Url; /// Wrapper around an [`alloy::RpcClient`] that uses WS as the transport. Supports batching /// JSON-RPC requests. -pub struct PubsubClient(alloy::RpcClient); +pub struct PubsubClient(alloyClient::RpcClient); #[allow(unused)] impl PubsubClient { @@ -27,7 +29,7 @@ impl PubsubClient { } impl Deref for PubsubClient { - type Target = alloy::RpcClient; + type Target = alloyClient::RpcClient; fn deref(&self) -> &Self::Target { &self.0 diff --git a/bolt-sidecar/src/client/rpc.rs b/bolt-sidecar/src/client/rpc.rs index 75f23ee6a..c6233d2be 100644 --- a/bolt-sidecar/src/client/rpc.rs +++ b/bolt-sidecar/src/client/rpc.rs @@ -1,21 +1,28 @@ //! This module contains the `RpcClient` struct, which is a wrapper around the `alloy_rpc_client`. //! It provides a simple interface to interact with the Execution layer JSON-RPC API. -use alloy_rpc_types_trace::geth::{GethDebugTracingCallOptions, GethTrace}; use futures::future::join_all; use std::{ collections::HashSet, ops::{Deref, DerefMut}, }; -use alloy::ClientBuilder; -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{Address, Bytes, B256, U256, U64}; -use alloy_rpc_client::{self as alloy, Waiter}; -use alloy_rpc_types::{Block, EIP1186AccountProofResponse, FeeHistory, TransactionRequest}; -use alloy_rpc_types_trace::parity::{TraceResults, TraceType}; -use alloy_transport::{TransportErrorKind, TransportResult}; -use alloy_transport_http::Http; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, Bytes, B256, U256, U64}, + rpc::{ + client::{self as alloyClient, ClientBuilder, Waiter}, + types::{ + trace::{ + geth::{GethDebugTracingCallOptions, GethTrace}, + parity::{TraceResults, TraceType}, + }, + {Block, EIP1186AccountProofResponse, FeeHistory, TransactionRequest}, + }, + }, + transports::{http::Http, TransportErrorKind, TransportResult}, +}; + use reqwest::{Client, Url}; use crate::primitives::AccountState; @@ -23,7 +30,7 @@ use crate::primitives::AccountState; /// An HTTP-based JSON-RPC client that supports batching. /// Implements all methods that are relevant to Bolt state. #[derive(Clone, Debug)] -pub struct RpcClient(alloy::RpcClient>); +pub struct RpcClient(alloyClient::RpcClient>); impl RpcClient { /// Create a new `RpcClient` with the given URL. @@ -201,7 +208,7 @@ impl RpcClient { } impl Deref for RpcClient { - type Target = alloy::RpcClient>; + type Target = alloyClient::RpcClient>; fn deref(&self) -> &Self::Target { &self.0 @@ -218,9 +225,11 @@ impl DerefMut for RpcClient { mod tests { use std::str::FromStr; - use alloy_consensus::constants::ETH_TO_WEI; - use alloy_primitives::{uint, Uint}; - use alloy_rpc_types::EIP1186AccountProofResponse; + use alloy::{ + consensus::constants::ETH_TO_WEI, + primitives::{uint, Uint}, + rpc::types::EIP1186AccountProofResponse, + }; use reth_primitives::B256; use crate::test_util::launch_anvil; diff --git a/bolt-sidecar/src/common.rs b/bolt-sidecar/src/common.rs index e73c8dbd4..c23e43c64 100644 --- a/bolt-sidecar/src/common.rs +++ b/bolt-sidecar/src/common.rs @@ -1,4 +1,4 @@ -use alloy_primitives::U256; +use alloy::primitives::U256; use reth_primitives::PooledTransactionsElement; use crate::{ diff --git a/bolt-sidecar/src/config/chain.rs b/bolt-sidecar/src/config/chain.rs index eda5c9d61..7ce0aa5a5 100644 --- a/bolt-sidecar/src/config/chain.rs +++ b/bolt-sidecar/src/config/chain.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_primitives::b256; +use alloy::primitives::b256; use clap::{Args, ValueEnum}; /// Default commitment deadline duration. diff --git a/bolt-sidecar/src/config/mod.rs b/bolt-sidecar/src/config/mod.rs index d0f60d595..a7818388c 100644 --- a/bolt-sidecar/src/config/mod.rs +++ b/bolt-sidecar/src/config/mod.rs @@ -1,6 +1,6 @@ use std::{fs::read_to_string, path::Path, str::FromStr}; -use alloy_primitives::Address; +use alloy::primitives::Address; use blst::min_pk::SecretKey; use clap::Parser; use reqwest::Url; diff --git a/bolt-sidecar/src/crypto/bls.rs b/bolt-sidecar/src/crypto/bls.rs index e06257135..9467f326c 100644 --- a/bolt-sidecar/src/crypto/bls.rs +++ b/bolt-sidecar/src/crypto/bls.rs @@ -1,4 +1,4 @@ -use alloy_primitives::FixedBytes; +use alloy::primitives::FixedBytes; use blst::{min_pk::Signature, BLST_ERROR}; use rand::RngCore; diff --git a/bolt-sidecar/src/json_rpc/api.rs b/bolt-sidecar/src/json_rpc/api.rs index 2b4f88aa6..3d23eac80 100644 --- a/bolt-sidecar/src/json_rpc/api.rs +++ b/bolt-sidecar/src/json_rpc/api.rs @@ -24,11 +24,11 @@ pub enum ApiError { #[error("duplicate: the same request already exists")] DuplicateRequest, #[error("signature error: {0}")] - Signature(#[from] alloy_primitives::SignatureError), + Signature(#[from] alloy::primitives::SignatureError), #[error("signature pubkey mismatch. expected: {expected}, got: {got}")] SignaturePubkeyMismatch { expected: String, got: String }, #[error("failed to decode RLP: {0}")] - Rlp(#[from] alloy_rlp::Error), + Rlp(#[from] alloy::transports::HttpError), #[error("failed during HTTP call: {0}")] Http(#[from] reqwest::Error), #[error("downstream error: {0}")] diff --git a/bolt-sidecar/src/primitives/commitment.rs b/bolt-sidecar/src/primitives/commitment.rs index 9db058198..5f421cc3e 100644 --- a/bolt-sidecar/src/primitives/commitment.rs +++ b/bolt-sidecar/src/primitives/commitment.rs @@ -1,7 +1,7 @@ use serde::{de, Deserialize, Deserializer, Serialize}; use std::str::FromStr; -use alloy_primitives::{keccak256, Address, Signature, B256}; +use alloy::primitives::{keccak256, Address, Signature, B256}; use reth_primitives::PooledTransactionsElement; use super::TransactionExt; diff --git a/bolt-sidecar/src/primitives/constraint.rs b/bolt-sidecar/src/primitives/constraint.rs index f1073ce53..db1abf7ba 100644 --- a/bolt-sidecar/src/primitives/constraint.rs +++ b/bolt-sidecar/src/primitives/constraint.rs @@ -1,4 +1,4 @@ -use alloy_primitives::{keccak256, Address}; +use alloy::primitives::{keccak256, Address}; use reth_primitives::PooledTransactionsElement; use secp256k1::Message; use serde::Serialize; diff --git a/bolt-sidecar/src/primitives/mod.rs b/bolt-sidecar/src/primitives/mod.rs index 3da7be625..b6eec1852 100644 --- a/bolt-sidecar/src/primitives/mod.rs +++ b/bolt-sidecar/src/primitives/mod.rs @@ -3,7 +3,7 @@ use std::sync::{atomic::AtomicU64, Arc}; -use alloy_primitives::U256; +use alloy::primitives::U256; use ethereum_consensus::{ crypto::{KzgCommitment, PublicKey as BlsPublicKey, Signature as BlsSignature}, deneb::{ diff --git a/bolt-sidecar/src/state/execution.rs b/bolt-sidecar/src/state/execution.rs index bec286b5c..13f8b4d24 100644 --- a/bolt-sidecar/src/state/execution.rs +++ b/bolt-sidecar/src/state/execution.rs @@ -1,6 +1,8 @@ -use alloy_eips::eip4844::MAX_BLOBS_PER_BLOCK; -use alloy_primitives::{Address, SignatureError, U256}; -use alloy_transport::TransportError; +use alloy::{ + eips::eip4844::MAX_BLOBS_PER_BLOCK, + primitives::{Address, SignatureError, U256}, + transports::TransportError, +}; use reth_primitives::{ revm_primitives::EnvKzgSettings, BlobTransactionValidationError, PooledTransactionsElement, }; @@ -432,12 +434,14 @@ mod tests { use std::str::FromStr; use std::{num::NonZero, time::Duration}; - use alloy_consensus::constants::ETH_TO_WEI; - use alloy_eips::eip2718::Encodable2718; - use alloy_network::EthereumWallet; - use alloy_primitives::{uint, Uint}; - use alloy_provider::{network::TransactionBuilder, Provider, ProviderBuilder}; - use alloy_signer_local::PrivateKeySigner; + use alloy::{ + consensus::constants::ETH_TO_WEI, + eips::eip2718::Encodable2718, + network::EthereumWallet, + primitives::{uint, Uint}, + providers::{network::TransactionBuilder, Provider, ProviderBuilder}, + signers::local::PrivateKeySigner, + }; use fetcher::{StateClient, StateFetcher}; use crate::{ diff --git a/bolt-sidecar/src/state/fetcher.rs b/bolt-sidecar/src/state/fetcher.rs index 2513c383c..9ef088b2b 100644 --- a/bolt-sidecar/src/state/fetcher.rs +++ b/bolt-sidecar/src/state/fetcher.rs @@ -4,9 +4,11 @@ use std::{collections::HashMap, time::Duration}; -use alloy_eips::BlockNumberOrTag; -use alloy_primitives::{Address, Bytes, U256, U64}; -use alloy_transport::TransportError; +use alloy::{ + eips::BlockNumberOrTag, + primitives::{Address, Bytes, U256, U64}, + transports::TransportError, +}; use futures::{stream::FuturesOrdered, StreamExt}; use reqwest::Url; diff --git a/bolt-sidecar/src/state/head_tracker.rs b/bolt-sidecar/src/state/head_tracker.rs index 6acfc6ced..8330c769d 100644 --- a/bolt-sidecar/src/state/head_tracker.rs +++ b/bolt-sidecar/src/state/head_tracker.rs @@ -1,6 +1,6 @@ use std::time::Duration; -use alloy_rpc_types_beacon::events::HeadEvent; +use alloy::rpc::types::beacon::events::HeadEvent; use beacon_api_client::Topic; use futures::StreamExt; use tokio::{sync::broadcast, task::AbortHandle}; diff --git a/bolt-sidecar/src/test_util.rs b/bolt-sidecar/src/test_util.rs index 86b01d747..ece145d1c 100644 --- a/bolt-sidecar/src/test_util.rs +++ b/bolt-sidecar/src/test_util.rs @@ -1,13 +1,15 @@ -use alloy_eips::eip2718::Encodable2718; -use alloy_network::{EthereumWallet, TransactionBuilder}; -use alloy_node_bindings::{Anvil, AnvilInstance}; -use alloy_primitives::{keccak256, Address, B256, U256}; -use alloy_rpc_types::TransactionRequest; -use alloy_signer::{ - k256::{ecdsa::SigningKey as K256SigningKey, SecretKey as K256SecretKey}, - Signer, +use alloy::{ + eips::eip2718::Encodable2718, + network::{EthereumWallet, TransactionBuilder}, + primitives::{keccak256, Address, B256, U256}, + rpc::types::TransactionRequest, + signers::{ + k256::{ecdsa::SigningKey as K256SigningKey, SecretKey as K256SecretKey}, + local::PrivateKeySigner, + Signer, + }, }; -use alloy_signer_local::PrivateKeySigner; +use alloy_node_bindings::{Anvil, AnvilInstance}; use blst::min_pk::SecretKey; use reth_primitives::PooledTransactionsElement; use secp256k1::Message;