Make node-template in sync with node. (#3422)

* Make node-template in sync with node.

* Update service.rs

* Updated babe constants.

* Added SignedExtra for CheckVersion in node-template and subkey.

* Added CheckVersion SignedExtra for node.

* Fixed tests.

* Try fix integration test.

* Attempt 2 at fixing integration test.

* Update node-template/runtime/src/lib.rs
This commit is contained in:
Gautam Dhameja
2019-08-19 09:17:33 +02:00
committed by Gavin Wood
parent 8eacdb54de
commit 0bb44f5024
15 changed files with 456 additions and 181 deletions
+6 -3
View File
@@ -44,7 +44,7 @@ mod tests {
use keyring::{AccountKeyring, Ed25519Keyring, Sr25519Keyring};
use runtime_support::{Hashable, StorageValue, StorageMap, assert_eq_error_rate, traits::Currency};
use state_machine::{CodeExecutor, Externalities, TestExternalities as CoreTestExternalities};
use primitives::{ twox_128, blake2_256, Blake2Hasher, ChangesTrieConfiguration, NeverNativeValue, NativeOrEncoded};
use primitives::{twox_128, blake2_256, Blake2Hasher, ChangesTrieConfiguration, NeverNativeValue, NativeOrEncoded};
use node_primitives::{Hash, BlockNumber, AccountId, Balance, Index};
use sr_primitives::traits::{Header as HeaderT, Hash as HashT, Convert};
use sr_primitives::{generic::Era, ApplyOutcome, ApplyError, ApplyResult, Perbill};
@@ -55,7 +55,7 @@ mod tests {
Header, Block, UncheckedExtrinsic, CheckedExtrinsic, Call, Runtime, Balances, BuildStorage,
GenesisConfig, BalancesConfig, SessionConfig, StakingConfig, System, SystemConfig,
GrandpaConfig, IndicesConfig, ContractsConfig, Event, SessionKeys, SignedExtra,
TransferFee, TransactionBaseFee, TransactionByteFee,
TransferFee, TransactionBaseFee, TransactionByteFee
};
use node_runtime::constants::currency::*;
use node_runtime::impls::WeightToFee;
@@ -79,6 +79,8 @@ mod tests {
const GENESIS_HASH: [u8; 32] = [69u8; 32];
const VERSION: u32 = node_runtime::VERSION.spec_version;
type TestExternalities<H> = CoreTestExternalities<H, u64>;
/// Default transfer fee
@@ -122,7 +124,7 @@ mod tests {
fn sign(xt: CheckedExtrinsic) -> UncheckedExtrinsic {
match xt.signed {
Some((signed, extra)) => {
let payload = (xt.function, extra.clone(), GENESIS_HASH, GENESIS_HASH);
let payload = (xt.function, extra.clone(), VERSION, GENESIS_HASH, GENESIS_HASH);
let key = AccountKeyring::from_public(&signed).unwrap();
let signature = payload.using_encoded(|b| {
if b.len() > 256 {
@@ -145,6 +147,7 @@ mod tests {
fn signed_extra(nonce: Index, extra_fee: Balance) -> SignedExtra {
(
system::CheckVersion::new(),
system::CheckGenesis::new(),
system::CheckEra::from(Era::mortal(256, 0)),
system::CheckNonce::from(nonce),