PVF: Add test instructions (#2058)

This commit is contained in:
Marcin S
2023-11-28 14:23:25 +01:00
committed by GitHub
parent cd8741c8b5
commit dbd8d20b25
18 changed files with 146 additions and 60 deletions
+1 -1
View File
@@ -21,6 +21,6 @@
//! `polkadot_node_core_pvf_worker::execute_worker_entrypoint`.
mod queue;
mod worker_intf;
mod worker_interface;
pub use queue::{start, PendingExecutionRequest, ToQueue};
+4 -4
View File
@@ -16,12 +16,12 @@
//! A queue that handles requests for PVF execution.
use super::worker_intf::Outcome;
use super::worker_interface::Outcome;
use crate::{
artifacts::{ArtifactId, ArtifactPathId},
host::ResultSender,
metrics::Metrics,
worker_intf::{IdleWorker, WorkerHandle},
worker_interface::{IdleWorker, WorkerHandle},
InvalidCandidate, PossiblyInvalidError, ValidationError, LOG_TARGET,
};
use futures::{
@@ -448,7 +448,7 @@ async fn spawn_worker_task(
use futures_timer::Delay;
loop {
match super::worker_intf::spawn(
match super::worker_interface::spawn(
&program_path,
&cache_path,
job.executor_params.clone(),
@@ -500,7 +500,7 @@ fn assign(queue: &mut Queue, worker: Worker, job: ExecuteJob) {
queue.mux.push(
async move {
let _timer = execution_timer;
let outcome = super::worker_intf::start_work(
let outcome = super::worker_interface::start_work(
idle,
job.artifact.clone(),
job.exec_timeout,
@@ -18,7 +18,7 @@
use crate::{
artifacts::ArtifactPathId,
worker_intf::{
worker_interface::{
clear_worker_dir_path, framed_recv, framed_send, spawn_with_program_path, IdleWorker,
SpawnErr, WorkerDir, WorkerHandle, JOB_TIMEOUT_WALL_CLOCK_FACTOR,
},
+2 -2
View File
@@ -98,7 +98,7 @@ mod metrics;
mod prepare;
mod priority;
mod security;
mod worker_intf;
mod worker_interface;
#[cfg(feature = "test-utils")]
pub mod testing;
@@ -107,7 +107,7 @@ pub use error::{InvalidCandidate, PossiblyInvalidError, ValidationError};
pub use host::{start, Config, ValidationHost, EXECUTE_BINARY_NAME, PREPARE_BINARY_NAME};
pub use metrics::Metrics;
pub use priority::Priority;
pub use worker_intf::{framed_recv, framed_send, JOB_TIMEOUT_WALL_CLOCK_FACTOR};
pub use worker_interface::{framed_recv, framed_send, JOB_TIMEOUT_WALL_CLOCK_FACTOR};
// Re-export some common types.
pub use polkadot_node_core_pvf_common::{
+1 -1
View File
@@ -24,7 +24,7 @@
mod pool;
mod queue;
mod worker_intf;
mod worker_interface;
pub use pool::start as start_pool;
pub use queue::{start as start_queue, FromQueue, ToQueue};
+4 -4
View File
@@ -14,10 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use super::worker_intf::{self, Outcome};
use super::worker_interface::{self, Outcome};
use crate::{
metrics::Metrics,
worker_intf::{IdleWorker, WorkerHandle},
worker_interface::{IdleWorker, WorkerHandle},
LOG_TARGET,
};
use always_assert::never;
@@ -278,7 +278,7 @@ async fn spawn_worker_task(
use futures_timer::Delay;
loop {
match worker_intf::spawn(
match worker_interface::spawn(
&program_path,
&cache_path,
spawn_timeout,
@@ -306,7 +306,7 @@ async fn start_work_task<Timer>(
cache_path: PathBuf,
_preparation_timer: Option<Timer>,
) -> PoolEvent {
let outcome = worker_intf::start_work(&metrics, idle, pvf, cache_path).await;
let outcome = worker_interface::start_work(&metrics, idle, pvf, cache_path).await;
PoolEvent::StartWork(worker, outcome)
}
@@ -19,7 +19,7 @@
use crate::{
artifacts::ArtifactId,
metrics::Metrics,
worker_intf::{
worker_interface::{
clear_worker_dir_path, framed_recv, framed_send, spawn_with_program_path, IdleWorker,
SpawnErr, WorkerDir, WorkerHandle, JOB_TIMEOUT_WALL_CLOCK_FACTOR,
},
+2 -2
View File
@@ -18,7 +18,7 @@
pub use crate::{
host::{EXECUTE_BINARY_NAME, PREPARE_BINARY_NAME},
worker_intf::{spawn_with_program_path, SpawnErr},
worker_interface::{spawn_with_program_path, SpawnErr},
};
use crate::get_worker_version;
@@ -36,7 +36,7 @@ pub fn validate_candidate(
code: &[u8],
params: &[u8],
) -> Result<Vec<u8>, Box<dyn std::error::Error>> {
use polkadot_node_core_pvf_common::executor_intf::{prepare, prevalidate};
use polkadot_node_core_pvf_common::executor_interface::{prepare, prevalidate};
use polkadot_node_core_pvf_execute_worker::execute_artifact;
let code = sp_maybe_compressed_blob::decompress(code, 10 * 1024 * 1024)