Skip to content

Commit e282363

Browse files
Gracefully handle deleting states prior to anchor_slot (#8409)
Fix an issue detected by @jimmygchen that occurs when checkpoint sync is aborted midway and then later restarted. The characteristic error is something like: > Nov 13 00:51:35.832 ERROR Database write failed error: Hdiff(LessThanStart(Slot(1728288), Slot(1728320))), action: "reverting blob DB changes" Nov 13 00:51:35.833 WARN Hot DB pruning failed error: DBError(HotColdDBError(Rollback)) This issue has existed since v7.1.0. Delete snapshot/diff in the case where `hot_storage_strategy` fails. Co-Authored-By: Michael Sproul <michael@sigmaprime.io>
1 parent b5260db commit e282363

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

beacon_node/store/src/hot_cold_store.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,8 +1308,13 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
13081308
state_root.as_slice().to_vec(),
13091309
));
13101310

1311-
if let Some(slot) = slot {
1312-
match self.hot_storage_strategy(slot)? {
1311+
// NOTE: `hot_storage_strategy` can error if there are states in the database
1312+
// prior to the `anchor_slot`. This can happen if checkpoint sync has been
1313+
// botched and left some states in the database prior to completing.
1314+
if let Some(slot) = slot
1315+
&& let Ok(strategy) = self.hot_storage_strategy(slot)
1316+
{
1317+
match strategy {
13131318
StorageStrategy::Snapshot => {
13141319
// Full state stored in this position
13151320
key_value_batch.push(KeyValueStoreOp::DeleteKey(

0 commit comments

Comments
 (0)