Update to alpha.6
parent
4be00bdec6
commit
c1b33f8c76
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,8 @@
|
|||
[profile.release]
|
||||
panic = 'unwind'
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
'node',
|
||||
'pallets/template',
|
||||
'runtime',
|
||||
]
|
||||
[profile.release]
|
||||
panic = 'unwind'
|
||||
|
|
|
@ -1,81 +1,78 @@
|
|||
[package]
|
||||
authors = ['Anonymous']
|
||||
build = 'build.rs'
|
||||
description = 'Substrate Node template'
|
||||
edition = '2018'
|
||||
homepage = 'https://substrate.dev'
|
||||
license = 'Unlicense'
|
||||
name = 'node-template'
|
||||
repository = 'https://github.com/paritytech/substrate/'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[build-dependencies]
|
||||
vergen = '3.0.4'
|
||||
|
||||
[build-dependencies.build-script-utils]
|
||||
package = 'substrate-build-script-utils'
|
||||
version = '2.0.0-alpha.5'
|
||||
[package.metadata.docs.rs]
|
||||
targets = ['x86_64-unknown-linux-gnu']
|
||||
|
||||
[dependencies]
|
||||
futures = '0.3.1'
|
||||
futures = '0.3.4'
|
||||
log = '0.4.8'
|
||||
structopt = '0.3.8'
|
||||
|
||||
[dependencies.grandpa]
|
||||
package = 'sc-finality-grandpa'
|
||||
version = '0.8.0-alpha.5'
|
||||
|
||||
[dependencies.grandpa-primitives]
|
||||
package = 'sp-finality-grandpa'
|
||||
version = '2.0.0-alpha.5'
|
||||
|
||||
[dependencies.node-template-runtime]
|
||||
path = '../runtime'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sc-basic-authorship]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-cli]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-client]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-client-api]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sc-consensus-aura]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-executor]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-finality-grandpa]
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-network]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-service]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sc-transaction-pool]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-consensus]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sp-consensus-aura]
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sp-core]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-finality-grandpa]
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-inherents]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-runtime]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-transaction-pool]
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
[build-dependencies.substrate-build-script-utils]
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[[bin]]
|
||||
name = 'node-template'
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use vergen::{ConstantsFlags, generate_cargo_keys};
|
||||
|
||||
const ERROR_MSG: &str = "Failed to generate metadata files";
|
||||
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};
|
||||
|
||||
fn main() {
|
||||
generate_cargo_keys(ConstantsFlags::SHA_SHORT).expect(ERROR_MSG);
|
||||
generate_cargo_keys();
|
||||
|
||||
build_script_utils::rerun_if_git_head_changed();
|
||||
rerun_if_git_head_changed();
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ use node_template_runtime::{
|
|||
AccountId, AuraConfig, BalancesConfig, GenesisConfig, GrandpaConfig,
|
||||
SudoConfig, SystemConfig, WASM_BINARY, Signature
|
||||
};
|
||||
use sp_consensus_aura::sr25519::{AuthorityId as AuraId};
|
||||
use grandpa_primitives::{AuthorityId as GrandpaId};
|
||||
use sc_service;
|
||||
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
|
||||
use sp_finality_grandpa::AuthorityId as GrandpaId;
|
||||
use sp_runtime::traits::{Verify, IdentifyAccount};
|
||||
use sc_service::ChainType;
|
||||
|
||||
// Note this is the URL for the telemetry server
|
||||
//const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";
|
||||
|
@ -14,17 +14,6 @@ use sp_runtime::traits::{Verify, IdentifyAccount};
|
|||
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
|
||||
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
|
||||
|
||||
/// The chain specification option. This is expected to come in from the CLI and
|
||||
/// is little more than one of a number of alternatives which can easily be converted
|
||||
/// from a string (`--chain=...`) into a `ChainSpec`.
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Alternative {
|
||||
/// Whatever the current runtime is, with just Alice as an auth.
|
||||
Development,
|
||||
/// Whatever the current runtime is, with simple Alice/Bob auths.
|
||||
LocalTestnet,
|
||||
}
|
||||
|
||||
/// Helper function to generate a crypto pair from seed
|
||||
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
|
||||
TPublic::Pair::from_string(&format!("//{}", seed), None)
|
||||
|
@ -42,80 +31,72 @@ pub fn get_account_id_from_seed<TPublic: Public>(seed: &str) -> AccountId where
|
|||
}
|
||||
|
||||
/// Helper function to generate an authority key for Aura
|
||||
pub fn get_authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
|
||||
pub fn authority_keys_from_seed(s: &str) -> (AuraId, GrandpaId) {
|
||||
(
|
||||
get_from_seed::<AuraId>(s),
|
||||
get_from_seed::<GrandpaId>(s),
|
||||
)
|
||||
}
|
||||
|
||||
impl Alternative {
|
||||
/// Get an actual chain config from one of the alternatives.
|
||||
pub(crate) fn load(self) -> Result<ChainSpec, String> {
|
||||
Ok(match self {
|
||||
Alternative::Development => ChainSpec::from_genesis(
|
||||
"Development",
|
||||
"dev",
|
||||
|| testnet_genesis(
|
||||
vec![
|
||||
get_authority_keys_from_seed("Alice"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
],
|
||||
true,
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
Alternative::LocalTestnet => ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
|| testnet_genesis(
|
||||
vec![
|
||||
get_authority_keys_from_seed("Alice"),
|
||||
get_authority_keys_from_seed("Bob"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
],
|
||||
true,
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None
|
||||
),
|
||||
})
|
||||
}
|
||||
pub fn development_config() -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Development",
|
||||
"dev",
|
||||
ChainType::Development,
|
||||
|| testnet_genesis(
|
||||
vec![
|
||||
authority_keys_from_seed("Alice"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
],
|
||||
true,
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn from(s: &str) -> Option<Self> {
|
||||
match s {
|
||||
"dev" => Some(Alternative::Development),
|
||||
"" | "local" => Some(Alternative::LocalTestnet),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
pub fn local_testnet_config() -> ChainSpec {
|
||||
ChainSpec::from_genesis(
|
||||
"Local Testnet",
|
||||
"local_testnet",
|
||||
ChainType::Local,
|
||||
|| testnet_genesis(
|
||||
vec![
|
||||
authority_keys_from_seed("Alice"),
|
||||
authority_keys_from_seed("Bob"),
|
||||
],
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
vec![
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Alice//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Bob//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Charlie//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Dave//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Eve//stash"),
|
||||
get_account_id_from_seed::<sr25519::Public>("Ferdie//stash"),
|
||||
],
|
||||
true,
|
||||
),
|
||||
vec![],
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
|
||||
|
@ -141,10 +122,3 @@ fn testnet_genesis(initial_authorities: Vec<(AuraId, GrandpaId)>,
|
|||
}),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn load_spec(id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(match Alternative::from(id) {
|
||||
Some(spec) => Box::new(spec.load()?),
|
||||
None => Box::new(ChainSpec::from_json_file(std::path::PathBuf::from(id))?),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -14,36 +14,68 @@
|
|||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use sc_cli::VersionInfo;
|
||||
use crate::service;
|
||||
use crate::chain_spec;
|
||||
use crate::cli::Cli;
|
||||
use crate::service;
|
||||
use sc_cli::SubstrateCli;
|
||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||
|
||||
/// Parse and run command line arguments
|
||||
pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
|
||||
let opt = sc_cli::from_args::<Cli>(&version);
|
||||
impl SubstrateCli for Cli {
|
||||
fn impl_name() -> &'static str {
|
||||
"Substrate Node"
|
||||
}
|
||||
|
||||
let mut config = sc_service::Configuration::from_version(&version);
|
||||
fn impl_version() -> &'static str {
|
||||
env!("SUBSTRATE_CLI_IMPL_VERSION")
|
||||
}
|
||||
|
||||
match opt.subcommand {
|
||||
Some(subcommand) => {
|
||||
subcommand.init(&version)?;
|
||||
subcommand.update_config(&mut config, chain_spec::load_spec, &version)?;
|
||||
subcommand.run(
|
||||
config,
|
||||
|config: _| Ok(new_full_start!(config).0),
|
||||
)
|
||||
},
|
||||
None => {
|
||||
opt.run.init(&version)?;
|
||||
opt.run.update_config(&mut config, chain_spec::load_spec, &version)?;
|
||||
opt.run.run(
|
||||
config,
|
||||
service::new_light,
|
||||
service::new_full,
|
||||
&version,
|
||||
)
|
||||
},
|
||||
fn description() -> &'static str {
|
||||
env!("CARGO_PKG_DESCRIPTION")
|
||||
}
|
||||
|
||||
fn author() -> &'static str {
|
||||
env!("CARGO_PKG_AUTHORS")
|
||||
}
|
||||
|
||||
fn support_url() -> &'static str {
|
||||
"support.anonymous.an"
|
||||
}
|
||||
|
||||
fn copyright_start_year() -> i32 {
|
||||
2017
|
||||
}
|
||||
|
||||
fn executable_name() -> &'static str {
|
||||
env!("CARGO_PKG_NAME")
|
||||
}
|
||||
|
||||
fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
Ok(match id {
|
||||
"dev" => Box::new(chain_spec::development_config()),
|
||||
"" | "local" => Box::new(chain_spec::local_testnet_config()),
|
||||
path => Box::new(chain_spec::ChainSpec::from_json_file(
|
||||
std::path::PathBuf::from(path),
|
||||
)?),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse and run command line arguments
|
||||
pub fn run() -> sc_cli::Result<()> {
|
||||
let cli = Cli::from_args();
|
||||
|
||||
match &cli.subcommand {
|
||||
Some(subcommand) => {
|
||||
let runner = cli.create_runner(subcommand)?;
|
||||
runner.run_subcommand(subcommand, |config| Ok(new_full_start!(config).0))
|
||||
}
|
||||
None => {
|
||||
let runner = cli.create_runner(&cli.run)?;
|
||||
runner.run_node(
|
||||
service::new_light,
|
||||
service::new_full,
|
||||
node_template_runtime::VERSION
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,5 @@ mod cli;
|
|||
mod command;
|
||||
|
||||
fn main() -> sc_cli::Result<()> {
|
||||
let version = sc_cli::VersionInfo {
|
||||
name: "Substrate Node",
|
||||
commit: env!("VERGEN_SHA_SHORT"),
|
||||
version: env!("CARGO_PKG_VERSION"),
|
||||
executable_name: "node-template",
|
||||
author: "Anonymous",
|
||||
description: "Template Node",
|
||||
support_url: "support.anonymous.an",
|
||||
copyright_start_year: 2017,
|
||||
};
|
||||
|
||||
command::run(version)
|
||||
command::run()
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ use sp_inherents::InherentDataProviders;
|
|||
use sc_executor::native_executor_instance;
|
||||
pub use sc_executor::NativeExecutor;
|
||||
use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
|
||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
|
||||
use sc_finality_grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider, StorageAndProofProvider};
|
||||
|
||||
// Our native executor instance.
|
||||
native_executor_instance!(
|
||||
|
@ -44,7 +44,7 @@ macro_rules! new_full_start {
|
|||
.ok_or_else(|| sc_service::Error::SelectChainRequired)?;
|
||||
|
||||
let (grandpa_block_import, grandpa_link) =
|
||||
grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
||||
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
||||
|
||||
let aura_block_import = sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(
|
||||
grandpa_block_import.clone(), client.clone(),
|
||||
|
@ -72,16 +72,11 @@ macro_rules! new_full_start {
|
|||
pub fn new_full(config: Configuration)
|
||||
-> Result<impl AbstractService, ServiceError>
|
||||
{
|
||||
let is_authority = config.roles.is_authority();
|
||||
let role = config.role.clone();
|
||||
let force_authoring = config.force_authoring;
|
||||
let name = config.name.clone();
|
||||
let name = config.network.node_name.clone();
|
||||
let disable_grandpa = config.disable_grandpa;
|
||||
|
||||
// sentry nodes announce themselves as authorities to the network
|
||||
// and should run the same protocols authorities do, but it should
|
||||
// never actively participate in any consensus process.
|
||||
let participates_in_consensus = is_authority && !config.sentry_mode;
|
||||
|
||||
let (builder, mut import_setup, inherent_data_providers) = new_full_start!(config);
|
||||
|
||||
let (block_import, grandpa_link) =
|
||||
|
@ -96,11 +91,9 @@ pub fn new_full(config: Configuration)
|
|||
})?
|
||||
.build()?;
|
||||
|
||||
if participates_in_consensus {
|
||||
let proposer = sc_basic_authorship::ProposerFactory::new(
|
||||
service.client(),
|
||||
service.transaction_pool()
|
||||
);
|
||||
if role.is_authority() {
|
||||
let proposer =
|
||||
sc_basic_authorship::ProposerFactory::new(service.client(), service.transaction_pool());
|
||||
|
||||
let client = service.client();
|
||||
let select_chain = service.select_chain()
|
||||
|
@ -129,20 +122,20 @@ pub fn new_full(config: Configuration)
|
|||
|
||||
// if the node isn't actively participating in consensus then it doesn't
|
||||
// need a keystore, regardless of which protocol we use below.
|
||||
let keystore = if participates_in_consensus {
|
||||
let keystore = if role.is_authority() {
|
||||
Some(service.keystore())
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let grandpa_config = grandpa::Config {
|
||||
let grandpa_config = sc_finality_grandpa::Config {
|
||||
// FIXME #1578 make this available through chainspec
|
||||
gossip_duration: Duration::from_millis(333),
|
||||
justification_period: 512,
|
||||
name: Some(name),
|
||||
observer_enabled: false,
|
||||
keystore,
|
||||
is_authority,
|
||||
is_authority: role.is_network_authority(),
|
||||
};
|
||||
|
||||
let enable_grandpa = !disable_grandpa;
|
||||
|
@ -153,13 +146,13 @@ pub fn new_full(config: Configuration)
|
|||
// and vote data availability than the observer. The observer has not
|
||||
// been tested extensively yet and having most nodes in a network run it
|
||||
// could lead to finality stalls.
|
||||
let grandpa_config = grandpa::GrandpaParams {
|
||||
let grandpa_config = sc_finality_grandpa::GrandpaParams {
|
||||
config: grandpa_config,
|
||||
link: grandpa_link,
|
||||
network: service.network(),
|
||||
inherent_data_providers: inherent_data_providers.clone(),
|
||||
telemetry_on_connect: Some(service.telemetry_on_connect_stream()),
|
||||
voting_rule: grandpa::VotingRulesBuilder::default().build(),
|
||||
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
||||
prometheus_registry: service.prometheus_registry()
|
||||
};
|
||||
|
||||
|
@ -167,10 +160,10 @@ pub fn new_full(config: Configuration)
|
|||
// if it fails we take down the service with it.
|
||||
service.spawn_essential_task(
|
||||
"grandpa-voter",
|
||||
grandpa::run_grandpa_voter(grandpa_config)?
|
||||
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?
|
||||
);
|
||||
} else {
|
||||
grandpa::setup_disabled_grandpa(
|
||||
sc_finality_grandpa::setup_disabled_grandpa(
|
||||
service.client(),
|
||||
&inherent_data_providers,
|
||||
service.network(),
|
||||
|
@ -204,7 +197,7 @@ pub fn new_light(config: Configuration)
|
|||
let fetch_checker = fetcher
|
||||
.map(|fetcher| fetcher.checker().clone())
|
||||
.ok_or_else(|| "Trying to start light import queue without active fetch checker")?;
|
||||
let grandpa_block_import = grandpa::light_block_import(
|
||||
let grandpa_block_import = sc_finality_grandpa::light_block_import(
|
||||
client.clone(),
|
||||
backend,
|
||||
&(client.clone() as Arc<_>),
|
||||
|
|
|
@ -6,44 +6,40 @@ homepage = 'https://substrate.dev'
|
|||
license = 'Unlicense'
|
||||
name = 'pallet-template'
|
||||
repository = 'https://github.com/paritytech/substrate/'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ['x86_64-unknown-linux-gnu']
|
||||
|
||||
[dependencies.codec]
|
||||
default-features = false
|
||||
features = ['derive']
|
||||
package = 'parity-scale-codec'
|
||||
version = '1.2.0'
|
||||
version = '1.3.0'
|
||||
|
||||
[dependencies.frame-support]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.safe-mix]
|
||||
[dependencies.frame-system]
|
||||
default-features = false
|
||||
version = '1.0.0'
|
||||
|
||||
[dependencies.system]
|
||||
default-features = false
|
||||
package = 'frame-system'
|
||||
version = '2.0.0-alpha.5'
|
||||
|
||||
version = '2.0.0-alpha.6'
|
||||
[dev-dependencies.sp-core]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dev-dependencies.sp-io]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dev-dependencies.sp-runtime]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[features]
|
||||
default = ['std']
|
||||
std = [
|
||||
'codec/std',
|
||||
'frame-support/std',
|
||||
'safe-mix/std',
|
||||
'system/std',
|
||||
'frame-system/std',
|
||||
]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/// https://github.com/paritytech/substrate/blob/master/frame/example/src/lib.rs
|
||||
|
||||
use frame_support::{decl_module, decl_storage, decl_event, decl_error, dispatch};
|
||||
use system::ensure_signed;
|
||||
use frame_system::{self as system, ensure_signed};
|
||||
|
||||
#[cfg(test)]
|
||||
mod mock;
|
||||
|
@ -75,6 +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()]
|
||||
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)?;
|
||||
|
@ -90,6 +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()]
|
||||
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)?;
|
||||
|
|
|
@ -6,6 +6,7 @@ use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
|
|||
use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentityLookup}, testing::Header, Perbill,
|
||||
};
|
||||
use frame_system as system;
|
||||
|
||||
impl_outer_origin! {
|
||||
pub enum Origin for Test {}
|
||||
|
|
|
@ -1,45 +1,36 @@
|
|||
[package]
|
||||
authors = ['Anonymous']
|
||||
edition = '2018'
|
||||
homepage = 'https://substrate.dev'
|
||||
license = 'Unlicense'
|
||||
name = 'node-template-runtime'
|
||||
repository = 'https://github.com/paritytech/substrate/'
|
||||
version = '2.0.0-alpha.5'
|
||||
|
||||
[dependencies.aura]
|
||||
default-features = false
|
||||
package = 'pallet-aura'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.balances]
|
||||
default-features = false
|
||||
package = 'pallet-balances'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.codec]
|
||||
default-features = false
|
||||
features = ['derive']
|
||||
package = 'parity-scale-codec'
|
||||
version = '1.2.0'
|
||||
version = '1.3.0'
|
||||
|
||||
[dependencies.frame-executive]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.frame-support]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.grandpa]
|
||||
default-features = false
|
||||
package = 'pallet-grandpa'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.randomness-collective-flip]
|
||||
default-features = false
|
||||
package = 'pallet-randomness-collective-flip'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.serde]
|
||||
features = ['derive']
|
||||
|
@ -48,81 +39,94 @@ version = '1.0.101'
|
|||
|
||||
[dependencies.sp-api]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-block-builder]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-consensus-aura]
|
||||
default-features = false
|
||||
version = '0.8.0-alpha.5'
|
||||
version = '0.8.0-alpha.6'
|
||||
|
||||
[dependencies.sp-core]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-inherents]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-io]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-offchain]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-runtime]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-session]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-std]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-transaction-pool]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sp-version]
|
||||
default-features = false
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.sudo]
|
||||
default-features = false
|
||||
package = 'pallet-sudo'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.system]
|
||||
default-features = false
|
||||
package = 'frame-system'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.template]
|
||||
default-features = false
|
||||
package = 'pallet-template'
|
||||
path = '../pallets/template'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.timestamp]
|
||||
default-features = false
|
||||
package = 'pallet-timestamp'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[dependencies.transaction-payment]
|
||||
default-features = false
|
||||
package = 'pallet-transaction-payment'
|
||||
version = '2.0.0-alpha.5'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[build-dependencies.wasm-builder-runner]
|
||||
package = 'substrate-wasm-builder-runner'
|
||||
version = '1.0.5'
|
||||
|
||||
[package]
|
||||
authors = ['Anonymous']
|
||||
edition = '2018'
|
||||
homepage = 'https://substrate.dev'
|
||||
license = 'Unlicense'
|
||||
name = 'node-template-runtime'
|
||||
repository = 'https://github.com/paritytech/substrate/'
|
||||
version = '2.0.0-alpha.6'
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ['x86_64-unknown-linux-gnu']
|
||||
|
||||
[features]
|
||||
default = ['std']
|
||||
std = [
|
||||
|
|
|
@ -11,8 +11,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
|
|||
use sp_std::prelude::*;
|
||||
use sp_core::OpaqueMetadata;
|
||||
use sp_runtime::{
|
||||
ApplyExtrinsicResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
|
||||
impl_opaque_keys, MultiSignature,
|
||||
ApplyExtrinsicResult, generic, create_runtime_str, impl_opaque_keys, MultiSignature,
|
||||
transaction_validity::{TransactionValidity, TransactionSource},
|
||||
};
|
||||
use sp_runtime::traits::{
|
||||
BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount
|
||||
|
@ -318,8 +318,11 @@ impl_runtime_apis! {
|
|||
}
|
||||
|
||||
impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
|
||||
fn validate_transaction(tx: <Block as BlockT>::Extrinsic) -> TransactionValidity {
|
||||
Executive::validate_transaction(tx)
|
||||
fn validate_transaction(
|
||||
source: TransactionSource,
|
||||
tx: <Block as BlockT>::Extrinsic,
|
||||
) -> TransactionValidity {
|
||||
Executive::validate_transaction(source, tx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue