Skip to content
Snippets Groups Projects
Commit 2a1ae954 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

wip: compilation ok (pallet_session)

parent 373fe275
No related branches found
No related tags found
No related merge requests found
...@@ -62,7 +62,7 @@ pub mod pallet { ...@@ -62,7 +62,7 @@ pub mod pallet {
+ pallet_authorship::Config + pallet_authorship::Config
// + pallet_certification::Config<I, IdtyIndex = IdtyIndex> // + pallet_certification::Config<I, IdtyIndex = IdtyIndex>
+ pallet_identity::Config<IdtyIndex = IdtyIndex> + pallet_identity::Config<IdtyIndex = IdtyIndex>
// + pallet_session::Config + pallet_session::Config
{ {
/// Because this pallet emits events, it depends on the runtime's definition of an event. /// Because this pallet emits events, it depends on the runtime's definition of an event.
type RuntimeEvent: From<Event<Self, I>> type RuntimeEvent: From<Event<Self, I>>
......
...@@ -22,7 +22,7 @@ use frame_support::{ ...@@ -22,7 +22,7 @@ use frame_support::{
use frame_system as system; use frame_system as system;
use pallet_session::{ShouldEndSession, TestSessionHandler}; use pallet_session::{ShouldEndSession, TestSessionHandler};
use sp_core::{ConstU32, H256}; use sp_core::{ConstU32, H256};
use sp_runtime::testing::UintAuthorityId; use sp_runtime::testing::{TestSignature, UintAuthorityId};
use sp_runtime::traits::{ConvertInto, IdentifyAccount, IsMember, Verify}; use sp_runtime::traits::{ConvertInto, IdentifyAccount, IsMember, Verify};
use sp_runtime::{ use sp_runtime::{
impl_opaque_keys, impl_opaque_keys,
...@@ -38,9 +38,9 @@ pub type IdtyIndex = u64; ...@@ -38,9 +38,9 @@ pub type IdtyIndex = u64;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>; type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
pub type Signature = MultiSignature; pub type Signature = MultiSignature;
pub type AccountPublic = <Signature as Verify>::Signer; pub type AccountPublic = <Signature as Verify>::Signer;
pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId; // pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
// 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>; // type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
...@@ -52,12 +52,12 @@ frame_support::construct_runtime!( ...@@ -52,12 +52,12 @@ frame_support::construct_runtime!(
UncheckedExtrinsic = UncheckedExtrinsic, UncheckedExtrinsic = UncheckedExtrinsic,
{ {
System: frame_system::{Pallet, Call, Config, Storage, Event<T>}, System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
// Session: pallet_session::{Pallet, Call, Storage, Config<T>, Event}, Session: pallet_session::{Pallet, Call, Storage, Config<T>, Event},
Authorship: pallet_authorship::{Pallet, Call, Storage}, Authorship: pallet_authorship::{Pallet, Call, Storage},
Distance: pallet_distance::{Pallet, Call, Config<T>, Storage, Event<T>}, Distance: pallet_distance::{Pallet, Call, Config<T>, Storage, Event<T>},
Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>}, Identity: pallet_identity::{Pallet, Call, Config<T>, Storage, Event<T>},
// Cert: pallet_certification::{Pallet, Call, Config<T>, Storage, Event<T>}, // Cert: pallet_certification::{Pallet, Call, Config<T>, Storage, Event<T>},
// AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>}, AuthorityMembers: pallet_authority_members::{Pallet, Call, Storage, Config<T>, Event<T>},
} }
); );
...@@ -77,7 +77,7 @@ impl system::Config for Test { ...@@ -77,7 +77,7 @@ impl system::Config for Test {
type BlockNumber = BlockNumber; type BlockNumber = BlockNumber;
type Hash = H256; type Hash = H256;
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
type AccountId = AccountId; type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
...@@ -137,17 +137,17 @@ impl ShouldEndSession<u64> for TestShouldEndSession { ...@@ -137,17 +137,17 @@ impl ShouldEndSession<u64> for TestShouldEndSession {
} }
} }
// impl pallet_session::Config for Test { impl pallet_session::Config for Test {
// type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
// type ValidatorId = u64; type ValidatorId = u64;
// type ValidatorIdOf = ConvertInto; type ValidatorIdOf = ConvertInto;
// type ShouldEndSession = TestShouldEndSession; type ShouldEndSession = TestShouldEndSession;
// type NextSessionRotation = (); type NextSessionRotation = ();
// type SessionManager = AuthorityMembers; type SessionManager = AuthorityMembers;
// type SessionHandler = TestSessionHandler; type SessionHandler = TestSessionHandler;
// type Keys = MockSessionKeys; type Keys = MockSessionKeys;
// type WeightInfo = (); type WeightInfo = ();
// } }
parameter_types! { parameter_types! {
pub const ChangeOwnerKeyPeriod: u64 = 10; pub const ChangeOwnerKeyPeriod: u64 = 10;
...@@ -172,12 +172,12 @@ impl pallet_identity::Config for Test { ...@@ -172,12 +172,12 @@ impl pallet_identity::Config for Test {
type IdtyData = (); type IdtyData = ();
type IdtyNameValidator = IdtyNameValidatorTestImpl; type IdtyNameValidator = IdtyNameValidatorTestImpl;
type IdtyIndex = u64; type IdtyIndex = u64;
type NewOwnerKeySigner = AccountPublic; type NewOwnerKeySigner = UintAuthorityId;
type NewOwnerKeySignature = Signature; type NewOwnerKeySignature = TestSignature;
type OnIdtyChange = (); type OnIdtyChange = ();
type RemoveIdentityConsumers = (); type RemoveIdentityConsumers = ();
type RevocationSigner = AccountPublic; type RevocationSigner = UintAuthorityId;
type RevocationSignature = Signature; type RevocationSignature = TestSignature;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
} }
...@@ -217,20 +217,20 @@ impl IsMember<u64> for TestIsSmithMember { ...@@ -217,20 +217,20 @@ impl IsMember<u64> for TestIsSmithMember {
} }
} }
// impl pallet_authority_members::Config for Test { impl pallet_authority_members::Config for Test {
// type KeysWrapper = MockSessionKeys; type KeysWrapper = MockSessionKeys;
// type IsMember = TestIsSmithMember; type IsMember = TestIsSmithMember;
// type MaxAuthorities = ConstU32<4>; type MaxAuthorities = ConstU32<4>;
// type MaxKeysLife = ConstU32<5>; type MaxKeysLife = ConstU32<5>;
// type MaxOfflineSessions = ConstU32<2>; type MaxOfflineSessions = ConstU32<2>;
// type MemberId = u64; type MemberId = u64;
// type MemberIdOf = ConvertInto; type MemberIdOf = ConvertInto;
// type OnNewSession = (); type OnNewSession = ();
// type OnRemovedMember = (); type OnRemovedMember = ();
// type RemoveMemberOrigin = system::EnsureRoot<u64>; type RemoveMemberOrigin = system::EnsureRoot<u64>;
// type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
// type WeightInfo = (); type WeightInfo = ();
// } }
pub struct FullIdentificationOfImpl; pub struct FullIdentificationOfImpl;
impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOfImpl { impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOfImpl {
...@@ -238,20 +238,20 @@ impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOf ...@@ -238,20 +238,20 @@ impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOf
Some(()) Some(())
} }
} }
// impl pallet_session::historical::Config for Test { impl pallet_session::historical::Config for Test {
// type FullIdentification = (); type FullIdentification = ();
// type FullIdentificationOf = FullIdentificationOfImpl; type FullIdentificationOf = FullIdentificationOfImpl;
// } }
// Build genesis storage according to the mock runtime. // Build genesis storage according to the mock runtime.
pub fn new_test_ext() -> sp_io::TestExternalities { pub fn new_test_ext() -> sp_io::TestExternalities {
GenesisConfig { GenesisConfig {
system: SystemConfig::default(), system: SystemConfig::default(),
// authority_members: pallet_authority_members::GenesisConfig::default(), authority_members: pallet_authority_members::GenesisConfig::default(),
// cert: pallet_certification::GenesisConfig::default(), // cert: pallet_certification::GenesisConfig::default(),
distance: pallet_distance::GenesisConfig::default(), distance: pallet_distance::GenesisConfig::default(),
identity: pallet_identity::GenesisConfig::default(), identity: pallet_identity::GenesisConfig::default(),
// session: pallet_session::GenesisConfig::default(), session: pallet_session::GenesisConfig::default(),
} }
.build_storage() .build_storage()
.unwrap() .unwrap()
......
...@@ -19,7 +19,7 @@ use frame_support::{assert_noop, assert_ok}; ...@@ -19,7 +19,7 @@ use frame_support::{assert_noop, assert_ok};
use sp_std::collections::btree_map::BTreeMap; use sp_std::collections::btree_map::BTreeMap;
#[test] #[test]
fn test_must_receive_cert_before_can_issue() { fn test_compilation() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
assert_eq!(true, true); assert_eq!(true, true);
// assert_eq!( // assert_eq!(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment