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
5cfcee7d
Commit
5cfcee7d
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix(
#176
): expiration should be postponed only for Pending smiths
parent
5879b057
No related branches found
No related tags found
1 merge request
!232
Resolve "PromotedToSmith is issued even for Smith"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pallets/smith-members/src/lib.rs
+11
-5
11 additions, 5 deletions
pallets/smith-members/src/lib.rs
pallets/smith-members/src/tests.rs
+0
-1
0 additions, 1 deletion
pallets/smith-members/src/tests.rs
with
11 additions
and
6 deletions
pallets/smith-members/src/lib.rs
+
11
−
5
View file @
5cfcee7d
...
...
@@ -447,11 +447,17 @@ impl<T: Config> Pallet<T> {
}
else
{
SmithStatus
::
Pending
};
// expiry postponed
let
new_expires_on
=
CurrentSession
::
<
T
>
::
get
()
+
T
::
SmithInactivityMaxDuration
::
get
();
smith_meta
.expires_on
=
Some
(
new_expires_on
);
Self
::
deposit_event
(
Event
::
<
T
>
::
SmithCertAdded
{
receiver
,
issuer
});
if
smith_meta
.status
==
SmithStatus
::
Pending
{
// - postpone the expiration: a Pending smith cannot do anything but wait
// this postponement is here to ease the process of becoming a smith
let
new_expires_on
=
CurrentSession
::
<
T
>
::
get
()
+
T
::
SmithInactivityMaxDuration
::
get
();
smith_meta
.expires_on
=
Some
(
new_expires_on
);
// ExpiresOn::<T>::append(new_expires_on, receiver);
}
// - if the status is smith but wasn't, notify that smith gained membership
if
smith_meta
.status
==
SmithStatus
::
Smith
&&
previous_status
!=
SmithStatus
::
Smith
{
Self
::
deposit_event
(
Event
::
<
T
>
::
SmithMembershipAdded
{
...
...
This diff is collapsed.
Click to expand it.
pallets/smith-members/src/tests.rs
+
0
−
1
View file @
5cfcee7d
...
...
@@ -610,7 +610,6 @@ fn certifying_an_online_smith() {
RuntimeOrigin
::
signed
(
3
),
5
));
// TODO: this test currently fails because expires_on is not None
assert_eq!
(
Smiths
::
<
Runtime
>
::
get
(
5
),
Some
(
SmithMeta
{
...
...
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