PVF: Instantiate wasm in pre-checking (#7246)

* PVF: Instantiate wasm in pre-checking

* Move `runtime_construction_check` to prepare thread, use bytes

* [minor] Update comment

* Fix compile error

* Update Cargo.lock

* Update docs

* Add some missing docs!
This commit is contained in:
Marcin S
2023-06-02 08:04:04 -04:00
committed by GitHub
parent 2d73e39d2f
commit 5bbb87c46b
16 changed files with 437 additions and 355 deletions
+17 -7
View File
@@ -1215,7 +1215,9 @@ pub(crate) mod tests {
// First, test a simple precheck request.
let (result_tx, result_rx) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(1), result_tx).await.unwrap();
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(1), result_tx)
.await
.unwrap();
// The queue received the prepare request.
assert_matches!(
@@ -1239,7 +1241,9 @@ pub(crate) mod tests {
let mut precheck_receivers = Vec::new();
for _ in 0..3 {
let (result_tx, result_rx) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(2), result_tx).await.unwrap();
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(2), result_tx)
.await
.unwrap();
precheck_receivers.push(result_rx);
}
// Received prepare request.
@@ -1289,7 +1293,9 @@ pub(crate) mod tests {
);
let (result_tx, result_rx) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(1), result_tx).await.unwrap();
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(1), result_tx)
.await
.unwrap();
// Suppose the preparation failed, the execution queue is empty and both
// "clients" receive their results.
@@ -1311,7 +1317,9 @@ pub(crate) mod tests {
let mut precheck_receivers = Vec::new();
for _ in 0..3 {
let (result_tx, result_rx) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(2), result_tx).await.unwrap();
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(2), result_tx)
.await
.unwrap();
precheck_receivers.push(result_rx);
}
@@ -1357,7 +1365,9 @@ pub(crate) mod tests {
// Submit a precheck request that fails.
let (result_tx, result_rx) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(1), result_tx).await.unwrap();
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(1), result_tx)
.await
.unwrap();
// The queue received the prepare request.
assert_matches!(
@@ -1379,7 +1389,7 @@ pub(crate) mod tests {
// Submit another precheck request.
let (result_tx_2, result_rx_2) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(1), result_tx_2)
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(1), result_tx_2)
.await
.unwrap();
@@ -1395,7 +1405,7 @@ pub(crate) mod tests {
// Submit another precheck request.
let (result_tx_3, result_rx_3) = oneshot::channel();
host.precheck_pvf(PvfPrepData::from_discriminator(1), result_tx_3)
host.precheck_pvf(PvfPrepData::from_discriminator_precheck(1), result_tx_3)
.await
.unwrap();
+1 -1
View File
@@ -113,7 +113,7 @@ pub use worker_intf::{framed_recv, framed_send, JOB_TIMEOUT_WALL_CLOCK_FACTOR};
// Re-export some common types.
pub use polkadot_node_core_pvf_common::{
error::{InternalValidationError, PrepareError},
prepare::PrepareStats,
prepare::{PrepareJobKind, PrepareStats},
pvf::PvfPrepData,
};