Skip to content

Commit

Permalink
chore: extract post-merge gRPC support to separate repos
Browse files Browse the repository at this point in the history
  • Loading branch information
suchapalaver committed Nov 28, 2024
1 parent cf71509 commit 991e53a
Show file tree
Hide file tree
Showing 21 changed files with 49 additions and 1,070 deletions.
32 changes: 23 additions & 9 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ alloy-consensus = "0.4.2"
alloy-eip2930 = "0.1.0"
alloy-rlp = "0.3.9"
base64 = "0.21.7"
beacon-protos = { git = "https://github.com/semiotic-ai/beacon-protos.git", branch = "main" }
bincode = "1.3.3"
bls = { git = "https://github.com/semiotic-ai/lighthouse.git", branch = "stable" }
clap = { version = "4.4.10", features = ["derive"] }
Expand All @@ -16,6 +17,8 @@ dotenvy = "0.15.7"
ethereum-types = "=0.14.1"
ethportal-api = { git = "https://github.com/ethereum/trin.git", version = "0.2.2", tag = "v0.1.0-alpha.51" }
fake = "2.10.0"
firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" }
firehose-rs = { git = "https://github.com/semiotic-ai/firehose-rs.git", branch = "main" }
futures = "0.3.31"
hex = "0.4.3"
http = "1.1.0"
Expand Down
1 change: 1 addition & 0 deletions crates/firehose-protos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ alloy-eip2930.workspace = true
alloy-primitives.workspace = true
alloy-rlp.workspace = true
ethportal-api.workspace = true
firehose-rs.workspace = true
primitive-types.workspace = true
prost.workspace = true
prost-wkt.workspace = true
Expand Down
6 changes: 1 addition & 5 deletions crates/firehose-protos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ fn main() {
.file_descriptor_set_path(out_dir.join("descriptors.bin"))
.compile_protos_with_config(
config,
&[
"protos/block.proto",
"protos/bstream.proto",
"protos/firehose.proto",
],
&["protos/block.proto", "protos/bstream.proto"],
&["protos/"],
)
.unwrap();
Expand Down
150 changes: 0 additions & 150 deletions crates/firehose-protos/protos/firehose.proto

This file was deleted.

6 changes: 2 additions & 4 deletions crates/firehose-protos/src/ethereum_v2/eth_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use super::{Block, BlockHeader, TransactionReceipt, TransactionTrace};
use alloy_primitives::{hex, Address, Bloom, FixedBytes, Uint, B256};
use alloy_rlp::{Encodable, Header as RlpHeader};
use ethportal_api::types::execution::header::Header;
use firehose_rs::{Response, SingleBlockResponse};
use prost::Message;
use prost_wkt_types::Any;
use reth_primitives::{
Expand All @@ -13,10 +14,7 @@ use reth_primitives::{
use reth_trie_common::root::ordered_trie_root_with_encoder;
use tracing::error;

use crate::{
error::ProtosError,
firehose_v2::{Response, SingleBlockResponse},
};
use crate::error::ProtosError;

impl TryFrom<&Block> for Header {
type Error = ProtosError;
Expand Down
6 changes: 0 additions & 6 deletions crates/firehose-protos/src/firehose_v2/mod.rs

This file was deleted.

16 changes: 0 additions & 16 deletions crates/firehose-protos/src/firehose_v2/request.rs

This file was deleted.

20 changes: 0 additions & 20 deletions crates/firehose-protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

mod error;
mod ethereum_v2;
mod firehose_v2;

mod bstream {
pub mod v1 {
Expand All @@ -30,22 +29,3 @@ mod bstream {
pub use bstream::v1::Block as BstreamBlock;
pub use error::ProtosError;
pub use ethereum_v2::{eth_block::FullReceipt, Block as EthBlock, BlockHeader};
pub(crate) use firehose_v2::single_block_request::BlockNumber;

/// Interact programatically with the Firehose v2 Fetch API.
pub use firehose_v2::fetch_client::FetchClient;

/// Create Firehose API fetch requests.
pub use firehose_v2::Request;

/// Work with Firehose API streaming responses.
pub use firehose_v2::Response;

/// Create Firehose API streaming requests.
pub use firehose_v2::SingleBlockRequest;

/// Receive Firehose API fetch responses.
pub use firehose_v2::SingleBlockResponse;

/// Work with the Firehose v2 Stream API.
pub use firehose_v2::stream_client::StreamClient;
3 changes: 2 additions & 1 deletion crates/forrestrie-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ version = "0.1.1"
edition = "2021"

[dev-dependencies]
beacon-protos.workspace = true
bls.workspace = true
ethportal-api.workspace = true
firehose-client = { git = "https://github.com/semiotic-ai/firehose-client.git", branch = "main" }
firehose-client.workspace = true
firehose-protos = { path = "../firehose-protos" }
forrestrie = { path = "../forrestrie" }
futures.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
//! assert_eq!(block_root, block_header_root);
//! ```
//!
use beacon_protos::Block as FirehoseBeaconBlock;
use firehose_client::{Chain, FirehoseClient};
use forrestrie::beacon_v1::Block as FirehoseBeaconBlock;
use tree_hash::TreeHash;
use types::{BeaconBlock, MainnetEthSpec};

Expand Down
10 changes: 4 additions & 6 deletions crates/forrestrie-examples/examples/match_ethereum_to_beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
//! comparison until the correct Beacon slot is found.
//!

use beacon_protos::{Block as FirehoseBeaconBlock, Body};
use firehose_client::{Chain, FirehoseClient};
use forrestrie::{
beacon_state::ETHEREUM_BEACON_DENEB_OFFSET,
beacon_v1::{block, Block as FirehoseBeaconBlock},
};
use forrestrie::beacon_state::ETHEREUM_BEACON_DENEB_OFFSET;
use std::cmp::Ordering::*;
use tracing::info;
use tracing_subscriber::FmtSubscriber;
Expand Down Expand Up @@ -74,7 +72,7 @@ async fn main() {
let response = beacon_client.fetch_block(mid).await.unwrap().unwrap();
let block = FirehoseBeaconBlock::try_from(response.into_inner()).unwrap();

let Some(block::Body::Deneb(body)) = &block.body else {
let Some(Body::Deneb(body)) = &block.body else {
panic!("Unsupported block version!");
};

Expand Down Expand Up @@ -113,7 +111,7 @@ async fn try_final_fetches(low: u64, high: u64, client: &mut FirehoseClient) ->

let block = FirehoseBeaconBlock::try_from(response.into_inner()).unwrap();

let Some(block::Body::Deneb(body)) = &block.body else {
let Some(Body::Deneb(body)) = &block.body else {
return None;
};

Expand Down
Loading

0 comments on commit 991e53a

Please sign in to comment.