Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ğ
Ğcli-v2s
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
clients
Rust
Ğcli-v2s
Commits
a14024bb
Commit
a14024bb
authored
1 year ago
by
Hugo Trentesaux
Browse files
Options
Downloads
Patches
Plain Diff
add distance evaluation request
parent
56ebb044
No related branches found
No related tags found
1 merge request
!15
update to runtime 800
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/commands/distance.rs
+17
-7
17 additions, 7 deletions
src/commands/distance.rs
src/commands/identity.rs
+4
-16
4 additions, 16 deletions
src/commands/identity.rs
src/display.rs
+2
-2
2 additions, 2 deletions
src/display.rs
with
23 additions
and
25 deletions
src/commands/distance.rs
+
17
−
7
View file @
a14024bb
...
@@ -2,14 +2,24 @@ use crate::*;
...
@@ -2,14 +2,24 @@ use crate::*;
/// request distance evaluation
/// request distance evaluation
pub
async
fn
request_distance_evaluation
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
pub
async
fn
request_distance_evaluation
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
let
progress
=
submit_call
(
submit_call_and_look_event
::
<
runtime
::
distance
::
events
::
EvaluationRequested
,
Payload
<
runtime
::
distance
::
calls
::
types
::
RequestDistanceEvaluation
>
,
>
(
data
,
data
,
&
runtime
::
tx
()
.distance
()
.request_distance_evaluation
(),
&
runtime
::
tx
()
.distance
()
.request_distance_evaluation
(),
)
)
.await
?
;
.await
if
data
.args.no_wait
{
}
return
Ok
(());
}
/// request distance evaluation for someone else (must be unvalidated)
let
_
=
track_progress
(
progress
)
.await
?
;
pub
async
fn
request_distance_evaluation_for
(
data
:
&
Data
,
target
:
IdtyId
)
->
Result
<
(),
subxt
::
Error
>
{
Ok
(())
submit_call_and_look_event
::
<
runtime
::
distance
::
events
::
EvaluationRequested
,
Payload
<
runtime
::
distance
::
calls
::
types
::
RequestDistanceEvaluationFor
>
,
>
(
data
,
&
runtime
::
tx
()
.distance
()
.request_distance_evaluation_for
(
target
),
)
.await
}
}
This diff is collapsed.
Click to expand it.
src/commands/identity.rs
+
4
−
16
View file @
a14024bb
...
@@ -34,9 +34,8 @@ pub enum Subcommand {
...
@@ -34,9 +34,8 @@ pub enum Subcommand {
/// Request distance evaluation
/// Request distance evaluation
/// make sure that it's ok otherwise currency is slashed
/// make sure that it's ok otherwise currency is slashed
RequestDistanceEvaluation
,
RequestDistanceEvaluation
,
/// Renew membership
/// Request distance evaluation for unvalidated identity
/// When membership comes to and end, it should be renewed for the identity to stay member
RequestDistanceEvaluationFor
{
target
:
IdtyId
},
RenewMembership
,
/// Certify an identity
/// Certify an identity
Certify
{
target
:
IdtyId
},
Certify
{
target
:
IdtyId
},
/// Revoke an identity immediately
/// Revoke an identity immediately
...
@@ -94,8 +93,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
...
@@ -94,8 +93,8 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
Subcommand
::
RequestDistanceEvaluation
=>
{
Subcommand
::
RequestDistanceEvaluation
=>
{
commands
::
distance
::
request_distance_evaluation
(
&
data
)
.await
?
;
commands
::
distance
::
request_distance_evaluation
(
&
data
)
.await
?
;
}
}
Subcommand
::
Re
newMembership
=>
{
Subcommand
::
Re
questDistanceEvaluationFor
{
target
}
=>
{
renew_membership
(
&
data
)
.await
?
;
commands
::
distance
::
request_distance_evaluation_for
(
&
data
,
target
)
.await
?
;
}
}
Subcommand
::
Certify
{
target
}
=>
{
Subcommand
::
Certify
{
target
}
=>
{
data
=
data
.fetch_idty_index
()
.await
?
;
data
=
data
.fetch_idty_index
()
.await
?
;
...
@@ -276,17 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er
...
@@ -276,17 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er
.await
.await
}
}
/// renew membership
pub
async
fn
renew_membership
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
submit_call_and_look_event
::
<
runtime
::
membership
::
events
::
MembershipRenewed
,
Payload
<
runtime
::
distance
::
calls
::
types
::
RequestDistanceEvaluation
>
,
>
(
data
,
&
runtime
::
tx
()
.distance
()
.request_distance_evaluation
(),
)
.await
}
/// generate revokation document and submit it immediately
/// generate revokation document and submit it immediately
pub
async
fn
revoke_identity
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
pub
async
fn
revoke_identity
(
data
:
&
Data
)
->
Result
<
(),
subxt
::
Error
>
{
...
...
This diff is collapsed.
Click to expand it.
src/display.rs
+
2
−
2
View file @
a14024bb
...
@@ -55,9 +55,9 @@ impl DisplayEvent for runtime::identity::events::IdtyChangedOwnerKey {
...
@@ -55,9 +55,9 @@ impl DisplayEvent for runtime::identity::events::IdtyChangedOwnerKey {
format!
(
"identity changed owner key {:?}"
,
self
)
format!
(
"identity changed owner key {:?}"
,
self
)
}
}
}
}
impl
DisplayEvent
for
runtime
::
membership
::
events
::
MembershipRenew
ed
{
impl
DisplayEvent
for
runtime
::
distance
::
events
::
EvaluationRequest
ed
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
fn
display
(
&
self
,
_data
:
&
Data
)
->
String
{
format!
(
"
membership renew
ed {:?}"
,
self
)
format!
(
"
evaluation request
ed {:?}"
,
self
)
}
}
}
}
impl
DisplayEvent
for
runtime
::
identity
::
events
::
IdtyRemoved
{
impl
DisplayEvent
for
runtime
::
identity
::
events
::
IdtyRemoved
{
...
...
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