Skip to content

Commit

Permalink
Debug db opening issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Dec 25, 2024
1 parent f460b59 commit ff69ee0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions account_manager/src/validator/slashing_protection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn cli_run<E: EthSpec>(
let slashing_protection_database =
SlashingDatabase::open_or_create(&slashing_protection_db_path).map_err(|e| {
format!(
"Unable to open database at {}: {:?}",
"Unable to open slashing protection database at {}: {:?}",
slashing_protection_db_path.display(),
e
)
Expand Down Expand Up @@ -198,7 +198,7 @@ pub fn cli_run<E: EthSpec>(
let slashing_protection_database = SlashingDatabase::open(&slashing_protection_db_path)
.map_err(|e| {
format!(
"Unable to open database at {}: {:?}",
"Unable to open slashing protection database at {}: {:?}",
slashing_protection_db_path.display(),
e
)
Expand Down
1 change: 1 addition & 0 deletions beacon_node/store/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub enum Error {
LoadBlobInfo(Box<Error>),
LoadDataColumnInfo(Box<Error>),
LoadConfig(Box<Error>),
LoadHotStateSummary(Box<Error>),
}

pub trait HandleUnavailable<T> {
Expand Down
10 changes: 9 additions & 1 deletion beacon_node/store/src/hot_cold_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,18 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
spec: Arc<ChainSpec>,
log: Logger,
) -> Result<Arc<Self>, Error> {
debug!(log, "Opening HotColdDB");
config.verify::<E>()?;

let hierarchy = config.hierarchy_config.to_moduli()?;

// TODO(hdiff): Use different exponents
let hierarchy_hot = config.hierarchy_config.to_moduli()?;

debug!(log, "Opening LevelDB"; "hot_path" => ?hot_path);
let hot_db = LevelDB::open(hot_path)?;
let anchor_info = RwLock::new(Self::load_anchor_info(&hot_db)?);
debug!(log, "Loaded anchor info"; "anchor_info" => ?anchor_info);

let db = HotColdDB {
split: RwLock::new(Split::default()),
Expand Down Expand Up @@ -307,6 +310,7 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
// Open separate blobs directory if configured and same configuration was used on previous
// run.
let blob_info = db.load_blob_info()?;
debug!(db.log, "Loaded blob info"; "blob_info" => ?blob_info);
let deneb_fork_slot = db
.spec
.deneb_fork_epoch
Expand Down Expand Up @@ -337,6 +341,7 @@ impl<E: EthSpec> HotColdDB<E, LevelDB<E>, LevelDB<E>> {
db.compare_and_set_blob_info_with_write(<_>::default(), new_blob_info.clone())?;

let data_column_info = db.load_data_column_info()?;
debug!(db.log, "Loaded data column info"; "data_column_info" => ?data_column_info);
let eip7594_fork_slot = db
.spec
.eip7594_fork_epoch
Expand Down Expand Up @@ -2645,6 +2650,7 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
fn load_split(&self) -> Result<Option<Split>, Error> {
match self.load_split_partial()? {
Some(mut split) => {
debug!(self.log, "Loaded split partial"; "split" => ?split);
// Load the hot state summary to get the block root.
let summary = self.load_hot_state_summary(&split.state_root)?.ok_or(
HotColdDBError::MissingSplitState(split.state_root, split.slot),
Expand Down Expand Up @@ -2674,7 +2680,9 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
&self,
state_root: &Hash256,
) -> Result<Option<HotStateSummary>, Error> {
self.hot_db.get(state_root)
self.hot_db
.get(state_root)
.map_err(|e| Error::LoadHotStateSummary(e.into()))
}

/// Load the temporary flag for a state root, if one exists.
Expand Down

0 comments on commit ff69ee0

Please sign in to comment.