Skip to content

Commit

Permalink
Make changes minor removing interface changing
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiEres committed Aug 5, 2024
1 parent 1cf6180 commit efb849b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
21 changes: 16 additions & 5 deletions polkadot/node/core/candidate-validation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ pub struct Config {

/// The candidate validation subsystem.
pub struct CandidateValidationSubsystem {
keystore: KeystorePtr,
keystore: Option<KeystorePtr>,
#[allow(missing_docs)]
pub metrics: Metrics,
#[allow(missing_docs)]
Expand All @@ -124,14 +124,23 @@ pub struct CandidateValidationSubsystem {
}

impl CandidateValidationSubsystem {
/// Create a new `CandidateValidationSubsystem`.
/// Create a new `CandidateValidationSubsystem` without keystore.
pub fn with_config(
config: Option<Config>,
metrics: Metrics,
pvf_metrics: polkadot_node_core_pvf::Metrics,
) -> Self {
CandidateValidationSubsystem { keystore: None, config, metrics, pvf_metrics }
}

/// Create a new `CandidateValidationSubsystem` with keystore.
pub fn with_config_and_keystore(
config: Option<Config>,
keystore: KeystorePtr,
metrics: Metrics,
pvf_metrics: polkadot_node_core_pvf::Metrics,
) -> Self {
CandidateValidationSubsystem { keystore, config, metrics, pvf_metrics }
CandidateValidationSubsystem { keystore: Some(keystore), config, metrics, pvf_metrics }
}
}

Expand Down Expand Up @@ -229,7 +238,7 @@ where
#[overseer::contextbounds(CandidateValidation, prefix = self::overseer)]
async fn run<Context>(
mut ctx: Context,
keystore: KeystorePtr,
keystore: Option<KeystorePtr>,
metrics: Metrics,
pvf_metrics: polkadot_node_core_pvf::Metrics,
Config {
Expand Down Expand Up @@ -268,7 +277,9 @@ async fn run<Context>(
comm = ctx.recv().fuse() => {
match comm {
Ok(FromOrchestra::Signal(OverseerSignal::ActiveLeaves(update))) => {
maybe_prepare_validation(ctx.sender(), keystore.clone(), validation_host.clone(), update, &mut prepare_state).await;
if let Some(ref keystore) = keystore {
maybe_prepare_validation(ctx.sender(), keystore.clone(), validation_host.clone(), update, &mut prepare_state).await;
}
},
Ok(FromOrchestra::Signal(OverseerSignal::BlockFinalized(..))) => {},
Ok(FromOrchestra::Signal(OverseerSignal::Conclude)) => return Ok(()),
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/service/src/overseer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ where
keystore.clone(),
Metrics::register(registry)?,
))
.candidate_validation(CandidateValidationSubsystem::with_config(
.candidate_validation(CandidateValidationSubsystem::with_config_and_keystore(
candidate_validation_config,
keystore.clone(),
Metrics::register(registry)?, // candidate-validation metrics
Expand Down
2 changes: 1 addition & 1 deletion prdoc/pr_4791.prdoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ crates:
- name: polkadot-service
bump: patch
- name: polkadot-node-core-candidate-validation
bump: major
bump: minor

0 comments on commit efb849b

Please sign in to comment.