Skip to content

Commit

Permalink
chore: remove blockchaintree dep from reth bin (#13712)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Jan 7, 2025
1 parent 7600622 commit 027f80e
Show file tree
Hide file tree
Showing 10 changed files with 5 additions and 244 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions bin/reth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ reth-cli-runner.workspace = true
reth-cli-commands.workspace = true
reth-cli-util.workspace = true
reth-consensus-common.workspace = true
reth-blockchain-tree.workspace = true
reth-rpc-builder.workspace = true
reth-rpc.workspace = true
reth-rpc-types-compat.workspace = true
Expand Down Expand Up @@ -64,7 +63,6 @@ reth-node-builder.workspace = true
reth-node-events.workspace = true
reth-node-metrics.workspace = true
reth-consensus.workspace = true
reth-engine-util.workspace = true
reth-prune.workspace = true

# crypto
Expand Down
16 changes: 2 additions & 14 deletions bin/reth/src/commands/debug_cmd/build_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ use reth_basic_payload_builder::{
BuildArguments, BuildOutcome, Cancelled, PayloadBuilder, PayloadConfig,
};
use reth_beacon_consensus::EthBeaconConsensus;
use reth_blockchain_tree::{
BlockchainTree, BlockchainTreeConfig, ShareableBlockchainTree, TreeExternals,
};
use reth_chainspec::ChainSpec;
use reth_cli::chainspec::ChainSpecParser;
use reth_cli_commands::common::{AccessRights, CliNodeTypes, Environment, EnvironmentArgs};
Expand All @@ -33,7 +30,7 @@ use reth_primitives::{
TransactionSigned,
};
use reth_provider::{
providers::{BlockchainProvider, ProviderNodeTypes},
providers::{BlockchainProvider2, ProviderNodeTypes},
BlockHashReader, BlockReader, BlockWriter, ChainSpecProvider, ProviderFactory,
StageCheckpointReader, StateProviderFactory,
};
Expand Down Expand Up @@ -131,21 +128,12 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
let consensus: Arc<dyn FullConsensus<Error = ConsensusError>> =
Arc::new(EthBeaconConsensus::new(provider_factory.chain_spec()));

let executor = EthExecutorProvider::ethereum(provider_factory.chain_spec());

// configure blockchain tree
let tree_externals =
TreeExternals::new(provider_factory.clone(), Arc::clone(&consensus), executor);
let tree = BlockchainTree::new(tree_externals, BlockchainTreeConfig::default())?;
let blockchain_tree = Arc::new(ShareableBlockchainTree::new(tree));

// fetch the best block from the database
let best_block = self
.lookup_best_block(provider_factory.clone())
.wrap_err("the head block is missing")?;

let blockchain_db =
BlockchainProvider::new(provider_factory.clone(), blockchain_tree.clone())?;
let blockchain_db = BlockchainProvider2::new(provider_factory.clone())?;
let blob_store = InMemoryBlobStore::default();

let validator =
Expand Down
4 changes: 0 additions & 4 deletions bin/reth/src/commands/debug_cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod build_block;
mod execution;
mod in_memory_merkle;
mod merkle;
mod replay_engine;

/// `reth debug` command
#[derive(Debug, Parser)]
Expand All @@ -32,8 +31,6 @@ pub enum Subcommands<C: ChainSpecParser> {
InMemoryMerkle(in_memory_merkle::Command<C>),
/// Debug block building.
BuildBlock(build_block::Command<C>),
/// Debug engine API by replaying stored messages.
ReplayEngine(replay_engine::Command<C>),
}

impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
Expand All @@ -49,7 +46,6 @@ impl<C: ChainSpecParser<ChainSpec = ChainSpec>> Command<C> {
Subcommands::Merkle(command) => command.execute::<N>(ctx).await,
Subcommands::InMemoryMerkle(command) => command.execute::<N>(ctx).await,
Subcommands::BuildBlock(command) => command.execute::<N>(ctx).await,
Subcommands::ReplayEngine(command) => command.execute::<N>(ctx).await,
}
}
}
212 changes: 0 additions & 212 deletions bin/reth/src/commands/debug_cmd/replay_engine.rs

This file was deleted.

4 changes: 0 additions & 4 deletions bin/reth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ pub mod primitives {
pub mod beacon_consensus {
pub use reth_beacon_consensus::*;
}
/// Re-exported from `reth_blockchain_tree`.
pub mod blockchain_tree {
pub use reth_blockchain_tree::*;
}

/// Re-exported from `reth_consensus`.
pub mod consensus {
Expand Down
1 change: 0 additions & 1 deletion book/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
- [`reth debug merkle`](./cli/reth/debug/merkle.md)
- [`reth debug in-memory-merkle`](./cli/reth/debug/in-memory-merkle.md)
- [`reth debug build-block`](./cli/reth/debug/build-block.md)
- [`reth debug replay-engine`](./cli/reth/debug/replay-engine.md)
- [`reth recover`](./cli/reth/recover.md)
- [`reth recover storage-tries`](./cli/reth/recover/storage-tries.md)
- [`reth prune`](./cli/reth/prune.md)
Expand Down
1 change: 0 additions & 1 deletion book/cli/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
- [`reth debug merkle`](./reth/debug/merkle.md)
- [`reth debug in-memory-merkle`](./reth/debug/in-memory-merkle.md)
- [`reth debug build-block`](./reth/debug/build-block.md)
- [`reth debug replay-engine`](./reth/debug/replay-engine.md)
- [`reth recover`](./reth/recover.md)
- [`reth recover storage-tries`](./reth/recover/storage-tries.md)
- [`reth prune`](./reth/prune.md)
1 change: 0 additions & 1 deletion book/cli/reth/debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Commands:
merkle Debug the clean & incremental state root calculations
in-memory-merkle Debug in-memory state root calculation
build-block Debug block building
replay-engine Debug engine API by replaying stored messages
help Print this message or the help of the given subcommand(s)
Options:
Expand Down
6 changes: 3 additions & 3 deletions examples/rpc-db/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use reth::{
api::NodeTypesWithDBAdapter,
beacon_consensus::EthBeaconConsensus,
providers::{
providers::{BlockchainProvider, StaticFileProvider},
providers::{BlockchainProvider2, StaticFileProvider},
ProviderFactory,
},
rpc::eth::EthApi,
Expand All @@ -33,7 +33,7 @@ use reth::rpc::builder::{
};
// Configuring the network parts, ideally also wouldn't need to think about this.
use myrpc_ext::{MyRpcExt, MyRpcExtApiServer};
use reth::{blockchain_tree::noop::NoopBlockchainTree, tasks::TokioTaskExecutor};
use reth::tasks::TokioTaskExecutor;
use reth_node_ethereum::{
node::EthereumEngineValidator, EthEvmConfig, EthExecutorProvider, EthereumNode,
};
Expand Down Expand Up @@ -61,7 +61,7 @@ async fn main() -> eyre::Result<()> {
// 2. Setup the blockchain provider using only the database provider and a noop for the tree to
// satisfy trait bounds. Tree is not used in this example since we are only operating on the
// disk and don't handle new blocks/live sync etc, which is done by the blockchain tree.
let provider = BlockchainProvider::new(factory, Arc::new(NoopBlockchainTree::default()))?;
let provider = BlockchainProvider2::new(factory)?;

let rpc_builder = RpcModuleBuilder::default()
.with_provider(provider.clone())
Expand Down

0 comments on commit 027f80e

Please sign in to comment.