Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Validation host support for pre-checking #3857

Closed
Tracked by #3211
pepyakin opened this issue Sep 15, 2021 · 0 comments · Fixed by #4123
Closed
Tracked by #3211

Validation host support for pre-checking #3857

pepyakin opened this issue Sep 15, 2021 · 0 comments · Fixed by #4123
Assignees

Comments

@pepyakin
Copy link
Contributor

Add a function into the validation host that will provide a way to pre-check a given wasm binary. (See #3211 for details on what pre-checking is).

The shape of the function would be:

pub async fn precheck_pvf(
    &mut self,
    pvf: Pvf,
    result_tx: oneshot::Sender<PrecheckResult>,
) -> Result<(), ..>

When called the function should return immediately if there is no back-pressure. When pre-checking is finished, the response is sent through result_tx.

PrecheckResult indicates on of the following outcomes:

  1. succeeded - meaning we are pretty sure that compilation of the given PVF finishes producing a compiled artifact within the certain memory and time limits.
  2. failed - we are pretty sure that compilation exceeds the certain memory and time limits.
  3. internal error - this potentially can be returned if there are problems claiming a worker process to do the pre-checking job, or other spurious failures.

The execution happens on the validation host async task. When executed, it will check if the given PVF already compiled. If it is, then it will respond immediately.

The compilation should be performed with turned off parallel compilation. See paritytech/substrate#9605 details.

If the PVF is being compiled right now then we should kill the current process or wait until it finishes on its own. Then the process should be restarted under the required conditions. The actual compilation should not differ from what we currently have, with the exception of custom settings. As an alternative, we may want to compile any PVFs in such a mode that ensures the least variance at all times.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants