Skip to content

Commit

Permalink
Cleanup/updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
firke committed Dec 13, 2021
1 parent 03f5276 commit 084a905
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 428 deletions.
136 changes: 68 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

31 changes: 1 addition & 30 deletions node/opportunity/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,16 @@ name = 'opportunity-standalone'
[package.metadata.docs.rs]
targets = [ 'x86_64-unknown-linux-gnu' ]

[lib]
crate-type = ["cdylib", "rlib"]

[build-dependencies]
substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" }

[features]
default = [ ]
# default = [ "cli", "full-node" ]

# browser = [
# "substrate-browser-utils",
# "wasm-bindgen",
# "wasm-bindgen-futures",
# "libp2p-wasm-ext",
# ]

# cli = [
# "node-inspect",
# "sc-cli",
# "frame-benchmarking-cli",
# "substrate-frame-cli",
# "sc-service/db",
# "structopt",
# "substrate-build-script-utils",
# "try-runtime-cli",
# ]
default = []

runtime-benchmarks = [
"opportunity-runtime/runtime-benchmarks",
]

# Enable features that allow the runtime to be tried and debugged. Name might be subject to change
# in the near future.
# try-runtime = [
# "opportunity-runtime/try-runtime",
# "try-runtime-cli",
# ]

[dependencies]
structopt = { version = "0.3.8" }
codec = { package = "parity-scale-codec", version = "2.0.0" }
Expand Down
18 changes: 7 additions & 11 deletions node/opportunity/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
service,
};
use primitives::Block;
use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;

impl SubstrateCli for Cli {
Expand Down Expand Up @@ -70,16 +70,6 @@ pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args();

match &cli.subcommand {
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
match config.role {
Role::Light => service::new_light(config),
_ => service::new_full(config),
}
.map_err(sc_cli::Error::Service)
})
},
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::Sign(cmd)) => cmd.run(),
Some(Subcommand::Verify(cmd)) => cmd.run(),
Expand Down Expand Up @@ -140,5 +130,11 @@ pub fn run() -> sc_cli::Result<()> {
You can enable it with `--features runtime-benchmarks`."
.into())
},
None => {
let runner = cli.create_runner(&cli.run)?;
runner.run_node_until_exit(|config| async move {
service::new_full(config).map_err(sc_cli::Error::Service)
})
},
}
}
3 changes: 0 additions & 3 deletions node/opportunity/src/lib.rs

This file was deleted.

35 changes: 0 additions & 35 deletions node/opportunity/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ use sp_consensus::SelectChain;
use sp_consensus_babe::BabeApi;
use sp_keystore::SyncCryptoStorePtr;

/// Light client extra dependencies.
pub struct LightDeps<C, F, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Remote access to the blockchain (async).
pub remote_blockchain: Arc<dyn sc_client_api::light::RemoteBlockchain<Block>>,
/// Fetcher instance.
pub fetcher: Arc<F>,
}

/// Extra dependencies for BABE.
pub struct BabeDeps {
/// BABE protocol config.
Expand Down Expand Up @@ -180,26 +168,3 @@ where

Ok(io)
}

/// Instantiate all Light RPC extensions.
pub fn create_light<C, P, M, F>(deps: LightDeps<C, F, P>) -> jsonrpc_core::IoHandler<M>
where
C: sp_blockchain::HeaderBackend<Block>,
C: Send + Sync + 'static,
F: sc_client_api::light::Fetcher<Block> + 'static,
P: TransactionPool + 'static,
M: jsonrpc_core::Metadata + Default,
{
use substrate_frame_rpc_system::{LightSystem, SystemApi};

let LightDeps { client, pool, remote_blockchain, fetcher } = deps;
let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(SystemApi::<Hash, AccountId, Index>::to_delegate(LightSystem::new(
client,
remote_blockchain,
fetcher,
pool,
)));

io
}
Loading

0 comments on commit 084a905

Please sign in to comment.