Drop unused EthSpec generic from Stores (#9281)

Co-Authored-By: dapplion <35266934+dapplion@users.noreply.github.com>
This commit is contained in:
Lion - dapplion
2026-05-21 02:35:35 -06:00
committed by GitHub
parent a9637c1650
commit 1caaa10fa8
31 changed files with 141 additions and 183 deletions

View File

@@ -49,7 +49,7 @@ use zstd::{Decoder, Encoder};
/// Stores vector fields like the `block_roots` and `state_roots` separately, and only stores
/// intermittent "restore point" states pre-finalization.
#[derive(Debug)]
pub struct HotColdDB<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> {
pub struct HotColdDB<E: EthSpec, Hot: ItemStore, Cold: ItemStore> {
/// The slot and state root at the point where the database is split between hot and cold.
///
/// States with slots less than `split.slot` are in the cold DB, while states with slots
@@ -217,11 +217,11 @@ pub enum HotColdDBError {
Rollback,
}
impl<E: EthSpec> HotColdDB<E, MemoryStore<E>, MemoryStore<E>> {
impl<E: EthSpec> HotColdDB<E, MemoryStore, MemoryStore> {
pub fn open_ephemeral(
config: StoreConfig,
spec: Arc<ChainSpec>,
) -> Result<HotColdDB<E, MemoryStore<E>, MemoryStore<E>>, Error> {
) -> Result<HotColdDB<E, MemoryStore, MemoryStore>, Error> {
config.verify::<E>()?;
let hierarchy = config.hierarchy_config.to_moduli()?;
@@ -258,7 +258,7 @@ impl<E: EthSpec> HotColdDB<E, MemoryStore<E>, MemoryStore<E>> {
}
}
impl<E: EthSpec> HotColdDB<E, BeaconNodeBackend<E>, BeaconNodeBackend<E>> {
impl<E: EthSpec> HotColdDB<E, BeaconNodeBackend, BeaconNodeBackend> {
/// Open a new or existing database, with the given paths to the hot and cold DBs.
///
/// The `migrate_schema` function is passed in so that the parent `BeaconChain` can provide
@@ -451,7 +451,7 @@ impl<E: EthSpec> HotColdDB<E, BeaconNodeBackend<E>, BeaconNodeBackend<E>> {
}
}
impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold> {
impl<E: EthSpec, Hot: ItemStore, Cold: ItemStore> HotColdDB<E, Hot, Cold> {
fn cold_storage_strategy(&self, slot: Slot) -> Result<StorageStrategy, Error> {
// The start slot for the freezer HDiff is always 0
Ok(self.hierarchy.storage_strategy(slot, Slot::new(0))?)
@@ -3575,7 +3575,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
/// This function previously did a combination of freezer migration alongside pruning. Now it is
/// *just* responsible for copying relevant data to the freezer, while pruning is implemented
/// in `prune_hot_db`.
pub fn migrate_database<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
pub fn migrate_database<E: EthSpec, Hot: ItemStore, Cold: ItemStore>(
store: Arc<HotColdDB<E, Hot, Cold>>,
finalized_state_root: Hash256,
finalized_block_root: Hash256,
@@ -3786,7 +3786,7 @@ pub enum StateSummaryIteratorError {
/// Return the ancestor state root of a state beyond SlotsPerHistoricalRoot using the roots iterator
/// and the store
pub fn get_ancestor_state_root<'a, E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
pub fn get_ancestor_state_root<'a, E: EthSpec, Hot: ItemStore, Cold: ItemStore>(
store: &'a HotColdDB<E, Hot, Cold>,
from_state: &'a BeaconState<E>,
target_slot: Slot,
@@ -3993,7 +3993,7 @@ impl StoreItem for HotStateSummary {
impl HotStateSummary {
/// Construct a new summary of the given state.
pub fn new<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>>(
pub fn new<E: EthSpec, Hot: ItemStore, Cold: ItemStore>(
store: &HotColdDB<E, Hot, Cold>,
state_root: Hash256,
state: &BeaconState<E>,