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
df405498
Commit
df405498
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
refac(
#173
): harmonize *MembershipAdded and *MembershipRemoved
parent
92fccb10
No related branches found
No related tags found
1 merge request
!228
Resolve "Améliorations pour smith-members"
Pipeline
#35541
failed
1 year ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pallets/smith-members/src/lib.rs
+4
-4
4 additions, 4 deletions
pallets/smith-members/src/lib.rs
pallets/smith-members/src/tests.rs
+12
-12
12 additions, 12 deletions
pallets/smith-members/src/tests.rs
runtime/gdev/tests/integration_tests.rs
+1
-1
1 addition, 1 deletion
runtime/gdev/tests/integration_tests.rs
with
17 additions
and
17 deletions
pallets/smith-members/src/lib.rs
+
4
−
4
View file @
df405498
...
...
@@ -146,9 +146,9 @@ pub mod pallet {
issuer
:
T
::
IdtyIndex
,
},
/// A smith gathered enough certifications to become an authority (can call `go_online()`).
PromotedToSmith
{
idty_index
:
T
::
IdtyIndex
},
SmithMembershipAdded
{
idty_index
:
T
::
IdtyIndex
},
/// A smith has been removed from the smiths set.
Smith
Exclud
ed
{
idty_index
:
T
::
IdtyIndex
},
Smith
MembershipRemov
ed
{
idty_index
:
T
::
IdtyIndex
},
}
#[pallet::genesis_config]
...
...
@@ -455,7 +455,7 @@ impl<T: Config> Pallet<T> {
smith_meta
.expires_on
=
Some
(
new_expires_on
);
Self
::
deposit_event
(
Event
::
<
T
>
::
SmithCertAdded
{
receiver
,
issuer
});
if
smith_meta
.status
==
SmithStatus
::
Smith
{
Self
::
deposit_event
(
Event
::
<
T
>
::
PromotedToSmith
{
Self
::
deposit_event
(
Event
::
<
T
>
::
SmithMembershipAdded
{
idty_index
:
receiver
,
});
}
...
...
@@ -513,7 +513,7 @@ impl<T: Config> Pallet<T> {
}
// Deletion done: notify (authority-members) for cascading
T
::
OnSmithDelete
::
on_smith_delete
(
receiver
,
reason
);
Self
::
deposit_event
(
Event
::
<
T
>
::
Smith
Exclud
ed
{
Self
::
deposit_event
(
Event
::
<
T
>
::
Smith
MembershipRemov
ed
{
idty_index
:
receiver
,
});
}
...
...
This diff is collapsed.
Click to expand it.
pallets/smith-members/src/tests.rs
+
12
−
12
View file @
df405498
...
...
@@ -93,9 +93,9 @@ fn process_to_become_a_smith_and_lose_it() {
receiver
:
5
,
issuer
:
1
,
}));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
PromotedToSmith
{
idty_index
:
5
,
}
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithMembershipAdded
{
idty_index
:
5
}
,
));
assert_eq!
(
Smiths
::
<
Runtime
>
::
get
(
5
)
.unwrap
(),
SmithMeta
{
...
...
@@ -116,9 +116,9 @@ fn process_to_become_a_smith_and_lose_it() {
assert!
(
Smiths
::
<
Runtime
>
::
get
(
5
)
.is_some
());
// On session 5 no more smiths because of lack of activity
Pallet
::
<
Runtime
>
::
on_new_session
(
5
);
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithExcluded
{
idty_index
:
1
,
}
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithMembershipRemoved
{
idty_index
:
1
}
,
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithCertRemoved
{
receiver
:
1
,
issuer
:
2
,
...
...
@@ -131,9 +131,9 @@ fn process_to_become_a_smith_and_lose_it() {
receiver
:
1
,
issuer
:
4
,
}));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithExcluded
{
idty_index
:
2
,
}
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithMembershipRemoved
{
idty_index
:
2
}
,
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithCertRemoved
{
receiver
:
2
,
issuer
:
3
,
...
...
@@ -142,9 +142,9 @@ fn process_to_become_a_smith_and_lose_it() {
receiver
:
2
,
issuer
:
4
,
}));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithExcluded
{
idty_index
:
5
,
}
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithMembershipRemoved
{
idty_index
:
5
}
,
));
System
::
assert_has_event
(
RuntimeEvent
::
Smith
(
Event
::
<
Runtime
>
::
SmithCertRemoved
{
receiver
:
1
,
issuer
:
3
,
...
...
This diff is collapsed.
Click to expand it.
runtime/gdev/tests/integration_tests.rs
+
1
−
1
View file @
df405498
...
...
@@ -1540,7 +1540,7 @@ fn test_smith_member_can_revoke_its_idty() {
));
// smith membership should be removed as well
System
::
assert_has_event
(
RuntimeEvent
::
SmithMembers
(
pallet_smith_members
::
Event
::
Smith
Exclud
ed
{
idty_index
:
3
},
pallet_smith_members
::
Event
::
Smith
MembershipRemov
ed
{
idty_index
:
3
},
));
System
::
assert_has_event
(
RuntimeEvent
::
SmithMembers
(
pallet_smith_members
::
Event
::
SmithCertRemoved
{
...
...
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