|
1 |
| -use std::sync::Arc; |
2 |
| - |
| 1 | +use crate::live_builder::simulation::SimulatedOrderCommand; |
3 | 2 | use crate::roothash::RootHashError;
|
4 |
| -use crate::{live_builder::simulation::SimulatedOrderCommand, utils::ProviderFactoryReopener}; |
5 | 3 | use alloy_consensus::Header;
|
6 | 4 | use alloy_eips::BlockNumHash;
|
7 | 5 | use alloy_primitives::{BlockHash, BlockNumber, B256};
|
8 |
| -use ipc_state_provider::IpcStateProviderFactory; |
9 | 6 | use reth::providers::ExecutionOutcome;
|
10 |
| -use reth_db::DatabaseEnv; |
11 | 7 | use reth_errors::ProviderResult;
|
12 |
| -use reth_node_api::NodeTypesWithDBAdapter; |
13 |
| -use reth_node_ethereum::EthereumNode; |
14 | 8 | use reth_provider::StateProviderBox;
|
15 | 9 | use tokio::sync::broadcast;
|
16 | 10 | use tokio_util::sync::CancellationToken;
|
@@ -58,75 +52,3 @@ pub trait RootHasher: std::fmt::Debug + Send + Sync {
|
58 | 52 | /// State root for changes outcome on top of parent block.
|
59 | 53 | fn state_root(&self, outcome: &ExecutionOutcome) -> Result<B256, RootHashError>;
|
60 | 54 | }
|
61 |
| - |
62 |
| -/// All supported state provider factories |
63 |
| -#[derive(Clone)] |
64 |
| -pub enum StateProviderFactories { |
65 |
| - Reth(ProviderFactoryReopener<NodeTypesWithDBAdapter<EthereumNode, Arc<DatabaseEnv>>>), |
66 |
| - Ipc(IpcStateProviderFactory), |
67 |
| -} |
68 |
| - |
69 |
| -impl StateProviderFactory for StateProviderFactories { |
70 |
| - fn latest(&self) -> ProviderResult<StateProviderBox> { |
71 |
| - match self { |
72 |
| - StateProviderFactories::Reth(factory) => factory.latest(), |
73 |
| - StateProviderFactories::Ipc(factory) => factory.latest(), |
74 |
| - } |
75 |
| - } |
76 |
| - |
77 |
| - fn history_by_block_number(&self, block: BlockNumber) -> ProviderResult<StateProviderBox> { |
78 |
| - match self { |
79 |
| - StateProviderFactories::Reth(factory) => factory.history_by_block_number(block), |
80 |
| - StateProviderFactories::Ipc(factory) => factory.history_by_block_number(block), |
81 |
| - } |
82 |
| - } |
83 |
| - |
84 |
| - fn history_by_block_hash(&self, block: BlockHash) -> ProviderResult<StateProviderBox> { |
85 |
| - match self { |
86 |
| - StateProviderFactories::Reth(factory) => factory.history_by_block_hash(block), |
87 |
| - StateProviderFactories::Ipc(factory) => factory.history_by_block_hash(block), |
88 |
| - } |
89 |
| - } |
90 |
| - |
91 |
| - fn header(&self, block_hash: &BlockHash) -> ProviderResult<Option<Header>> { |
92 |
| - match self { |
93 |
| - StateProviderFactories::Reth(factory) => factory.header(block_hash), |
94 |
| - StateProviderFactories::Ipc(factory) => factory.header(block_hash), |
95 |
| - } |
96 |
| - } |
97 |
| - |
98 |
| - fn block_hash(&self, number: BlockNumber) -> ProviderResult<Option<B256>> { |
99 |
| - match self { |
100 |
| - StateProviderFactories::Reth(factory) => factory.block_hash(number), |
101 |
| - StateProviderFactories::Ipc(factory) => factory.block_hash(number), |
102 |
| - } |
103 |
| - } |
104 |
| - |
105 |
| - fn best_block_number(&self) -> ProviderResult<BlockNumber> { |
106 |
| - match self { |
107 |
| - StateProviderFactories::Reth(factory) => factory.best_block_number(), |
108 |
| - StateProviderFactories::Ipc(factory) => factory.best_block_number(), |
109 |
| - } |
110 |
| - } |
111 |
| - |
112 |
| - fn header_by_number(&self, num: u64) -> ProviderResult<Option<Header>> { |
113 |
| - match self { |
114 |
| - StateProviderFactories::Reth(factory) => factory.header_by_number(num), |
115 |
| - StateProviderFactories::Ipc(factory) => factory.header_by_number(num), |
116 |
| - } |
117 |
| - } |
118 |
| - |
119 |
| - fn last_block_number(&self) -> ProviderResult<BlockNumber> { |
120 |
| - match self { |
121 |
| - StateProviderFactories::Reth(factory) => factory.last_block_number(), |
122 |
| - StateProviderFactories::Ipc(factory) => factory.last_block_number(), |
123 |
| - } |
124 |
| - } |
125 |
| - |
126 |
| - fn root_hasher(&self, parent_num_hash: BlockNumHash) -> ProviderResult<Box<dyn RootHasher>> { |
127 |
| - match self { |
128 |
| - StateProviderFactories::Reth(factory) => factory.root_hasher(parent_num_hash), |
129 |
| - StateProviderFactories::Ipc(factory) => factory.root_hasher(parent_num_hash), |
130 |
| - } |
131 |
| - } |
132 |
| -} |
0 commit comments