diff --git a/Cargo.lock b/Cargo.lock index b9eab3665..5808818e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7322,7 +7322,7 @@ dependencies = [ ] [[package]] -name = "reth-bsc-tasks" +name = "reth-bsc-engine" version = "1.0.0" dependencies = [ "alloy-dyn-abi", @@ -8349,7 +8349,7 @@ dependencies = [ "reth-auto-seal-consensus", "reth-beacon-consensus", "reth-blockchain-tree", - "reth-bsc-tasks", + "reth-bsc-engine", "reth-chainspec", "reth-config", "reth-consensus", diff --git a/Cargo.toml b/Cargo.toml index fdeba12c8..17a1ed4c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -107,7 +107,7 @@ members = [ "crates/trie/parallel/", "crates/trie/trie", "crates/bsc/node/", - "crates/bsc/tasks", + "crates/bsc/engine/", "examples/beacon-api-sidecar-fetcher/", "examples/beacon-api-sse/", "examples/bsc-p2p", @@ -338,7 +338,7 @@ reth-static-file-types = { path = "crates/static-file/types" } reth-storage-api = { path = "crates/storage/storage-api" } reth-storage-errors = { path = "crates/storage/errors" } reth-tasks = { path = "crates/tasks" } -reth-bsc-tasks = { path = "crates/bsc/tasks" } +reth-bsc-engine = { path = "crates/bsc/engine" } reth-testing-utils = { path = "testing/testing-utils" } reth-tokio-util = { path = "crates/tokio-util" } reth-tracing = { path = "crates/tracing" } diff --git a/crates/bsc/tasks/Cargo.toml b/crates/bsc/engine/Cargo.toml similarity index 98% rename from crates/bsc/tasks/Cargo.toml rename to crates/bsc/engine/Cargo.toml index 3bd60729e..a49d4da69 100644 --- a/crates/bsc/tasks/Cargo.toml +++ b/crates/bsc/engine/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "reth-bsc-tasks" +name = "reth-bsc-engine" version.workspace = true edition.workspace = true rust-version.workspace = true diff --git a/crates/bsc/tasks/src/client.rs b/crates/bsc/engine/src/client.rs similarity index 100% rename from crates/bsc/tasks/src/client.rs rename to crates/bsc/engine/src/client.rs diff --git a/crates/bsc/tasks/src/lib.rs b/crates/bsc/engine/src/lib.rs similarity index 100% rename from crates/bsc/tasks/src/lib.rs rename to crates/bsc/engine/src/lib.rs diff --git a/crates/bsc/tasks/src/task.rs b/crates/bsc/engine/src/task.rs similarity index 99% rename from crates/bsc/tasks/src/task.rs rename to crates/bsc/engine/src/task.rs index ddac74567..0a8030530 100644 --- a/crates/bsc/tasks/src/task.rs +++ b/crates/bsc/engine/src/task.rs @@ -1,5 +1,4 @@ use crate::{client::ParliaClient, Storage}; -use alloy_rlp::Encodable; use reth_beacon_consensus::{BeaconEngineMessage, ForkchoiceStatus}; use reth_bsc_consensus::Parlia; use reth_chainspec::ChainSpec; @@ -18,7 +17,6 @@ use std::{ }; use tokio::sync::Mutex; -use reth_network_p2p::bodies::client::BodiesClient; use tokio::{ signal, sync::{ @@ -35,7 +33,7 @@ enum ForkChoiceMessage { /// Broadcast new hash. NewHeader(NewHeaderEvent), } -/// internal message to beacon engine +/// internal message to notify the engine of a new block #[derive(Debug, Clone)] struct NewHeaderEvent { header: SealedHeader, @@ -366,6 +364,7 @@ impl< } Err(err) => { error!(target: "consensus::parlia", %err, "Parlia fork choice update failed"); + break } } } diff --git a/crates/bsc/evm/src/execute.rs b/crates/bsc/evm/src/execute.rs index f9176090b..de49931fb 100644 --- a/crates/bsc/evm/src/execute.rs +++ b/crates/bsc/evm/src/execute.rs @@ -859,17 +859,14 @@ where Ok(snap) } - pub(crate) fn get_header_by_hash( - &self, - block_hash: B256, - ) -> Result { + fn get_header_by_hash(&self, block_hash: B256) -> Result { self.provider .header(&block_hash) .map_err(|err| BscBlockExecutionError::ProviderInnerError { error: err.into() })? .ok_or_else(|| BscBlockExecutionError::UnknownHeader { block_hash }.into()) } - pub(crate) fn find_ancient_header( + fn find_ancient_header( &self, header: &Header, count: u64, diff --git a/crates/node/builder/Cargo.toml b/crates/node/builder/Cargo.toml index 456bd5e5f..63e2eecac 100644 --- a/crates/node/builder/Cargo.toml +++ b/crates/node/builder/Cargo.toml @@ -45,7 +45,7 @@ reth-node-events.workspace = true reth-consensus.workspace = true reth-consensus-debug-client.workspace = true reth-rpc-types.workspace = true -reth-bsc-tasks = { workspace = true, optional = true} +reth-bsc-engine = { workspace = true, optional = true} ## async futures.workspace = true @@ -80,5 +80,5 @@ tempfile.workspace = true [features] bsc = [ - "reth-bsc-tasks/bsc", + "reth-bsc-engine/bsc", ] \ No newline at end of file diff --git a/crates/node/builder/src/launch/mod.rs b/crates/node/builder/src/launch/mod.rs index 260a694d3..f78ebaa7e 100644 --- a/crates/node/builder/src/launch/mod.rs +++ b/crates/node/builder/src/launch/mod.rs @@ -15,7 +15,7 @@ use reth_beacon_consensus::{ use reth_blockchain_tree::{BlockchainTree, ShareableBlockchainTree, TreeExternals}; #[cfg(feature = "bsc")] -use reth_bsc_tasks::ParliaEngineBuilder; +use reth_bsc_engine::ParliaEngineBuilder; use reth_consensus::Consensus; use reth_consensus_debug_client::{DebugConsensusClient, EtherscanBlockProvider, RpcBlockProvider}; use reth_exex::ExExManagerHandle;