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
23e08b5f
Commit
23e08b5f
authored
1 year ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
fix(
!115
): use value rather than references
parent
58eed892
No related branches found
No related tags found
1 merge request
!173
Resolve "Identity pallet events are duplicated"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pallets/duniter-wot/src/lib.rs
+5
-6
5 additions, 6 deletions
pallets/duniter-wot/src/lib.rs
runtime/common/src/handlers.rs
+4
-3
4 additions, 3 deletions
runtime/common/src/handlers.rs
with
9 additions
and
9 deletions
pallets/duniter-wot/src/lib.rs
+
5
−
6
View file @
23e08b5f
...
...
@@ -301,6 +301,7 @@ where
// implement identity event handler
impl
<
T
:
Config
<
I
>
,
I
:
'static
>
pallet_identity
::
traits
::
OnIdtyChange
<
T
>
for
Pallet
<
T
,
I
>
{
fn
on_idty_change
(
_idty_index
:
IdtyIndex
,
idty_event
:
&
pallet_identity
::
Event
<
T
>
)
->
Weight
{
let
idty_event
:
pallet_identity
::
Event
<
T
>
=
(
*
idty_event
)
.clone
();
match
idty_event
{
pallet_identity
::
Event
::
IdtyCreated
{
creator
,
...
...
@@ -308,9 +309,7 @@ impl<T: Config<I>, I: 'static> pallet_identity::traits::OnIdtyChange<T> for Pall
idty_index
,
}
=>
{
if
let
Err
(
e
)
=
<
pallet_certification
::
Pallet
<
T
,
I
>>
::
do_add_cert_checked
(
*
creator
,
*
idty_index
,
true
,
creator
,
idty_index
,
true
,
)
{
sp_std
::
if_std!
{
println!
(
"fail to force add cert: {:?}"
,
e
)
...
...
@@ -319,14 +318,14 @@ impl<T: Config<I>, I: 'static> pallet_identity::traits::OnIdtyChange<T> for Pall
}
pallet_identity
::
Event
::
IdtyValidated
{
idty_index
}
=>
{
// auto claim membership on main wot
<
pallet_membership
::
Pallet
<
T
,
I
>>
::
try_claim_membership
(
*
idty_index
);
<
pallet_membership
::
Pallet
<
T
,
I
>>
::
try_claim_membership
(
idty_index
);
}
pallet_identity
::
Event
::
IdtyRemoved
{
idty_index
,
status
}
=>
{
if
*
status
!=
IdtyStatus
::
Validated
{
if
status
!=
IdtyStatus
::
Validated
{
if
let
Err
(
e
)
=
<
pallet_certification
::
Pallet
<
T
,
I
>>
::
remove_all_certs_received_by
(
frame_system
::
Origin
::
<
T
>
::
Root
.into
(),
*
idty_index
,
idty_index
,
)
{
sp_std
::
if_std!
{
...
...
This diff is collapsed.
Click to expand it.
runtime/common/src/handlers.rs
+
4
−
3
View file @
23e08b5f
...
...
@@ -45,6 +45,7 @@ where
T
:
pallet_universal_dividend
::
Config
,
{
fn
on_idty_change
(
_idty_index
:
IdtyIndex
,
idty_event
:
&
pallet_identity
::
Event
<
T
>
)
->
Weight
{
let
idty_event
:
pallet_identity
::
Event
<
T
>
=
(
*
idty_event
)
.clone
();
match
idty_event
{
pallet_identity
::
Event
::
IdtyValidated
{
idty_index
:
_
}
=>
{
// when identity is validated, it starts getting right to UD
...
...
@@ -55,8 +56,8 @@ where
new_owner_key
,
}
=>
{
if
let
Err
(
e
)
=
pallet_authority_members
::
Pallet
::
<
T
>
::
change_owner_key
(
*
idty_index
,
(
*
new_owner_key
)
.clone
(),
idty_index
,
(
new_owner_key
)
.clone
(),
)
{
log
::
error!
(
"on_idty_change: pallet_authority_members.change_owner_key(): {:?}"
,
...
...
@@ -67,7 +68,7 @@ where
pallet_identity
::
Event
::
IdtyCreated
{
..
}
|
pallet_identity
::
Event
::
IdtyConfirmed
{
..
}
|
pallet_identity
::
Event
::
IdtyRemoved
{
..
}
=>
{}
&
_
=>
{}
// TODO: why is it necessary?
_
=>
{}
// TODO: why is it necessary?
}
Weight
::
zero
()
}
...
...
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