chore: use reth-ethereum in example (#14409)

This commit is contained in:
Matthias Seitz
2025-02-12 09:56:15 +01:00
committed by GitHub
parent ea40f78e59
commit e9b99b0610
7 changed files with 36 additions and 37 deletions

11
Cargo.lock generated
View File

@ -3125,17 +3125,9 @@ dependencies = [
name = "example-db-access"
version = "0.0.0"
dependencies = [
"alloy-consensus",
"alloy-primitives",
"alloy-rpc-types-eth",
"eyre",
"reth-chainspec",
"reth-db",
"reth-node-ethereum",
"reth-node-types",
"reth-primitives",
"reth-primitives-traits",
"reth-provider",
"reth-ethereum",
]
[[package]]
@ -7488,6 +7480,7 @@ dependencies = [
name = "reth-ethereum"
version = "1.1.5"
dependencies = [
"alloy-rpc-types-eth",
"reth-chainspec",
"reth-consensus",
"reth-consensus-common",

View File

@ -33,6 +33,9 @@ reth-ethereum-consensus = { workspace = true, optional = true }
reth-evm-ethereum = { workspace = true, optional = true }
reth-node-ethereum = { workspace = true, optional = true }
# alloy
alloy-rpc-types-eth = { workspace = true, optional = true }
[features]
default = ["std"]
std = [
@ -41,6 +44,7 @@ std = [
"reth-primitives-traits/std",
"reth-consensus?/std",
"reth-consensus-common?/std",
"alloy-rpc-types-eth?/std",
]
arbitrary = [
"std",
@ -48,6 +52,7 @@ arbitrary = [
"reth-ethereum-primitives/arbitrary",
"reth-primitives-traits/arbitrary",
"reth-db?/arbitrary",
"alloy-rpc-types-eth?/arbitrary",
]
test-utils = [
@ -69,7 +74,7 @@ consensus = ["dep:reth-consensus", "dep:reth-consensus-common", "dep:reth-ethere
evm = ["dep:reth-evm", "dep:reth-evm-ethereum"]
node-api = ["dep:reth-node-api"]
node = ["provider", "consensus", "evm", "node-api", "dep:reth-node-ethereum", "rpc"]
rpc = ["dep:reth-rpc", "dep:reth-rpc-builder", "dep:reth-rpc-api", "dep:reth-rpc-eth-types"]
rpc = ["dep:reth-rpc", "dep:reth-rpc-builder", "dep:reth-rpc-api", "dep:reth-rpc-eth-types", "dep:alloy-rpc-types-eth"]
js-tracer = ["rpc", "reth-rpc/js-tracer"]
network = ["dep:reth-network"]
provider = ["storage-api", "dep:reth-provider", "dep:reth-db"]

View File

@ -87,6 +87,12 @@ pub mod rpc {
pub use reth_rpc_api as api;
#[doc(inline)]
pub use reth_rpc_builder as builder;
#[doc(inline)]
pub use reth_rpc_eth_types as eth;
/// Re-exported eth types
pub mod eth {
#[doc(inline)]
pub use alloy_rpc_types_eth as primitives;
#[doc(inline)]
pub use reth_rpc_eth_types::*;
}
}

View File

@ -1,10 +1,11 @@
//! Block header data primitive.
use crate::{InMemorySize, MaybeCompact, MaybeSerde, MaybeSerdeBincodeCompat};
use alloy_primitives::Sealable;
use core::{fmt, hash::Hash};
use alloy_primitives::Sealable;
use crate::{InMemorySize, MaybeCompact, MaybeSerde, MaybeSerdeBincodeCompat};
/// Re-exported alias
pub use alloy_consensus::BlockHeader as AlloyBlockHeader;
/// Helper trait that unifies all behaviour required by block header to support full node
/// operations.

View File

@ -95,7 +95,7 @@ pub use transaction::{
pub mod block;
pub use block::{
body::{BlockBody, FullBlockBody},
header::{BlockHeader, FullBlockHeader},
header::{AlloyBlockHeader, BlockHeader, FullBlockHeader},
Block, FullBlock, RecoveredBlock, SealedBlock,
};

View File

@ -6,16 +6,7 @@ edition.workspace = true
license.workspace = true
[dependencies]
reth-chainspec.workspace = true
reth-db.workspace = true
reth-primitives.workspace = true
reth-primitives-traits.workspace = true
reth-provider.workspace = true
reth-node-ethereum.workspace = true
reth-node-types.workspace = true
alloy-consensus.workspace = true
alloy-rpc-types-eth.workspace = true
reth-ethereum = { workspace = true, features = ["node"] }
alloy-primitives.workspace = true
eyre.workspace = true

View File

@ -1,13 +1,16 @@
use alloy_consensus::BlockHeader;
use alloy_primitives::{Address, B256};
use alloy_rpc_types_eth::{Filter, FilteredParams};
use reth_chainspec::ChainSpecBuilder;
use reth_node_ethereum::EthereumNode;
use reth_primitives::{SealedBlock, SealedHeader, TransactionSigned};
use reth_primitives_traits::transaction::signed::SignedTransaction;
use reth_provider::{
providers::ReadOnlyConfig, AccountReader, BlockReader, BlockSource, HeaderProvider,
ReceiptProvider, StateProvider, TransactionsProvider,
use reth_ethereum::{
chainspec::ChainSpecBuilder,
node::EthereumNode,
primitives::{
transaction::signed::SignedTransaction, AlloyBlockHeader, SealedBlock, SealedHeader,
},
provider::{
providers::ReadOnlyConfig, AccountReader, BlockReader, BlockSource, HeaderProvider,
ReceiptProvider, StateProvider, TransactionsProvider,
},
rpc::eth::primitives::{Filter, FilteredParams},
TransactionSigned,
};
// Providers are zero cost abstractions on top of an opened MDBX Transaction
@ -112,7 +115,7 @@ fn txs_provider_example<T: TransactionsProvider<Transaction = TransactionSigned>
}
/// The `BlockReader` allows querying the headers-related tables.
fn block_provider_example<T: BlockReader<Block = reth_primitives::Block>>(
fn block_provider_example<T: BlockReader<Block = reth_ethereum::Block>>(
provider: T,
number: u64,
) -> eyre::Result<()> {
@ -159,7 +162,7 @@ fn block_provider_example<T: BlockReader<Block = reth_primitives::Block>>(
/// The `ReceiptProvider` allows querying the receipts tables.
fn receipts_provider_example<
T: ReceiptProvider<Receipt = reth_primitives::Receipt>
T: ReceiptProvider<Receipt = reth_ethereum::Receipt>
+ TransactionsProvider<Transaction = TransactionSigned>
+ HeaderProvider,
>(