pvf: ensure enough stack space (#5712)

* pvf: ensure enough stack space

* fix typos

Co-authored-by: Andronik <write@reusable.software>

* Use rayon to cache the thread

Co-authored-by: Andronik <write@reusable.software>
This commit is contained in:
Sergei Shulepov
2022-06-24 13:16:36 +02:00
committed by GitHub
parent 63b875aa74
commit 94a85eeac7
7 changed files with 132 additions and 45 deletions
+3 -3
View File
@@ -29,7 +29,7 @@ pub fn validate_candidate(
code: &[u8],
params: &[u8],
) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
use crate::executor_intf::{execute, prepare, prevalidate, TaskExecutor};
use crate::executor_intf::{prepare, prevalidate, Executor};
let code = sp_maybe_compressed_blob::decompress(code, 10 * 1024 * 1024)
.expect("Decompressing code failed");
@@ -40,11 +40,11 @@ pub fn validate_candidate(
let artifact_path = tmpdir.path().join("blob");
std::fs::write(&artifact_path, &artifact)?;
let executor = TaskExecutor::new()?;
let executor = Executor::new()?;
let result = unsafe {
// SAFETY: This is trivially safe since the artifact is obtained by calling `prepare`
// and is written into a temporary directory in an unmodified state.
execute(&artifact_path, params, executor)?
executor.execute(&artifact_path, params)?
};
Ok(result)