Skip to content

Commit

Permalink
Merge branch 'master' into dz/3
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda authored Nov 29, 2023
2 parents f898ef7 + 39d6c95 commit 2638d55
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 259 deletions.
57 changes: 17 additions & 40 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ members = [
"substrate/bin/node-template/runtime",
"substrate/bin/node/bench",
"substrate/bin/node/cli",
"substrate/bin/node/executor",
"substrate/bin/node/inspect",
"substrate/bin/node/primitives",
"substrate/bin/node/rpc",
Expand Down
30 changes: 6 additions & 24 deletions substrate/bin/node-template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,17 @@ use node_template_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::{Backend, BlockBackend};
use sc_consensus_aura::{ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
pub use sc_executor::NativeElseWasmExecutor;
use sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncParams};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};

// Our native executor instance.
pub struct ExecutorDispatch;

impl sc_executor::NativeExecutionDispatch for ExecutorDispatch {
/// Only enable the benchmarking host functions when we actually want to benchmark.
#[cfg(feature = "runtime-benchmarks")]
type ExtendHostFunctions = frame_benchmarking::benchmarking::HostFunctions;
/// Otherwise we only use the default Substrate host functions.
#[cfg(not(feature = "runtime-benchmarks"))]
type ExtendHostFunctions = ();

fn dispatch(method: &str, data: &[u8]) -> Option<Vec<u8>> {
node_template_runtime::api::dispatch(method, data)
}

fn native_version() -> sc_executor::NativeVersion {
node_template_runtime::native_version()
}
}

pub(crate) type FullClient =
sc_service::TFullClient<Block, RuntimeApi, NativeElseWasmExecutor<ExecutorDispatch>>;
pub(crate) type FullClient = sc_service::TFullClient<
Block,
RuntimeApi,
sc_executor::WasmExecutor<sp_io::SubstrateHostFunctions>,
>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;

Expand Down Expand Up @@ -75,7 +57,7 @@ pub fn new_partial(
})
.transpose()?;

let executor = sc_service::new_native_or_wasm_executor(config);
let executor = sc_service::new_wasm_executor::<sp_io::SubstrateHostFunctions>(config);
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, _>(
config,
Expand Down
40 changes: 39 additions & 1 deletion substrate/bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ sc-storage-monitor = { path = "../../../client/storage-monitor" }
sc-offchain = { path = "../../../client/offchain" }

# frame dependencies
frame-benchmarking = { path = "../../../frame/benchmarking" }
frame-system = { path = "../../../frame/system" }
frame-system-rpc-runtime-api = { path = "../../../frame/system/rpc/runtime-api" }
pallet-assets = { path = "../../../frame/assets" }
Expand All @@ -102,7 +103,6 @@ pallet-skip-feeless-payment = { path = "../../../frame/transaction-payment/skip-
kitchensink-runtime = { path = "../runtime" }
node-rpc = { path = "../rpc" }
node-primitives = { path = "../primitives" }
node-executor = { package = "staging-node-executor", path = "../executor" }

# CLI-specific dependencies
sc-cli = { path = "../../../client/cli", optional = true}
Expand Down Expand Up @@ -136,6 +136,26 @@ substrate-rpc-client = { path = "../../../utils/frame/rpc/client" }
pallet-timestamp = { path = "../../../frame/timestamp" }
substrate-cli-test-utils = { path = "../../../test-utils/cli" }

wat = "1.0"
frame-support = { path = "../../../frame/support" }
node-testing = { path = "../testing" }
pallet-balances = { path = "../../../frame/balances" }
pallet-contracts = { path = "../../../frame/contracts" }
pallet-glutton = { path = "../../../frame/glutton" }
pallet-sudo = { path = "../../../frame/sudo" }
pallet-treasury = { path = "../../../frame/treasury" }
pallet-transaction-payment = { path = "../../../frame/transaction-payment" }
sp-application-crypto = { path = "../../../primitives/application-crypto" }
pallet-root-testing = { path = "../../../frame/root-testing" }
sp-consensus-babe = { path = "../../../primitives/consensus/babe" }
sp-externalities = { path = "../../../primitives/externalities" }
sp-keyring = { path = "../../../primitives/keyring" }
sp-runtime = { path = "../../../primitives/runtime" }
serde_json = "1.0.108"
scale-info = { version = "2.10.0", features = ["derive", "serde"] }
sp-trie = { path = "../../../primitives/trie" }
sp-state-machine = { path = "../../../primitives/state-machine" }

[build-dependencies]
clap = { version = "4.4.6", optional = true }
clap_complete = { version = "4.0.2", optional = true }
Expand Down Expand Up @@ -163,30 +183,44 @@ cli = [
]
runtime-benchmarks = [
"frame-benchmarking-cli/runtime-benchmarks",
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"kitchensink-runtime/runtime-benchmarks",
"node-inspect?/runtime-benchmarks",
"pallet-asset-tx-payment/runtime-benchmarks",
"pallet-assets/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-contracts/runtime-benchmarks",
"pallet-glutton/runtime-benchmarks",
"pallet-im-online/runtime-benchmarks",
"pallet-skip-feeless-payment/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-treasury/runtime-benchmarks",
"sc-client-db/runtime-benchmarks",
"sc-service/runtime-benchmarks",
"sp-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 = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"kitchensink-runtime/try-runtime",
"pallet-asset-conversion-tx-payment/try-runtime",
"pallet-asset-tx-payment/try-runtime",
"pallet-assets/try-runtime",
"pallet-balances/try-runtime",
"pallet-contracts/try-runtime",
"pallet-glutton/try-runtime",
"pallet-im-online/try-runtime",
"pallet-root-testing/try-runtime",
"pallet-skip-feeless-payment/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
"pallet-transaction-payment/try-runtime",
"pallet-treasury/try-runtime",
"sp-runtime/try-runtime",
"substrate-cli-test-utils/try-runtime",
"try-runtime-cli/try-runtime",
Expand All @@ -199,3 +233,7 @@ harness = false
[[bench]]
name = "block_production"
harness = false

[[bench]]
name = "executor"
harness = false
Loading

0 comments on commit 2638d55

Please sign in to comment.