Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Duniter v2S
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
2a1ae954
Commit
2a1ae954
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
wip: compilation ok (pallet_session)
parent
373fe275
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pallets/distance/src/lib.rs
+1
-1
1 addition, 1 deletion
pallets/distance/src/lib.rs
pallets/distance/src/mock.rs
+41
-41
41 additions, 41 deletions
pallets/distance/src/mock.rs
pallets/distance/src/tests.rs
+1
-1
1 addition, 1 deletion
pallets/distance/src/tests.rs
with
43 additions
and
43 deletions
pallets/distance/src/lib.rs
+
1
−
1
View file @
2a1ae954
...
...
@@ -62,7 +62,7 @@ pub mod pallet {
+
pallet_authorship
::
Config
// + pallet_certification::Config<I, 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.
type
RuntimeEvent
:
From
<
Event
<
Self
,
I
>>
...
...
This diff is collapsed.
Click to expand it.
pallets/distance/src/mock.rs
+
41
−
41
View file @
2a1ae954
...
...
@@ -22,7 +22,7 @@ use frame_support::{
use
frame_system
as
system
;
use
pallet_session
::{
ShouldEndSession
,
TestSessionHandler
};
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
::{
impl_opaque_keys
,
...
...
@@ -38,9 +38,9 @@ pub type IdtyIndex = u64;
type
UncheckedExtrinsic
=
frame_system
::
mocking
::
MockUncheckedExtrinsic
<
Test
>
;
pub
type
Signature
=
MultiSignature
;
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 UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
...
...
@@ -52,12 +52,12 @@ frame_support::construct_runtime!(
UncheckedExtrinsic
=
UncheckedExtrinsic
,
{
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
},
Distance
:
pallet_distance
::{
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>},
//
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 {
type
BlockNumber
=
BlockNumber
;
type
Hash
=
H256
;
type
Hashing
=
BlakeTwo256
;
type
AccountId
=
AccountId
;
type
AccountId
=
u64
;
type
Lookup
=
IdentityLookup
<
Self
::
AccountId
>
;
type
Header
=
Header
;
type
RuntimeEvent
=
RuntimeEvent
;
...
...
@@ -137,17 +137,17 @@ impl ShouldEndSession<u64> for TestShouldEndSession {
}
}
//
impl pallet_session::Config for Test {
//
type RuntimeEvent = RuntimeEvent;
//
type ValidatorId = u64;
//
type ValidatorIdOf = ConvertInto;
//
type ShouldEndSession = TestShouldEndSession;
//
type NextSessionRotation = ();
//
type SessionManager = AuthorityMembers;
//
type SessionHandler = TestSessionHandler;
//
type Keys = MockSessionKeys;
//
type WeightInfo = ();
//
}
impl
pallet_session
::
Config
for
Test
{
type
RuntimeEvent
=
RuntimeEvent
;
type
ValidatorId
=
u64
;
type
ValidatorIdOf
=
ConvertInto
;
type
ShouldEndSession
=
TestShouldEndSession
;
type
NextSessionRotation
=
();
type
SessionManager
=
AuthorityMembers
;
type
SessionHandler
=
TestSessionHandler
;
type
Keys
=
MockSessionKeys
;
type
WeightInfo
=
();
}
parameter_types!
{
pub
const
ChangeOwnerKeyPeriod
:
u64
=
10
;
...
...
@@ -172,12 +172,12 @@ impl pallet_identity::Config for Test {
type
IdtyData
=
();
type
IdtyNameValidator
=
IdtyNameValidatorTestImpl
;
type
IdtyIndex
=
u64
;
type
NewOwnerKeySigner
=
AccountPublic
;
type
NewOwnerKeySignature
=
Signature
;
type
NewOwnerKeySigner
=
UintAuthorityId
;
type
NewOwnerKeySignature
=
Test
Signature
;
type
OnIdtyChange
=
();
type
RemoveIdentityConsumers
=
();
type
RevocationSigner
=
AccountPublic
;
type
RevocationSignature
=
Signature
;
type
RevocationSigner
=
UintAuthorityId
;
type
RevocationSignature
=
Test
Signature
;
type
RuntimeEvent
=
RuntimeEvent
;
type
WeightInfo
=
();
}
...
...
@@ -217,20 +217,20 @@ impl IsMember<u64> for TestIsSmithMember {
}
}
//
impl pallet_authority_members::Config for Test {
//
type KeysWrapper = MockSessionKeys;
//
type IsMember = TestIsSmithMember;
//
type MaxAuthorities = ConstU32<4>;
//
type MaxKeysLife = ConstU32<5>;
//
type MaxOfflineSessions = ConstU32<2>;
//
type MemberId = u64;
//
type MemberIdOf = ConvertInto;
//
type OnNewSession = ();
//
type OnRemovedMember = ();
//
type RemoveMemberOrigin = system::EnsureRoot<u64>;
//
type RuntimeEvent = RuntimeEvent;
//
type WeightInfo = ();
//
}
impl
pallet_authority_members
::
Config
for
Test
{
type
KeysWrapper
=
MockSessionKeys
;
type
IsMember
=
TestIsSmithMember
;
type
MaxAuthorities
=
ConstU32
<
4
>
;
type
MaxKeysLife
=
ConstU32
<
5
>
;
type
MaxOfflineSessions
=
ConstU32
<
2
>
;
type
MemberId
=
u64
;
type
MemberIdOf
=
ConvertInto
;
type
OnNewSession
=
();
type
OnRemovedMember
=
();
type
RemoveMemberOrigin
=
system
::
EnsureRoot
<
u64
>
;
type
RuntimeEvent
=
RuntimeEvent
;
type
WeightInfo
=
();
}
pub
struct
FullIdentificationOfImpl
;
impl
sp_runtime
::
traits
::
Convert
<
AccountId
,
Option
<
()
>>
for
FullIdentificationOfImpl
{
...
...
@@ -238,20 +238,20 @@ impl sp_runtime::traits::Convert<AccountId, Option<()>> for FullIdentificationOf
Some
(())
}
}
//
impl pallet_session::historical::Config for Test {
//
type FullIdentification = ();
//
type FullIdentificationOf = FullIdentificationOfImpl;
//
}
impl
pallet_session
::
historical
::
Config
for
Test
{
type
FullIdentification
=
();
type
FullIdentificationOf
=
FullIdentificationOfImpl
;
}
// Build genesis storage according to the mock runtime.
pub
fn
new_test_ext
()
->
sp_io
::
TestExternalities
{
GenesisConfig
{
system
:
SystemConfig
::
default
(),
//
authority_members: pallet_authority_members::GenesisConfig::default(),
authority_members
:
pallet_authority_members
::
GenesisConfig
::
default
(),
// cert: pallet_certification::GenesisConfig::default(),
distance
:
pallet_distance
::
GenesisConfig
::
default
(),
identity
:
pallet_identity
::
GenesisConfig
::
default
(),
//
session: pallet_session::GenesisConfig::default(),
session
:
pallet_session
::
GenesisConfig
::
default
(),
}
.build_storage
()
.unwrap
()
...
...
This diff is collapsed.
Click to expand it.
pallets/distance/src/tests.rs
+
1
−
1
View file @
2a1ae954
...
...
@@ -19,7 +19,7 @@ use frame_support::{assert_noop, assert_ok};
use
sp_std
::
collections
::
btree_map
::
BTreeMap
;
#[test]
fn
test_
must_receive_cert_before_can_issue
()
{
fn
test_
compilation
()
{
new_test_ext
()
.execute_with
(||
{
assert_eq!
(
true
,
true
);
// assert_eq!(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment