mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 02:01:02 +00:00
PVF timeouts follow-up (#6151)
* Rename timeout consts and timeout parameter; bump leniency * Update implementor's guide with info about PVFs * Make glossary a bit easier to read * Add a note to LENIENT_PREPARATION_TIMEOUT * Remove PVF-specific section from glossary * Fix some typos
This commit is contained in:
@@ -38,15 +38,16 @@ use std::{
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
/// The time period after which the precheck preparation worker is considered unresponsive and will
|
||||
/// be killed.
|
||||
/// For prechecking requests, the time period after which the preparation worker is considered
|
||||
/// unresponsive and will be killed.
|
||||
// NOTE: If you change this make sure to fix the buckets of `pvf_preparation_time` metric.
|
||||
pub const PRECHECK_COMPILATION_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
pub const PRECHECK_PREPARATION_TIMEOUT: Duration = Duration::from_secs(60);
|
||||
|
||||
/// The time period after which the execute preparation worker is considered unresponsive and will
|
||||
/// be killed.
|
||||
/// For execution and heads-up requests, the time period after which the preparation worker is
|
||||
/// considered unresponsive and will be killed. More lenient than the timeout for prechecking to
|
||||
/// prevent honest validators from timing out on valid PVFs.
|
||||
// NOTE: If you change this make sure to fix the buckets of `pvf_preparation_time` metric.
|
||||
pub const EXECUTE_COMPILATION_TIMEOUT: Duration = Duration::from_secs(180);
|
||||
pub const LENIENT_PREPARATION_TIMEOUT: Duration = Duration::from_secs(360);
|
||||
|
||||
/// An alias to not spell the type for the oneshot sender for the PVF execution result.
|
||||
pub(crate) type ResultSender = oneshot::Sender<Result<ValidationResult, ValidationError>>;
|
||||
@@ -429,9 +430,10 @@ async fn handle_to_host(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Handles PVF prechecking.
|
||||
/// Handles PVF prechecking requests.
|
||||
///
|
||||
/// This tries to prepare the PVF by compiling the WASM blob within a given timeout ([`PRECHECK_COMPILATION_TIMEOUT`]).
|
||||
/// This tries to prepare the PVF by compiling the WASM blob within a given timeout
|
||||
/// ([`PRECHECK_PREPARATION_TIMEOUT`]).
|
||||
async fn handle_precheck_pvf(
|
||||
artifacts: &mut Artifacts,
|
||||
prepare_queue: &mut mpsc::Sender<prepare::ToQueue>,
|
||||
@@ -459,7 +461,7 @@ async fn handle_precheck_pvf(
|
||||
prepare::ToQueue::Enqueue {
|
||||
priority: Priority::Normal,
|
||||
pvf,
|
||||
compilation_timeout: PRECHECK_COMPILATION_TIMEOUT,
|
||||
preparation_timeout: PRECHECK_PREPARATION_TIMEOUT,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
@@ -469,9 +471,10 @@ async fn handle_precheck_pvf(
|
||||
|
||||
/// Handles PVF execution.
|
||||
///
|
||||
/// This will first try to prepare the PVF, if a prepared artifact does not already exist. If there is already a
|
||||
/// preparation job, we coalesce the two preparation jobs. When preparing for execution, we use a more lenient timeout
|
||||
/// ([`EXECUTE_COMPILATION_TIMEOUT`]) than when prechecking.
|
||||
/// This will first try to prepare the PVF, if a prepared artifact does not already exist. If there
|
||||
/// is already a preparation job, we coalesce the two preparation jobs. When preparing for
|
||||
/// execution, we use a more lenient timeout ([`LENIENT_PREPARATION_TIMEOUT`]) than when
|
||||
/// prechecking.
|
||||
async fn handle_execute_pvf(
|
||||
cache_path: &Path,
|
||||
artifacts: &mut Artifacts,
|
||||
@@ -518,7 +521,7 @@ async fn handle_execute_pvf(
|
||||
prepare::ToQueue::Enqueue {
|
||||
priority,
|
||||
pvf,
|
||||
compilation_timeout: EXECUTE_COMPILATION_TIMEOUT,
|
||||
preparation_timeout: LENIENT_PREPARATION_TIMEOUT,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
@@ -557,7 +560,7 @@ async fn handle_heads_up(
|
||||
prepare::ToQueue::Enqueue {
|
||||
priority: Priority::Normal,
|
||||
pvf: active_pvf,
|
||||
compilation_timeout: EXECUTE_COMPILATION_TIMEOUT,
|
||||
preparation_timeout: LENIENT_PREPARATION_TIMEOUT,
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user