diff --git a/beacon_node/beacon_chain/src/builder.rs b/beacon_node/beacon_chain/src/builder.rs index 2c5a68388e..f83cf471b0 100644 --- a/beacon_node/beacon_chain/src/builder.rs +++ b/beacon_node/beacon_chain/src/builder.rs @@ -318,6 +318,7 @@ where .ok_or("set_genesis_state requires a store")?; let beacon_block = genesis_block(&mut beacon_state, &self.spec)?; + let blinded_block = beacon_block.clone_as_blinded(); beacon_state .build_all_caches(&self.spec) @@ -330,12 +331,12 @@ where .put_state(&beacon_state_root, &beacon_state) .map_err(|e| format!("Failed to store genesis state: {:?}", e))?; store - .put_block(&beacon_block_root, beacon_block.clone()) + .put_cold_blinded_block(&beacon_block_root, &blinded_block) .map_err(|e| format!("Failed to store genesis block: {:?}", e))?; // Store the genesis block under the `ZERO_HASH` key. store - .put_block(&Hash256::zero(), beacon_block.clone()) + .put_cold_blinded_block(&Hash256::zero(), &blinded_block) .map_err(|e| { format!( "Failed to store genesis block under 0x00..00 alias: {:?}", diff --git a/beacon_node/store/src/hot_cold_store.rs b/beacon_node/store/src/hot_cold_store.rs index 8bc308951d..b8706be6e0 100644 --- a/beacon_node/store/src/hot_cold_store.rs +++ b/beacon_node/store/src/hot_cold_store.rs @@ -410,7 +410,7 @@ impl, Cold: ItemStore> HotColdDB slot: Option, ) -> Result>, Error> { if let Some(slot) = slot { - if slot < self.get_split_slot() { + if slot < self.get_split_slot() || slot == 0 { // To the freezer DB. self.get_cold_blinded_block_by_slot(slot) } else { @@ -469,6 +469,16 @@ impl, Cold: ItemStore> HotColdDB )?)) } + pub fn put_cold_blinded_block( + &self, + block_root: &Hash256, + block: &SignedBlindedBeaconBlock, + ) -> Result<(), Error> { + let mut ops = Vec::with_capacity(2); + self.blinded_block_as_cold_kv_store_ops(block_root, block, &mut ops)?; + self.cold_db.do_atomically(ops) + } + pub fn blinded_block_as_cold_kv_store_ops( &self, block_root: &Hash256,