Skip to content

Commit

Permalink
Move manual seal node template under a feature flag (paritytech#317)
Browse files Browse the repository at this point in the history
* Move manual seal node template under a feature flag

* Fix feature propogation

* Fix tests

* [WIP] Log GA-generated contract bytecode for debugging

* [WIP] Comment out middle steps for faster debugging

* Switch to dockerized truffle build

* [WIP] Try a different solidity version

* Remove debug GA workflow code

* Remove bytecode match check in tests

* Fix tests due to solc update
  • Loading branch information
sorpaas authored Mar 15, 2021
1 parent 8d54307 commit c1694f4
Show file tree
Hide file tree
Showing 13 changed files with 4,899 additions and 200 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
run: cargo build --verbose --all
- name: Run tests
run: cargo test --verbose --all
- name: Build manual seal client
run: cd template/node && cargo build --verbose --no-default-features --features manual-seal
- name: Use Node.js 10
uses: actions/setup-node@v1
with:
Expand Down
7 changes: 6 additions & 1 deletion template/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "

fc-consensus = { path = "../../client/consensus" }
fp-consensus = { path = "../../primitives/consensus" }
frontier-template-runtime = { path = "../runtime" }
frontier-template-runtime = { path = "../runtime", default-features = false, features = ["std"] }
fc-rpc = { path = "../../client/rpc" }
fp-rpc = { path = "../../primitives/rpc" }
fc-rpc-core = { path = "../../client/rpc-core" }
Expand All @@ -60,3 +60,8 @@ fc-mapping-sync = { path = "../../client/mapping-sync" }

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate.git", branch = "frontier" }

[features]
default = ["aura"]
aura = ["frontier-template-runtime/aura"]
manual-seal = ["frontier-template-runtime/manual-seal"]
16 changes: 13 additions & 3 deletions template/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use structopt::{StructOpt, clap::arg_enum};
use structopt::StructOpt;
#[cfg(feature = "manual-seal")]
use structopt::clap::arg_enum;

#[cfg(feature = "manual-seal")]
arg_enum! {
/// Available Sealing methods.
#[allow(missing_docs)]
#[derive(Debug, Copy, Clone, StructOpt)]
pub enum Sealing {
// Seal using rpc method.
Expand All @@ -12,16 +14,24 @@ arg_enum! {
}
}

#[cfg(feature = "manual-seal")]
impl Default for Sealing {
fn default() -> Sealing {
Sealing::Manual
}
}

#[allow(missing_docs)]
#[derive(Debug, StructOpt)]
pub struct RunCmd {
#[allow(missing_docs)]
#[structopt(flatten)]
pub base: sc_cli::RunCmd,

#[cfg(feature = "manual-seal")]
/// Choose sealing method.
#[structopt(long = "sealing")]
pub sealing: Option<Sealing>,
pub sealing: Sealing,

#[structopt(long = "enable-dev-signer")]
pub enable_dev_signer: bool,
Expand Down
12 changes: 6 additions & 6 deletions template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,31 +58,31 @@ pub fn run() -> sc_cli::Result<()> {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, import_queue, ..}
= new_partial(&config, cli.run.sealing)?;
= new_partial(&config, &cli)?;
Ok((cmd.run(client, import_queue), task_manager))
})
},
Some(Subcommand::ExportBlocks(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, ..}
= new_partial(&config, cli.run.sealing)?;
= new_partial(&config, &cli)?;
Ok((cmd.run(client, config.database), task_manager))
})
},
Some(Subcommand::ExportState(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, ..}
= new_partial(&config, cli.run.sealing)?;
= new_partial(&config, &cli)?;
Ok((cmd.run(client, config.chain_spec), task_manager))
})
},
Some(Subcommand::ImportBlocks(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, import_queue, ..}
= new_partial(&config, cli.run.sealing)?;
= new_partial(&config, &cli)?;
Ok((cmd.run(client, import_queue), task_manager))
})
},
Expand All @@ -94,7 +94,7 @@ pub fn run() -> sc_cli::Result<()> {
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
let PartialComponents { client, task_manager, backend, ..}
= new_partial(&config, cli.run.sealing)?;
= new_partial(&config, &cli)?;
Ok((cmd.run(client, backend), task_manager))
})
},
Expand All @@ -103,7 +103,7 @@ pub fn run() -> sc_cli::Result<()> {
runner.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config, cli.run.sealing, cli.run.enable_dev_signer),
_ => service::new_full(config, &cli),
}.map_err(sc_cli::Error::Service)
})
}
Expand Down
Loading

0 comments on commit c1694f4

Please sign in to comment.