Skip to content

Commit

Permalink
chore(engine): replace reth_primitives with alloy_primitives
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishekkochar <[email protected]>
  • Loading branch information
Abhishekkochar committed Sep 20, 2024
1 parent 884c74d commit 79c86b7
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 17 deletions.
5 changes: 5 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/engine/invalid-block-hooks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ reth-tracing.workspace = true
reth-trie = { workspace = true, features = ["serde"] }

# alloy
alloy-primitives.workspace = true
alloy-rlp.workspace = true
alloy-rpc-types-debug.workspace = true

Expand Down
5 changes: 2 additions & 3 deletions crates/engine/invalid-block-hooks/src/witness.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{collections::HashMap, fmt::Debug, fs::File, io::Write, path::PathBuf};

use alloy_primitives::{keccak256, B256, U256};
use alloy_rpc_types_debug::ExecutionWitness;
use eyre::OptionExt;
use pretty_assertions::Comparison;
Expand All @@ -9,9 +10,7 @@ use reth_evm::{
system_calls::{apply_beacon_root_contract_call, apply_blockhashes_contract_call},
ConfigureEvm,
};
use reth_primitives::{
keccak256, Header, Receipt, SealedBlockWithSenders, SealedHeader, B256, U256,
};
use reth_primitives::{Header, Receipt, SealedBlockWithSenders, SealedHeader};
use reth_provider::{BlockExecutionOutput, ChainSpecProvider, StateProviderFactory};
use reth_revm::{
database::StateProviderDatabase,
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ reth-prune.workspace = true
reth-transaction-pool.workspace = true
reth-stages-api.workspace = true

# alloy
alloy-primitives.workspace = true

# async
tokio.workspace = true
tokio-stream.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/local/src/miner.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Contains the implementation of the mining mode for the local engine.

use alloy_primitives::TxHash;
use futures_util::{stream::Fuse, StreamExt};
use reth_primitives::TxHash;
use reth_transaction_pool::TransactionPool;
use std::{
future::Future,
Expand Down
4 changes: 2 additions & 2 deletions crates/engine/local/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
//! building at a fixed interval.

use crate::miner::MiningMode;
use alloy_primitives::B256;
use reth_beacon_consensus::EngineNodeTypes;
use reth_engine_tree::persistence::PersistenceHandle;
use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{
BuiltPayload, PayloadAttributesBuilder, PayloadBuilderAttributes, PayloadTypes,
};
use reth_primitives::B256;
use reth_provider::ProviderFactory;
use reth_prune::PrunerWithFactory;
use reth_stages_api::MetricEventsSender;
Expand Down Expand Up @@ -157,14 +157,14 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::B256;
use reth_chainspec::MAINNET;
use reth_config::PruneConfig;
use reth_db::test_utils::{create_test_rw_db, create_test_static_files_dir};
use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_exex_test_utils::TestNode;
use reth_node_types::NodeTypesWithDBAdapter;
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::B256;
use reth_provider::{providers::StaticFileProvider, BlockReader, ProviderFactory};
use reth_prune::PrunerBuilder;
use reth_transaction_pool::{
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@ reth-payload-primitives.workspace = true
reth-primitives.workspace = true
reth-trie.workspace = true

# alloy
alloy-primitives.workspace = true

# misc
serde.workspace = true
3 changes: 2 additions & 1 deletion crates/engine/primitives/src/invalid_block_hook.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::B256;
use reth_execution_types::BlockExecutionOutput;
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader, B256};
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use reth_trie::updates::TrieUpdates;

/// An invalid block hook.
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ reth-tasks.workspace = true
reth-trie.workspace = true
reth-trie-parallel.workspace = true

# alloy
alloy-primitives.workspace = true

# common
futures.workspace = true
tokio = { workspace = true, features = ["macros", "sync"] }
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/backfill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,12 @@ impl<N: ProviderNodeTypes> PipelineState<N> {
mod tests {
use super::*;
use crate::test_utils::{insert_headers_into_client, TestPipelineBuilder};
use alloy_primitives::{BlockNumber, B256};
use assert_matches::assert_matches;
use futures::poll;
use reth_chainspec::{ChainSpecBuilder, MAINNET};
use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::{BlockNumber, Header, B256};
use reth_primitives::Header;
use reth_provider::test_utils::MockNodeTypesWithDB;
use reth_stages::ExecOutput;
use reth_stages_api::StageCheckpoint;
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/download.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
//! Handler that can download blocks on demand (e.g. from the network).

use crate::{engine::DownloadRequest, metrics::BlockDownloaderMetrics};
use alloy_primitives::B256;
use futures::FutureExt;
use reth_consensus::Consensus;
use reth_network_p2p::{
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
BlockClient,
};
use reth_primitives::{SealedBlock, SealedBlockWithSenders, B256};
use reth_primitives::{SealedBlock, SealedBlockWithSenders};
use std::{
cmp::{Ordering, Reverse},
collections::{binary_heap::PeekMut, BinaryHeap, HashSet, VecDeque},
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ use crate::{
chain::{ChainHandler, FromOrchestrator, HandlerEvent},
download::{BlockDownloader, DownloadAction, DownloadOutcome},
};
use alloy_primitives::B256;
use futures::{Stream, StreamExt};
use reth_beacon_consensus::{BeaconConsensusEngineEvent, BeaconEngineMessage};
use reth_chain_state::ExecutedBlock;
use reth_engine_primitives::EngineTypes;
use reth_primitives::{SealedBlockWithSenders, B256};
use reth_primitives::SealedBlockWithSenders;
use std::{
collections::HashSet,
fmt::Display,
Expand Down
2 changes: 1 addition & 1 deletion crates/engine/tree/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,9 @@ impl PersistenceHandle {
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::B256;
use reth_chain_state::test_utils::TestBlockBuilder;
use reth_exex_types::FinishedExExHeight;
use reth_primitives::B256;
use reth_provider::test_utils::create_test_provider_factory;
use reth_prune::Pruner;
use tokio::sync::mpsc::unbounded_channel;
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloy_primitives::B256;
use reth_chainspec::ChainSpec;
use reth_network_p2p::test_utils::TestFullBlockClient;
use reth_primitives::{BlockBody, SealedHeader, B256};
use reth_primitives::{BlockBody, SealedHeader};
use reth_provider::{
test_utils::{create_test_provider_factory_with_chain_spec, MockNodeTypesWithDB},
ExecutionOutcome,
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/tree/src/tree/invalid_block_hook.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_primitives::B256;
use reth_engine_primitives::InvalidBlockHook;
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader, B256};
use reth_primitives::{Receipt, SealedBlockWithSenders, SealedHeader};
use reth_provider::BlockExecutionOutput;
use reth_trie::updates::TrieUpdates;

Expand Down
6 changes: 3 additions & 3 deletions crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
engine::{DownloadRequest, EngineApiEvent, FromEngine},
persistence::PersistenceHandle,
};
use alloy_primitives::{BlockNumber, B256, U256};
use reth_beacon_consensus::{
BeaconConsensusEngineEvent, BeaconEngineMessage, ForkchoiceStateTracker, InvalidHeaderCache,
OnForkChoiceUpdated, MIN_BLOCKS_FOR_PIPELINE_RUN,
Expand All @@ -24,8 +25,7 @@ use reth_payload_builder::PayloadBuilderHandle;
use reth_payload_primitives::{PayloadAttributes, PayloadBuilderAttributes};
use reth_payload_validator::ExecutionPayloadValidator;
use reth_primitives::{
Block, BlockNumHash, BlockNumber, GotExpected, Header, SealedBlock, SealedBlockWithSenders,
SealedHeader, B256, U256,
Block, BlockNumHash, GotExpected, Header, SealedBlock, SealedBlockWithSenders, SealedHeader,
};
use reth_provider::{
providers::ConsistentDbView, BlockReader, DatabaseProviderFactory, ExecutionOutcome,
Expand Down Expand Up @@ -2583,13 +2583,13 @@ impl PersistenceState {
mod tests {
use super::*;
use crate::persistence::PersistenceAction;
use alloy_primitives::Bytes;
use alloy_rlp::Decodable;
use reth_beacon_consensus::{EthBeaconConsensus, ForkchoiceStatus};
use reth_chain_state::{test_utils::TestBlockBuilder, BlockState};
use reth_chainspec::{ChainSpec, HOLESKY, MAINNET};
use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_evm::test_utils::MockExecutorProvider;
use reth_primitives::Bytes;
use reth_provider::test_utils::MockEthProvider;
use reth_rpc_types_compat::engine::{block_to_payload_v1, payload::block_to_payload_v3};
use reth_trie::updates::TrieUpdates;
Expand Down
3 changes: 3 additions & 0 deletions crates/engine/util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ reth-ethereum-forks.workspace = true
revm-primitives.workspace = true
reth-trie.workspace = true

# alloy
alloy-primitives.workspace = true

# async
tokio = { workspace = true, default-features = false }
tokio-util.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/engine/util/src/reorg.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! Stream wrapper that simulates reorgs.

use alloy_primitives::U256;
use futures::{stream::FuturesUnordered, Stream, StreamExt, TryFutureExt};
use itertools::Either;
use reth_beacon_consensus::{BeaconEngineMessage, BeaconOnNewPayloadError, OnForkChoiceUpdated};
Expand All @@ -9,7 +10,7 @@ use reth_ethereum_forks::EthereumHardforks;
use reth_evm::{system_calls::apply_beacon_root_contract_call, ConfigureEvm};
use reth_payload_validator::ExecutionPayloadValidator;
use reth_primitives::{
eip4844::calculate_excess_blob_gas, proofs, Block, Header, Receipt, Receipts, U256,
eip4844::calculate_excess_blob_gas, proofs, Block, Header, Receipt, Receipts,
};
use reth_provider::{BlockReader, ExecutionOutcome, ProviderError, StateProviderFactory};
use reth_revm::{
Expand Down

0 comments on commit 79c86b7

Please sign in to comment.