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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
rust
Duniter v2S
Commits
c8247b06
Commit
c8247b06
authored
7 months ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
fix
#243
parent
2aa18ec5
No related branches found
No related tags found
1 merge request
!303
Resolve "OutgoingAuthorities event is triggered too many times."
Pipeline
#39481
passed
7 months ago
Stage: labels
Stage: quality
Stage: build
Stage: tests
Stage: deploy
Changes
2
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
pallets/smith-members/src/lib.rs
+5
-3
5 additions, 3 deletions
pallets/smith-members/src/lib.rs
runtime/gdev/tests/integration_tests.rs
+3
-5
3 additions, 5 deletions
runtime/gdev/tests/integration_tests.rs
with
8 additions
and
8 deletions
pallets/smith-members/src/lib.rs
+
5
−
3
View file @
c8247b06
...
...
@@ -582,7 +582,7 @@ impl<T: Config> Pallet<T> {
if
let
Some
(
smith_meta
)
=
maybe_smith_meta
{
// As long as the smith is online, it cannot expire
smith_meta
.expires_on
=
None
;
// FIXME: unschedule old expiry
// FIXME: unschedule old expiry
(#182)
}
});
}
...
...
@@ -592,10 +592,12 @@ impl<T: Config> Pallet<T> {
/// Handle the event when a Smith goes offline.
pub
fn
on_smith_goes_offline
(
idty_index
:
T
::
IdtyIndex
)
{
if
let
Some
(
smith_meta
)
=
Smiths
::
<
T
>
::
get
(
idty_index
)
{
if
smith_meta
.expires_on
.is_none
()
{
// Smith can go offline after main membership expiry
// in this case, there is no scheduled expiry since it is already excluded
if
smith_meta
.status
!=
SmithStatus
::
Excluded
{
Smiths
::
<
T
>
::
mutate
(
idty_index
,
|
maybe_smith_meta
|
{
if
let
Some
(
smith_meta
)
=
maybe_smith_meta
{
//
As long as the smith is online, it cannot
expir
e
//
schedule
expir
y
let
new_expires_on
=
CurrentSession
::
<
T
>
::
get
()
+
T
::
SmithInactivityMaxDuration
::
get
();
smith_meta
.expires_on
=
Some
(
new_expires_on
);
...
...
This diff is collapsed.
Click to expand it.
runtime/gdev/tests/integration_tests.rs
+
3
−
5
View file @
c8247b06
...
...
@@ -1023,7 +1023,7 @@ fn test_smith_process() {
// reveal bug from #243
#[test]
fn
test_expired_smith_
with
_null_expires_on
()
{
fn
test_expired_smith_
has
_null_expires_on
()
{
// initial_authorities_len = 2 → Alice and Bob are online
// initial_smiths_len = 3 → Charlie is offline Smith
// initial_identities_len = 4 → Dave is member but not smith
...
...
@@ -1093,14 +1093,12 @@ fn test_expired_smith_with_null_expires_on() {
pallet_authority_members
::
Event
::
OutgoingAuthorities
{
members
:
vec!
[
2
]
},
));
// show that expires_on is non null
// this is issue #243
// Bob is not Smith anymore
// control state is still ok
assert_eq!
(
SmithMembers
::
smiths
(
2
),
Some
(
pallet_smith_members
::
SmithMeta
{
status
:
SmithStatus
::
Excluded
,
// still excluded
expires_on
:
Some
(
48
),
// should be still None
!!
expires_on
:
None
,
// should be still None
issued_certs
:
vec!
[
1
,
3
],
received_certs
:
vec!
[],
})
...
...
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