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
fcd17363
Commit
fcd17363
authored
2 years ago
by
Mildred Ki'Lya
Browse files
Options
Downloads
Patches
Plain Diff
Remove dead code (MembershipRevokedRecently)
parent
d32bcbf4
No related branches found
No related tags found
1 merge request
!94
Remove RevocationPeriod rule
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pallets/duniter-wot/src/tests.rs
+0
-7
0 additions, 7 deletions
pallets/duniter-wot/src/tests.rs
pallets/membership/src/lib.rs
+4
-11
4 additions, 11 deletions
pallets/membership/src/lib.rs
pallets/membership/src/tests.rs
+1
-8
1 addition, 8 deletions
pallets/membership/src/tests.rs
with
5 additions
and
26 deletions
pallets/duniter-wot/src/tests.rs
+
0
−
7
View file @
fcd17363
...
@@ -154,13 +154,6 @@ fn test_revoke_smiths_them_rejoin() {
...
@@ -154,13 +154,6 @@ fn test_revoke_smiths_them_rejoin() {
Some
(
4
)
Some
(
4
)
));
));
// Dave should not be able to re-request membership before the RevocationPeriod end
run_to_block
(
3
);
assert_noop!
(
SmithsMembership
::
request_membership
(
Origin
::
signed
(
4
),
()),
pallet_membership
::
Error
::
<
Test
,
crate
::
Instance2
>
::
MembershipRevokedRecently
);
// At block #6, Dave shoud be able to request smith membership
// At block #6, Dave shoud be able to request smith membership
run_to_block
(
6
);
run_to_block
(
6
);
assert_ok!
(
SmithsMembership
::
request_membership
(
Origin
::
signed
(
4
),
()));
assert_ok!
(
SmithsMembership
::
request_membership
(
Origin
::
signed
(
4
),
()));
...
...
This diff is collapsed.
Click to expand it.
pallets/membership/src/lib.rs
+
4
−
11
View file @
fcd17363
...
@@ -180,8 +180,6 @@ pub mod pallet {
...
@@ -180,8 +180,6 @@ pub mod pallet {
OriginNotAllowedToUseIdty
,
OriginNotAllowedToUseIdty
,
/// Membership request not found
/// Membership request not found
MembershipRequestNotFound
,
MembershipRequestNotFound
,
/// Membership revoked recently
MembershipRevokedRecently
,
}
}
// HOOKS //
// HOOKS //
...
@@ -292,7 +290,10 @@ pub mod pallet {
...
@@ -292,7 +290,10 @@ pub mod pallet {
let
idty_id
=
Self
::
ensure_origin_and_get_idty_id
(
origin
,
maybe_idty_id
)
?
;
let
idty_id
=
Self
::
ensure_origin_and_get_idty_id
(
origin
,
maybe_idty_id
)
?
;
// Apply phase
// Apply phase
let
_
=
Self
::
do_revoke_membership
(
idty_id
);
if
Self
::
remove_membership
(
&
idty_id
)
{
Self
::
deposit_event
(
Event
::
MembershipRevoked
(
idty_id
));
T
::
OnEvent
::
on_event
(
&
sp_membership
::
Event
::
MembershipRevoked
(
idty_id
));
}
Ok
(()
.into
())
Ok
(()
.into
())
}
}
...
@@ -336,14 +337,6 @@ pub mod pallet {
...
@@ -336,14 +337,6 @@ pub mod pallet {
Ok
(()
.into
())
Ok
(()
.into
())
}
}
pub
(
super
)
fn
do_revoke_membership
(
idty_id
:
T
::
IdtyId
)
->
Weight
{
if
Self
::
remove_membership
(
&
idty_id
)
{
Self
::
deposit_event
(
Event
::
MembershipRevoked
(
idty_id
));
T
::
OnEvent
::
on_event
(
&
sp_membership
::
Event
::
MembershipRevoked
(
idty_id
));
}
0
}
fn
ensure_origin_and_get_idty_id
(
fn
ensure_origin_and_get_idty_id
(
origin
:
OriginFor
<
T
>
,
origin
:
OriginFor
<
T
>
,
maybe_idty_id
:
Option
<
T
::
IdtyId
>
,
maybe_idty_id
:
Option
<
T
::
IdtyId
>
,
...
...
This diff is collapsed.
Click to expand it.
pallets/membership/src/tests.rs
+
1
−
8
View file @
fcd17363
...
@@ -113,14 +113,7 @@ fn test_membership_revocation() {
...
@@ -113,14 +113,7 @@ fn test_membership_revocation() {
RuntimeEvent
::
DefaultMembership
(
Event
::
MembershipRevoked
(
0
))
RuntimeEvent
::
DefaultMembership
(
Event
::
MembershipRevoked
(
0
))
);
);
// Membership 0 can't request membership before the end of RevokePeriod (1 + 4 = 5)
// Membership 0 can re-request membership
run_to_block
(
2
);
assert_eq!
(
DefaultMembership
::
request_membership
(
Origin
::
signed
(
0
),
()),
Err
(
Error
::
<
Test
,
_
>
::
MembershipRevokedRecently
.into
())
);
// Membership 0 can request membership after the end of RevokePeriod (1 + 4 = 5)
run_to_block
(
5
);
run_to_block
(
5
);
assert_ok!
(
DefaultMembership
::
request_membership
(
Origin
::
signed
(
0
),
()),);
assert_ok!
(
DefaultMembership
::
request_membership
(
Origin
::
signed
(
0
),
()),);
assert_eq!
(
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