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
0f55fd7f
Commit
0f55fd7f
authored
4 months ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
fix bug from
#276
parent
64d97009
No related branches found
No related tags found
1 merge request
!305
Resolve "smithMembers.expiresOn is only growing"
Pipeline
#39513
passed
4 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
+1
-1
1 addition, 1 deletion
pallets/smith-members/src/lib.rs
pallets/smith-members/src/tests.rs
+4
-5
4 additions, 5 deletions
pallets/smith-members/src/tests.rs
with
5 additions
and
6 deletions
pallets/smith-members/src/lib.rs
+
1
−
1
View file @
0f55fd7f
...
@@ -519,7 +519,7 @@ impl<T: Config> Pallet<T> {
...
@@ -519,7 +519,7 @@ impl<T: Config> Pallet<T> {
/// Handle the removal of Smiths whose expiration time has been reached at a given session index.
/// Handle the removal of Smiths whose expiration time has been reached at a given session index.
fn
on_exclude_expired_smiths
(
at
:
SessionIndex
)
{
fn
on_exclude_expired_smiths
(
at
:
SessionIndex
)
{
if
let
Some
(
smiths_to_remove
)
=
ExpiresOn
::
<
T
>
::
get
(
at
)
{
if
let
Some
(
smiths_to_remove
)
=
ExpiresOn
::
<
T
>
::
take
(
at
)
{
for
smith
in
smiths_to_remove
{
for
smith
in
smiths_to_remove
{
if
let
Some
(
smith_meta
)
=
Smiths
::
<
T
>
::
get
(
smith
)
{
if
let
Some
(
smith_meta
)
=
Smiths
::
<
T
>
::
get
(
smith
)
{
if
let
Some
(
expires_on
)
=
smith_meta
.expires_on
{
if
let
Some
(
expires_on
)
=
smith_meta
.expires_on
{
...
...
This diff is collapsed.
Click to expand it.
pallets/smith-members/src/tests.rs
+
4
−
5
View file @
0f55fd7f
...
@@ -628,10 +628,9 @@ fn certifying_an_online_smith() {
...
@@ -628,10 +628,9 @@ fn certifying_an_online_smith() {
});
});
}
}
/// Shows that scheduled expiration stay scheduled forever, even in the past
/// Test that scheduled expiration is removed after session
/// This is harmful for storage because we store unnecessary data
#[test]
#[test]
fn
expires_on_
keeps_growing
()
{
fn
expires_on_
cleans_up
()
{
new_test_ext
(
GenesisConfig
{
new_test_ext
(
GenesisConfig
{
initial_smiths
:
btreemap!
[
initial_smiths
:
btreemap!
[
1
=>
(
true
,
vec!
[
2
,
3
]),
1
=>
(
true
,
vec!
[
2
,
3
]),
...
@@ -666,8 +665,8 @@ fn expires_on_keeps_growing() {
...
@@ -666,8 +665,8 @@ fn expires_on_keeps_growing() {
received_certs
:
vec!
[]
received_certs
:
vec!
[]
})
})
);
);
//
but
ExpiresOn
schedule is still there (and will stay forever)
// ExpiresOn
is clean
assert_eq!
(
ExpiresOn
::
<
Runtime
>
::
get
(
5
),
Some
(
vec!
[
1
])
);
assert_eq!
(
ExpiresOn
::
<
Runtime
>
::
get
(
5
),
None
);
});
});
}
}
...
...
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