File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -883,6 +883,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
883883 return Ok ( None ) ;
884884 }
885885
886+ // Fast-path for the split slot (which usually corresponds to the finalized slot).
887+ let split = self . store . get_split_info ( ) ;
888+ if request_slot == split. slot {
889+ return Ok ( Some ( split. state_root ) ) ;
890+ }
891+
886892 // Try an optimized path of reading the root directly from the head state.
887893 let fast_lookup: Option < Hash256 > = self . with_head ( |head| {
888894 if head. beacon_block . slot ( ) <= request_slot {
Original file line number Diff line number Diff line change @@ -3155,6 +3155,10 @@ async fn weak_subjectivity_sync_test(
31553155 . get_state ( & state_root, Some ( slot) , CACHE_STATE_IN_TESTS )
31563156 . unwrap ( )
31573157 . unwrap ( ) ;
3158+ assert_eq ! (
3159+ state_root,
3160+ beacon_chain. state_root_at_slot( slot) . unwrap( ) . unwrap( )
3161+ ) ;
31583162 assert_eq ! ( state. slot( ) , slot) ;
31593163 assert_eq ! ( state. canonical_root( ) . unwrap( ) , state_root) ;
31603164 }
You can’t perform that action at this time.
0 commit comments