Upgrade to v2.0.0-rc6 (#75)

main
Dan Forbes 2020-08-21 04:20:35 -07:00 committed by GitHub
parent 8682ee4edf
commit c9fda53e31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1381 additions and 780 deletions

1445
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -72,7 +72,8 @@ Substrate-based blockchain nodes expose a number of capabilities:
- Consensus: Blockchains must have a way to come to - Consensus: Blockchains must have a way to come to
[consensus](https://substrate.dev/docs/en/knowledgebase/advanced/consensus) on the state of the [consensus](https://substrate.dev/docs/en/knowledgebase/advanced/consensus) on the state of the
network. Substrate makes it possible to supply custom consensus engines and also ships with network. Substrate makes it possible to supply custom consensus engines and also ships with
several consensus mechanisms that have been built on top of Web3 Foundation research. several consensus mechanisms that have been built on top of
[Web3 Foundation research](https://research.web3.foundation/en/latest/polkadot/NPoS/index.html).
- RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes. - RPC Server: A remote procedure call (RPC) server is used to interact with Substrate nodes.
There are several files in the `node` directory - take special note of the following: There are several files in the `node` directory - take special note of the following:
@ -104,12 +105,17 @@ capabilities and configuration parameters that it exposes:
### Runtime ### Runtime
The Substrate project in this repository uses the In Substrate, the terms
[FRAME](https://substrate.dev/docs/en/knowledgebase/runtime/frame) framework to construct a "[runtime](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary#runtime)" and
"[state transition function](https://substrate.dev/docs/en/knowledgebase/getting-started/glossary#stf-state-transition-function)"
are analogous - they refer to the core logic of the blockchain that is responsible for validating
blocks and executing the state changes they define. The Substrate project in this repository uses
the [FRAME](https://substrate.dev/docs/en/knowledgebase/runtime/frame) framework to construct a
blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules blockchain runtime. FRAME allows runtime developers to declare domain-specific logic in modules
called "pallets". At the heart of FRAME is a helpful called "pallets". At the heart of FRAME is a helpful
[macro language](https://substrate.dev/docs/en/knowledgebase/runtime/macros) that makes it easy to [macro language](https://substrate.dev/docs/en/knowledgebase/runtime/macros) that makes it easy to
create pallets and flexibly compose them to create blockchains that can address a variety of needs. create pallets and flexibly compose them to create blockchains that can address
[a variety of needs](https://www.substrate.io/substrate-users/).
Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note Review the [FRAME runtime implementation](./runtime/src/lib.rs) included in this template and note
the following: the following:

View File

@ -7,7 +7,7 @@ homepage = 'https://substrate.dev'
license = 'Unlicense' license = 'Unlicense'
name = 'node-template' name = 'node-template'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/' repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']
@ -17,95 +17,131 @@ name = 'node-template'
[dependencies.node-template-runtime] [dependencies.node-template-runtime]
path = '../runtime' path = '../runtime'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.pallet-transaction-payment-rpc]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.sc-basic-authorship] [dependencies.sc-basic-authorship]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-cli] [dependencies.sc-cli]
features = ['wasmtime'] features = ['wasmtime']
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-client-api] [dependencies.sc-client-api]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sc-consensus] [dependencies.sc-consensus]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-consensus-aura] [dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-executor] [dependencies.sc-executor]
features = ['wasmtime'] features = ['wasmtime']
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-finality-grandpa] [dependencies.sc-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-rpc]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.sc-rpc-api]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '0.8.0-rc6'
[dependencies.sc-service] [dependencies.sc-service]
features = ['wasmtime'] features = ['wasmtime']
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sc-transaction-pool] [dependencies.sc-transaction-pool]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-api]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.sp-block-builder]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.sp-blockchain]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.sp-consensus] [dependencies.sp-consensus]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sp-consensus-aura] [dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sp-core] [dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-finality-grandpa] [dependencies.sp-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-inherents] [dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-runtime] [dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-transaction-pool] [dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.structopt] [dependencies.substrate-frame-rpc-system]
version = '0.3.8' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies]
jsonrpc-core = '14.0.3'
structopt = '0.3.8'
[build-dependencies.substrate-build-script-utils] [build-dependencies.substrate-build-script-utils]
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'

View File

@ -134,22 +134,22 @@ fn testnet_genesis(
_enable_println: bool, _enable_println: bool,
) -> GenesisConfig { ) -> GenesisConfig {
GenesisConfig { GenesisConfig {
system: Some(SystemConfig { frame_system: Some(SystemConfig {
// Add Wasm runtime to storage. // Add Wasm runtime to storage.
code: wasm_binary.to_vec(), code: wasm_binary.to_vec(),
changes_trie_config: Default::default(), changes_trie_config: Default::default(),
}), }),
balances: Some(BalancesConfig { pallet_balances: Some(BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60. // Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(), balances: endowed_accounts.iter().cloned().map(|k|(k, 1 << 60)).collect(),
}), }),
aura: Some(AuraConfig { pallet_aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(), authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}), }),
grandpa: Some(GrandpaConfig { pallet_grandpa: Some(GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(), authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
}), }),
sudo: Some(SudoConfig { pallet_sudo: Some(SudoConfig {
// Assign network admin rights. // Assign network admin rights.
key: root_key, key: root_key,
}), }),

View File

@ -19,8 +19,8 @@ use crate::chain_spec;
use crate::cli::Cli; use crate::cli::Cli;
use crate::service; use crate::service;
use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec}; use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec};
use sc_service::ServiceParams; use sc_service::PartialComponents;
use crate::service::new_full_params; use crate::service::new_partial;
impl SubstrateCli for Cli { impl SubstrateCli for Cli {
fn impl_name() -> String { fn impl_name() -> String {
@ -66,12 +66,12 @@ impl SubstrateCli for Cli {
pub fn run() -> sc_cli::Result<()> { pub fn run() -> sc_cli::Result<()> {
let cli = Cli::from_args(); let cli = Cli::from_args();
match &cli.subcommand { match cli.subcommand {
Some(subcommand) => { Some(ref subcommand) => {
let runner = cli.create_runner(subcommand)?; let runner = cli.create_runner(subcommand)?;
runner.run_subcommand(subcommand, |config| { runner.run_subcommand(subcommand, |config| {
let (ServiceParams { client, backend, task_manager, import_queue, .. }, ..) let PartialComponents { client, backend, task_manager, import_queue, .. }
= new_full_params(config)?; = new_partial(&config)?;
Ok((client, backend, import_queue, task_manager)) Ok((client, backend, import_queue, task_manager))
}) })
} }

View File

@ -1,2 +1,3 @@
pub mod chain_spec; pub mod chain_spec;
pub mod service; pub mod service;
pub mod rpc;

View File

@ -6,6 +6,7 @@ mod chain_spec;
mod service; mod service;
mod cli; mod cli;
mod command; mod command;
mod rpc;
fn main() -> sc_cli::Result<()> { fn main() -> sc_cli::Result<()> {
command::run() command::run()

64
node/src/rpc.rs 100644
View File

@ -0,0 +1,64 @@
//! A collection of node-specific RPC methods.
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
//! used by Substrate nodes. This file extends those RPC definitions with
//! capabilities that are specific to this project's runtime configuration.
#![warn(missing_docs)]
use std::sync::Arc;
use node_template_runtime::{opaque::Block, AccountId, Balance, Index};
use sp_api::ProvideRuntimeApi;
use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend};
use sp_block_builder::BlockBuilder;
pub use sc_rpc_api::DenyUnsafe;
use sp_transaction_pool::TransactionPool;
/// Full client dependencies.
pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
}
/// Instantiate all full RPC extensions.
pub fn create_full<C, P>(
deps: FullDeps<C, P>,
) -> jsonrpc_core::IoHandler<sc_rpc::Metadata> where
C: ProvideRuntimeApi<Block>,
C: HeaderBackend<Block> + HeaderMetadata<Block, Error=BlockChainError> + 'static,
C: Send + Sync + 'static,
C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,
C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,
C::Api: BlockBuilder<Block>,
P: TransactionPool + 'static,
{
use substrate_frame_rpc_system::{FullSystem, SystemApi};
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApi};
let mut io = jsonrpc_core::IoHandler::default();
let FullDeps {
client,
pool,
deny_unsafe,
} = deps;
io.extend_with(
SystemApi::to_delegate(FullSystem::new(client.clone(), pool, deny_unsafe))
);
io.extend_with(
TransactionPaymentApi::to_delegate(TransactionPayment::new(client.clone()))
);
// Extend this RPC with a custom API by using the following syntax.
// `YourRpcStruct` should have a reference to a client, which is needed
// to call into the runtime.
// `io.extend_with(YourRpcTrait::to_delegate(YourRpcStruct::new(ReferenceToClient, ...)));`
io
}

View File

@ -4,14 +4,12 @@ use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
use sc_client_api::{ExecutorProvider, RemoteBackend}; use sc_client_api::{ExecutorProvider, RemoteBackend};
use node_template_runtime::{self, opaque::Block, RuntimeApi}; use node_template_runtime::{self, opaque::Block, RuntimeApi};
use sc_service::{error::Error as ServiceError, Configuration, ServiceComponents, TaskManager}; use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sp_inherents::InherentDataProviders; use sp_inherents::InherentDataProviders;
use sc_executor::native_executor_instance; use sc_executor::native_executor_instance;
pub use sc_executor::NativeExecutor; pub use sc_executor::NativeExecutor;
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair}; use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
use sc_finality_grandpa::{ use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState};
FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, SharedVoterState,
};
// Our native executor instance. // Our native executor instance.
native_executor_instance!( native_executor_instance!(
@ -24,18 +22,15 @@ type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullBackend = sc_service::TFullBackend<Block>; type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>; type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
pub fn new_full_params(config: Configuration) -> Result<( pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponents<
sc_service::ServiceParams< FullClient, FullBackend, FullSelectChain,
Block, FullClient, sp_consensus::DefaultImportQueue<Block, FullClient>,
sc_consensus_aura::AuraImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>, sc_transaction_pool::FullPool<Block, FullClient>,
(), FullBackend, (
>,
FullSelectChain,
sp_inherents::InherentDataProviders,
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>, sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain> sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>
), ServiceError> { )
>, ServiceError> {
let inherent_data_providers = sp_inherents::InherentDataProviders::new(); let inherent_data_providers = sp_inherents::InherentDataProviders::new();
let (client, backend, keystore, task_manager) = let (client, backend, keystore, task_manager) =
@ -44,12 +39,8 @@ pub fn new_full_params(config: Configuration) -> Result<(
let select_chain = sc_consensus::LongestChain::new(backend.clone()); let select_chain = sc_consensus::LongestChain::new(backend.clone());
let pool_api = sc_transaction_pool::FullChainApi::new(
client.clone(), config.prometheus_registry(),
);
let transaction_pool = sc_transaction_pool::BasicPool::new_full( let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(), config.transaction_pool.clone(),
std::sync::Arc::new(pool_api),
config.prometheus_registry(), config.prometheus_registry(),
task_manager.spawn_handle(), task_manager.spawn_handle(),
client.clone(), client.clone(),
@ -63,7 +54,7 @@ pub fn new_full_params(config: Configuration) -> Result<(
grandpa_block_import.clone(), client.clone(), grandpa_block_import.clone(), client.clone(),
); );
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
sc_consensus_aura::slot_duration(&*client)?, sc_consensus_aura::slot_duration(&*client)?,
aura_block_import, aura_block_import,
Some(Box::new(grandpa_block_import.clone())), Some(Box::new(grandpa_block_import.clone())),
@ -72,58 +63,80 @@ pub fn new_full_params(config: Configuration) -> Result<(
inherent_data_providers.clone(), inherent_data_providers.clone(),
&task_manager.spawn_handle(), &task_manager.spawn_handle(),
config.prometheus_registry(), config.prometheus_registry(),
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
)?; )?;
let provider = client.clone() as Arc<dyn StorageAndProofProvider<_, _>>; Ok(sc_service::PartialComponents {
let finality_proof_provider = client, backend, task_manager, import_queue, keystore, select_chain, transaction_pool,
Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), provider)); inherent_data_providers,
other: (grandpa_block_import, grandpa_link),
let params = sc_service::ServiceParams { })
backend, client, import_queue, keystore, task_manager, transaction_pool,
config,
block_announce_validator_builder: None,
finality_proof_request_builder: None,
finality_proof_provider: Some(finality_proof_provider),
on_demand: None,
remote_blockchain: None,
rpc_extensions_builder: Box::new(|_| ()),
};
Ok((
params, select_chain, inherent_data_providers,
grandpa_block_import, grandpa_link,
))
} }
/// Builds a new service for a full client. /// Builds a new service for a full client.
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> { pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
let ( let sc_service::PartialComponents {
params, select_chain, inherent_data_providers, client, backend, mut task_manager, import_queue, keystore, select_chain, transaction_pool,
block_import, grandpa_link, inherent_data_providers,
) = new_full_params(config)?; other: (block_import, grandpa_link),
} = new_partial(&config)?;
let ( let finality_proof_provider =
role, force_authoring, name, enable_grandpa, prometheus_registry, GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
client, transaction_pool, keystore,
) = {
let sc_service::ServiceParams {
config, client, transaction_pool, keystore, ..
} = &params;
( let (network, network_status_sinks, system_rpc_tx, network_starter) =
config.role.clone(), sc_service::build_network(sc_service::BuildNetworkParams {
config.force_authoring, config: &config,
config.network.node_name.clone(), client: client.clone(),
!config.disable_grandpa, transaction_pool: transaction_pool.clone(),
config.prometheus_registry().cloned(), spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: None,
block_announce_validator_builder: None,
finality_proof_request_builder: None,
finality_proof_provider: Some(finality_proof_provider.clone()),
})?;
client.clone(), transaction_pool.clone(), keystore.clone(), if config.offchain_worker.enabled {
) sc_service::build_offchain_workers(
&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
);
}
let role = config.role.clone();
let force_authoring = config.force_authoring;
let name = config.network.node_name.clone();
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
let rpc_extensions_builder = {
let client = client.clone();
let pool = transaction_pool.clone();
Box::new(move |deny_unsafe, _| {
let deps = crate::rpc::FullDeps {
client: client.clone(),
pool: pool.clone(),
deny_unsafe,
}; };
let ServiceComponents { crate::rpc::create_full(deps)
task_manager, network, telemetry_on_connect_sinks, .. })
} = sc_service::build(params)?; };
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: network.clone(),
client: client.clone(),
keystore: keystore.clone(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
rpc_extensions_builder: rpc_extensions_builder,
on_demand: None,
remote_blockchain: None,
backend, network_status_sinks, system_rpc_tx, config,
})?;
if role.is_authority() { if role.is_authority() {
let proposer = sc_basic_authorship::ProposerFactory::new( let proposer = sc_basic_authorship::ProposerFactory::new(
@ -183,7 +196,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
link: grandpa_link, link: grandpa_link,
network, network,
inherent_data_providers, inherent_data_providers,
telemetry_on_connect: Some(telemetry_on_connect_sinks.on_connect_stream()), telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(), voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry, prometheus_registry,
shared_voter_state: SharedVoterState::empty(), shared_voter_state: SharedVoterState::empty(),
@ -203,23 +216,22 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
)?; )?;
} }
network_starter.start_network();
Ok(task_manager) Ok(task_manager)
} }
/// Builds a new service for a light client. /// Builds a new service for a light client.
pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> { pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
let (client, backend, keystore, task_manager, on_demand) = let (client, backend, keystore, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?; sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
let transaction_pool_api = Arc::new(sc_transaction_pool::LightChainApi::new( let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
client.clone(), on_demand.clone(),
));
let transaction_pool = sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(), config.transaction_pool.clone(),
transaction_pool_api,
config.prometheus_registry(), config.prometheus_registry(),
task_manager.spawn_handle(), task_manager.spawn_handle(),
); client.clone(),
on_demand.clone(),
));
let grandpa_block_import = sc_finality_grandpa::light_block_import( let grandpa_block_import = sc_finality_grandpa::light_block_import(
client.clone(), backend.clone(), &(client.clone() as Arc<_>), client.clone(), backend.clone(), &(client.clone() as Arc<_>),
@ -229,7 +241,7 @@ pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
let finality_proof_request_builder = let finality_proof_request_builder =
finality_proof_import.create_finality_proof_request_builder(); finality_proof_import.create_finality_proof_request_builder();
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>( let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
sc_consensus_aura::slot_duration(&*client)?, sc_consensus_aura::slot_duration(&*client)?,
grandpa_block_import, grandpa_block_import,
None, None,
@ -238,19 +250,48 @@ pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
InherentDataProviders::new(), InherentDataProviders::new(),
&task_manager.spawn_handle(), &task_manager.spawn_handle(),
config.prometheus_registry(), config.prometheus_registry(),
sp_consensus::NeverCanAuthor,
)?; )?;
let finality_proof_provider = let finality_proof_provider =
Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), client.clone() as Arc<_>)); GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
sc_service::build(sc_service::ServiceParams { let (network, network_status_sinks, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: Some(on_demand.clone()),
block_announce_validator_builder: None, block_announce_validator_builder: None,
finality_proof_request_builder: Some(finality_proof_request_builder), finality_proof_request_builder: Some(finality_proof_request_builder),
finality_proof_provider: Some(finality_proof_provider), finality_proof_provider: Some(finality_proof_provider),
on_demand: Some(on_demand), })?;
remote_blockchain: Some(backend.remote_blockchain()),
rpc_extensions_builder: Box::new(|_| ()), if config.offchain_worker.enabled {
transaction_pool: Arc::new(transaction_pool), sc_service::build_offchain_workers(
config, client, import_queue, keystore, backend, task_manager &config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
}).map(|ServiceComponents { task_manager, .. }| task_manager) );
}
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
remote_blockchain: Some(backend.remote_blockchain()),
transaction_pool,
task_manager: &mut task_manager,
on_demand: Some(on_demand),
rpc_extensions_builder: Box::new(|_, _| ()),
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
config,
client,
keystore,
backend,
network,
network_status_sinks,
system_rpc_tx,
})?;
network_starter.start_network();
Ok(task_manager)
} }

View File

@ -6,7 +6,7 @@ homepage = 'https://substrate.dev'
license = 'Unlicense' license = 'Unlicense'
name = 'pallet-template' name = 'pallet-template'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/' repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']
@ -15,37 +15,37 @@ targets = ['x86_64-unknown-linux-gnu']
default-features = false default-features = false
features = ['derive'] features = ['derive']
package = 'parity-scale-codec' package = 'parity-scale-codec'
version = '1.3.1' version = '1.3.4'
[dependencies.frame-support] [dependencies.frame-support]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.frame-system] [dependencies.frame-system]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dev-dependencies.sp-core] [dev-dependencies.sp-core]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dev-dependencies.sp-io] [dev-dependencies.sp-io]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dev-dependencies.sp-runtime] [dev-dependencies.sp-runtime]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[features] [features]
default = ['std'] default = ['std']

View File

@ -5,56 +5,88 @@ homepage = 'https://substrate.dev'
license = 'Unlicense' license = 'Unlicense'
name = 'node-template-runtime' name = 'node-template-runtime'
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/' repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu'] targets = ['x86_64-unknown-linux-gnu']
[dependencies.aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-aura'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[dependencies.balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-balances'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[dependencies.codec] [dependencies.codec]
default-features = false default-features = false
features = ['derive'] features = ['derive']
package = 'parity-scale-codec' package = 'parity-scale-codec'
version = '1.3.1' version = '1.3.4'
[dependencies.frame-executive] [dependencies.frame-executive]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.frame-support] [dependencies.frame-support]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.grandpa] [dependencies.frame-system]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-grandpa' tag = 'v2.0.0-rc6'
tag = 'v2.0.0-rc5' version = '2.0.0-rc6'
version = '2.0.0-rc5'
[dependencies.randomness-collective-flip] [dependencies.frame-system-rpc-runtime-api]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-randomness-collective-flip' tag = 'v2.0.0-rc6'
tag = 'v2.0.0-rc5' version = '2.0.0-rc6'
version = '2.0.0-rc5'
[dependencies.pallet-aura]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-balances]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-grandpa]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-randomness-collective-flip]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-sudo]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-timestamp]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-transaction-payment]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.pallet-transaction-payment-rpc-runtime-api]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc6'
version = '2.0.0-rc6'
[dependencies.serde] [dependencies.serde]
features = ['derive'] features = ['derive']
@ -64,119 +96,91 @@ version = '1.0.101'
[dependencies.sp-api] [dependencies.sp-api]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-block-builder] [dependencies.sp-block-builder]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-consensus-aura] [dependencies.sp-consensus-aura]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '0.8.0-rc5' version = '0.8.0-rc6'
[dependencies.sp-core] [dependencies.sp-core]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-inherents] [dependencies.sp-inherents]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-offchain] [dependencies.sp-offchain]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-runtime] [dependencies.sp-runtime]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-session] [dependencies.sp-session]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-std] [dependencies.sp-std]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-transaction-pool] [dependencies.sp-transaction-pool]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sp-version] [dependencies.sp-version]
default-features = false default-features = false
git = 'https://github.com/paritytech/substrate.git' git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-rc5' tag = 'v2.0.0-rc6'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.sudo]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-sudo'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[dependencies.system]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'frame-system'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[dependencies.template] [dependencies.template]
default-features = false default-features = false
package = 'pallet-template' package = 'pallet-template'
path = '../pallets/template' path = '../pallets/template'
version = '2.0.0-rc5' version = '2.0.0-rc6'
[dependencies.timestamp]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-timestamp'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[dependencies.transaction-payment]
default-features = false
git = 'https://github.com/paritytech/substrate.git'
package = 'pallet-transaction-payment'
tag = 'v2.0.0-rc5'
version = '2.0.0-rc5'
[build-dependencies.wasm-builder-runner]
git = 'https://github.com/paritytech/substrate.git'
package = 'substrate-wasm-builder-runner'
tag = 'v2.0.0-rc5'
version = '1.0.5'
[features] [features]
default = ['std'] default = ['std']
std = [ std = [
'aura/std',
'balances/std',
'codec/std', 'codec/std',
'frame-executive/std', 'frame-executive/std',
'frame-support/std', 'frame-support/std',
'grandpa/std', 'frame-system/std',
'randomness-collective-flip/std', 'frame-system-rpc-runtime-api/std',
'pallet-aura/std',
'pallet-balances/std',
'pallet-grandpa/std',
'pallet-randomness-collective-flip/std',
'pallet-sudo/std',
'pallet-timestamp/std',
'pallet-transaction-payment/std',
'pallet-transaction-payment-rpc-runtime-api/std',
'serde', 'serde',
'sp-api/std', 'sp-api/std',
'sp-block-builder/std', 'sp-block-builder/std',
@ -189,9 +193,11 @@ std = [
'sp-std/std', 'sp-std/std',
'sp-transaction-pool/std', 'sp-transaction-pool/std',
'sp-version/std', 'sp-version/std',
'sudo/std',
'system/std',
'timestamp/std',
'transaction-payment/std',
'template/std', 'template/std',
] ]
[build-dependencies.wasm-builder-runner]
git = 'https://github.com/paritytech/substrate.git'
package = 'substrate-wasm-builder-runner'
tag = 'v2.0.0-rc6'
version = '1.0.5'

View File

@ -17,8 +17,8 @@ use sp_runtime::traits::{
}; };
use sp_api::impl_runtime_apis; use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId; use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList}; use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
use grandpa::fg_primitives; use pallet_grandpa::fg_primitives;
use sp_version::RuntimeVersion; use sp_version::RuntimeVersion;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use sp_version::NativeVersion; use sp_version::NativeVersion;
@ -26,8 +26,8 @@ use sp_version::NativeVersion;
// A few exports that help ease life for downstream crates. // A few exports that help ease life for downstream crates.
#[cfg(any(feature = "std", test))] #[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage; pub use sp_runtime::BuildStorage;
pub use timestamp::Call as TimestampCall; pub use pallet_timestamp::Call as TimestampCall;
pub use balances::Call as BalancesCall; pub use pallet_balances::Call as BalancesCall;
pub use sp_runtime::{Permill, Perbill}; pub use sp_runtime::{Permill, Perbill};
pub use frame_support::{ pub use frame_support::{
construct_runtime, parameter_types, StorageValue, construct_runtime, parameter_types, StorageValue,
@ -133,7 +133,7 @@ parameter_types! {
// Configure FRAME pallets to include in runtime. // Configure FRAME pallets to include in runtime.
impl system::Trait for Runtime { impl frame_system::Trait for Runtime {
/// The basic call filter to use in dispatchable. /// The basic call filter to use in dispatchable.
type BaseCallFilter = (); type BaseCallFilter = ();
/// The identifier used to distinguish between accounts. /// The identifier used to distinguish between accounts.
@ -187,16 +187,16 @@ impl system::Trait for Runtime {
/// What to do if an account is fully reaped from the system. /// What to do if an account is fully reaped from the system.
type OnKilledAccount = (); type OnKilledAccount = ();
/// The data to be stored in an account. /// The data to be stored in an account.
type AccountData = balances::AccountData<Balance>; type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet. /// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = (); type SystemWeightInfo = ();
} }
impl aura::Trait for Runtime { impl pallet_aura::Trait for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
} }
impl grandpa::Trait for Runtime { impl pallet_grandpa::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
@ -217,7 +217,7 @@ parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2; pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
} }
impl timestamp::Trait for Runtime { impl pallet_timestamp::Trait for Runtime {
/// A timestamp: milliseconds since the unix epoch. /// A timestamp: milliseconds since the unix epoch.
type Moment = u64; type Moment = u64;
type OnTimestampSet = Aura; type OnTimestampSet = Aura;
@ -229,7 +229,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 500; pub const ExistentialDeposit: u128 = 500;
} }
impl balances::Trait for Runtime { impl pallet_balances::Trait for Runtime {
/// The type for recording an account's balance. /// The type for recording an account's balance.
type Balance = Balance; type Balance = Balance;
/// The ubiquitous event type. /// The ubiquitous event type.
@ -244,15 +244,15 @@ parameter_types! {
pub const TransactionByteFee: Balance = 1; pub const TransactionByteFee: Balance = 1;
} }
impl transaction_payment::Trait for Runtime { impl pallet_transaction_payment::Trait for Runtime {
type Currency = balances::Module<Runtime>; type Currency = Balances;
type OnTransactionPayment = (); type OnTransactionPayment = ();
type TransactionByteFee = TransactionByteFee; type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>; type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = (); type FeeMultiplierUpdate = ();
} }
impl sudo::Trait for Runtime { impl pallet_sudo::Trait for Runtime {
type Event = Event; type Event = Event;
type Call = Call; type Call = Call;
} }
@ -269,14 +269,14 @@ construct_runtime!(
NodeBlock = opaque::Block, NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic UncheckedExtrinsic = UncheckedExtrinsic
{ {
System: system::{Module, Call, Config, Storage, Event<T>}, System: frame_system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage}, RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Timestamp: timestamp::{Module, Call, Storage, Inherent}, Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Aura: aura::{Module, Config<T>, Inherent}, Aura: pallet_aura::{Module, Config<T>, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event}, Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>}, Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage}, TransactionPayment: pallet_transaction_payment::{Module, Storage},
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>}, Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
// Include the custom logic from the template pallet in the runtime. // Include the custom logic from the template pallet in the runtime.
TemplateModule: template::{Module, Call, Storage, Event<T>}, TemplateModule: template::{Module, Call, Storage, Event<T>},
} }
@ -294,20 +294,26 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type BlockId = generic::BlockId<Block>; pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic. /// The SignedExtension to the basic transaction logic.
pub type SignedExtra = ( pub type SignedExtra = (
system::CheckSpecVersion<Runtime>, frame_system::CheckSpecVersion<Runtime>,
system::CheckTxVersion<Runtime>, frame_system::CheckTxVersion<Runtime>,
system::CheckGenesis<Runtime>, frame_system::CheckGenesis<Runtime>,
system::CheckEra<Runtime>, frame_system::CheckEra<Runtime>,
system::CheckNonce<Runtime>, frame_system::CheckNonce<Runtime>,
system::CheckWeight<Runtime>, frame_system::CheckWeight<Runtime>,
transaction_payment::ChargeTransactionPayment<Runtime> pallet_transaction_payment::ChargeTransactionPayment<Runtime>
); );
/// Unchecked extrinsic type as expected by this runtime. /// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>; pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
/// Extrinsic type that has already been checked. /// Extrinsic type that has already been checked.
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>; pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
/// Executive: handles dispatch to the various modules. /// Executive: handles dispatch to the various modules.
pub type Executive = frame_executive::Executive<Runtime, Block, system::ChainContext<Runtime>, Runtime, AllModules>; pub type Executive = frame_executive::Executive<
Runtime,
Block,
frame_system::ChainContext<Runtime>,
Runtime,
AllModules,
>;
impl_runtime_apis! { impl_runtime_apis! {
impl sp_api::Core<Block> for Runtime { impl sp_api::Core<Block> for Runtime {
@ -417,4 +423,19 @@ impl_runtime_apis! {
None None
} }
} }
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
System::account_nonce(account)
}
}
impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
fn query_info(
uxt: <Block as BlockT>::Extrinsic,
len: u32,
) -> pallet_transaction_payment_rpc_runtime_api::RuntimeDispatchInfo<Balance> {
TransactionPayment::query_info(uxt, len)
}
}
} }