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
08beaa33
Commit
08beaa33
authored
2 years ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
wip replace identity removal check
parent
69ad2193
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
pallets/duniter-wot/src/lib.rs
+8
-3
8 additions, 3 deletions
pallets/duniter-wot/src/lib.rs
pallets/identity/src/lib.rs
+1
-6
1 addition, 6 deletions
pallets/identity/src/lib.rs
pallets/identity/src/traits.rs
+4
-4
4 additions, 4 deletions
pallets/identity/src/traits.rs
with
13 additions
and
13 deletions
pallets/duniter-wot/src/lib.rs
+
8
−
3
View file @
08beaa33
...
@@ -105,6 +105,8 @@ pub mod pallet {
...
@@ -105,6 +105,8 @@ pub mod pallet {
MaxEmitedCertsReached
,
MaxEmitedCertsReached
,
/// Not allowed to change identity address
/// Not allowed to change identity address
NotAllowedToChangeIdtyAddress
,
NotAllowedToChangeIdtyAddress
,
/// Not allowed to remove identity
NotAllowedToRemoveIdty
,
}
}
}
}
...
@@ -178,11 +180,14 @@ where
...
@@ -178,11 +180,14 @@ where
Ok
(())
Ok
(())
}
}
}
}
fn
c
an
_remove_identity
(
idty_index
:
IdtyIndex
)
->
bool
{
fn
c
heck
_remove_identity
(
idty_index
:
IdtyIndex
)
->
Result
<
(),
DispatchError
>
{
if
T
::
IsSubWot
::
get
()
{
if
T
::
IsSubWot
::
get
()
{
!
pallet_membership
::
Pallet
::
<
T
,
I
>
::
is_member
(
&
idty_index
)
match
pallet_membership
::
Pallet
::
<
T
,
I
>
::
is_member
(
&
idty_index
)
{
true
=>
Err
(
Error
::
<
T
,
I
>
::
NotAllowedToRemoveIdty
.into
()),
false
=>
Ok
(()),
}
}
else
{
}
else
{
true
Ok
(())
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
pallets/identity/src/lib.rs
+
1
−
6
View file @
08beaa33
...
@@ -498,10 +498,7 @@ pub mod pallet {
...
@@ -498,10 +498,7 @@ pub mod pallet {
Error
::
<
T
>
::
InvalidRevocationKey
Error
::
<
T
>
::
InvalidRevocationKey
);
);
ensure!
(
T
::
EnsureIdtyCallAllowed
::
check_remove_identity
(
idty_index
)
?
;
T
::
EnsureIdtyCallAllowed
::
can_remove_identity
(
idty_index
),
Error
::
<
T
>
::
NotAllowedToRemoveIdty
);
let
genesis_hash
=
frame_system
::
Pallet
::
<
T
>
::
block_hash
(
T
::
BlockNumber
::
zero
());
let
genesis_hash
=
frame_system
::
Pallet
::
<
T
>
::
block_hash
(
T
::
BlockNumber
::
zero
());
let
revocation_payload
=
RevocationPayload
{
let
revocation_payload
=
RevocationPayload
{
...
@@ -601,8 +598,6 @@ pub mod pallet {
...
@@ -601,8 +598,6 @@ pub mod pallet {
InvalidRevocationKey
,
InvalidRevocationKey
,
/// Revocation payload signature is invalid
/// Revocation payload signature is invalid
InvalidRevocationSig
,
InvalidRevocationSig
,
/// Not allowed to remove identity
NotAllowedToRemoveIdty
,
/// Identity creation period is not respected
/// Identity creation period is not respected
NotRespectIdtyCreationPeriod
,
NotRespectIdtyCreationPeriod
,
/// Not the same identity name
/// Not the same identity name
...
...
This diff is collapsed.
Click to expand it.
pallets/identity/src/traits.rs
+
4
−
4
View file @
08beaa33
...
@@ -24,7 +24,7 @@ pub trait EnsureIdtyCallAllowed<T: Config> {
...
@@ -24,7 +24,7 @@ pub trait EnsureIdtyCallAllowed<T: Config> {
fn
check_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_confirm_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_validate_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_change_identity_address
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
check_change_identity_address
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
fn
c
an
_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
;
fn
c
heck
_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
;
}
}
#[impl_for_tuples(
5
)]
#[impl_for_tuples(
5
)]
...
@@ -46,9 +46,9 @@ impl<T: Config> EnsureIdtyCallAllowed<T> for Tuple {
...
@@ -46,9 +46,9 @@ impl<T: Config> EnsureIdtyCallAllowed<T> for Tuple {
for_tuples!
(
#
(
Tuple
::
check_change_identity_address
(
idty_index
)
?
;
)
*
);
for_tuples!
(
#
(
Tuple
::
check_change_identity_address
(
idty_index
)
?
;
)
*
);
Ok
(())
Ok
(())
}
}
fn
c
an
_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
bool
{
fn
c
heck
_remove_identity
(
idty_index
:
T
::
IdtyIndex
)
->
Result
<
(),
DispatchError
>
{
for_tuples!
(
#
(
if
!
Tuple
::
c
an
_remove_identity
(
idty_index
)
{
return
false
;
}
)
*
);
for_tuples!
(
#
(
Tuple
::
c
heck
_remove_identity
(
idty_index
)
?
;
)
*
);
true
Ok
(())
}
}
}
}
...
...
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