Skip to content
Snippets Groups Projects

Upgrade to polkadot-v1.6.0

Merged Benjamin Gallois requested to merge bgallois/duniter-v2s:update-polkadot-1.6.0 into master
10 files
+ 80
90
Compare changes
  • Side-by-side
  • Inline
Files
10
@@ -16,28 +16,24 @@
@@ -16,28 +16,24 @@
use super::*;
use super::*;
use crate::{self as pallet_authority_members};
use crate::{self as pallet_authority_members};
use frame_support::{
use frame_support::{pallet_prelude::*, parameter_types, traits::Everything};
pallet_prelude::*,
parameter_types,
traits::{Everything, GenesisBuild},
BasicExternalities,
};
use frame_system as system;
use frame_system as system;
use pallet_offences::traits::OnOffenceHandler;
use pallet_offences::traits::OnOffenceHandler;
use pallet_offences::SlashStrategy;
use pallet_offences::SlashStrategy;
use pallet_session::ShouldEndSession;
use pallet_session::ShouldEndSession;
use sp_core::{crypto::key_types::DUMMY, H256};
use sp_core::{crypto::key_types::DUMMY, H256};
 
use sp_runtime::BuildStorage;
use sp_runtime::{
use sp_runtime::{
impl_opaque_keys,
impl_opaque_keys,
testing::{Header, UintAuthorityId},
testing::UintAuthorityId,
traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys},
traits::{BlakeTwo256, ConvertInto, IdentityLookup, IsMember, OpaqueKeys},
KeyTypeId,
KeyTypeId,
};
};
use sp_staking::offence::OffenceDetails;
use sp_staking::offence::OffenceDetails;
 
use sp_state_machine::BasicExternalities;
type AccountId = u64;
type AccountId = u64;
type Block = frame_system::mocking::MockBlock<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
impl_opaque_keys! {
impl_opaque_keys! {
pub struct MockSessionKeys {
pub struct MockSessionKeys {
@@ -53,14 +49,11 @@ impl From<UintAuthorityId> for MockSessionKeys {
@@ -53,14 +49,11 @@ impl From<UintAuthorityId> for MockSessionKeys {
// Configure a mock runtime to test the pallet.
// Configure a mock runtime to test the pallet.
frame_support::construct_runtime!(
frame_support::construct_runtime!(
pub enum Test where
pub enum Test
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
System: frame_system,
Session: pallet_session::{Pallet, Call, Storage, Config<T>, Event},
Session: pallet_session,
AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>},
AuthorityMembers: pallet_authority_members,
}
}
);
);
@@ -73,16 +66,14 @@ impl system::Config for Test {
@@ -73,16 +66,14 @@ impl system::Config for Test {
type BaseCallFilter = Everything;
type BaseCallFilter = Everything;
type BlockWeights = ();
type BlockWeights = ();
type BlockLength = ();
type BlockLength = ();
 
type Block = Block;
type DbWeight = ();
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type RuntimeCall = RuntimeCall;
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Hash = H256;
type Hashing = BlakeTwo256;
type Hashing = BlakeTwo256;
type AccountId = AccountId;
type AccountId = AccountId;
type Lookup = IdentityLookup<Self::AccountId>;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = RuntimeEvent;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type BlockHashCount = BlockHashCount;
type Version = ();
type Version = ();
@@ -94,6 +85,8 @@ impl system::Config for Test {
@@ -94,6 +85,8 @@ impl system::Config for Test {
type SS58Prefix = SS58Prefix;
type SS58Prefix = SS58Prefix;
type OnSetCode = ();
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
 
type RuntimeTask = ();
 
type Nonce = u64;
}
}
pub struct TestSessionHandler;
pub struct TestSessionHandler;
@@ -172,10 +165,10 @@ pub fn new_test_ext(initial_authorities_len: u64) -> sp_io::TestExternalities {
@@ -172,10 +165,10 @@ pub fn new_test_ext(initial_authorities_len: u64) -> sp_io::TestExternalities {
.map(|i| (i * 3, i * 3, UintAuthorityId(i * 3).into()))
.map(|i| (i * 3, i * 3, UintAuthorityId(i * 3).into()))
.collect();
.collect();
let mut t = frame_system::GenesisConfig::default()
let mut t = frame_system::GenesisConfig::<Test>::default()
.build_storage::<Test>()
.build_storage()
.unwrap();
.unwrap();
BasicExternalities::execute_with_storage(&mut t, || {
BasicExternalities::build_storage(&mut t, || {
for (ref k, ..) in &keys {
for (ref k, ..) in &keys {
frame_system::Pallet::<Test>::inc_providers(k);
frame_system::Pallet::<Test>::inc_providers(k);
}
}
Loading