-
Notifications
You must be signed in to change notification settings - Fork 1.6k
☭ Liberate workers! ☭ #7570
base: master
Are you sure you want to change the base?
☭ Liberate workers! ☭ #7570
Changes from 7 commits
cc8e1fd
3c43f00
25f950c
53d035d
5ae83f3
c9329ca
dcbd057
8d50a4c
3ab5657
96d2a90
63ee515
c172aab
85f0a50
c4d8844
a8c98c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "polkadot-execute-worker" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
|
||
[[bin]] | ||
name = "polkadot-execute-worker" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
polkadot-node-core-pvf-common = { path = "../../node/core/pvf/common" } | ||
polkadot-node-core-pvf-execute-worker = { path = "../../node/core/pvf/execute-worker" } | ||
|
||
[build-dependencies] | ||
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
fn main() { | ||
substrate_build_script_utils::generate_cargo_keys(); | ||
// For the node/worker version check, make sure we always rebuild the node and binary workers | ||
// when the version changes. | ||
substrate_build_script_utils::rerun_if_git_head_changed(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/// Execute worker binary name | ||
pub const BINARY_NAME: &str = "polkadot-execute-worker"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Execute worker. | ||
|
||
#[cfg(test)] | ||
use polkadot_execute_worker::BINARY_NAME; | ||
|
||
polkadot_node_core_pvf_common::decl_worker_main!( | ||
"execute-worker", | ||
polkadot_node_core_pvf_execute_worker::worker_entrypoint, | ||
env!("SUBSTRATE_CLI_IMPL_VERSION") | ||
); | ||
|
||
#[test] | ||
fn name_test() { | ||
// If binary name ever needs to change, it must be changed in the package manifest | ||
// as well as in the constant value | ||
assert_eq!(env!("CARGO_BIN_NAME"), BINARY_NAME); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "polkadot-prepare-worker" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
|
||
[[bin]] | ||
name = "polkadot-prepare-worker" | ||
path = "src/main.rs" | ||
|
||
[dependencies] | ||
polkadot-node-core-pvf-common = { path = "../../node/core/pvf/common" } | ||
polkadot-node-core-pvf-prepare-worker = { path = "../../node/core/pvf/prepare-worker" } | ||
|
||
[build-dependencies] | ||
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "master" } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
fn main() { | ||
substrate_build_script_utils::generate_cargo_keys(); | ||
// For the node/worker version check, make sure we always rebuild the node and binary workers | ||
// when the version changes. | ||
substrate_build_script_utils::rerun_if_git_head_changed(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/// Prepare worker binary name | ||
pub const BINARY_NAME: &str = "polkadot-prepare-worker"; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// This file is part of Polkadot. | ||
|
||
// Polkadot is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Polkadot is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Prepare worker. | ||
|
||
#[cfg(test)] | ||
use polkadot_prepare_worker::BINARY_NAME; | ||
|
||
polkadot_node_core_pvf_common::decl_worker_main!( | ||
"prepare-worker", | ||
polkadot_node_core_pvf_prepare_worker::worker_entrypoint, | ||
env!("SUBSTRATE_CLI_IMPL_VERSION") | ||
); | ||
|
||
#[test] | ||
fn name_test() { | ||
// If binary name ever needs to change, it must be changed in the package manifest | ||
// as well as in the constant value | ||
assert_eq!(env!("CARGO_BIN_NAME"), BINARY_NAME); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ build-malus: | |
- .compiler-info | ||
- .collect-artifacts | ||
script: | ||
- time cargo build --locked --profile testnet --verbose -p polkadot-test-malus | ||
- time cargo build --locked --profile testnet --verbose -p polkadot-test-malus -p polkadot-execute-worker -p polkadot-prepare-worker | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried different approaches and ended up explicitly building workers for This one even works but has some flaws and looks too hacky to end up in the production code. Any better ideas are appreciated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to have a separate workspace for I think this would work if the
Yeah that looks too hacky to me, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Unfortunately, no, nested workspaces are proposed but not supported yet. I went through a lot of interesting proposals while I was researching possible solutions, like intersecting workspaces and binary dependencies, but neither of them is implemented now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah I know the feeling. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've found out that |
||
# pack artifacts | ||
- mkdir -p ./artifacts | ||
- mv ./target/testnet/malus ./artifacts/. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same as
PREPARE_BINARY_NAME
in pvf-host. Can we move it to the pvf/prepare-worker crate, and use that here, for less duplication?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm there is an issue with the PVF host depending on the worker binaries in this way. The worker binaries will be recompiled after every commit which will be annoying when hacking on
pvf
crate. I think we can move the binary names intopvf-common
.