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

Make debug builds more usable #4683

Merged
merged 4 commits into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/node-template/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use wasm_builder_runner::{build_current_project_with_rustflags, WasmBuilderSourc
fn main() {
build_current_project_with_rustflags(
"wasm_binary.rs",
WasmBuilderSource::Crates("1.0.8"),
WasmBuilderSource::Crates("1.0.9"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also need to bump this on other substrate node template based projects?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you want to always have release" builds, yes.

// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
"-Clink-arg=--export=__heap_base",
Expand Down
7 changes: 6 additions & 1 deletion bin/node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ pub fn run<I, T, E>(args: I, exit: E, version: sc_cli::VersionInfo) -> error::Re
&version,
None,
)?;
sc_cli::fill_import_params(&mut config, &cli_args.import_params, ServiceRoles::FULL)?;
sc_cli::fill_import_params(
&mut config,
&cli_args.import_params,
ServiceRoles::FULL,
cli_args.shared_params.dev,
)?;

match ChainSpec::from(config.chain_spec.id()) {
Some(ref c) if c == &ChainSpec::Development || c == &ChainSpec::LocalTestnet => {},
Expand Down
2 changes: 1 addition & 1 deletion bin/node/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../../utils/wasm-builder",
version: "1.0.8",
version: "1.0.9",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down
25 changes: 21 additions & 4 deletions client/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,12 @@ impl<'a> ParseAndPrepareImport<'a> {
self.version,
None,
)?;
fill_import_params(&mut config, &self.params.import_params, sc_service::Roles::FULL)?;
fill_import_params(
&mut config,
&self.params.import_params,
sc_service::Roles::FULL,
self.params.shared_params.dev,
)?;

let file: Box<dyn ReadPlusSeek + Send> = match self.params.input {
Some(filename) => Box::new(File::open(filename)?),
Expand Down Expand Up @@ -620,7 +625,12 @@ impl<'a> CheckBlock<'a> {
self.version,
None,
)?;
fill_import_params(&mut config, &self.params.import_params, sc_service::Roles::FULL)?;
fill_import_params(
&mut config,
&self.params.import_params,
sc_service::Roles::FULL,
self.params.shared_params.dev,
)?;
fill_config_keystore_in_memory(&mut config)?;

let input = if self.params.input.starts_with("0x") { &self.params.input[2..] } else { &self.params.input[..] };
Expand Down Expand Up @@ -904,6 +914,7 @@ pub fn fill_import_params<C, G, E>(
config: &mut Configuration<C, G, E>,
cli: &ImportParams,
role: sc_service::Roles,
is_dev: bool,
) -> error::Result<()>
where
C: Default,
Expand Down Expand Up @@ -942,8 +953,14 @@ pub fn fill_import_params<C, G, E>(

config.wasm_method = cli.wasm_method.into();

let execution = if is_dev {
cli.execution_strategies.execution.or(Some(ExecutionStrategy::Native))
} else {
cli.execution_strategies.execution
};

let exec = &cli.execution_strategies;
let exec_all_or = |strat: ExecutionStrategy| exec.execution.unwrap_or(strat).into();
let exec_all_or = |strat: ExecutionStrategy| execution.unwrap_or(strat).into();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will default to execution even if strat is ovewritten in CLI, I thought you wanted to use strat and only default to execution, no?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we need to test whether exec was explicitly set or if it's a default as part of is_dev being true.

config.execution_strategies = ExecutionStrategies {
syncing: exec_all_or(exec.execution_syncing),
importing: exec_all_or(exec.execution_import_block),
Expand Down Expand Up @@ -987,7 +1004,7 @@ where
sc_service::Roles::FULL
};

fill_import_params(&mut config, &cli.import_params, role)?;
fill_import_params(&mut config, &cli.import_params, role, is_dev)?;

config.impl_name = impl_name;
config.impl_commit = version.commit;
Expand Down
2 changes: 1 addition & 1 deletion client/executor/runtime-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../../utils/wasm-builder",
version: "1.0.8",
version: "1.0.9",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down
2 changes: 1 addition & 1 deletion primitives/runtime-interface/test-wasm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../../utils/wasm-builder",
version: "1.0.6",
version: "1.0.9",
},
// This instructs LLD to export __heap_base as a global variable, which is used by the
// external memory allocator.
Expand Down
2 changes: 1 addition & 1 deletion test-utils/runtime/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn main() {
"wasm_binary.rs",
WasmBuilderSource::CratesOrPath {
path: "../../utils/wasm-builder",
version: "1.0.8",
version: "1.0.9",
},
// Note that we set the stack-size to 1MB explicitly even though it is set
// to this value by default. This is because some of our tests (`restoration_of_globals`)
Expand Down
2 changes: 1 addition & 1 deletion utils/wasm-builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "substrate-wasm-builder"
version = "1.0.8"
version = "1.0.9"
authors = ["Parity Technologies <admin@parity.io>"]
description = "Utility for building WASM binaries"
edition = "2018"
Expand Down
2 changes: 1 addition & 1 deletion utils/wasm-builder/src/wasm_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ fn is_release_build() -> bool {
),
}
} else {
!build_helper::debug()
true
}
}

Expand Down