Update to 2.0.0-alpha.7 (#38)

Closes #35

Thanks to @brenzi for the work he did on #36 I copied a lot of it 🙏
main
Dan Forbes 2020-05-06 13:25:03 -07:00 committed by GitHub
parent 6c1d11508c
commit 36971ec2ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 402 additions and 386 deletions

605
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'node-template'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.6'
version = '2.0.0-alpha.7'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@ -19,89 +19,89 @@ structopt = '0.3.8'
[dependencies.node-template-runtime]
path = '../runtime'
version = '2.0.0-alpha.6'
version = '2.0.0-alpha.7'
[dependencies.sc-basic-authorship]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-cli]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
[dependencies.sc-client]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-client-api]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-consensus]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-executor]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-network]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-service]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sc-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-consensus]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-finality-grandpa]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[build-dependencies.substrate-build-script-utils]
git = 'https://github.com/paritytech/substrate.git'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[[bin]]
name = 'node-template'

View File

@ -2,15 +2,17 @@
use std::sync::Arc;
use std::time::Duration;
use sc_client::LongestChain;
use sc_client_api::ExecutorProvider;
use sc_consensus::LongestChain;
use node_template_runtime::{self, opaque::Block, RuntimeApi};
use sc_service::{error::{Error as ServiceError}, AbstractService, Configuration, ServiceBuilder};
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::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
use sc_finality_grandpa::{
self, FinalityProofProvider as GrandpaFinalityProofProvider, SharedVoterState, StorageAndProofProvider
};
// Our native executor instance.
native_executor_instance!(
@ -33,13 +35,13 @@ macro_rules! new_full_start {
node_template_runtime::opaque::Block, node_template_runtime::RuntimeApi, crate::service::Executor
>($config)?
.with_select_chain(|_config, backend| {
Ok(sc_client::LongestChain::new(backend.clone()))
Ok(sc_consensus::LongestChain::new(backend.clone()))
})?
.with_transaction_pool(|config, client, _fetcher| {
.with_transaction_pool(|config, client, _fetcher, prometheus_registry| {
let pool_api = sc_transaction_pool::FullChainApi::new(client.clone());
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api)))
Ok(sc_transaction_pool::BasicPool::new(config, std::sync::Arc::new(pool_api), prometheus_registry))
})?
.with_import_queue(|_config, client, mut select_chain, _transaction_pool| {
.with_import_queue(|_config, client, mut select_chain, _transaction_pool, spawn_task_handle| {
let select_chain = select_chain.take()
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
@ -50,13 +52,14 @@ macro_rules! new_full_start {
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())),
None,
client,
inherent_data_providers.clone(),
spawn_task_handle,
)?;
import_setup = Some((grandpa_block_import, grandpa_link));
@ -153,7 +156,8 @@ pub fn new_full(config: Configuration)
inherent_data_providers: inherent_data_providers.clone(),
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry: service.prometheus_registry()
prometheus_registry: service.prometheus_registry(),
shared_voter_state: SharedVoterState::empty()
};
// the GRANDPA voter task is considered infallible, i.e.
@ -183,17 +187,17 @@ pub fn new_light(config: Configuration)
.with_select_chain(|_config, backend| {
Ok(LongestChain::new(backend.clone()))
})?
.with_transaction_pool(|config, client, fetcher| {
.with_transaction_pool(|config, client, fetcher, prometheus_registry| {
let fetcher = fetcher
.ok_or_else(|| "Trying to start light transaction pool without active fetcher")?;
let pool_api = sc_transaction_pool::LightChainApi::new(client.clone(), fetcher.clone());
let pool = sc_transaction_pool::BasicPool::with_revalidation_type(
config, Arc::new(pool_api), sc_transaction_pool::RevalidationType::Light,
config, Arc::new(pool_api), prometheus_registry, sc_transaction_pool::RevalidationType::Light,
);
Ok(pool)
})?
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool| {
.with_import_queue_and_fprb(|_config, client, backend, fetcher, _select_chain, _tx_pool, spawn_task_handle| {
let fetch_checker = fetcher
.map(|fetcher| fetcher.checker().clone())
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
@ -207,13 +211,14 @@ pub fn new_light(config: Configuration)
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,
Some(Box::new(finality_proof_import)),
client,
inherent_data_providers.clone(),
spawn_task_handle,
)?;
Ok((import_queue, finality_proof_request_builder))

View File

@ -6,7 +6,7 @@ homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'pallet-template'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.6'
version = '2.0.0-alpha.7'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']
@ -20,27 +20,27 @@ version = '1.3.0'
[dependencies.frame-support]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.frame-system]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dev-dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dev-dependencies.sp-io]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dev-dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[features]
default = ['std']

View File

@ -75,7 +75,7 @@ decl_module! {
/// Just a dummy entry point.
/// function that can be called by the external world as an extrinsics call
/// takes a parameter of the type `AccountId`, stores it, and emits an event
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = 10_000]
pub fn do_something(origin, something: u32) -> dispatch::DispatchResult {
// Check it was signed and get the signer. See also: ensure_root and ensure_none
let who = ensure_signed(origin)?;
@ -91,7 +91,7 @@ decl_module! {
/// Another dummy entry point.
/// takes no parameters, attempts to increment storage value, and possibly throws an error
#[weight = frame_support::weights::SimpleDispatchInfo::default()]
#[weight = 10_000]
pub fn cause_error(origin) -> dispatch::DispatchResult {
// Check it was signed and get the signer. See also: ensure_root and ensure_none
let _who = ensure_signed(origin)?;

View File

@ -38,6 +38,9 @@ impl system::Trait for Test {
type MaximumBlockWeight = MaximumBlockWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type BlockExecutionWeight = ();
type DbWeight = ();
type ExtrinsicBaseWeight = ();
type Version = ();
type ModuleToIndex = ();
type AccountData = ();

View File

@ -2,13 +2,13 @@
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-aura'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.balances]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-balances'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.codec]
default-features = false
@ -19,24 +19,24 @@ version = '1.3.0'
[dependencies.frame-executive]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.frame-support]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.grandpa]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-grandpa'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.randomness-collective-flip]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-randomness-collective-flip'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.serde]
features = ['derive']
@ -46,93 +46,93 @@ version = '1.0.101'
[dependencies.sp-api]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-block-builder]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-consensus-aura]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
version = '0.8.0-alpha.6'
tag = 'v2.0.0-alpha.6'
version = '0.8.0-alpha.7'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-core]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-inherents]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-io]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-offchain]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-runtime]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-session]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-std]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-transaction-pool]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sp-version]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.sudo]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-sudo'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.system]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'frame-system'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.template]
default-features = false
package = 'pallet-template'
path = '../pallets/template'
version = '2.0.0-alpha.6'
version = '2.0.0-alpha.7'
[dependencies.timestamp]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-timestamp'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[dependencies.transaction-payment]
git = 'https://github.com/paritytech/substrate.git'
default-features = false
package = 'pallet-transaction-payment'
tag = 'v2.0.0-alpha.6'
tag = 'v2.0.0-alpha.7'
[build-dependencies.wasm-builder-runner]
git = 'https://github.com/paritytech/substrate.git'
@ -146,7 +146,7 @@ homepage = 'https://substrate.dev'
license = 'Unlicense'
name = 'node-template-runtime'
repository = 'https://github.com/paritytech/substrate/'
version = '2.0.0-alpha.6'
version = '2.0.0-alpha.7'
[package.metadata.docs.rs]
targets = ['x86_64-unknown-linux-gnu']

View File

@ -34,7 +34,10 @@ pub use sp_runtime::{Permill, Perbill};
pub use frame_support::{
StorageValue, construct_runtime, parameter_types,
traits::Randomness,
weights::Weight,
weights::{
Weight,
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
},
};
/// Importing a template pallet
@ -97,6 +100,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
authoring_version: 1,
spec_version: 1,
impl_version: 1,
transaction_version: 1,
apis: RUNTIME_API_VERSIONS,
};
@ -120,7 +124,8 @@ pub fn native_version() -> NativeVersion {
parameter_types! {
pub const BlockHashCount: BlockNumber = 250;
pub const MaximumBlockWeight: Weight = 1_000_000_000;
/// We allow for 2 seconds of compute with a 6 second average block time.
pub const MaximumBlockWeight: Weight = 2 * WEIGHT_PER_SECOND;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
pub const MaximumBlockLength: u32 = 5 * 1024 * 1024;
pub const Version: RuntimeVersion = VERSION;
@ -155,6 +160,14 @@ impl system::Trait for Runtime {
type MaximumBlockLength = MaximumBlockLength;
/// Portion of the block weight that is available to all normal transactions.
type AvailableBlockRatio = AvailableBlockRatio;
/// The weight of the overhead invoked on the block import process, independent of the
/// extrinsics included in that block.
type BlockExecutionWeight = BlockExecutionWeight;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The base weight of any extrinsic processed by the runtime, independent of the
/// logic of that extrinsic. (Signature verification, nonce increment, fee, etc...)
type ExtrinsicBaseWeight = ExtrinsicBaseWeight;
/// Version of the runtime.
type Version = Version;
/// Converts a module to the index of the module in `construct_runtime!`.
@ -203,14 +216,12 @@ impl balances::Trait for Runtime {
}
parameter_types! {
pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1;
}
impl transaction_payment::Trait for Runtime {
type Currency = balances::Module<Runtime>;
type OnTransactionPayment = ();
type TransactionBaseFee = TransactionBaseFee;
type TransactionByteFee = TransactionByteFee;
type WeightToFee = ConvertInto;
type FeeMultiplierUpdate = ();