Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update substrate #50

Merged
merged 7 commits into from
Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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,031 changes: 734 additions & 1,297 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ path = "src/main.rs"
required-features = ["canyon-cli/cli"]

[dependencies]
sc-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master" }

canyon-cli = { path = "cli" }

Expand Down
121 changes: 61 additions & 60 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
codec = { package = "parity-scale-codec", version = "2.1" }
futures = { version = "0.3.9", features = ["compat"] }
jsonrpc-pubsub = "15.1.0"
futures = "0.3.16"
jsonrpc-pubsub = "18.0.0"
hex-literal = "0.3.1"
log = "0.4.8"
parking_lot = "0.11.1"
Expand All @@ -28,51 +28,52 @@ serde = { version = "1.0.102", features = ["derive"] }
structopt = { version = "0.3.8", optional = true }

# primitives
sp-authority-discovery = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-authorship = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-consensus = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-consensus-babe = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-core = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-finality-grandpa = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-io = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-keyring = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-keystore = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-runtime = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-timestamp = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
sp-transaction-pool = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sp-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }

# client dependencies
sc-authority-discovery = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-basic-authorship = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-chain-spec = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-client-api = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-client-db = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
sc-consensus = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus-babe = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus-slots = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus-uncles = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-network = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-offchain = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-rpc = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-service = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
sc-sync-state-rpc = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-telemetry = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-transaction-pool = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-tracing = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-client-db = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-uncles = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
sc-sync-state-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
grandpa = { package = "sc-finality-grandpa", git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }

# frame dependencies
pallet-authority-discovery = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-balances = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-contracts = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-grandpa = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-im-online = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
pallet-indices = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-staking = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-timestamp = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
pallet-transaction-payment = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
frame-support = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false }
frame-system = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
pallet-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-contracts = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-im-online = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "master" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "master" }
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false , branch = "master" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "master" }

# canyon-specific dependencies
canyon-executor = { path = "../executor" }
Expand All @@ -87,43 +88,43 @@ pallet-permastore = { path = "../pallets/permastore" }
pallet-poa = { path = "../pallets/poa" }

# CLI-specific dependencies
sc-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
frame-benchmarking-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
try-runtime-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }

[target.'cfg(target_arch="x86_64")'.dependencies]
sc-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true, features = ["wasmtime"] }
sc-service = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false, features = ["wasmtime"] }
sp-trie = { git = "https://github.com/canyon-network/substrate", branch = "canyon", default-features = false, features = ["memory-tracker"] }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "master", optional = true, features = ["wasmtime"] }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["wasmtime"] }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "master", default-features = false, features = ["memory-tracker"] }

canyon-executor = { path = "../executor", features = ["wasmtime"] }

[dev-dependencies]
assert_cmd = "1.0"
async-std = { version = "1.6.5", features = ["attributes"] }
futures = "0.3.9"
futures = "0.3.16"
nix = "0.19"
platforms = "1.1"
regex = "1"
serde_json = "1.0"
soketto = "0.4.2"
tempfile = "3.1.0"

sc-consensus = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus-babe = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus-epochs = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-keystore = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-service-test = { git = "https://github.com/canyon-network/substrate", branch = "canyon" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service-test = { git = "https://github.com/paritytech/substrate", branch = "master" }

[build-dependencies]
structopt = { version = "0.3.8", optional = true }

sc-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }

frame-benchmarking-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
substrate-build-script-utils = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
substrate-frame-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
try-runtime-cli = { git = "https://github.com/canyon-network/substrate", branch = "canyon", optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }
substrate-frame-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }
try-runtime-cli = { git = "https://github.com/paritytech/substrate", optional = true , branch = "master" }

canyon-inspect = { path = "../inspect", optional = true }

Expand Down
8 changes: 4 additions & 4 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use sc_cli::{ChainSpec, Result, Role, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;

use canyon_executor::Executor;
use canyon_executor::ExecutorDispatch;
use canyon_runtime::{Block, RuntimeApi};

use crate::service::new_partial;
Expand Down Expand Up @@ -91,13 +91,13 @@ pub fn run() -> Result<()> {
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;

runner.sync_run(|config| cmd.run::<Block, RuntimeApi, Executor>(config))
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, ExecutorDispatch>(config))
}
Some(Subcommand::Benchmark(cmd)) => {
if cfg!(feature = "runtime-benchmarks") {
let runner = cli.create_runner(cmd)?;

runner.sync_run(|config| cmd.run::<Block, Executor>(config))
runner.sync_run(|config| cmd.run::<Block, ExecutorDispatch>(config))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -185,7 +185,7 @@ pub fn run() -> Result<()> {
sc_service::TaskManager::new(config.task_executor.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;

Ok((cmd.run::<Block, Executor>(config), task_manager))
Ok((cmd.run::<Block, ExecutorDispatch>(config), task_manager))
})
}
}
Expand Down
38 changes: 24 additions & 14 deletions cli/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,24 @@ use futures::prelude::*;

use sc_client_api::{Backend, ExecutorProvider, RemoteBackend};
use sc_consensus_babe::SlotProportion;
use sc_executor::NativeElseWasmExecutor;
use sc_network::{Event, NetworkService};
use sc_service::{config::Configuration, error::Error as ServiceError, RpcHandlers, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sp_runtime::traits::Block as BlockT;

use canyon_executor::Executor;
use canyon_executor::ExecutorDispatch;
use canyon_primitives::Block;
use canyon_runtime::RuntimeApi;

type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullClient =
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
type FullGrandpaBlockImport =
grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>;
type LightClient = sc_service::TLightClient<Block, RuntimeApi, Executor>;
type LightClient =
sc_service::TLightClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;

type FullPoaBlockImport = cc_consensus_poa::PurePoaBlockImport<
Block,
Expand Down Expand Up @@ -86,10 +89,17 @@ pub fn new_partial(
})
.transpose()?;

let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
);

let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let client = Arc::new(client);

Expand Down Expand Up @@ -212,7 +222,7 @@ pub fn new_partial(
use jsonrpc_pubsub::manager::SubscriptionManager;

let task_executor = sc_rpc::SubscriptionTaskExecutor::new(spawn_handle.clone());
let subscriptions = SubscriptionManager::new(Arc::new(task_executor.clone()));
let subscriptions = SubscriptionManager::new(Arc::new(task_executor));
let author = sc_rpc::author::Author::new(
client.clone(),
pool.clone(),
Expand Down Expand Up @@ -496,23 +506,23 @@ pub fn new_light_base(
.clone()
.filter(|x| !x.is_empty())
.map(|endpoints| -> Result<_, sc_telemetry::Error> {
#[cfg(feature = "browser")]
let transport = Some(sc_telemetry::ExtTransport::new(
libp2p_wasm_ext::ffi::websocket_transport(),
));
#[cfg(not(feature = "browser"))]
let transport = None;

let worker = TelemetryWorker::with_transport(16, transport)?;
let worker = TelemetryWorker::new(16)?;
let telemetry = worker.handle().new_telemetry(endpoints);
Ok((worker, telemetry))
})
.transpose()?;

let executor = NativeElseWasmExecutor::<ExecutorDispatch>::new(
config.wasm_method,
config.default_heap_pages,
config.max_runtime_instances,
);

let (client, backend, keystore_container, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(
sc_service::new_light_parts::<Block, RuntimeApi, _>(
&config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;

let mut telemetry = telemetry.map(|(worker, telemetry)| {
Expand Down
Loading