mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 21:37:56 +00:00
PVF preparation: do not conflate errors (#6384)
* PVF preparation: do not conflate errors + Adds some more granularity to the prepare errors. + Better distinguish whether errors occur on the host side or the worker. + Do not kill the worker if the error happened on the host side. + Do not retry preparation if the error was `Panic`. + Removes unnecessary indirection with `Selected` type. * Add missing docs, resolve TODOs * Address review comments and remove TODOs * Fix error in CI * Undo unnecessary change * Update couple of comments * Don't return error for stream shutdown * Update node/core/pvf/src/worker_common.rs
This commit is contained in:
@@ -320,12 +320,12 @@ where
|
||||
|
||||
match validation_backend.precheck_pvf(validation_code).await {
|
||||
Ok(_) => PreCheckOutcome::Valid,
|
||||
Err(prepare_err) => match prepare_err {
|
||||
PrepareError::Prevalidation(_) |
|
||||
PrepareError::Preparation(_) |
|
||||
PrepareError::Panic(_) => PreCheckOutcome::Invalid,
|
||||
PrepareError::TimedOut | PrepareError::DidNotMakeIt => PreCheckOutcome::Failed,
|
||||
},
|
||||
Err(prepare_err) =>
|
||||
if prepare_err.is_deterministic() {
|
||||
PreCheckOutcome::Invalid
|
||||
} else {
|
||||
PreCheckOutcome::Failed
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,10 +667,11 @@ impl ValidationBackend for ValidationHost {
|
||||
async fn precheck_pvf(&mut self, pvf: Pvf) -> Result<Duration, PrepareError> {
|
||||
let (tx, rx) = oneshot::channel();
|
||||
if let Err(_) = self.precheck_pvf(pvf, tx).await {
|
||||
return Err(PrepareError::DidNotMakeIt)
|
||||
// Return an IO error if there was an error communicating with the host.
|
||||
return Err(PrepareError::IoErr)
|
||||
}
|
||||
|
||||
let precheck_result = rx.await.or(Err(PrepareError::DidNotMakeIt))?;
|
||||
let precheck_result = rx.await.or(Err(PrepareError::IoErr))?;
|
||||
|
||||
precheck_result
|
||||
}
|
||||
|
||||
@@ -1053,5 +1053,5 @@ fn precheck_properly_classifies_outcomes() {
|
||||
inner(Err(PrepareError::Panic("baz".to_owned())), PreCheckOutcome::Invalid);
|
||||
|
||||
inner(Err(PrepareError::TimedOut), PreCheckOutcome::Failed);
|
||||
inner(Err(PrepareError::DidNotMakeIt), PreCheckOutcome::Failed);
|
||||
inner(Err(PrepareError::IoErr), PreCheckOutcome::Failed);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user