Skip to content

Commit

Permalink
build: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
suchapalaver committed Dec 20, 2024
1 parent e13870b commit d08000d
Show file tree
Hide file tree
Showing 9 changed files with 609 additions and 460 deletions.
956 changes: 554 additions & 402 deletions Cargo.lock

Large diffs are not rendered by default.

44 changes: 20 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,37 @@ members = ["crates/*"]
resolver = "2"

[workspace.dependencies]
alloy-primitives = "0.8.10"
alloy-consensus = "0.4.2"
alloy-primitives = "0.8.15"
alloy-consensus = "0.8.3"
alloy-eip2930 = "0.1.0"
alloy-rlp = "0.3.9"
base64 = "0.21.7"
alloy-rlp = "0.3.10"
base64 = "0.22.1"
bincode = "1.3.3"
clap = { version = "4.4.10", features = ["derive"] }
clap = { version = "4.5.23", features = ["derive"] }
criterion = { version = "0.5.1", features = ["html_reports"] }
ethportal-api = { git = "https://github.com/ethereum/trin.git", version = "0.2.2", tag = "v0.1.0-alpha.51" }
ethportal-api = { git = "https://github.com/ethereum/trin.git", version = "0.4.0" }
firehose-protos = { path = "crates/firehose-protos", version = "0.1.0" }
firehose-rs = { git = "https://github.com/semiotic-ai/firehose-rs.git", branch = "main" }
decoder = { path = "crates/decoder", version = "0.1.0" }
header-accumulator = { path = "crates/header-accumulator", version = "0.1.0" }
hex = "0.4.3"
primitive-types = "0.12.2"
prost = "0.13.1"
prost-build = "0.13.1"
prost = "0.13.4"
prost-build = "0.13.4"
prost-wkt = "0.6.0"
prost-wkt-types = "0.6.0"
rand = "0.8.5"
reth-primitives = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
reth-trie-common = { git = "https://github.com/paradigmxyz/reth", version = "1.1.0", tag = "v1.1.0" }
rlp = "0.5.2"
serde = "1.0.208"
serde_json = "1.0.127"
tempfile = "3.0"
thiserror = "2.0.0"
tokio = "1.39.2"
tonic = "0.12.0"
tonic-build = "0.12.0"
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
reth-primitives = { git = "https://github.com/paradigmxyz/reth", version = "1.1.4" }
serde = "1.0.216"
serde_json = "1.0.133"
tempfile = "3.14.0"
thiserror = "2.0.8"
tokio = "1.42.0"
tonic = "0.12.3"
tonic-build = "0.12.3"
tracing = "0.1.41"
tracing-subscriber = "0.3.19"
tree_hash = "0.8.0"
trin-validation = { git = "https://github.com/ethereum/trin.git", version = "0.1.0", tag = "v0.1.0-alpha.51" }
zstd = "0.13.0"
trin-validation = { git = "https://github.com/ethereum/trin.git", version = "0.1.0" }
zstd = "0.13.2"

[profile.dev.build-override]
opt-level = 3
Expand Down
3 changes: 0 additions & 3 deletions crates/firehose-protos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@ 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
prost-wkt-types.workspace = true
reth-primitives.workspace = true
reth-trie-common.workspace = true
serde.workspace = true
thiserror.workspace = true
tonic.workspace = true
tracing.workspace = true

[dev-dependencies]
hex.workspace = true
serde_json.workspace = true
tokio.workspace = true

Expand Down
25 changes: 13 additions & 12 deletions crates/firehose-protos/src/ethereum_v2/eth_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
// SPDX-License-Identifier: Apache-2.0

use super::{Block, BlockHeader, TransactionReceipt, TransactionTrace};
use alloy_consensus::Receipt;
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::{FromResponse, HasNumberOrSlot, Response, SingleBlockResponse};
use prost::Message;
use prost_wkt_types::Any;
use reth_primitives::{
proofs::calculate_transaction_root, Log, Receipt, ReceiptWithBloom, TransactionSigned,
proofs::{calculate_transaction_root, ordered_trie_root_with_encoder},
Log, ReceiptWithBloom, TransactionSigned,
};
use reth_trie_common::root::ordered_trie_root_with_encoder;
use tracing::error;

use crate::error::ProtosError;
Expand Down Expand Up @@ -280,23 +281,23 @@ impl TryFrom<&TransactionTrace> for FullReceipt {
type Error = ProtosError;

fn try_from(trace: &TransactionTrace) -> Result<Self, Self::Error> {
let tx_type = trace.try_into()?;

let trace_receipt = trace.receipt()?;

let logs = trace_receipt.logs()?;

let receipt = Receipt {
success: trace.is_success(),
tx_type,
status: trace.is_success().into(),
logs,
cumulative_gas_used: trace_receipt.cumulative_gas_used,
cumulative_gas_used: trace_receipt.cumulative_gas_used as u128,
};

let bloom = Bloom::try_from(trace_receipt)?;
let logs_bloom = Bloom::try_from(trace_receipt)?;

Ok(Self {
receipt: ReceiptWithBloom { receipt, bloom },
receipt: ReceiptWithBloom {
receipt,
logs_bloom,
},
state_root: trace_receipt.state_root.to_vec(),
})
}
Expand Down Expand Up @@ -332,14 +333,14 @@ impl FullReceipt {
self.rlp_header().encode(encoded);
self.state_root.as_slice().encode(encoded);
Encodable::encode(&self.receipt.receipt.cumulative_gas_used, encoded);
self.receipt.bloom.encode(encoded);
self.receipt.logs_bloom.encode(encoded);
self.receipt.receipt.logs.encode(encoded);
}

/// For Byzantium and later: only encode the inner receipt contents using the `reth_primitives`
/// [`ReceiptWithBloom`] `encode_inner` method.
fn encode_byzantium_and_later_receipt(&self, encoded: &mut Vec<u8>) {
self.receipt.encode_inner(encoded, false);
self.receipt.encode(encoded);
}

/// Returns a reference to the [`ReceiptWithBloom`] for this [`FullReceipt`]
Expand All @@ -351,7 +352,7 @@ impl FullReceipt {
fn rlp_header(&self) -> RlpHeader {
let payload_length = self.state_root.as_slice().length()
+ self.receipt.receipt.cumulative_gas_used.length()
+ self.receipt.bloom.length()
+ self.receipt.logs_bloom.length()
+ self.receipt.receipt.logs.length();

RlpHeader {
Expand Down
22 changes: 11 additions & 11 deletions crates/firehose-protos/src/ethereum_v2/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use std::fmt::Display;
use alloy_consensus::{TxEip1559, TxEip2930, TxLegacy};
use alloy_eip2930::{AccessList, AccessListItem};
use alloy_primitives::{
hex, Address, Bytes, ChainId, FixedBytes, Parity, TxKind, Uint, U128, U256,
hex, Address, Bytes, ChainId, FixedBytes, PrimitiveSignature, TxKind, Uint, U128, U256,
};
use reth_primitives::{Signature, Transaction, TransactionSigned, TxType};
use reth_primitives::{Transaction, TransactionSigned, TxType};
use tracing::debug;

use crate::error::ProtosError;
Expand Down Expand Up @@ -62,7 +62,7 @@ impl TransactionTrace {
self.status == 1
}

fn parity(&self) -> Result<Parity, ProtosError> {
fn parity(&self) -> Result<bool, ProtosError> {
// Extract the first byte of the V value (Ethereum's V value).
let v = self.v();

Expand All @@ -85,7 +85,7 @@ impl TransactionTrace {
}
};

Ok(parity.into())
Ok(parity)
}

pub(crate) fn receipt(&self) -> Result<&TransactionReceipt, ProtosError> {
Expand Down Expand Up @@ -144,7 +144,7 @@ impl TryFrom<&TransactionTrace> for TxKind {
}
}

impl TryFrom<&TransactionTrace> for Signature {
impl TryFrom<&TransactionTrace> for PrimitiveSignature {
type Error = ProtosError;

fn try_from(trace: &TransactionTrace) -> Result<Self, Self::Error> {
Expand All @@ -165,7 +165,7 @@ impl TryFrom<&TransactionTrace> for Signature {
// Extract the Y parity from the V value.
let odd_y_parity = trace.parity()?;

Ok(Signature::new(r, s, odd_y_parity))
Ok(PrimitiveSignature::new(r, s, odd_y_parity))
}
}

Expand Down Expand Up @@ -244,8 +244,8 @@ impl TryFrom<&TransactionTrace> for TransactionSigned {

fn try_from(trace: &TransactionTrace) -> Result<Self, Self::Error> {
let transaction = Transaction::try_from(trace)?;
let signature = Signature::try_from(trace)?;
let hash = FixedBytes::from_slice(trace.hash.as_slice());
let signature = PrimitiveSignature::try_from(trace)?;
let hash = FixedBytes::from_slice(trace.hash.as_slice()).into();

Ok(TransactionSigned {
transaction,
Expand Down Expand Up @@ -341,13 +341,13 @@ mod tests {
..Default::default()
};

let signature = Signature::try_from(&trace).unwrap();
let signature = PrimitiveSignature::try_from(&trace).unwrap();
assert_eq!(signature.r(), U256::from(1));
assert_eq!(signature.s(), U256::from(1));
assert!(!trace.parity().unwrap().y_parity());
assert!(!trace.parity().unwrap());

trace.v = vec![28];
assert!(trace.parity().unwrap().y_parity());
assert!(trace.parity().unwrap());
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions crates/header-accumulator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ base64.workspace = true
clap.workspace = true
ethportal-api.workspace = true
firehose-protos.workspace = true
primitive-types.workspace = true
rlp.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
tracing.workspace = true
Expand Down
11 changes: 8 additions & 3 deletions crates/header-accumulator/src/era_validator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright 2024-, Semiotic AI, Inc.
// SPDX-License-Identifier: Apache-2.0

use alloy_primitives::FixedBytes;
use ethportal_api::types::execution::accumulator::EpochAccumulator;
use tree_hash::{Hash256, TreeHash};
use tree_hash::TreeHash;

use trin_validation::accumulator::{HistoricalEpochRoots, PreMergeAccumulator};

use crate::{
Expand Down Expand Up @@ -35,7 +37,10 @@ impl EraValidator {
/// # Arguments
///
/// * `epochs`- An array of [`Epoch`].
pub fn validate_eras(&self, epochs: &[&Epoch]) -> Result<Vec<Hash256>, EraValidateError> {
pub fn validate_eras(
&self,
epochs: &[&Epoch],
) -> Result<Vec<FixedBytes<32>>, EraValidateError> {
let mut validated_epochs = Vec::new();
for epoch in epochs {
let root = self.validate_era(epoch)?;
Expand All @@ -53,7 +58,7 @@ impl EraValidator {
///
/// For block post merge, the sync-committee should be used to validate block headers
/// in the canonical blockchain. So this function is not useful for those.
pub fn validate_era(&self, epoch: &Epoch) -> Result<Hash256, EraValidateError> {
pub fn validate_era(&self, epoch: &Epoch) -> Result<FixedBytes<32>, EraValidateError> {
if epoch.number() > FINAL_EPOCH {
return Err(EraValidateError::EpochPostMerge(epoch.number()));
}
Expand Down
4 changes: 2 additions & 2 deletions crates/header-accumulator/src/inclusion_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use crate::{epoch::MAX_EPOCH_SIZE, errors::EraValidateError, Epoch};

use alloy_primitives::FixedBytes;
use ethportal_api::{
types::execution::{
accumulator::EpochAccumulator,
Expand All @@ -12,7 +13,6 @@ use ethportal_api::{
},
Header,
};
use tree_hash::Hash256;
use trin_validation::{
accumulator::PreMergeAccumulator, header_validator::HeaderValidator,
historical_roots_acc::HistoricalRootsAccumulator,
Expand All @@ -24,7 +24,7 @@ const PROOF_SIZE: usize = 15;
#[derive(Clone)]
pub struct InclusionProof {
block_number: u64,
proof: [Hash256; PROOF_SIZE],
proof: [FixedBytes<32>; PROOF_SIZE],
}

impl InclusionProof {
Expand Down
2 changes: 1 addition & 1 deletion crates/vee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ decoder.workspace = true
header-accumulator.workspace = true

[dev-dependencies]
tree_hash = "0.8.0"
tree_hash.workspace = true

0 comments on commit d08000d

Please sign in to comment.