Commit 05b1c168 authored by Bastian Köcher's avatar Bastian Köcher Committed by Gavin Wood
Browse files

Update to latest Substrate master (#472)

* Update to latest Substrate master

* Fix

* Fix compilation
parent 2213e91d
Pipeline #53758 passed with stages
in 16 minutes and 22 seconds
This diff is collapsed.
......@@ -114,4 +114,5 @@ std = [
"babe/std",
"babe-primitives/std",
"substrate-session/std",
"randomness-collective-flip/std",
]
......@@ -27,8 +27,7 @@ use serde::{self, Serialize, Deserialize, Serializer, Deserializer};
#[cfg(feature = "std")]
use sr_primitives::traits::Zero;
use sr_primitives::{
weights::SimpleDispatchInfo,
traits::ValidateUnsigned,
weights::SimpleDispatchInfo, traits::ValidateUnsigned,
transaction_validity::{
TransactionLongevity, TransactionValidity, ValidTransaction, InvalidTransaction
},
......@@ -237,8 +236,7 @@ mod tests {
use hex_literal::hex;
use super::*;
use sr_io::with_externalities;
use substrate_primitives::{H256, Blake2Hasher};
use substrate_primitives::H256;
use codec::Encode;
// The testing primitives are very useful for avoiding having to work with signatures
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
......@@ -348,7 +346,7 @@ mod tests {
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> sr_io::TestExternalities<Blake2Hasher> {
fn new_test_ext() -> sr_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
// We use default for brevity, but you can configure as desired if needed.
balances::GenesisConfig::<Test>::default().assimilate_storage(&mut t).unwrap();
......@@ -360,7 +358,7 @@ mod tests {
#[test]
fn basic_setup_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Claims::total(), 100);
assert_eq!(Claims::claims(&alice_eth()), Some(100));
assert_eq!(Claims::claims(&EthereumAddress::default()), None);
......@@ -378,7 +376,7 @@ mod tests {
#[test]
fn claiming_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Balances::free_balance(&42), 0);
assert_ok!(Claims::claim(Origin::NONE, 42, alice_sig(&42u64.encode())));
assert_eq!(Balances::free_balance(&42), 100);
......@@ -387,7 +385,7 @@ mod tests {
#[test]
fn origin_signed_claiming_fail() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Balances::free_balance(&42), 0);
assert_err!(
Claims::claim(Origin::signed(42), 42, alice_sig(&42u64.encode())),
......@@ -398,7 +396,7 @@ mod tests {
#[test]
fn double_claiming_doesnt_work() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Balances::free_balance(&42), 0);
assert_ok!(Claims::claim(Origin::NONE, 42, alice_sig(&42u64.encode())));
assert_noop!(Claims::claim(Origin::NONE, 42, alice_sig(&42u64.encode())), "Ethereum address has no claim");
......@@ -407,7 +405,7 @@ mod tests {
#[test]
fn non_sender_sig_doesnt_work() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Balances::free_balance(&42), 0);
assert_noop!(Claims::claim(Origin::NONE, 42, alice_sig(&69u64.encode())), "Ethereum address has no claim");
});
......@@ -415,7 +413,7 @@ mod tests {
#[test]
fn non_claimant_doesnt_work() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(Balances::free_balance(&42), 0);
assert_noop!(Claims::claim(Origin::NONE, 42, bob_sig(&69u64.encode())), "Ethereum address has no claim");
});
......@@ -423,7 +421,7 @@ mod tests {
#[test]
fn real_eth_sig_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// "Pay RUSTs to the TEST account:2a00000000000000"
let sig = hex!["444023e89b67e67c0562ed0305d252a5dd12b2af5ac51d6d3cb69a0b486bc4b3191401802dc29d26d586221f7256cd3329fe82174bdf659baea149a40e1c495d1c"];
let sig = EcdsaSignature(sig);
......@@ -435,7 +433,7 @@ mod tests {
#[test]
fn validate_unsigned_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(
<Module<Test>>::validate_unsigned(&Call::claim(1, alice_sig(&1u64.encode()))),
Ok(ValidTransaction {
......
......@@ -502,9 +502,8 @@ mod tests {
use std::{collections::HashMap, cell::RefCell};
use srml_support::{impl_outer_origin, assert_ok, assert_noop, parameter_types};
use sr_io::with_externalities;
use substrate_primitives::{H256, Blake2Hasher};
use primitives::parachain::Info as ParaInfo;
use substrate_primitives::H256;
use primitives::parachain::{Info as ParaInfo, Id as ParaId};
// The testing primitives are very useful for avoiding having to work with signatures
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are requried.
use sr_primitives::{
......@@ -639,6 +638,7 @@ mod tests {
type Parachains = TestParachains;
type LeasePeriod = LeasePeriod;
type EndingPeriod = EndingPeriod;
type Randomness = RandomnessCollectiveFlip;
}
parameter_types! {
pub const SubmissionDeposit: u64 = 1;
......@@ -658,10 +658,11 @@ mod tests {
type Slots = slots::Module<Test>;
type Treasury = treasury::Module<Test>;
type Crowdfund = Module<Test>;
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
// This function basically just builds a genesis storage key/value store according to
// our desired mockup.
fn new_test_ext() -> sr_io::TestExternalities<Blake2Hasher> {
fn new_test_ext() -> sr_io::TestExternalities {
let mut t = system::GenesisConfig::default().build_storage::<Test>().unwrap();
balances::GenesisConfig::<Test>{
balances: vec![(1, 1000), (2, 2000), (3, 3000), (4, 4000)],
......@@ -688,7 +689,7 @@ mod tests {
#[test]
fn basic_setup_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
assert_eq!(System::block_number(), 1);
assert_eq!(Crowdfund::fund_count(), 0);
assert_eq!(Crowdfund::funds(0), None);
......@@ -701,7 +702,7 @@ mod tests {
#[test]
fn create_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Now try to create a crowdfund campaign
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Crowdfund::fund_count(), 1);
......@@ -732,7 +733,7 @@ mod tests {
#[test]
fn create_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Cannot create a crowdfund with bad slots
assert_noop!(Crowdfund::create(Origin::signed(1), 1000, 4, 1, 9), "last slot must be greater than first slot");
assert_noop!(Crowdfund::create(Origin::signed(1), 1000, 1, 5, 9), "last slot cannot be more then 3 more than first slot");
......@@ -744,7 +745,7 @@ mod tests {
#[test]
fn contribute_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
......@@ -774,7 +775,7 @@ mod tests {
#[test]
fn contribute_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Cannot contribute to non-existing fund
assert_noop!(Crowdfund::contribute(Origin::signed(1), 0, 49), "invalid fund index");
// Cannot contribute below minimum contribution
......@@ -797,7 +798,7 @@ mod tests {
#[test]
fn fix_deploy_data_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
......@@ -819,7 +820,7 @@ mod tests {
#[test]
fn fix_deploy_data_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
assert_eq!(Balances::free_balance(1), 999);
......@@ -862,7 +863,7 @@ mod tests {
#[test]
fn onboard_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -897,7 +898,7 @@ mod tests {
#[test]
fn onboard_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -934,7 +935,7 @@ mod tests {
#[test]
fn begin_retirement_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -976,7 +977,7 @@ mod tests {
#[test]
fn begin_retirement_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -1020,7 +1021,7 @@ mod tests {
#[test]
fn withdraw_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -1046,7 +1047,7 @@ mod tests {
#[test]
fn withdraw_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -1070,7 +1071,7 @@ mod tests {
#[test]
fn dissolve_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -1105,7 +1106,7 @@ mod tests {
#[test]
fn dissolve_handles_basic_errors() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Set up a crowdfund
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
......@@ -1137,7 +1138,7 @@ mod tests {
#[test]
fn fund_before_auction_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Create a crowdfund before an auction is created
assert_ok!(Crowdfund::create(Origin::signed(1), 1000, 1, 4, 9));
// Users can already contribute
......@@ -1175,7 +1176,7 @@ mod tests {
#[test]
fn fund_across_multiple_auctions_works() {
with_externalities(&mut new_test_ext(), || {
new_test_ext().execute_with(|| {
// Create an auction
assert_ok!(Slots::new_auction(Origin::ROOT, 5, 1));
// Create two competing crowdfunds, with end dates across multiple auctions
......
......@@ -54,7 +54,7 @@ use version::NativeVersion;
use substrate_primitives::OpaqueMetadata;
use sr_staking_primitives::SessionIndex;
use srml_support::{
parameter_types, construct_runtime, traits::{SplitTwoWays, Currency}
parameter_types, construct_runtime, traits::{SplitTwoWays, Currency, Randomness}
};
use authority_discovery_primitives::{AuthorityId as EncodedAuthorityId, Signature as EncodedSignature};
use im_online::sr25519::AuthorityId as ImOnlineId;
......@@ -480,6 +480,7 @@ impl parachains::Trait for Runtime {
type Origin = Origin;
type Call = Call;
type ParachainCurrency = Balances;
type Randomness = RandomnessCollectiveFlip;
type ActiveParachains = Registrar;
type Registrar = Registrar;
}
......@@ -511,6 +512,7 @@ impl slots::Trait for Runtime {
type Parachains = Registrar;
type LeasePeriod = LeasePeriod;
type EndingPeriod = EndingPeriod;
type Randomness = RandomnessCollectiveFlip;
}
parameter_types!{
......
......@@ -27,14 +27,16 @@ use sr_primitives::traits::{
AccountIdConversion,
};
use sr_primitives::weights::SimpleDispatchInfo;
use primitives::{Hash, Balance, parachain::{
self, Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement,
ParachainDispatchOrigin, UpwardMessage, BlockIngressRoots, ValidatorId, ActiveParas, CollatorId,
Retriable
}};
use {system, session};
use primitives::{
Hash, Balance,
parachain::{
self, Id as ParaId, Chain, DutyRoster, AttestedCandidate, Statement, ParachainDispatchOrigin,
UpwardMessage, BlockIngressRoots, ValidatorId, ActiveParas, CollatorId, Retriable
},
};
use srml_support::{
Parameter, dispatch::Result, traits::{Currency, Get, WithdrawReason, ExistenceRequirement},
Parameter, dispatch::Result,
traits::{Currency, Get, WithdrawReason, ExistenceRequirement, Randomness},
};
use inherents::{ProvideInherent, InherentData, RuntimeString, MakeFatalError, InherentIdentifier};
......@@ -119,6 +121,9 @@ pub trait Trait: attestations::Trait {
/// Some way of interacting with balances for fees.
type ParachainCurrency: ParachainCurrency<Self::AccountId>;
/// Something that provides randomness in the runtime.
type Randomness: Randomness<Self::Hash>;
/// Means to determine what the current set of active parachains are.
type ActiveParachains: ActiveParas;
......@@ -517,7 +522,7 @@ impl<T: Trait> Module<T> {
let mut seed = {
let phrase = b"validator_role_pairs";
let seed = randomness_collective_flip::Module::<T>::random(&phrase[..]);
let seed = T::Randomness::random(&phrase[..]);
let seed_len = seed.as_ref().len();
let needed_bytes = validator_count * 4;
......@@ -882,7 +887,7 @@ mod tests {
use super::*;
use super::Call as ParachainsCall;
use bitvec::{bitvec, vec::BitVec};
use sr_io::{TestExternalities, with_externalities};
use sr_io::TestExternalities;
use substrate_primitives::{H256, Blake2Hasher};
use substrate_trie::NodeCodec;
use sr_primitives::{
......@@ -1061,6 +1066,7 @@ mod tests {
type Parachains = registrar::Module<Test>;
type EndingPeriod = EndingPeriod;
type LeasePeriod = LeasePeriod;
type Randomness = RandomnessCollectiveFlip;
}
parameter_types! {
......@@ -1083,6 +1089,7 @@ mod tests {
type Origin = Origin;
type Call = Call;
type ParachainCurrency = balances::Module<Test>;
type Randomness = RandomnessCollectiveFlip;
type ActiveParachains = registrar::Module<Test>;
type Registrar = registrar::Module<Test>;
}
......@@ -1092,7 +1099,7 @@ mod tests {
type RandomnessCollectiveFlip = randomness_collective_flip::Module<Test>;
type Registrar = registrar::Module<Test>;
fn new_test_ext(parachains: Vec<(ParaId, Vec<u8>, Vec<u8>)>) -> TestExternalities<Blake2Hasher> {
fn new_test_ext(parachains: Vec<(ParaId, Vec<u8>, Vec<u8>)>) -> TestExternalities {
use staking::StakerStatus;
use babe::AuthorityId as BabeAuthorityId;
......@@ -1287,7 +1294,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
(2u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains.clone()), || {
new_test_ext(parachains.clone()).execute_with(|| {
init_block();
queue_upward_messages(0.into(), &vec![
UpwardMessage { origin: ParachainDispatchOrigin::Parachain, data: vec![0; 4] }
......@@ -1304,7 +1311,7 @@ mod tests {
assert!(<RelayDispatchQueue>::get(ParaId::from(0)).is_empty());
assert_eq!(<RelayDispatchQueue>::get(ParaId::from(1)).len(), 1);
});
with_externalities(&mut new_test_ext(parachains.clone()), || {
new_test_ext(parachains.clone()).execute_with(|| {
init_block();
queue_upward_messages(0.into(), &vec![
UpwardMessage { origin: ParachainDispatchOrigin::Parachain, data: vec![0; 2] }
......@@ -1326,7 +1333,7 @@ mod tests {
assert_eq!(<RelayDispatchQueue>::get(ParaId::from(1)).len(), 1);
assert!(<RelayDispatchQueue>::get(ParaId::from(2)).is_empty());
});
with_externalities(&mut new_test_ext(parachains.clone()), || {
new_test_ext(parachains.clone()).execute_with(|| {
init_block();
queue_upward_messages(0.into(), &vec![
UpwardMessage { origin: ParachainDispatchOrigin::Parachain, data: vec![0; 2] }
......@@ -1348,7 +1355,7 @@ mod tests {
assert_eq!(<RelayDispatchQueue>::get(ParaId::from(1)).len(), 1);
assert!(<RelayDispatchQueue>::get(ParaId::from(2)).is_empty());
});
with_externalities(&mut new_test_ext(parachains.clone()), || {
new_test_ext(parachains.clone()).execute_with(|| {
init_block();
queue_upward_messages(0.into(), &vec![
UpwardMessage { origin: ParachainDispatchOrigin::Parachain, data: vec![0; 2] }
......@@ -1377,7 +1384,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
let messages = vec![
UpwardMessage { origin: ParachainDispatchOrigin::Signed, data: vec![0] }
......@@ -1405,7 +1412,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// oversize, but ok since it's just one and the queue is empty.
let messages = vec![
......@@ -1441,7 +1448,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// too many messages.
queue_upward_messages(0.into(), &vec![
......@@ -1463,7 +1470,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// too much data.
queue_upward_messages(0.into(), &vec![
......@@ -1484,7 +1491,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// bad - already an oversize messages queued.
queue_upward_messages(0.into(), &vec![
......@@ -1505,7 +1512,7 @@ mod tests {
let parachains = vec![
(0u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// bad - oversized and already a message queued.
queue_upward_messages(0.into(), &vec![
......@@ -1529,7 +1536,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// parachain 0 is self
let mut candidates = vec![
......@@ -1559,7 +1566,7 @@ mod tests {
(100u32.into(), vec![4,5,6], vec![2]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
assert_eq!(Parachains::active_parachains(), vec![(5u32.into(), None), (100u32.into(), None)]);
assert_eq!(Parachains::parachain_code(ParaId::from(5u32)), Some(vec![1, 2, 3]));
......@@ -1574,7 +1581,7 @@ mod tests {
(100u32.into(), vec![4,5,6], vec![2,]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
assert_eq!(Parachains::active_parachains(), vec![(5u32.into(), None), (100u32.into(), None)]);
......@@ -1607,7 +1614,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
let check_roster = |duty_roster: &DutyRoster| {
assert_eq!(duty_roster.validator_duty.len(), 8);
......@@ -1643,7 +1650,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
let candidate = AttestedCandidate {
validity_votes: vec![],
......@@ -1672,7 +1679,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
assert_eq!(Parachains::active_parachains().len(), 2);
......@@ -1728,7 +1735,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
let mut candidate = AttestedCandidate {
validity_votes: vec![],
......@@ -1765,7 +1772,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
let mut candidate = AttestedCandidate {
validity_votes: vec![],
......@@ -1803,7 +1810,7 @@ mod tests {
(99u32.into(), vec![1, 2, 3], vec![4, 5, 6]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains).execute_with(|| {
assert_eq!(Parachains::ingress(ParaId::from(1), None), Some(Vec::new()));
assert_eq!(Parachains::ingress(ParaId::from(99), None), Some(Vec::new()));
......@@ -1925,7 +1932,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// parachain 99 does not exist
let non_existent = vec![(99.into(), [1; 32].into())];
......@@ -1950,7 +1957,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// parachain 0 is self
let to_self = vec![(0.into(), [1; 32].into())];
......@@ -1975,7 +1982,7 @@ mod tests {
(1u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// parachain 0 is self
let out_of_order = vec![(1.into(), [1; 32].into()), ((0.into(), [1; 32].into()))];
......@@ -2000,7 +2007,7 @@ mod tests {
(2u32.into(), vec![], vec![]),
];
with_externalities(&mut new_test_ext(parachains), || {
new_test_ext(parachains.clone()).execute_with(|| {
run_to_block(2);
// parachain 0 is self
let contains_empty_trie_root = vec![(1.into(), [1; 32].into()), ((2.into(), EMPTY_TRIE_ROOT.into()))];
......
......@@ -574,8 +574,8 @@ impl<T: Trait + Send + Sync> SignedExtension for LimitParathreadCommits<T> where
mod tests {
use super::*;
use bitvec::vec::BitVec;
use sr_io::{TestExternalities, with_externalities};
use substrate_primitives::{H256, Blake2Hasher, Pair};
use sr_io::TestExternalities;
use substrate_primitives::{H256, Pair};
use sr_primitives::{
traits::{
BlakeTwo256, IdentityLookup, ConvertInto, OnInitialize, OnFinalize, Dispatchable,
......@@ -673,6 +673,7 @@ mod tests {
type Parachains = Registrar;
type EndingPeriod = EndingPeriod;
type LeasePeriod = LeasePeriod;
type Randomness = RandomnessCollectiveFlip;
}
parameter_types!{
......@@ -709,6 +710,7 @@ mod tests {
type ParachainCurrency = balances::Module<Test>;
type ActiveParachains = Registrar;
type Registrar = Registrar;
type Randomness = RandomnessCollectiveFlip;
}