Skip to content
Snippets Groups Projects
Commit 04869cd2 authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

more runtime info

parent b2027c2c
No related branches found
No related tags found
1 merge request!15update to runtime 800
...@@ -71,9 +71,14 @@ Secret key format can be changed using `--secret-format` with the following valu ...@@ -71,9 +71,14 @@ Secret key format can be changed using `--secret-format` with the following valu
- [x] implement config formatter - [x] implement config formatter
- [x] add link/unlink account commands - [x] add link/unlink account commands
- [ ] migrate all xt to submit_call_and_look_event - [x] migrate all xt to submit_call_and_look_event
- [ ] add transfer with unit (ĞD, UD...) - [x] add transfer with unit (ĞD, UD...)
- [ ] add more runtime-info like cert count, sudo key... - [x] add more runtime-info like cert count, wot and smith params...
- [ ] add more info like sudo key, block interval
- [ ] better format runtime info block number (duration in days...) and perbill (%)
- [ ] add proper tabulation for runtime info
- [ ] add clap complete for autocompletion
- [ ] allow to listen to multiple events (like CertAdded and CertRenewed)
- [ ] add more info on identity view like status, number certs emitted, received - [ ] add more info on identity view like status, number certs emitted, received
- [ ] implement squid indexer to get cert list + tx history... - [ ] implement squid indexer to get cert list + tx history...
- [ ] - [ ]
......
...@@ -13,13 +13,18 @@ pub async fn request_distance_evaluation(data: &Data) -> Result<(), subxt::Error ...@@ -13,13 +13,18 @@ pub async fn request_distance_evaluation(data: &Data) -> Result<(), subxt::Error
} }
/// request distance evaluation for someone else (must be unvalidated) /// request distance evaluation for someone else (must be unvalidated)
pub async fn request_distance_evaluation_for(data: &Data, target: IdtyId) -> Result<(), subxt::Error> { pub async fn request_distance_evaluation_for(
data: &Data,
target: IdtyId,
) -> Result<(), subxt::Error> {
submit_call_and_look_event::< submit_call_and_look_event::<
runtime::distance::events::EvaluationRequested, runtime::distance::events::EvaluationRequested,
Payload<runtime::distance::calls::types::RequestDistanceEvaluationFor>, Payload<runtime::distance::calls::types::RequestDistanceEvaluationFor>,
>( >(
data, data,
&runtime::tx().distance().request_distance_evaluation_for(target), &runtime::tx()
.distance()
.request_distance_evaluation_for(target),
) )
.await .await
} }
...@@ -275,7 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er ...@@ -275,7 +275,6 @@ pub async fn confirm_identity(data: &Data, name: String) -> Result<(), subxt::Er
.await .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> {
let (_payload, signature) = generate_revoc_doc(data); let (_payload, signature) = generate_revoc_doc(data);
......
...@@ -2,42 +2,155 @@ use crate::*; ...@@ -2,42 +2,155 @@ use crate::*;
pub async fn runtime_info(data: Data) { pub async fn runtime_info(data: Data) {
let api = data.client(); let api = data.client();
let consts = runtime::constants();
// get constant u32 value
let getu32 = |c| api.constants().at(&c).unwrap();
// get constant u64 value
let getu64 = |c| api.constants().at(&c).unwrap();
// get constant perbill value
let getp = |c| api.constants().at(&c).unwrap();
// get formatted currency value
let getf = |c| data.format_balance(api.constants().at(&c).unwrap());
// certifications // identity
let cert_period = api println!("--- identity ---");
.constants() println!(
.at(&runtime::constants().certification().cert_period()) "confirm period: {} blocks",
.unwrap(); getu32(consts.identity().confirm_period())
let max_by_issuer = api );
.constants() println!(
.at(&runtime::constants().certification().max_by_issuer()) "validation period: {} blocks",
.unwrap(); getu32(consts.identity().validation_period())
let validity_period = api );
.constants() println!(
.at(&runtime::constants().certification().validity_period()) "autorevocation period: {} blocks",
.unwrap(); getu32(consts.identity().autorevocation_period())
);
println!("certification period: {cert_period} blocks"); println!(
println!("max certs by issuer: {max_by_issuer}"); "deletion period: {} blocks",
println!("certification validity: {validity_period} blocks"); getu32(consts.identity().deletion_period())
);
// account println!(
let new_account_price = api "change owner key period: {} blocks",
.constants() getu32(consts.identity().change_owner_key_period())
.at(&runtime::constants().account().new_account_price()) );
.unwrap(); println!(
// balances "identity creation period: {} blocks",
let existential_deposit = api getu32(consts.identity().idty_creation_period())
.constants() );
.at(&runtime::constants().balances().existential_deposit()) // certification
.unwrap(); println!("--- certification ---");
println!(
"certification period: {} blocks",
getu32(consts.certification().cert_period())
);
println!(
"max certs by issuer: {}",
getu32(consts.certification().max_by_issuer())
);
println!(
"min received cert to issue cert: {}",
getu32(consts.certification().min_received_cert_to_be_able_to_issue_cert())
);
println!(
"certification validity: {} blocks",
getu32(consts.certification().validity_period())
);
// wot
println!("--- wot ---");
println!(
"first issuable on: {}",
getu32(consts.wot().first_issuable_on())
);
println!(
"min cert for membership: {}",
getu32(consts.wot().min_cert_for_membership())
);
println!(
"min cert for create identity: {}",
getu32(consts.wot().min_cert_for_create_idty_right())
);
// membership
println!("--- membership ---");
println!(
"membership validity: {} blocks",
getu32(consts.membership().membership_period())
);
// smith members
println!("--- smith members ---");
println!(
"max certs by issuer: {}",
getu32(consts.smith_members().max_by_issuer())
);
println!(
"min cert for membership: {}",
getu32(consts.smith_members().min_cert_for_membership())
);
println!(
"smith inactivity max duration: {}",
getu32(consts.smith_members().smith_inactivity_max_duration())
);
// todo membership renewal period
// distance
println!("--- distance ---");
println!(
"max referee distance: {}",
getu32(consts.distance().max_referee_distance())
);
println!(
"min accessible referees: {:?}",
getp(consts.distance().min_accessible_referees())
);
println!(
"distance evaluation price: {}",
getf(consts.distance().evaluation_price())
);
// currency
println!("--- currency ---");
println!( println!(
"new account price: {}", "new account price: {}",
data.format_balance(new_account_price) getf(consts.account().new_account_price())
);
println!(
"max new accounts per block: {}",
getu32(consts.account().max_new_accounts_per_block())
); );
println!( println!(
"existential deposit: {}", "existential deposit: {}",
data.format_balance(existential_deposit) getf(consts.balances().existential_deposit())
);
// provide randomness
println!("--- provide randomness ---");
println!(
"max requests: {}",
getu32(consts.provide_randomness().max_requests())
);
println!(
"request price: {}",
getf(consts.provide_randomness().request_price())
);
// universal dividend
println!("--- universal dividend ---");
println!(
"max past reevals: {}",
getu32(consts.universal_dividend().max_past_reeval())
);
println!(
"square money growth rate: {:?}",
getp(consts.universal_dividend().square_money_growth_rate())
);
println!(
"UD creation period: {}",
getu64(consts.universal_dividend().ud_creation_period())
);
println!(
"UD reeval period: {}",
getu64(consts.universal_dividend().ud_reeval_period())
);
println!(
"units per ud: {}",
getf(consts.universal_dividend().units_per_ud())
); );
// todo treasury, technical committee, transaction payment, authority members
// consts.system().ss58_prefix()
} }
\ No newline at end of file
...@@ -90,18 +90,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE ...@@ -90,18 +90,10 @@ pub async fn handle_command(data: Data, command: Subcommand) -> Result<(), GcliE
data = data.build_indexer().await?; data = data.build_indexer().await?;
commands::expire::monitor_expirations(&data, blocks, sessions).await? commands::expire::monitor_expirations(&data, blocks, sessions).await?
} }
Subcommand::ShowOnline => { Subcommand::ShowOnline => online(&data).await?,
online(&data).await? Subcommand::Invite { target } => invite_smith(&data, target).await?,
} Subcommand::Accept => accept_invitation(&data).await?,
Subcommand::Invite { target } => { Subcommand::Certify { target } => certify_smith(&data, target).await?,
invite_smith(&data, target).await?
}
Subcommand::Accept => {
accept_invitation(&data).await?
}
Subcommand::Certify { target } => {
certify_smith(&data, target).await?
}
}; };
Ok(()) Ok(())
...@@ -294,13 +286,7 @@ pub async fn certify_smith(data: &Data, target: IdtyId) -> Result<(), subxt::Err ...@@ -294,13 +286,7 @@ pub async fn certify_smith(data: &Data, target: IdtyId) -> Result<(), subxt::Err
// Payload<runtime::smith_members::calls::types::CertifySmith>, // Payload<runtime::smith_members::calls::types::CertifySmith>,
// >(data, &runtime::tx().smith_members().certify_smith(target)) // >(data, &runtime::tx().smith_members().certify_smith(target))
// .await // .await
let progress = submit_call( let progress = submit_call(data, &runtime::tx().smith_members().certify_smith(target)).await?;
data,
&runtime::tx()
.smith_members()
.certify_smith(target),
)
.await?;
if data.args.no_wait { if data.args.no_wait {
return Ok(()); return Ok(());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment