@@ -944,26 +944,11 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
944944
945945 /// Store a state in the store.
946946 pub fn put_state ( & self , state_root : & Hash256 , state : & BeaconState < E > ) -> Result < ( ) , Error > {
947- self . put_state_possibly_temporary ( state_root, state, false )
948- }
949-
950- /// Store a state in the store.
951- ///
952- /// The `temporary` flag indicates whether this state should be considered canonical.
953- pub fn put_state_possibly_temporary (
954- & self ,
955- state_root : & Hash256 ,
956- state : & BeaconState < E > ,
957- temporary : bool ,
958- ) -> Result < ( ) , Error > {
959947 let mut ops: Vec < KeyValueStoreOp > = Vec :: new ( ) ;
960948 if state. slot ( ) < self . get_split_slot ( ) {
961949 self . store_cold_state ( state_root, state, & mut ops) ?;
962950 self . cold_db . do_atomically ( ops)
963951 } else {
964- if temporary {
965- ops. push ( TemporaryFlag . as_kv_store_op ( * state_root) ) ;
966- }
967952 self . store_hot_state ( state_root, state, & mut ops) ?;
968953 self . hot_db . do_atomically ( ops)
969954 }
@@ -1208,17 +1193,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
12081193 key_value_batch. push ( summary. as_kv_store_op ( state_root) ) ;
12091194 }
12101195
1211- StoreOp :: PutStateTemporaryFlag ( state_root) => {
1212- key_value_batch. push ( TemporaryFlag . as_kv_store_op ( state_root) ) ;
1213- }
1214-
1215- StoreOp :: DeleteStateTemporaryFlag ( state_root) => {
1216- key_value_batch. push ( KeyValueStoreOp :: DeleteKey (
1217- TemporaryFlag :: db_column ( ) ,
1218- state_root. as_slice ( ) . to_vec ( ) ,
1219- ) ) ;
1220- }
1221-
12221196 StoreOp :: DeleteBlock ( block_root) => {
12231197 key_value_batch. push ( KeyValueStoreOp :: DeleteKey (
12241198 DBColumn :: BeaconBlock ,
@@ -1248,13 +1222,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
12481222 state_root. as_slice ( ) . to_vec ( ) ,
12491223 ) ) ;
12501224
1251- // Delete the state temporary flag (if any). Temporary flags are commonly
1252- // created by the state advance routine.
1253- key_value_batch. push ( KeyValueStoreOp :: DeleteKey (
1254- DBColumn :: BeaconStateTemporary ,
1255- state_root. as_slice ( ) . to_vec ( ) ,
1256- ) ) ;
1257-
12581225 if let Some ( slot) = slot {
12591226 match self . hot_storage_strategy ( slot) ? {
12601227 StorageStrategy :: Snapshot => {
@@ -1440,10 +1407,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
14401407
14411408 StoreOp :: PutStateSummary ( _, _) => ( ) ,
14421409
1443- StoreOp :: PutStateTemporaryFlag ( _) => ( ) ,
1444-
1445- StoreOp :: DeleteStateTemporaryFlag ( _) => ( ) ,
1446-
14471410 StoreOp :: DeleteBlock ( block_root) => {
14481411 guard. delete_block ( & block_root) ;
14491412 self . state_cache . lock ( ) . delete_block_states ( & block_root) ;
@@ -1738,12 +1701,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
17381701 ) -> Result < Option < ( BeaconState < E > , Hash256 ) > , Error > {
17391702 metrics:: inc_counter ( & metrics:: BEACON_STATE_HOT_GET_COUNT ) ;
17401703
1741- // If the state is marked as temporary, do not return it. It will become visible
1742- // only once its transaction commits and deletes its temporary flag.
1743- if self . load_state_temporary_flag ( state_root) ?. is_some ( ) {
1744- return Ok ( None ) ;
1745- }
1746-
17471704 if let Some ( HotStateSummary {
17481705 slot,
17491706 latest_block_root,
@@ -2804,17 +2761,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
28042761 . collect ( )
28052762 }
28062763
2807- /// Load the temporary flag for a state root, if one exists.
2808- ///
2809- /// Returns `Some` if the state is temporary, or `None` if the state is permanent or does not
2810- /// exist -- you should call `load_hot_state_summary` to find out which.
2811- pub fn load_state_temporary_flag (
2812- & self ,
2813- state_root : & Hash256 ,
2814- ) -> Result < Option < TemporaryFlag > , Error > {
2815- self . hot_db . get ( state_root)
2816- }
2817-
28182764 /// Run a compaction pass to free up space used by deleted states.
28192765 pub fn compact ( & self ) -> Result < ( ) , Error > {
28202766 self . hot_db . compact ( ) ?;
@@ -3549,23 +3495,6 @@ impl StoreItem for ColdStateSummary {
35493495 }
35503496}
35513497
3552- #[ derive( Debug , Clone , Copy , Default ) ]
3553- pub struct TemporaryFlag ;
3554-
3555- impl StoreItem for TemporaryFlag {
3556- fn db_column ( ) -> DBColumn {
3557- DBColumn :: BeaconStateTemporary
3558- }
3559-
3560- fn as_store_bytes ( & self ) -> Vec < u8 > {
3561- vec ! [ ]
3562- }
3563-
3564- fn from_store_bytes ( _: & [ u8 ] ) -> Result < Self , Error > {
3565- Ok ( TemporaryFlag )
3566- }
3567- }
3568-
35693498#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
35703499pub struct BytesKey {
35713500 pub key : Vec < u8 > ,
0 commit comments