From 8752deeced23ef9a81498090f37b1526cd2c5038 Mon Sep 17 00:00:00 2001 From: Emilia Hane Date: Sat, 14 Jan 2023 17:18:55 +0100 Subject: [PATCH] Store orphan block roots --- beacon_node/beacon_chain/src/migrate.rs | 1 + beacon_node/store/src/hot_cold_store.rs | 8 ++++++++ beacon_node/store/src/lib.rs | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/beacon_node/beacon_chain/src/migrate.rs b/beacon_node/beacon_chain/src/migrate.rs index 3ef0b265a..4aa55f404 100644 --- a/beacon_node/beacon_chain/src/migrate.rs +++ b/beacon_node/beacon_chain/src/migrate.rs @@ -573,6 +573,7 @@ impl, Cold: ItemStore> BackgroundMigrator, Cold: ItemStore> HotColdDB let key = get_key_for_col(DBColumn::ExecPayload.into(), block_root.as_bytes()); key_value_batch.push(KeyValueStoreOp::DeleteKey(key)); } + + StoreOp::PutOrphanedBlobs(block_root) => { + let db_key = + get_key_for_col(DBColumn::BeaconBlobOrphan.into(), block_root.as_bytes()); + key_value_batch.push(KeyValueStoreOp::PutKeyValue(db_key, [].into())); + } } } Ok(key_value_batch) @@ -862,6 +868,8 @@ impl, Cold: ItemStore> HotColdDB StoreOp::DeleteState(_, _) => (), StoreOp::DeleteExecutionPayload(_) => (), + + StoreOp::PutOrphanedBlobs(_) => (), } } diff --git a/beacon_node/store/src/lib.rs b/beacon_node/store/src/lib.rs index e1b2c948a..7d244f5ae 100644 --- a/beacon_node/store/src/lib.rs +++ b/beacon_node/store/src/lib.rs @@ -158,6 +158,7 @@ pub enum StoreOp<'a, E: EthSpec> { PutBlock(Hash256, Arc>), PutState(Hash256, &'a BeaconState), PutBlobs(Hash256, Arc>), + PutOrphanedBlobs(Hash256), PutStateSummary(Hash256, HotStateSummary), PutStateTemporaryFlag(Hash256), DeleteStateTemporaryFlag(Hash256), @@ -177,6 +178,9 @@ pub enum DBColumn { BeaconBlock, #[strum(serialize = "blb")] BeaconBlob, + /// Block roots of orphaned beacon blobs. + #[strum(serialize = "blbo")] + BeaconBlobOrphan, /// For full `BeaconState`s in the hot database (finalized or fork-boundary states). #[strum(serialize = "ste")] BeaconState,