@@ -36,17 +36,17 @@ use polkadot_primitives::{
36
36
CandidateHash , CoreIndex , EncodeAs , ExecutorParams , GroupIndex , GroupRotationInfo , Hash ,
37
37
Id as ParaId , IndexedVec , NodeFeatures , SessionIndex , SessionInfo , Signed , SigningContext ,
38
38
UncheckedSigned , ValidationCode , ValidationCodeHash , ValidatorId , ValidatorIndex ,
39
- DEFAULT_SCHEDULING_LOOKAHEAD , LEGACY_MIN_BACKING_VOTES ,
39
+ DEFAULT_SCHEDULING_LOOKAHEAD ,
40
40
} ;
41
41
42
42
use std:: collections:: { BTreeMap , VecDeque } ;
43
43
44
44
use crate :: {
45
- has_required_runtime , request_availability_cores, request_candidate_events,
46
- request_claim_queue , request_disabled_validators, request_from_runtime,
47
- request_key_ownership_proof , request_on_chain_votes, request_session_executor_params,
48
- request_session_index_for_child , request_session_info, request_submit_report_dispute_lost,
49
- request_unapplied_slashes , request_validation_code_by_hash, request_validator_groups,
45
+ request_availability_cores, request_candidate_events, request_claim_queue ,
46
+ request_disabled_validators, request_from_runtime, request_key_ownership_proof ,
47
+ request_on_chain_votes, request_session_executor_params, request_session_index_for_child ,
48
+ request_session_info, request_submit_report_dispute_lost, request_unapplied_slashes ,
49
+ request_validation_code_by_hash, request_validator_groups,
50
50
} ;
51
51
52
52
/// Errors that can happen on runtime fetches.
@@ -202,7 +202,7 @@ impl RuntimeInfo {
202
202
Some ( result) => Ok ( result) ,
203
203
None => {
204
204
let disabled_validators =
205
- get_disabled_validators_with_fallback ( sender , relay_parent ) . await ?;
205
+ request_disabled_validators ( relay_parent , sender ) . await . await ? ?;
206
206
self . disabled_validators_cache . insert ( relay_parent, disabled_validators. clone ( ) ) ;
207
207
Ok ( disabled_validators)
208
208
} ,
@@ -469,61 +469,35 @@ where
469
469
}
470
470
471
471
/// Request the min backing votes value.
472
- /// Prior to runtime API version 6, just return a hardcoded constant.
473
472
pub async fn request_min_backing_votes (
474
473
parent : Hash ,
475
474
session_index : SessionIndex ,
476
475
sender : & mut impl overseer:: SubsystemSender < RuntimeApiMessage > ,
477
476
) -> Result < u32 > {
478
- let min_backing_votes_res = recv_runtime (
477
+ recv_runtime (
479
478
request_from_runtime ( parent, sender, |tx| {
480
479
RuntimeApiRequest :: MinimumBackingVotes ( session_index, tx)
481
480
} )
482
481
. await ,
483
482
)
484
- . await ;
485
-
486
- if let Err ( Error :: RuntimeRequest ( RuntimeApiError :: NotSupported { .. } ) ) = min_backing_votes_res
487
- {
488
- gum:: trace!(
489
- target: LOG_TARGET ,
490
- ?parent,
491
- "Querying the backing threshold from the runtime is not supported by the current Runtime API" ,
492
- ) ;
493
-
494
- Ok ( LEGACY_MIN_BACKING_VOTES )
495
- } else {
496
- min_backing_votes_res
497
- }
483
+ . await
498
484
}
499
485
500
486
/// Request the node features enabled in the runtime.
501
487
/// Pass in the session index for caching purposes, as it should only change on session boundaries.
502
- /// Prior to runtime API version 9, just return `None`.
503
488
pub async fn request_node_features (
504
489
parent : Hash ,
505
490
session_index : SessionIndex ,
506
491
sender : & mut impl overseer:: SubsystemSender < RuntimeApiMessage > ,
507
492
) -> Result < Option < NodeFeatures > > {
508
- let res = recv_runtime (
493
+ recv_runtime (
509
494
request_from_runtime ( parent, sender, |tx| {
510
495
RuntimeApiRequest :: NodeFeatures ( session_index, tx)
511
496
} )
512
497
. await ,
513
498
)
514
- . await ;
515
-
516
- if let Err ( Error :: RuntimeRequest ( RuntimeApiError :: NotSupported { .. } ) ) = res {
517
- gum:: trace!(
518
- target: LOG_TARGET ,
519
- ?parent,
520
- "Querying the node features from the runtime is not supported by the current Runtime API" ,
521
- ) ;
522
-
523
- Ok ( None )
524
- } else {
525
- res. map ( Some )
526
- }
499
+ . await
500
+ . map ( Some )
527
501
}
528
502
529
503
/// A snapshot of the runtime claim queue at an arbitrary relay chain block.
@@ -568,34 +542,6 @@ impl ClaimQueueSnapshot {
568
542
}
569
543
}
570
544
571
- // TODO: https://github.com/paritytech/polkadot-sdk/issues/1940
572
- /// Returns disabled validators list if the runtime supports it. Otherwise logs a debug messages and
573
- /// returns an empty vec.
574
- /// Once runtime ver `DISABLED_VALIDATORS_RUNTIME_REQUIREMENT` is released remove this function and
575
- /// replace all usages with `request_disabled_validators`
576
- pub async fn get_disabled_validators_with_fallback < Sender : SubsystemSender < RuntimeApiMessage > > (
577
- sender : & mut Sender ,
578
- relay_parent : Hash ,
579
- ) -> Result < Vec < ValidatorIndex > > {
580
- let disabled_validators = if has_required_runtime (
581
- sender,
582
- relay_parent,
583
- RuntimeApiRequest :: DISABLED_VALIDATORS_RUNTIME_REQUIREMENT ,
584
- )
585
- . await
586
- {
587
- request_disabled_validators ( relay_parent, sender)
588
- . await
589
- . await
590
- . map_err ( Error :: RuntimeRequestCanceled ) ??
591
- } else {
592
- gum:: debug!( target: LOG_TARGET , "Runtime doesn't support `DisabledValidators` - continuing with an empty disabled validators set" ) ;
593
- vec ! [ ]
594
- } ;
595
-
596
- Ok ( disabled_validators)
597
- }
598
-
599
545
/// Fetch the claim queue and wrap it into a helpful `ClaimQueueSnapshot`
600
546
pub async fn fetch_claim_queue (
601
547
sender : & mut impl SubsystemSender < RuntimeApiMessage > ,
@@ -609,8 +555,8 @@ pub async fn fetch_claim_queue(
609
555
Ok ( cq. into ( ) )
610
556
}
611
557
612
- /// Checks if the runtime supports `request_claim_queue` and attempts to fetch the claim queue.
613
- /// Returns `ClaimQueueSnapshot` or `None` if claim queue API is not supported by runtime.
558
+ /// Returns the lookahead from the scheduler params if the runtime supports it,
559
+ /// or default value if scheduling lookahead API is not supported by runtime.
614
560
pub async fn fetch_scheduling_lookahead (
615
561
parent : Hash ,
616
562
session_index : SessionIndex ,
0 commit comments