diff --git a/beacon_node/beacon_chain/src/builder.rs b/beacon_node/beacon_chain/src/builder.rs index a0ebcc8db9..1a66d80a6a 100644 --- a/beacon_node/beacon_chain/src/builder.rs +++ b/beacon_node/beacon_chain/src/builder.rs @@ -830,12 +830,7 @@ where })?; let migrator_config = self.store_migrator_config.unwrap_or_default(); - let store_migrator = BackgroundMigrator::new( - store.clone(), - migrator_config, - genesis_block_root, - log.clone(), - ); + let store_migrator = BackgroundMigrator::new(store.clone(), migrator_config, log.clone()); if let Some(slot) = slot_clock.now() { validator_monitor.process_valid_state( diff --git a/beacon_node/beacon_chain/src/migrate.rs b/beacon_node/beacon_chain/src/migrate.rs index bcecb7fce8..09609c8b3b 100644 --- a/beacon_node/beacon_chain/src/migrate.rs +++ b/beacon_node/beacon_chain/src/migrate.rs @@ -1,6 +1,4 @@ -use crate::beacon_chain::BEACON_CHAIN_DB_KEY; use crate::errors::BeaconChainError; -use crate::persisted_beacon_chain::{PersistedBeaconChain, DUMMY_CANONICAL_HEAD_BLOCK_ROOT}; use crate::summaries_dag::{ self, BlockSummariesDAG, DAGBlockSummary, DAGStateSummary, StateSummariesDAG, }; @@ -13,7 +11,7 @@ use std::sync::{mpsc, Arc}; use std::thread; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use store::hot_cold_store::{migrate_database, HotColdDBError}; -use store::{DBColumn, Error, HotStateSummary, ItemStore, StoreItem, StoreOp}; +use store::{DBColumn, Error, HotStateSummary, ItemStore, StoreOp}; pub use store::{HotColdDB, MemoryStore}; use types::{BeaconState, BeaconStateHash, Checkpoint, Epoch, EthSpec, Hash256, Slot}; @@ -39,8 +37,6 @@ pub struct BackgroundMigrator, Cold: ItemStore> prev_migration: Arc>, #[allow(clippy::type_complexity)] tx_thread: Option, thread::JoinHandle<()>)>>, - /// Genesis block root, for persisting the `PersistedBeaconChain`. - genesis_block_root: Hash256, log: Logger, } @@ -132,17 +128,11 @@ pub struct FinalizationNotification { finalized_state_root: BeaconStateHash, finalized_checkpoint: Checkpoint, prev_migration: Arc>, - genesis_block_root: Hash256, } impl, Cold: ItemStore> BackgroundMigrator { /// Create a new `BackgroundMigrator` and spawn its thread if necessary. - pub fn new( - db: Arc>, - config: MigratorConfig, - genesis_block_root: Hash256, - log: Logger, - ) -> Self { + pub fn new(db: Arc>, config: MigratorConfig, log: Logger) -> Self { // Estimate last migration run from DB split slot. let prev_migration = Arc::new(Mutex::new(PrevMigration { epoch: db.get_split_slot().epoch(E::slots_per_epoch()), @@ -157,7 +147,6 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> BackgroundMigrator, new_finalized_checkpoint: Checkpoint, - genesis_block_root: Hash256, log: &Logger, ) -> Result { let new_finalized_slot = new_finalized_checkpoint @@ -532,7 +518,7 @@ impl, Cold: ItemStore> BackgroundMigrator DAGBlockSummary { + DAGBlockSummary { + slot: Slot::new(0), + parent_root, + } + } + #[test] fn new_from_v22_empty() { StateSummariesDAG::new_from_v22(vec![], HashMap::new(), Hash256::ZERO).unwrap(); @@ -321,9 +328,8 @@ mod tests { let root_1 = root(1); let root_2 = root(2); let root_3 = root(3); - // (child, parent) - let parents = HashMap::from_iter([(root_1, root_2)]); - let dag = BlockSummariesDAG::new(parents); + let parents = vec![(root_1, block_with_parent(root_2))]; + let dag = BlockSummariesDAG::new(&parents); // root 1 is known and has no childs assert_eq!(