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" name = "example-db-access"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"alloy-consensus",
"alloy-primitives", "alloy-primitives",
"alloy-rpc-types-eth",
"eyre", "eyre",
"reth-chainspec", "reth-ethereum",
"reth-db",
"reth-node-ethereum",
"reth-node-types",
"reth-primitives",
"reth-primitives-traits",
"reth-provider",
] ]
[[package]] [[package]]
@ -7488,6 +7480,7 @@ dependencies = [
name = "reth-ethereum" name = "reth-ethereum"
version = "1.1.5" version = "1.1.5"
dependencies = [ dependencies = [
"alloy-rpc-types-eth",
"reth-chainspec", "reth-chainspec",
"reth-consensus", "reth-consensus",
"reth-consensus-common", "reth-consensus-common",

View File

@ -33,6 +33,9 @@ reth-ethereum-consensus = { workspace = true, optional = true }
reth-evm-ethereum = { workspace = true, optional = true } reth-evm-ethereum = { workspace = true, optional = true }
reth-node-ethereum = { workspace = true, optional = true } reth-node-ethereum = { workspace = true, optional = true }
# alloy
alloy-rpc-types-eth = { workspace = true, optional = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
@ -41,6 +44,7 @@ std = [
"reth-primitives-traits/std", "reth-primitives-traits/std",
"reth-consensus?/std", "reth-consensus?/std",
"reth-consensus-common?/std", "reth-consensus-common?/std",
"alloy-rpc-types-eth?/std",
] ]
arbitrary = [ arbitrary = [
"std", "std",
@ -48,6 +52,7 @@ arbitrary = [
"reth-ethereum-primitives/arbitrary", "reth-ethereum-primitives/arbitrary",
"reth-primitives-traits/arbitrary", "reth-primitives-traits/arbitrary",
"reth-db?/arbitrary", "reth-db?/arbitrary",
"alloy-rpc-types-eth?/arbitrary",
] ]
test-utils = [ 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"] evm = ["dep:reth-evm", "dep:reth-evm-ethereum"]
node-api = ["dep:reth-node-api"] node-api = ["dep:reth-node-api"]
node = ["provider", "consensus", "evm", "node-api", "dep:reth-node-ethereum", "rpc"] 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"] js-tracer = ["rpc", "reth-rpc/js-tracer"]
network = ["dep:reth-network"] network = ["dep:reth-network"]
provider = ["storage-api", "dep:reth-provider", "dep:reth-db"] 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; pub use reth_rpc_api as api;
#[doc(inline)] #[doc(inline)]
pub use reth_rpc_builder as builder; 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. //! Block header data primitive.
use crate::{InMemorySize, MaybeCompact, MaybeSerde, MaybeSerdeBincodeCompat};
use alloy_primitives::Sealable;
use core::{fmt, hash::Hash}; use core::{fmt, hash::Hash};
use alloy_primitives::Sealable; /// Re-exported alias
pub use alloy_consensus::BlockHeader as AlloyBlockHeader;
use crate::{InMemorySize, MaybeCompact, MaybeSerde, MaybeSerdeBincodeCompat};
/// Helper trait that unifies all behaviour required by block header to support full node /// Helper trait that unifies all behaviour required by block header to support full node
/// operations. /// operations.

View File

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

View File

@ -6,16 +6,7 @@ edition.workspace = true
license.workspace = true license.workspace = true
[dependencies] [dependencies]
reth-chainspec.workspace = true reth-ethereum = { workspace = true, features = ["node"] }
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
alloy-primitives.workspace = true alloy-primitives.workspace = true
eyre.workspace = true eyre.workspace = true

View File

@ -1,13 +1,16 @@
use alloy_consensus::BlockHeader;
use alloy_primitives::{Address, B256}; use alloy_primitives::{Address, B256};
use alloy_rpc_types_eth::{Filter, FilteredParams}; use reth_ethereum::{
use reth_chainspec::ChainSpecBuilder; chainspec::ChainSpecBuilder,
use reth_node_ethereum::EthereumNode; node::EthereumNode,
use reth_primitives::{SealedBlock, SealedHeader, TransactionSigned}; primitives::{
use reth_primitives_traits::transaction::signed::SignedTransaction; transaction::signed::SignedTransaction, AlloyBlockHeader, SealedBlock, SealedHeader,
use reth_provider::{ },
providers::ReadOnlyConfig, AccountReader, BlockReader, BlockSource, HeaderProvider, provider::{
ReceiptProvider, StateProvider, TransactionsProvider, 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 // 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. /// 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, provider: T,
number: u64, number: u64,
) -> eyre::Result<()> { ) -> eyre::Result<()> {
@ -159,7 +162,7 @@ fn block_provider_example<T: BlockReader<Block = reth_primitives::Block>>(
/// The `ReceiptProvider` allows querying the receipts tables. /// The `ReceiptProvider` allows querying the receipts tables.
fn receipts_provider_example< fn receipts_provider_example<
T: ReceiptProvider<Receipt = reth_primitives::Receipt> T: ReceiptProvider<Receipt = reth_ethereum::Receipt>
+ TransactionsProvider<Transaction = TransactionSigned> + TransactionsProvider<Transaction = TransactionSigned>
+ HeaderProvider, + HeaderProvider,
>( >(