@@ -944,26 +944,11 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
944
944
945
945
/// Store a state in the store.
946
946
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 > {
959
947
let mut ops: Vec < KeyValueStoreOp > = Vec :: new ( ) ;
960
948
if state. slot ( ) < self . get_split_slot ( ) {
961
949
self . store_cold_state ( state_root, state, & mut ops) ?;
962
950
self . cold_db . do_atomically ( ops)
963
951
} else {
964
- if temporary {
965
- ops. push ( TemporaryFlag . as_kv_store_op ( * state_root) ) ;
966
- }
967
952
self . store_hot_state ( state_root, state, & mut ops) ?;
968
953
self . hot_db . do_atomically ( ops)
969
954
}
@@ -1208,17 +1193,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
1208
1193
key_value_batch. push ( summary. as_kv_store_op ( state_root) ) ;
1209
1194
}
1210
1195
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
-
1222
1196
StoreOp :: DeleteBlock ( block_root) => {
1223
1197
key_value_batch. push ( KeyValueStoreOp :: DeleteKey (
1224
1198
DBColumn :: BeaconBlock ,
@@ -1248,13 +1222,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
1248
1222
state_root. as_slice ( ) . to_vec ( ) ,
1249
1223
) ) ;
1250
1224
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
-
1258
1225
if let Some ( slot) = slot {
1259
1226
match self . hot_storage_strategy ( slot) ? {
1260
1227
StorageStrategy :: Snapshot => {
@@ -1440,10 +1407,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
1440
1407
1441
1408
StoreOp :: PutStateSummary ( _, _) => ( ) ,
1442
1409
1443
- StoreOp :: PutStateTemporaryFlag ( _) => ( ) ,
1444
-
1445
- StoreOp :: DeleteStateTemporaryFlag ( _) => ( ) ,
1446
-
1447
1410
StoreOp :: DeleteBlock ( block_root) => {
1448
1411
guard. delete_block ( & block_root) ;
1449
1412
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>
1738
1701
) -> Result < Option < ( BeaconState < E > , Hash256 ) > , Error > {
1739
1702
metrics:: inc_counter ( & metrics:: BEACON_STATE_HOT_GET_COUNT ) ;
1740
1703
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
-
1747
1704
if let Some ( HotStateSummary {
1748
1705
slot,
1749
1706
latest_block_root,
@@ -2804,17 +2761,6 @@ impl<E: EthSpec, Hot: ItemStore<E>, Cold: ItemStore<E>> HotColdDB<E, Hot, Cold>
2804
2761
. collect ( )
2805
2762
}
2806
2763
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
-
2818
2764
/// Run a compaction pass to free up space used by deleted states.
2819
2765
pub fn compact ( & self ) -> Result < ( ) , Error > {
2820
2766
self . hot_db . compact ( ) ?;
@@ -3549,23 +3495,6 @@ impl StoreItem for ColdStateSummary {
3549
3495
}
3550
3496
}
3551
3497
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
-
3569
3498
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
3570
3499
pub struct BytesKey {
3571
3500
pub key : Vec < u8 > ,
0 commit comments