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

Commit 81da250

Browse files
authored
PVF: Move PVF workers into separate crate (#7101)
* Move PVF workers into separate crate * Fix indentation * Fix compilation errors * Fix more compilation errors * Rename `worker.rs` files, make host interface to worker more clear * Fix more compilation errors * Fix more compilation errors * Add link to issue * Address review comments * Update comment
1 parent fc95bc6 commit 81da250

42 files changed

Lines changed: 878 additions & 627 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 56 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ tikv-jemallocator = "0.5.0"
2424

2525
# Crates in our workspace, defined as dependencies so we can pass them feature flags.
2626
polkadot-cli = { path = "cli", features = [ "kusama-native", "westend-native", "rococo-native" ] }
27-
polkadot-node-core-pvf = { path = "node/core/pvf" }
27+
polkadot-node-core-pvf-worker = { path = "node/core/pvf/worker" }
2828
polkadot-overseer = { path = "node/overseer" }
2929

3030
[dev-dependencies]
@@ -80,6 +80,7 @@ members = [
8080
"node/core/parachains-inherent",
8181
"node/core/provisioner",
8282
"node/core/pvf",
83+
"node/core/pvf/worker",
8384
"node/core/pvf-checker",
8485
"node/core/runtime-api",
8586
"node/network/approval-distribution",
@@ -206,7 +207,7 @@ try-runtime = [ "polkadot-cli/try-runtime" ]
206207
fast-runtime = [ "polkadot-cli/fast-runtime" ]
207208
runtime-metrics = [ "polkadot-cli/runtime-metrics" ]
208209
pyroscope = ["polkadot-cli/pyroscope"]
209-
jemalloc-allocator = ["polkadot-node-core-pvf/jemalloc-allocator", "polkadot-overseer/jemalloc-allocator"]
210+
jemalloc-allocator = ["polkadot-node-core-pvf-worker/jemalloc-allocator", "polkadot-overseer/jemalloc-allocator"]
210211

211212
# Configuration for building a .deb package - for use with `cargo-deb`
212213
[package.metadata.deb]

cli/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ pyro = { package = "pyroscope", version = "0.3.1", optional = true }
2222

2323
service = { package = "polkadot-service", path = "../node/service", default-features = false, optional = true }
2424
polkadot-client = { path = "../node/client", optional = true }
25-
polkadot-node-core-pvf = { path = "../node/core/pvf", optional = true }
25+
polkadot-node-core-pvf-worker = { path = "../node/core/pvf/worker", optional = true }
2626
polkadot-performance-test = { path = "../node/test/performance-test", optional = true }
2727

2828
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
2929
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
3030
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
31+
sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" }
3132
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
3233
try-runtime-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
3334
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true }
@@ -52,7 +53,7 @@ cli = [
5253
"frame-benchmarking-cli",
5354
"try-runtime-cli",
5455
"polkadot-client",
55-
"polkadot-node-core-pvf",
56+
"polkadot-node-core-pvf-worker",
5657
]
5758
runtime-benchmarks = [
5859
"service/runtime-benchmarks",

cli/src/command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ pub fn run() -> Result<()> {
494494

495495
#[cfg(not(target_os = "android"))]
496496
{
497-
polkadot_node_core_pvf::prepare_worker_entrypoint(
497+
polkadot_node_core_pvf_worker::prepare_worker_entrypoint(
498498
&cmd.socket_path,
499499
Some(&cmd.node_impl_version),
500500
);
@@ -516,7 +516,7 @@ pub fn run() -> Result<()> {
516516

517517
#[cfg(not(target_os = "android"))]
518518
{
519-
polkadot_node_core_pvf::execute_worker_entrypoint(
519+
polkadot_node_core_pvf_worker::execute_worker_entrypoint(
520520
&cmd.socket_path,
521521
Some(&cmd.node_impl_version),
522522
);

cli/src/host_perf_check.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
1616

1717
use log::info;
18-
use polkadot_node_core_pvf::sp_maybe_compressed_blob;
1918
use polkadot_performance_test::{
2019
measure_erasure_coding, measure_pvf_prepare, PerfCheckError, ERASURE_CODING_N_VALIDATORS,
2120
ERASURE_CODING_TIME_LIMIT, PVF_PREPARE_TIME_LIMIT, VALIDATION_CODE_BOMB_LIMIT,

node/core/pvf/Cargo.toml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,15 @@ version.workspace = true
44
authors.workspace = true
55
edition.workspace = true
66

7-
[[bin]]
8-
name = "puppet_worker"
9-
path = "bin/puppet_worker.rs"
10-
117
[dependencies]
128
always-assert = "0.1"
13-
assert_matches = "1.4.0"
14-
cpu-time = "1.0.0"
159
futures = "0.3.21"
1610
futures-timer = "3.0.2"
1711
gum = { package = "tracing-gum", path = "../../gum" }
1812
libc = "0.2.139"
1913
pin-project = "1.0.9"
2014
rand = "0.8.5"
21-
rayon = "1.5.1"
2215
slotmap = "1.0"
23-
tempfile = "3.3.0"
24-
tikv-jemalloc-ctl = { version = "0.5.0", optional = true }
2516
tokio = { version = "1.24.2", features = ["fs", "process"] }
2617

2718
parity-scale-codec = { version = "3.4.0", default-features = false, features = ["derive"] }
@@ -30,13 +21,8 @@ polkadot-parachain = { path = "../../../parachain" }
3021
polkadot-core-primitives = { path = "../../../core-primitives" }
3122
polkadot-node-metrics = { path = "../../metrics" }
3223
polkadot-node-primitives = { path = "../../primitives" }
33-
3424
polkadot-primitives = { path = "../../../primitives" }
35-
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
36-
sc-executor-wasmtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
37-
sc-executor-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
38-
sp-externalities = { git = "https://github.com/paritytech/substrate", branch = "master" }
39-
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
25+
4026
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
4127
sp-wasm-interface = { git = "https://github.com/paritytech/substrate", branch = "master" }
4228
sp-maybe-compressed-blob = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -45,14 +31,7 @@ sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master
4531
[build-dependencies]
4632
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
4733

48-
[target.'cfg(target_os = "linux")'.dependencies]
49-
tikv-jemalloc-ctl = "0.5.0"
50-
5134
[dev-dependencies]
52-
adder = { package = "test-parachain-adder", path = "../../../parachain/test-parachains/adder" }
53-
halt = { package = "test-parachain-halt", path = "../../../parachain/test-parachains/halt" }
54-
hex-literal = "0.4.1"
35+
assert_matches = "1.4.0"
36+
hex-literal = "0.3.4"
5537
tempfile = "3.3.0"
56-
57-
[features]
58-
jemalloc-allocator = ["dep:tikv-jemalloc-ctl"]

node/core/pvf/src/artifacts.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ use std::{
6565
time::{Duration, SystemTime},
6666
};
6767

68+
/// Contains the bytes for a successfully compiled artifact.
6869
pub struct CompiledArtifact(Vec<u8>);
6970

7071
impl CompiledArtifact {
72+
/// Creates a `CompiledArtifact`.
7173
pub fn new(code: Vec<u8>) -> Self {
7274
Self(code)
7375
}

0 commit comments

Comments
 (0)