Skip to content

Commit

Permalink
chore(firehose-protos): rename sf-protos to firehose-protos
Browse files Browse the repository at this point in the history
  • Loading branch information
suchapalaver committed Oct 21, 2024
1 parent 85d1e4e commit 5ebe688
Show file tree
Hide file tree
Showing 47 changed files with 93 additions and 790 deletions.
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"crates/flat-head": "0.1.0",
"crates/forrestrie": "0.1.0",
"crates/header-accumulator": "0.2.0",
"crates/sf-protos": "0.1.0"
"crates/firehose-protos": "0.1.0"
}
56 changes: 28 additions & 28 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions crates/firehose-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ name = "firehose_client"
path = "src/lib.rs"

[dependencies]
sf-protos = { path = "../sf-protos" }

dotenvy.workspace = true
firehose-protos = { path = "../firehose-protos" }
futures.workspace = true
http.workspace = true
once_cell.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/firehose-client/examples/fetch_beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Demonstrates how to fetch a single block from Beacon Firehose, using the `Fetch` API.

use firehose_client::client::{Chain, FirehoseClient};
use sf_protos::{
use firehose_protos::{
beacon_v1::{block::Body, Block as FirehoseBeaconBlock},
ethereum_v2::Block as FirehoseEthBlock,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/firehose-client/examples/fetch_ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! Demonstrates how to fetch a single block from Ethereum firehose.

use firehose_client::client::{Chain, FirehoseClient};
use sf_protos::ethereum_v2::Block as FirehoseEthBlock;
use firehose_protos::ethereum_v2::Block as FirehoseEthBlock;

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion crates/firehose-client/examples/stream_beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
//! Demonstrates how to stream a range of blocks from Firehose Beacon

use firehose_client::client::{Chain, FirehoseClient};
use firehose_protos::beacon_v1::Block as FirehoseBeaconBlock;
use futures::StreamExt;
use sf_protos::beacon_v1::Block as FirehoseBeaconBlock;

#[tokio::main]
async fn main() {
Expand Down
2 changes: 1 addition & 1 deletion crates/firehose-client/examples/stream_ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
//!
//! This example demonstrates how to stream Ethereum blocks using the Firehose client.
use firehose_client::client::{Chain, FirehoseClient};
use firehose_protos::ethereum_v2::Block as FirehoseEthBlock;
use futures::StreamExt;
use sf_protos::ethereum_v2::Block as FirehoseEthBlock;

#[tokio::main]
async fn main() {
Expand Down
4 changes: 2 additions & 2 deletions crates/firehose-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::str::FromStr;

use crate::error::ClientError;
use dotenvy::{dotenv, var};
use sf_protos::firehose::v2::SingleBlockResponse;
use sf_protos::{
use firehose_protos::firehose::v2::SingleBlockResponse;
use firehose_protos::{
beacon_v1::Block as FirehoseBeaconBlock,
ethereum_v2::Block as FirehoseEthBlock,
firehose::v2::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "sf-protos"
name = "firehose-protos"
version = "0.1.0"
edition = "2021"

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//! Firehose Beacon-related data structures and operations.
//! See the protobuffer definitions section of the README for more information.
//!
use crate::error::ProtosError;
use crate::firehose::v2::{Response, SingleBlockResponse};
use primitive_types::{H256, U256};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Module for Firehose Ethereum-related data structures and operations.
//! Currently contains the `.proto` defined [here](https://github.com/streamingfast/firehose-ethereum/blob/d9ec696423c2288db640f00026ae29a6cc4c2121/proto/sf/ethereum/type/v2/type.proto#L9)

//! Firehose Ethereum-related data structures and operations.
//! See the protobuffer definitions section of the README for more information.
//!
use alloy_primitives::{Address, Bloom, FixedBytes, Uint};
use ethportal_api::types::execution::header::Header;
use prost::Message;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ alloy-rlp.workspace = true
alloy-eip2930.workspace = true
bincode.workspace = true
clap.workspace = true
firehose-protos = { path = "../firehose-protos" }
prost.workspace = true
rand.workspace = true
rayon.workspace = true
Expand All @@ -20,7 +21,6 @@ reth-trie-common.workspace = true
revm-primitives.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
sf-protos = { path = "../sf-protos" }
simple-log.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }
Expand Down
27 changes: 16 additions & 11 deletions crates/flat-files-decoder/benches/stream_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ fn read_decode_check_bench(c: &mut Criterion) {
}
};
b.iter(|| {
black_box(sf_protos::bstream::v1::Block::decode(message.as_slice())).unwrap();
black_box(firehose_protos::bstream::v1::Block::decode(
message.as_slice(),
))
.unwrap();
});
}
}
Expand Down Expand Up @@ -97,9 +100,9 @@ fn read_decode_check_bench(c: &mut Criterion) {
}
};
let block_stream =
sf_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
firehose_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
b.iter(|| {
black_box(sf_protos::ethereum_v2::Block::decode(
black_box(firehose_protos::ethereum_v2::Block::decode(
block_stream.payload_buffer.as_slice(),
))
.unwrap();
Expand Down Expand Up @@ -130,10 +133,11 @@ fn read_decode_check_bench(c: &mut Criterion) {
}
};
let block_stream =
sf_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
let block =
sf_protos::ethereum_v2::Block::decode(block_stream.payload_buffer.as_slice())
.unwrap();
firehose_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
let block = firehose_protos::ethereum_v2::Block::decode(
block_stream.payload_buffer.as_slice(),
)
.unwrap();
b.iter(|| {
black_box(check_receipt_root(&block)).unwrap();
});
Expand Down Expand Up @@ -163,10 +167,11 @@ fn read_decode_check_bench(c: &mut Criterion) {
}
};
let block_stream =
sf_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
let block =
sf_protos::ethereum_v2::Block::decode(block_stream.payload_buffer.as_slice())
.unwrap();
firehose_protos::bstream::v1::Block::decode(message.as_slice()).unwrap();
let block = firehose_protos::ethereum_v2::Block::decode(
block_stream.payload_buffer.as_slice(),
)
.unwrap();
b.iter(|| {
black_box(check_transaction_root(&block)).unwrap();
});
Expand Down
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/src/headers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ pub mod error;

use crate::headers::error::BlockHeaderError;
use alloy_primitives::B256;
use firehose_protos::ethereum_v2::{Block, BlockHeader};
use serde::{Deserialize, Serialize};
use sf_protos::ethereum_v2::{Block, BlockHeader};
use std::fs::File;

#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
Expand Down
8 changes: 4 additions & 4 deletions crates/flat-files-decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ use crate::{
};
use dbin::DbinFile;
use error::CheckError;
use firehose_protos::ethereum_v2::Block;
use headers::HeaderRecordWithNumber;
use prost::Message;
use rayon::prelude::*;
use receipts::check_receipt_root;
use sf_protos::ethereum_v2::Block;
use simple_log::log;
use std::{
fs::{self, File},
Expand Down Expand Up @@ -322,9 +322,9 @@ pub async fn stream_blocks<R: Read, W: Write>(
}

fn decode_block_from_bytes(bytes: &Vec<u8>) -> Result<Block, DecodeError> {
let block_stream = sf_protos::bstream::v1::Block::decode(bytes.as_slice())
let block_stream = firehose_protos::bstream::v1::Block::decode(bytes.as_slice())
.map_err(|err| DecodeError::ProtobufError(err.to_string()))?;
let block = sf_protos::ethereum_v2::Block::decode(block_stream.payload_buffer.as_slice())
let block = firehose_protos::ethereum_v2::Block::decode(block_stream.payload_buffer.as_slice())
.map_err(|err| DecodeError::ProtobufError(err.to_string()))?;
Ok(block)
}
Expand All @@ -345,7 +345,7 @@ where

#[cfg(test)]
mod tests {
use sf_protos::bstream::v1::Block as BstreamBlock;
use firehose_protos::bstream::v1::Block as BstreamBlock;
use std::io::{BufReader, BufWriter};

use super::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/src/receipts/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use reth_primitives::{Log, LogData};
use revm_primitives::hex;
use std::convert::TryInto;

use sf_protos::ethereum_v2::Log as BlockLog;
use firehose_protos::ethereum_v2::Log as BlockLog;

pub fn map_logs(logs: &[BlockLog]) -> Result<Vec<Log>, ReceiptError> {
logs.iter().map(block_log_to_log).collect()
Expand Down
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/src/receipts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::receipts::error::ReceiptError;
use crate::receipts::receipt::FullReceipt;
use alloy_primitives::B256;
use alloy_rlp::{Encodable, Header};
use firehose_protos::ethereum_v2::Block;
use reth_trie_common::root::ordered_trie_root_with_encoder;
use revm_primitives::hex;
use sf_protos::ethereum_v2::Block;

const BYZANTINUM_FORK_BLOCK: u64 = 4_370_000;

Expand Down
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/src/receipts/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use crate::receipts::error::ReceiptError;
use crate::receipts::logs::map_logs;
use crate::transactions::tx_type::map_tx_type;
use alloy_primitives::{Bloom, FixedBytes};
use firehose_protos::ethereum_v2::TransactionTrace;
use reth_primitives::{Log, Receipt, ReceiptWithBloom};
use revm_primitives::hex;
use sf_protos::ethereum_v2::TransactionTrace;

pub struct FullReceipt {
pub receipt: ReceiptWithBloom,
Expand Down
2 changes: 1 addition & 1 deletion crates/flat-files-decoder/src/transactions/access_list.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::transactions::error::TransactionError;
use alloy_eip2930::{AccessList, AccessListItem};
use alloy_primitives::{Address, B256};
use firehose_protos::ethereum_v2::AccessTuple;
use revm_primitives::hex;
use sf_protos::ethereum_v2::AccessTuple;

pub(crate) fn compute_access_list(
access_list: &[AccessTuple],
Expand Down
Loading

0 comments on commit 5ebe688

Please sign in to comment.