mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 07:55:45 +00:00
PVF: Add Secure Validator Mode (#2486)
Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
@@ -36,7 +36,7 @@ use polkadot_node_core_pvf_common::{
|
||||
prepare::PrepareSuccess,
|
||||
pvf::PvfPrepData,
|
||||
};
|
||||
use polkadot_node_subsystem::SubsystemResult;
|
||||
use polkadot_node_subsystem::{SubsystemError, SubsystemResult};
|
||||
use polkadot_parachain_primitives::primitives::ValidationResult;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
@@ -156,6 +156,8 @@ pub struct Config {
|
||||
pub cache_path: PathBuf,
|
||||
/// The version of the node. `None` can be passed to skip the version check (only for tests).
|
||||
pub node_version: Option<String>,
|
||||
/// Whether the node is attempting to run as a secure validator.
|
||||
pub secure_validator_mode: bool,
|
||||
|
||||
/// The path to the program that can be used to spawn the prepare workers.
|
||||
pub prepare_worker_program_path: PathBuf,
|
||||
@@ -180,12 +182,14 @@ impl Config {
|
||||
pub fn new(
|
||||
cache_path: PathBuf,
|
||||
node_version: Option<String>,
|
||||
secure_validator_mode: bool,
|
||||
prepare_worker_program_path: PathBuf,
|
||||
execute_worker_program_path: PathBuf,
|
||||
) -> Self {
|
||||
Self {
|
||||
cache_path,
|
||||
node_version,
|
||||
secure_validator_mode,
|
||||
|
||||
prepare_worker_program_path,
|
||||
prepare_worker_spawn_timeout: Duration::from_secs(3),
|
||||
@@ -213,8 +217,12 @@ pub async fn start(
|
||||
) -> SubsystemResult<(ValidationHost, impl Future<Output = ()>)> {
|
||||
gum::debug!(target: LOG_TARGET, ?config, "starting PVF validation host");
|
||||
|
||||
// Run checks for supported security features once per host startup. Warn here if not enabled.
|
||||
let security_status = security::check_security_status(&config).await;
|
||||
// Run checks for supported security features once per host startup. If some checks fail, warn
|
||||
// if Secure Validator Mode is disabled and return an error otherwise.
|
||||
let security_status = match security::check_security_status(&config).await {
|
||||
Ok(ok) => ok,
|
||||
Err(err) => return Err(SubsystemError::Context(err)),
|
||||
};
|
||||
|
||||
let (to_host_tx, to_host_rx) = mpsc::channel(10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user