mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 18:51:02 +00:00
New PVF validation host (#2710)
* Implement PVF validation host * WIP: Diener * Increase the alloted compilation time * Add more comments * Minor clean up * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Fix pruning artifact removal * Fix formatting and newlines * Fix the thread pool * Update node/core/pvf/src/executor_intf.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Remove redundant test declaration * Don't convert the path into an intermediate string * Try to workaround the test failure * Use the puppet_worker trick again * Fix a blip * Move `ensure_wasmtime_version` under the tests mod * Add a macro for puppet_workers * fix build for not real-overseer * Rename the puppet worker for adder collator * play it safe with the name of adder puppet worker * Typo: triggered * Add more comments * Do not kill exec worker on every error * Plumb Duration for timeouts * typo: critical * Add proofs * Clean unused imports * Revert "WIP: Diener" This reverts commit b9f54e513366c7a6dfdd117ac19fbdc46b900b4d. * Sync version of wasmtime * Update cargo.lock * Update Substrate * Merge fixes still * Update wasmtime version in test * bastifmt Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Squash spaces * Trailing new line for testing.rs * Remove controversial code * comment about biasing * Fix suggestion * Add comments * make it more clear why unwrap_err * tmpfile retry * proper proofs for claim_idle * Remove mutex from ValidationHost * Add some more logging * Extract exec timeout into a constant * Add some clarifying logging * Use blake2_256 * Clean up the merge Specifically the leftovers after removing real-overseer * Update parachain/test-parachains/adder/collator/Cargo.toml Co-authored-by: Andronik Ordian <write@reusable.software> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Andronik Ordian <write@reusable.software>
This commit is contained in:
@@ -31,6 +31,7 @@ use {
|
||||
polkadot_node_core_av_store::Config as AvailabilityConfig,
|
||||
polkadot_node_core_av_store::Error as AvailabilityError,
|
||||
polkadot_node_core_approval_voting::Config as ApprovalVotingConfig,
|
||||
polkadot_node_core_candidate_validation::Config as CandidateValidationConfig,
|
||||
polkadot_node_core_proposer::ProposerFactory,
|
||||
polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandler},
|
||||
polkadot_primitives::v1::ParachainHost,
|
||||
@@ -60,7 +61,6 @@ use telemetry::{Telemetry, TelemetryWorker, TelemetryWorkerHandle};
|
||||
pub use self::client::{AbstractClient, Client, ClientHandle, ExecuteWithClient, RuntimeApiCollection};
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec};
|
||||
pub use consensus_common::{Proposal, SelectChain, BlockImport, block_validation::Chain};
|
||||
pub use polkadot_parachain::wasm_executor::IsolationStrategy;
|
||||
pub use polkadot_primitives::v1::{Block, BlockId, CollatorPair, Hash, Id as ParaId};
|
||||
pub use sc_client_api::{Backend, ExecutionStrategy, CallExecutor};
|
||||
pub use sc_consensus::LongestChain;
|
||||
@@ -426,7 +426,7 @@ fn real_overseer<Spawner, RuntimeClient>(
|
||||
registry: Option<&Registry>,
|
||||
spawner: Spawner,
|
||||
is_collator: IsCollator,
|
||||
isolation_strategy: IsolationStrategy,
|
||||
candidate_validation_config: CandidateValidationConfig,
|
||||
) -> Result<(Overseer<Spawner, Arc<RuntimeClient>>, OverseerHandler), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block> + AuxStore,
|
||||
@@ -484,10 +484,9 @@ where
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
candidate_validation: CandidateValidationSubsystem::new(
|
||||
spawner.clone(),
|
||||
candidate_validation: CandidateValidationSubsystem::with_config(
|
||||
candidate_validation_config,
|
||||
Metrics::register(registry)?,
|
||||
isolation_strategy,
|
||||
),
|
||||
chain_api: ChainApiSubsystem::new(
|
||||
runtime_client.clone(),
|
||||
@@ -673,8 +672,8 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
is_collator: IsCollator,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
jaeger_agent: Option<std::net::SocketAddr>,
|
||||
isolation_strategy: IsolationStrategy,
|
||||
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
||||
program_path: Option<std::path::PathBuf>,
|
||||
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
|
||||
where
|
||||
RuntimeApi: ConstructRuntimeApi<Block, FullClient<RuntimeApi, Executor>> + Send + Sync + 'static,
|
||||
@@ -785,6 +784,17 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
slot_duration_millis: slot_duration.as_millis() as u64,
|
||||
};
|
||||
|
||||
let candidate_validation_config = CandidateValidationConfig {
|
||||
artifacts_cache_path: config.database
|
||||
.path()
|
||||
.ok_or(Error::DatabasePathRequired)?
|
||||
.join("pvf-artifacts"),
|
||||
program_path: match program_path {
|
||||
None => std::env::current_exe()?,
|
||||
Some(p) => p,
|
||||
},
|
||||
};
|
||||
|
||||
let chain_spec = config.chain_spec.cloned_box();
|
||||
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
|
||||
config,
|
||||
@@ -863,7 +873,7 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
prometheus_registry.as_ref(),
|
||||
spawner,
|
||||
is_collator,
|
||||
isolation_strategy,
|
||||
candidate_validation_config,
|
||||
)?;
|
||||
let overseer_handler_clone = overseer_handler.clone();
|
||||
|
||||
@@ -1216,27 +1226,14 @@ pub fn build_full(
|
||||
jaeger_agent: Option<std::net::SocketAddr>,
|
||||
telemetry_worker_handle: Option<TelemetryWorkerHandle>,
|
||||
) -> Result<NewFull<Client>, Error> {
|
||||
let isolation_strategy = {
|
||||
#[cfg(not(any(target_os = "android", target_os = "unknown")))]
|
||||
{
|
||||
let cache_base_path = config.database.path();
|
||||
IsolationStrategy::external_process_with_caching(cache_base_path)
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "android", target_os = "unknown"))]
|
||||
{
|
||||
IsolationStrategy::InProcess
|
||||
}
|
||||
};
|
||||
|
||||
if config.chain_spec.is_rococo() {
|
||||
new_full::<rococo_runtime::RuntimeApi, RococoExecutor>(
|
||||
config,
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
jaeger_agent,
|
||||
isolation_strategy,
|
||||
telemetry_worker_handle,
|
||||
None,
|
||||
).map(|full| full.with_client(Client::Rococo))
|
||||
} else if config.chain_spec.is_kusama() {
|
||||
new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
|
||||
@@ -1244,8 +1241,8 @@ pub fn build_full(
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
jaeger_agent,
|
||||
isolation_strategy,
|
||||
telemetry_worker_handle,
|
||||
None,
|
||||
).map(|full| full.with_client(Client::Kusama))
|
||||
} else if config.chain_spec.is_westend() {
|
||||
new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
|
||||
@@ -1253,8 +1250,8 @@ pub fn build_full(
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
jaeger_agent,
|
||||
isolation_strategy,
|
||||
telemetry_worker_handle,
|
||||
None,
|
||||
).map(|full| full.with_client(Client::Westend))
|
||||
} else {
|
||||
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
|
||||
@@ -1262,8 +1259,8 @@ pub fn build_full(
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
jaeger_agent,
|
||||
isolation_strategy,
|
||||
telemetry_worker_handle,
|
||||
None,
|
||||
).map(|full| full.with_client(Client::Polkadot))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user