Skip to content

Commit

Permalink
feat(sidecar): use alloy as single dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
namn-grg authored and thedevbirb committed Jul 19, 2024
1 parent 5b16d12 commit d60fe90
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 109 deletions.
179 changes: 161 additions & 18 deletions bolt-sidecar/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 1 addition & 19 deletions bolt-sidecar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
2 changes: 1 addition & 1 deletion bolt-sidecar/bin/sidecar.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
12 changes: 7 additions & 5 deletions bolt-sidecar/src/builder/compat.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions bolt-sidecar/src/builder/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_primitives::U256;
use alloy::primitives::U256;
use blst::min_pk::SecretKey;
use ethereum_consensus::{
crypto::PublicKey,
Expand Down Expand Up @@ -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}")]
Expand Down
21 changes: 12 additions & 9 deletions bolt-sidecar/src/builder/payload_builder.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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::{
Expand Down
Loading

0 comments on commit d60fe90

Please sign in to comment.