Pvf thiserror (#2958)

resolve #2157 

- [x] fix broken doc links
- [x] fix codec macro typo
https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/node/core/pvf/common/src/error.rs#L81
(see the comment below)
- [x] refactor `ValidationError`, `PrepareError` and related error types
to use `thiserror` crate

## `codec` issue

`codec` macro was mistakenly applied two times to `Kernel` error (so it
was encoded with 10 instead of 11 and the same as `JobDied`). The PR
changes it to 11 because

- it was an initial goal of the code author
- Kernel is less frequent than JobDied so in case of existing error
encoding it is more probable to have 10 as JobDied than Kernel

See https://github.com/paritytech/parity-scale-codec/issues/555

----
polkadot address: 13zCyRG2a1W2ih5SioL8byqmQ6mc8vkgFwQgVzJSdRUUmp46

---------

Co-authored-by: s0me0ne-unkn0wn <48632512+s0me0ne-unkn0wn@users.noreply.github.com>
This commit is contained in:
maksimryndin
2024-01-19 15:10:09 +01:00
committed by GitHub
parent 697c2c392e
commit 47a3faa41e
7 changed files with 43 additions and 69 deletions
+2 -2
View File
@@ -45,8 +45,8 @@ pub struct FromQueue {
/// Identifier of an artifact.
pub(crate) artifact_id: ArtifactId,
/// Outcome of the PVF processing. [`Ok`] indicates that compiled artifact
/// is successfully stored on disk. Otherwise, an [error](crate::error::PrepareError)
/// is supplied.
/// is successfully stored on disk. Otherwise, an
/// [error](polkadot_node_core_pvf_common::error::PrepareError) is supplied.
pub(crate) result: PrepareResult,
}
@@ -174,7 +174,7 @@ pub async fn start_work(
gum::warn!(
target: LOG_TARGET,
worker_pid = %pid,
"failed to recv a prepare response: {:?}",
"failed to recv a prepare response: {}",
err,
);
Outcome::IoErr(err.to_string())