mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 15:01:06 +00:00
PVF: Add Secure Validator Mode (#2486)
Co-authored-by: Javier Viola <javier@parity.io>
This commit is contained in:
@@ -16,9 +16,7 @@
|
||||
|
||||
//! Contains the logic for executing PVFs. Used by the polkadot-execute-worker binary.
|
||||
|
||||
pub use polkadot_node_core_pvf_common::{
|
||||
executor_interface::execute_artifact, worker_dir, SecurityStatus,
|
||||
};
|
||||
pub use polkadot_node_core_pvf_common::{executor_interface::execute_artifact, worker_dir};
|
||||
|
||||
// NOTE: Initializing logging in e.g. tests will not have an effect in the workers, as they are
|
||||
// separate spawned processes. Run with e.g. `RUST_LOG=parachain::pvf-execute-worker=trace`.
|
||||
@@ -92,12 +90,13 @@ use std::{
|
||||
/// The stack size for the execute thread.
|
||||
pub const EXECUTE_THREAD_STACK_SIZE: usize = 2 * 1024 * 1024 + DEFAULT_NATIVE_STACK_MAX as usize;
|
||||
|
||||
fn recv_handshake(stream: &mut UnixStream) -> io::Result<Handshake> {
|
||||
/// Receives a handshake with information specific to the execute worker.
|
||||
fn recv_execute_handshake(stream: &mut UnixStream) -> io::Result<Handshake> {
|
||||
let handshake_enc = framed_recv_blocking(stream)?;
|
||||
let handshake = Handshake::decode(&mut &handshake_enc[..]).map_err(|_| {
|
||||
io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"execute pvf recv_handshake: failed to decode Handshake".to_owned(),
|
||||
"execute pvf recv_execute_handshake: failed to decode Handshake".to_owned(),
|
||||
)
|
||||
})?;
|
||||
Ok(handshake)
|
||||
@@ -139,7 +138,6 @@ pub fn worker_entrypoint(
|
||||
worker_dir_path: PathBuf,
|
||||
node_version: Option<&str>,
|
||||
worker_version: Option<&str>,
|
||||
security_status: SecurityStatus,
|
||||
) {
|
||||
run_worker(
|
||||
WorkerKind::Execute,
|
||||
@@ -147,12 +145,11 @@ pub fn worker_entrypoint(
|
||||
worker_dir_path,
|
||||
node_version,
|
||||
worker_version,
|
||||
&security_status,
|
||||
|mut stream, worker_dir_path| {
|
||||
let worker_pid = process::id();
|
||||
let artifact_path = worker_dir::execute_artifact(&worker_dir_path);
|
||||
|
||||
let Handshake { executor_params } = recv_handshake(&mut stream)?;
|
||||
let Handshake { executor_params } = recv_execute_handshake(&mut stream)?;
|
||||
|
||||
loop {
|
||||
let (params, execution_timeout) = recv_request(&mut stream)?;
|
||||
|
||||
Reference in New Issue
Block a user