Skip to content

Commit

Permalink
Retire puppet workers (#1449)
Browse files Browse the repository at this point in the history
Closes #583

After the separation of PVF worker binaries, dedicated puppet workers
are not needed for tests anymore. The production workers can be used
instead, avoiding some code duplication and decreasing complexity.

The changes also make it possible to further refactor the code to
isolate workers completely.
  • Loading branch information
s0me0ne-unkn0wn authored Sep 11, 2023
1 parent 4b8bd90 commit 2c8021f
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 376 deletions.
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ members = [
"cumulus/primitives/utility",
"cumulus/test/client",
"cumulus/test/relay-sproof-builder",
"cumulus/test/relay-validation-worker-provider",
"cumulus/test/runtime",
"cumulus/test/service",
"cumulus/xcm/xcm-emulator",
Expand Down
15 changes: 0 additions & 15 deletions cumulus/test/relay-validation-worker-provider/Cargo.toml

This file was deleted.

169 changes: 0 additions & 169 deletions cumulus/test/relay-validation-worker-provider/build.rs

This file was deleted.

27 changes: 0 additions & 27 deletions cumulus/test/relay-validation-worker-provider/src/lib.rs

This file was deleted.

1 change: 0 additions & 1 deletion cumulus/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-primitives-parachain-inherent = { path = "../../primitives/parachain-inherent" }
cumulus-relay-chain-inprocess-interface = { path = "../../client/relay-chain-inprocess-interface" }
cumulus-relay-chain-interface = { path = "../../client/relay-chain-interface" }
cumulus-test-relay-validation-worker-provider = { path = "../relay-validation-worker-provider" }
cumulus-test-runtime = { path = "../runtime" }
cumulus-relay-chain-minimal-node = { path = "../../client/relay-chain-minimal-node" }
cumulus-client-pov-recovery = { path = "../../client/pov-recovery" }
Expand Down
9 changes: 5 additions & 4 deletions cumulus/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -903,8 +903,9 @@ pub fn run_relay_chain_validator_node(
config.rpc_addr = Some(SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), port));
}

polkadot_test_service::run_validator_node(
config,
Some(cumulus_test_relay_validation_worker_provider::VALIDATION_WORKER.into()),
)
let mut workers_path = std::env::current_exe().unwrap();
workers_path.pop();
workers_path.pop();

polkadot_test_service::run_validator_node(config, Some(workers_path))
}
8 changes: 0 additions & 8 deletions polkadot/node/core/pvf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ authors.workspace = true
edition.workspace = true
license.workspace = true

[[bin]]
name = "puppet_worker"
path = "bin/puppet_worker.rs"
required-features = ["test-utils"]

[dependencies]
always-assert = "0.1"
futures = "0.3.21"
Expand All @@ -35,7 +30,6 @@ polkadot-primitives = { path = "../../../primitives" }
sp-core = { path = "../../../../substrate/primitives/core" }
sp-wasm-interface = { path = "../../../../substrate/primitives/wasm-interface" }
sp-maybe-compressed-blob = { path = "../../../../substrate/primitives/maybe-compressed-blob" }
sp-tracing = { path = "../../../../substrate/primitives/tracing", optional = true }
polkadot-node-core-pvf-prepare-worker = { path = "prepare-worker", optional = true }
polkadot-node-core-pvf-execute-worker = { path = "execute-worker", optional = true }

Expand All @@ -56,9 +50,7 @@ halt = { package = "test-parachain-halt", path = "../../../parachain/test-parach
ci-only-tests = []
jemalloc-allocator = [ "polkadot-node-core-pvf-common/jemalloc-allocator" ]
# This feature is used to export test code to other crates without putting it in the production build.
# This is also used by the `puppet_worker` binary.
test-utils = [
"polkadot-node-core-pvf-execute-worker",
"polkadot-node-core-pvf-prepare-worker",
"sp-tracing",
]
4 changes: 4 additions & 0 deletions polkadot/node/core/pvf/common/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ macro_rules! decl_worker_main {
println!("{}", $worker_version);
return
},
"test-sleep" => {
std::thread::sleep(std::time::Duration::from_secs(5));
return
},
subcommand => {
// Must be passed for compatibility with the single-binary test workers.
if subcommand != $expected_command {
Expand Down
10 changes: 0 additions & 10 deletions polkadot/node/core/pvf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ mod worker_intf;
#[cfg(feature = "test-utils")]
pub mod testing;

// Used by `decl_puppet_worker_main!`.
#[cfg(feature = "test-utils")]
pub use sp_tracing;

pub use error::{InvalidCandidate, ValidationError};
pub use host::{start, Config, ValidationHost, EXECUTE_BINARY_NAME, PREPARE_BINARY_NAME};
pub use metrics::Metrics;
Expand All @@ -117,11 +113,5 @@ pub use polkadot_node_core_pvf_common::{
pvf::PvfPrepData,
};

// Re-export worker entrypoints.
#[cfg(feature = "test-utils")]
pub use polkadot_node_core_pvf_execute_worker::worker_entrypoint as execute_worker_entrypoint;
#[cfg(feature = "test-utils")]
pub use polkadot_node_core_pvf_prepare_worker::worker_entrypoint as prepare_worker_entrypoint;

/// The log target for this crate.
pub const LOG_TARGET: &str = "parachain::pvf";
Loading

0 comments on commit 2c8021f

Please sign in to comment.