Remove tx factory (#5890)

* Remove tx factory files.

* Remove unused imports.

* Revert cargo lock.
This commit is contained in:
Marcio Diaz
2020-05-05 13:54:51 +02:00
committed by GitHub
parent 16af2642ff
commit 4b44c73a4d
10 changed files with 3 additions and 539 deletions
+2 -50
View File
@@ -14,12 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
use crate::{chain_spec, factory_impl::FactoryState, service, Cli, FactoryCmd, Subcommand};
use crate::{chain_spec, service, Cli, Subcommand};
use node_executor::Executor;
use node_runtime::{Block, RuntimeApi};
use node_transaction_factory::RuntimeAdapter;
use sc_cli::{CliConfiguration, ImportParams, Result, SharedParams, SubstrateCli};
use sc_service::Configuration;
use sc_cli::{Result, SubstrateCli};
impl SubstrateCli for Cli {
fn impl_name() -> &'static str {
@@ -94,11 +92,6 @@ pub fn run() -> Result<()> {
Ok(())
}
}
Some(Subcommand::Factory(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(config))
}
Some(Subcommand::Base(subcommand)) => {
let runner = cli.create_runner(subcommand)?;
@@ -106,44 +99,3 @@ pub fn run() -> Result<()> {
}
}
}
impl CliConfiguration for FactoryCmd {
fn shared_params(&self) -> &SharedParams {
&self.shared_params
}
fn import_params(&self) -> Option<&ImportParams> {
Some(&self.import_params)
}
}
impl FactoryCmd {
fn run(&self, config: Configuration) -> Result<()> {
match config.chain_spec.id() {
"dev" | "local" => {}
_ => return Err("Factory is only supported for development and local testnet.".into()),
}
// Setup tracing.
if let Some(tracing_targets) = self.import_params.tracing_targets.as_ref() {
let subscriber = sc_tracing::ProfilingSubscriber::new(
self.import_params.tracing_receiver.into(),
tracing_targets,
);
if let Err(e) = tracing::subscriber::set_global_default(subscriber) {
return Err(format!("Unable to set global default subscriber {}", e).into());
}
}
let factory_state = FactoryState::new(self.blocks, self.transactions);
let service_builder = new_full_start!(config).0;
node_transaction_factory::factory(
factory_state,
service_builder.client(),
service_builder
.select_chain()
.expect("The select_chain is always initialized by new_full_start!; qed"),
)
}
}