@@ -99,9 +99,10 @@ use polkadot_node_subsystem::{
9999use polkadot_node_subsystem_util:: {
100100 self as util,
101101 backing_implicit_view:: View as ImplicitView ,
102- request_claim_queue, request_disabled_validators, request_session_executor_params,
103- request_session_index_for_child, request_validator_groups, request_validators,
104- runtime:: { self , request_min_backing_votes, ClaimQueueSnapshot } ,
102+ request_claim_queue, request_disabled_validators, request_min_backing_votes,
103+ request_node_features, request_session_executor_params, request_session_index_for_child,
104+ request_validator_groups, request_validators,
105+ runtime:: { self , ClaimQueueSnapshot } ,
105106 Validator ,
106107} ;
107108use polkadot_parachain_primitives:: primitives:: IsSystem ;
@@ -125,7 +126,6 @@ use polkadot_statement_table::{
125126 Context as TableContextTrait , Table ,
126127} ;
127128use sp_keystore:: KeystorePtr ;
128- use util:: runtime:: request_node_features;
129129
130130mod error;
131131
@@ -260,7 +260,7 @@ struct PerSessionCache {
260260 /// Cache for storing validators list, retrieved from the runtime.
261261 validators_cache : LruMap < SessionIndex , Arc < Vec < ValidatorId > > > ,
262262 /// Cache for storing node features, retrieved from the runtime.
263- node_features_cache : LruMap < SessionIndex , Option < NodeFeatures > > ,
263+ node_features_cache : LruMap < SessionIndex , NodeFeatures > ,
264264 /// Cache for storing executor parameters, retrieved from the runtime.
265265 executor_params_cache : LruMap < SessionIndex , Arc < ExecutorParams > > ,
266266 /// Cache for storing the minimum backing votes threshold, retrieved from the runtime.
@@ -322,15 +322,20 @@ impl PerSessionCache {
322322 session_index : SessionIndex ,
323323 parent : Hash ,
324324 sender : & mut impl overseer:: SubsystemSender < RuntimeApiMessage > ,
325- ) -> Result < Option < NodeFeatures > , Error > {
325+ ) -> Result < NodeFeatures , RuntimeApiError > {
326326 // Try to get the node features from the cache.
327327 if let Some ( node_features) = self . node_features_cache . get ( & session_index) {
328328 return Ok ( node_features. clone ( ) ) ;
329329 }
330330
331331 // Fetch the node features from the runtime since it was not in the cache.
332- let node_features: Option < NodeFeatures > =
333- request_node_features ( parent, session_index, sender) . await ?;
332+ let node_features = request_node_features ( parent, session_index, sender)
333+ . await
334+ . await
335+ . map_err ( |err| RuntimeApiError :: Execution {
336+ runtime_api_name : "NodeFeatures" ,
337+ source : Arc :: new ( err) ,
338+ } ) ??;
334339
335340 // Cache the fetched node features for future use.
336341 self . node_features_cache . insert ( session_index, node_features. clone ( ) ) ;
@@ -388,11 +393,12 @@ impl PerSessionCache {
388393
389394 // Fetch the value from the runtime since it was not in the cache.
390395 let minimum_backing_votes = request_min_backing_votes ( parent, session_index, sender)
396+ . await
391397 . await
392398 . map_err ( |err| RuntimeApiError :: Execution {
393399 runtime_api_name : "MinimumBackingVotes" ,
394400 source : Arc :: new ( err) ,
395- } ) ?;
401+ } ) ?? ;
396402
397403 // Cache the fetched value for future use.
398404 self . minimum_backing_votes_cache . insert ( session_index, minimum_backing_votes) ;
@@ -1152,10 +1158,8 @@ async fn construct_per_relay_parent_state<Context>(
11521158 let validators = per_session_cache. validators ( session_index, parent, ctx. sender ( ) ) . await ;
11531159 let validators = try_runtime_api ! ( validators) ;
11541160
1155- let node_features = per_session_cache
1156- . node_features ( session_index, parent, ctx. sender ( ) )
1157- . await ?
1158- . unwrap_or ( NodeFeatures :: EMPTY ) ;
1161+ let node_features = per_session_cache. node_features ( session_index, parent, ctx. sender ( ) ) . await ;
1162+ let node_features = try_runtime_api ! ( node_features) ;
11591163
11601164 let inject_core_index = node_features
11611165 . get ( FeatureIndex :: ElasticScalingMVP as usize )
0 commit comments