pvf-precheck: teach runtime-api to work with versions (#4510)

As part of #3211 we will need to add a couple of runtime APIs. That
change is coming in a following PR.

The runtime API for pre-checking will be introduced with a version bump
for `ParachainHost`. This commit prepares the ground for that change,
by introducing a error condition that signals that the given API is not
supported.
This commit is contained in:
Sergei Shulepov
2021-12-14 13:06:58 +01:00
committed by GitHub
parent c328d1e63b
commit 2ccbf38b85
3 changed files with 115 additions and 38 deletions
+12 -1
View File
@@ -240,7 +240,18 @@ fn runtime_api_error_does_not_stop_the_subsystem() {
RuntimeApiRequest::CandidateEvents(tx),
)) => {
assert_eq!(relay_parent, new_leaf);
tx.send(Err(RuntimeApiError::from("oh no".to_string()))).unwrap();
#[derive(Debug)]
struct FauxError;
impl std::error::Error for FauxError {}
impl std::fmt::Display for FauxError {
fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
Ok(())
}
}
tx.send(Err(RuntimeApiError::Execution {
runtime_api_name: "faux",
source: Arc::new(FauxError),
})).unwrap();
}
);