Upgrade to v2.0.0-rc6 (#75)
parent
8682ee4edf
commit
c9fda53e31
File diff suppressed because it is too large
Load Diff
14
README.md
14
README.md
|
@ -72,7 +72,8 @@ Substrate-based blockchain nodes expose a number of capabilities:
|
|||
- Consensus: Blockchains must have a way to come to
|
||||
[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
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
The Substrate project in this repository uses the
|
||||
[FRAME](https://substrate.dev/docs/en/knowledgebase/runtime/frame) framework to construct a
|
||||
In Substrate, the terms
|
||||
"[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
|
||||
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
|
||||
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
|
||||
the following:
|
||||
|
|
112
node/Cargo.toml
112
node/Cargo.toml
|
@ -7,7 +7,7 @@ homepage = 'https://substrate.dev'
|
|||
license = 'Unlicense'
|
||||
name = '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]
|
||||
targets = ['x86_64-unknown-linux-gnu']
|
||||
|
@ -17,95 +17,131 @@ name = 'node-template'
|
|||
|
||||
[dependencies.node-template-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]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-cli]
|
||||
features = ['wasmtime']
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-client-api]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sc-consensus]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-consensus-aura]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-executor]
|
||||
features = ['wasmtime']
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-finality-grandpa]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
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]
|
||||
features = ['wasmtime']
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sc-transaction-pool]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
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]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sp-consensus-aura]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sp-core]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-finality-grandpa]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-inherents]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-runtime]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-transaction-pool]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.structopt]
|
||||
version = '0.3.8'
|
||||
[dependencies.substrate-frame-rpc-system]
|
||||
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]
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
|
|
@ -134,22 +134,22 @@ fn testnet_genesis(
|
|||
_enable_println: bool,
|
||||
) -> GenesisConfig {
|
||||
GenesisConfig {
|
||||
system: Some(SystemConfig {
|
||||
frame_system: Some(SystemConfig {
|
||||
// Add Wasm runtime to storage.
|
||||
code: wasm_binary.to_vec(),
|
||||
changes_trie_config: Default::default(),
|
||||
}),
|
||||
balances: Some(BalancesConfig {
|
||||
pallet_balances: Some(BalancesConfig {
|
||||
// Configure endowed accounts with initial balance of 1 << 60.
|
||||
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(),
|
||||
}),
|
||||
grandpa: Some(GrandpaConfig {
|
||||
pallet_grandpa: Some(GrandpaConfig {
|
||||
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
|
||||
}),
|
||||
sudo: Some(SudoConfig {
|
||||
pallet_sudo: Some(SudoConfig {
|
||||
// Assign network admin rights.
|
||||
key: root_key,
|
||||
}),
|
||||
|
|
|
@ -19,8 +19,8 @@ use crate::chain_spec;
|
|||
use crate::cli::Cli;
|
||||
use crate::service;
|
||||
use sc_cli::{SubstrateCli, RuntimeVersion, Role, ChainSpec};
|
||||
use sc_service::ServiceParams;
|
||||
use crate::service::new_full_params;
|
||||
use sc_service::PartialComponents;
|
||||
use crate::service::new_partial;
|
||||
|
||||
impl SubstrateCli for Cli {
|
||||
fn impl_name() -> String {
|
||||
|
@ -66,12 +66,12 @@ impl SubstrateCli for Cli {
|
|||
pub fn run() -> sc_cli::Result<()> {
|
||||
let cli = Cli::from_args();
|
||||
|
||||
match &cli.subcommand {
|
||||
Some(subcommand) => {
|
||||
match cli.subcommand {
|
||||
Some(ref subcommand) => {
|
||||
let runner = cli.create_runner(subcommand)?;
|
||||
runner.run_subcommand(subcommand, |config| {
|
||||
let (ServiceParams { client, backend, task_manager, import_queue, .. }, ..)
|
||||
= new_full_params(config)?;
|
||||
let PartialComponents { client, backend, task_manager, import_queue, .. }
|
||||
= new_partial(&config)?;
|
||||
Ok((client, backend, import_queue, task_manager))
|
||||
})
|
||||
}
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
pub mod chain_spec;
|
||||
pub mod service;
|
||||
pub mod rpc;
|
||||
|
|
|
@ -6,6 +6,7 @@ mod chain_spec;
|
|||
mod service;
|
||||
mod cli;
|
||||
mod command;
|
||||
mod rpc;
|
||||
|
||||
fn main() -> sc_cli::Result<()> {
|
||||
command::run()
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -4,14 +4,12 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
use sc_client_api::{ExecutorProvider, RemoteBackend};
|
||||
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 sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use sc_finality_grandpa::{
|
||||
FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider, SharedVoterState,
|
||||
};
|
||||
use sc_finality_grandpa::{FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState};
|
||||
|
||||
// Our 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 FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
|
||||
|
||||
pub fn new_full_params(config: Configuration) -> Result<(
|
||||
sc_service::ServiceParams<
|
||||
Block, FullClient,
|
||||
sc_consensus_aura::AuraImportQueue<Block, FullClient>,
|
||||
sc_transaction_pool::FullPool<Block, FullClient>,
|
||||
(), FullBackend,
|
||||
>,
|
||||
FullSelectChain,
|
||||
sp_inherents::InherentDataProviders,
|
||||
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,
|
||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>
|
||||
), ServiceError> {
|
||||
pub fn new_partial(config: &Configuration) -> Result<sc_service::PartialComponents<
|
||||
FullClient, FullBackend, FullSelectChain,
|
||||
sp_consensus::DefaultImportQueue<Block, FullClient>,
|
||||
sc_transaction_pool::FullPool<Block, FullClient>,
|
||||
(
|
||||
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>,
|
||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>
|
||||
)
|
||||
>, ServiceError> {
|
||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||
|
||||
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 pool_api = sc_transaction_pool::FullChainApi::new(
|
||||
client.clone(), config.prometheus_registry(),
|
||||
);
|
||||
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
||||
config.transaction_pool.clone(),
|
||||
std::sync::Arc::new(pool_api),
|
||||
config.prometheus_registry(),
|
||||
task_manager.spawn_handle(),
|
||||
client.clone(),
|
||||
|
@ -63,7 +54,7 @@ pub fn new_full_params(config: Configuration) -> Result<(
|
|||
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)?,
|
||||
aura_block_import,
|
||||
Some(Box::new(grandpa_block_import.clone())),
|
||||
|
@ -72,58 +63,80 @@ pub fn new_full_params(config: Configuration) -> Result<(
|
|||
inherent_data_providers.clone(),
|
||||
&task_manager.spawn_handle(),
|
||||
config.prometheus_registry(),
|
||||
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
|
||||
)?;
|
||||
|
||||
let provider = client.clone() as Arc<dyn StorageAndProofProvider<_, _>>;
|
||||
let finality_proof_provider =
|
||||
Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), provider));
|
||||
|
||||
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,
|
||||
))
|
||||
Ok(sc_service::PartialComponents {
|
||||
client, backend, task_manager, import_queue, keystore, select_chain, transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (grandpa_block_import, grandpa_link),
|
||||
})
|
||||
}
|
||||
|
||||
/// Builds a new service for a full client.
|
||||
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
let (
|
||||
params, select_chain, inherent_data_providers,
|
||||
block_import, grandpa_link,
|
||||
) = new_full_params(config)?;
|
||||
pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||
let sc_service::PartialComponents {
|
||||
client, backend, mut task_manager, import_queue, keystore, select_chain, transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (block_import, grandpa_link),
|
||||
} = new_partial(&config)?;
|
||||
|
||||
let (
|
||||
role, force_authoring, name, enable_grandpa, prometheus_registry,
|
||||
client, transaction_pool, keystore,
|
||||
) = {
|
||||
let sc_service::ServiceParams {
|
||||
config, client, transaction_pool, keystore, ..
|
||||
} = ¶ms;
|
||||
let finality_proof_provider =
|
||||
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
||||
|
||||
(
|
||||
config.role.clone(),
|
||||
config.force_authoring,
|
||||
config.network.node_name.clone(),
|
||||
!config.disable_grandpa,
|
||||
config.prometheus_registry().cloned(),
|
||||
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: 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,
|
||||
};
|
||||
|
||||
crate::rpc::create_full(deps)
|
||||
})
|
||||
};
|
||||
|
||||
let ServiceComponents {
|
||||
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() {
|
||||
let proposer = sc_basic_authorship::ProposerFactory::new(
|
||||
|
@ -183,7 +196,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
|
|||
link: grandpa_link,
|
||||
network,
|
||||
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(),
|
||||
prometheus_registry,
|
||||
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)
|
||||
}
|
||||
|
||||
/// Builds a new service for a light client.
|
||||
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)?;
|
||||
|
||||
let transaction_pool_api = Arc::new(sc_transaction_pool::LightChainApi::new(
|
||||
client.clone(), on_demand.clone(),
|
||||
));
|
||||
let transaction_pool = sc_transaction_pool::BasicPool::new_light(
|
||||
|
||||
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
|
||||
config.transaction_pool.clone(),
|
||||
transaction_pool_api,
|
||||
config.prometheus_registry(),
|
||||
task_manager.spawn_handle(),
|
||||
);
|
||||
client.clone(),
|
||||
on_demand.clone(),
|
||||
));
|
||||
|
||||
let grandpa_block_import = sc_finality_grandpa::light_block_import(
|
||||
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 =
|
||||
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)?,
|
||||
grandpa_block_import,
|
||||
None,
|
||||
|
@ -238,19 +250,48 @@ pub fn new_light(config: Configuration) -> Result<TaskManager, ServiceError> {
|
|||
InherentDataProviders::new(),
|
||||
&task_manager.spawn_handle(),
|
||||
config.prometheus_registry(),
|
||||
sp_consensus::NeverCanAuthor,
|
||||
)?;
|
||||
|
||||
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 {
|
||||
block_announce_validator_builder: None,
|
||||
finality_proof_request_builder: Some(finality_proof_request_builder),
|
||||
finality_proof_provider: Some(finality_proof_provider),
|
||||
on_demand: Some(on_demand),
|
||||
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,
|
||||
finality_proof_request_builder: Some(finality_proof_request_builder),
|
||||
finality_proof_provider: Some(finality_proof_provider),
|
||||
})?;
|
||||
|
||||
if config.offchain_worker.enabled {
|
||||
sc_service::build_offchain_workers(
|
||||
&config, backend.clone(), task_manager.spawn_handle(), client.clone(), network.clone(),
|
||||
);
|
||||
}
|
||||
|
||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||
remote_blockchain: Some(backend.remote_blockchain()),
|
||||
rpc_extensions_builder: Box::new(|_| ()),
|
||||
transaction_pool: Arc::new(transaction_pool),
|
||||
config, client, import_queue, keystore, backend, task_manager
|
||||
}).map(|ServiceComponents { task_manager, .. }| task_manager)
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ homepage = 'https://substrate.dev'
|
|||
license = 'Unlicense'
|
||||
name = 'pallet-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]
|
||||
targets = ['x86_64-unknown-linux-gnu']
|
||||
|
@ -15,37 +15,37 @@ targets = ['x86_64-unknown-linux-gnu']
|
|||
default-features = false
|
||||
features = ['derive']
|
||||
package = 'parity-scale-codec'
|
||||
version = '1.3.1'
|
||||
version = '1.3.4'
|
||||
|
||||
[dependencies.frame-support]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.frame-system]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dev-dependencies.sp-core]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dev-dependencies.sp-io]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dev-dependencies.sp-runtime]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[features]
|
||||
default = ['std']
|
||||
|
|
|
@ -5,56 +5,88 @@ homepage = 'https://substrate.dev'
|
|||
license = 'Unlicense'
|
||||
name = 'node-template-runtime'
|
||||
repository = 'https://github.com/substrate-developer-hub/substrate-node-template/'
|
||||
version = '2.0.0-rc5'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
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]
|
||||
default-features = false
|
||||
features = ['derive']
|
||||
package = 'parity-scale-codec'
|
||||
version = '1.3.1'
|
||||
version = '1.3.4'
|
||||
|
||||
[dependencies.frame-executive]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.frame-support]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.grandpa]
|
||||
[dependencies.frame-system]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
package = 'pallet-grandpa'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.randomness-collective-flip]
|
||||
[dependencies.frame-system-rpc-runtime-api]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
package = 'pallet-randomness-collective-flip'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[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]
|
||||
features = ['derive']
|
||||
|
@ -64,119 +96,91 @@ version = '1.0.101'
|
|||
[dependencies.sp-api]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-block-builder]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-consensus-aura]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '0.8.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '0.8.0-rc6'
|
||||
|
||||
[dependencies.sp-core]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-inherents]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-offchain]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-runtime]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-session]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-std]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-transaction-pool]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.sp-version]
|
||||
default-features = false
|
||||
git = 'https://github.com/paritytech/substrate.git'
|
||||
tag = 'v2.0.0-rc5'
|
||||
version = '2.0.0-rc5'
|
||||
|
||||
[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'
|
||||
tag = 'v2.0.0-rc6'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[dependencies.template]
|
||||
default-features = false
|
||||
package = 'pallet-template'
|
||||
path = '../pallets/template'
|
||||
version = '2.0.0-rc5'
|
||||
|
||||
[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'
|
||||
version = '2.0.0-rc6'
|
||||
|
||||
[features]
|
||||
default = ['std']
|
||||
std = [
|
||||
'aura/std',
|
||||
'balances/std',
|
||||
'codec/std',
|
||||
'frame-executive/std',
|
||||
'frame-support/std',
|
||||
'grandpa/std',
|
||||
'randomness-collective-flip/std',
|
||||
'frame-system/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',
|
||||
'sp-api/std',
|
||||
'sp-block-builder/std',
|
||||
|
@ -189,9 +193,11 @@ std = [
|
|||
'sp-std/std',
|
||||
'sp-transaction-pool/std',
|
||||
'sp-version/std',
|
||||
'sudo/std',
|
||||
'system/std',
|
||||
'timestamp/std',
|
||||
'transaction-payment/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'
|
||||
|
|
|
@ -17,8 +17,8 @@ use sp_runtime::traits::{
|
|||
};
|
||||
use sp_api::impl_runtime_apis;
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
|
||||
use grandpa::fg_primitives;
|
||||
use pallet_grandpa::{AuthorityId as GrandpaId, AuthorityList as GrandpaAuthorityList};
|
||||
use pallet_grandpa::fg_primitives;
|
||||
use sp_version::RuntimeVersion;
|
||||
#[cfg(feature = "std")]
|
||||
use sp_version::NativeVersion;
|
||||
|
@ -26,8 +26,8 @@ use sp_version::NativeVersion;
|
|||
// A few exports that help ease life for downstream crates.
|
||||
#[cfg(any(feature = "std", test))]
|
||||
pub use sp_runtime::BuildStorage;
|
||||
pub use timestamp::Call as TimestampCall;
|
||||
pub use balances::Call as BalancesCall;
|
||||
pub use pallet_timestamp::Call as TimestampCall;
|
||||
pub use pallet_balances::Call as BalancesCall;
|
||||
pub use sp_runtime::{Permill, Perbill};
|
||||
pub use frame_support::{
|
||||
construct_runtime, parameter_types, StorageValue,
|
||||
|
@ -133,7 +133,7 @@ parameter_types! {
|
|||
|
||||
// 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.
|
||||
type BaseCallFilter = ();
|
||||
/// 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.
|
||||
type OnKilledAccount = ();
|
||||
/// 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.
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
impl aura::Trait for Runtime {
|
||||
impl pallet_aura::Trait for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
}
|
||||
|
||||
impl grandpa::Trait for Runtime {
|
||||
impl pallet_grandpa::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
|
||||
|
@ -217,7 +217,7 @@ parameter_types! {
|
|||
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.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
|
@ -229,7 +229,7 @@ parameter_types! {
|
|||
pub const ExistentialDeposit: u128 = 500;
|
||||
}
|
||||
|
||||
impl balances::Trait for Runtime {
|
||||
impl pallet_balances::Trait for Runtime {
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
/// The ubiquitous event type.
|
||||
|
@ -244,15 +244,15 @@ parameter_types! {
|
|||
pub const TransactionByteFee: Balance = 1;
|
||||
}
|
||||
|
||||
impl transaction_payment::Trait for Runtime {
|
||||
type Currency = balances::Module<Runtime>;
|
||||
impl pallet_transaction_payment::Trait for Runtime {
|
||||
type Currency = Balances;
|
||||
type OnTransactionPayment = ();
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
type WeightToFee = IdentityFee<Balance>;
|
||||
type FeeMultiplierUpdate = ();
|
||||
}
|
||||
|
||||
impl sudo::Trait for Runtime {
|
||||
impl pallet_sudo::Trait for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
}
|
||||
|
@ -269,14 +269,14 @@ construct_runtime!(
|
|||
NodeBlock = opaque::Block,
|
||||
UncheckedExtrinsic = UncheckedExtrinsic
|
||||
{
|
||||
System: system::{Module, Call, Config, Storage, Event<T>},
|
||||
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Inherent},
|
||||
Aura: aura::{Module, Config<T>, Inherent},
|
||||
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
|
||||
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
TransactionPayment: transaction_payment::{Module, Storage},
|
||||
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
|
||||
System: frame_system::{Module, Call, Config, Storage, Event<T>},
|
||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
|
||||
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
|
||||
Aura: pallet_aura::{Module, Config<T>, Inherent},
|
||||
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
|
||||
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
|
||||
TransactionPayment: pallet_transaction_payment::{Module, Storage},
|
||||
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
|
||||
// Include the custom logic from the template pallet in the runtime.
|
||||
TemplateModule: template::{Module, Call, Storage, Event<T>},
|
||||
}
|
||||
|
@ -294,20 +294,26 @@ pub type SignedBlock = generic::SignedBlock<Block>;
|
|||
pub type BlockId = generic::BlockId<Block>;
|
||||
/// The SignedExtension to the basic transaction logic.
|
||||
pub type SignedExtra = (
|
||||
system::CheckSpecVersion<Runtime>,
|
||||
system::CheckTxVersion<Runtime>,
|
||||
system::CheckGenesis<Runtime>,
|
||||
system::CheckEra<Runtime>,
|
||||
system::CheckNonce<Runtime>,
|
||||
system::CheckWeight<Runtime>,
|
||||
transaction_payment::ChargeTransactionPayment<Runtime>
|
||||
frame_system::CheckSpecVersion<Runtime>,
|
||||
frame_system::CheckTxVersion<Runtime>,
|
||||
frame_system::CheckGenesis<Runtime>,
|
||||
frame_system::CheckEra<Runtime>,
|
||||
frame_system::CheckNonce<Runtime>,
|
||||
frame_system::CheckWeight<Runtime>,
|
||||
pallet_transaction_payment::ChargeTransactionPayment<Runtime>
|
||||
);
|
||||
/// Unchecked extrinsic type as expected by this runtime.
|
||||
pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
|
||||
/// Extrinsic type that has already been checked.
|
||||
pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
|
||||
/// 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 sp_api::Core<Block> for Runtime {
|
||||
|
@ -417,4 +423,19 @@ impl_runtime_apis! {
|
|||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue