From 01b41f57f216ccdc20840b863ae69361ffbf5953 Mon Sep 17 00:00:00 2001 From: haerdib Date: Wed, 14 Jun 2023 16:38:25 +0200 Subject: [PATCH 1/8] add list-reputables --- Cargo.lock | 10 ++-- client/src/cli_args.rs | 18 +++++++ client/src/main.rs | 113 ++++++++++++++++++++++++++++++++++++----- 3 files changed, 122 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b5138b2..6f1b73b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "ac-compose-macros" version = "0.4.0" -source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#2a479c447ec4f0041149af111d8ef99da4cb0d11" +source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#d17eb3389550e675350593829218e8949a7dd06b" dependencies = [ "ac-primitives", "log", @@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "ac-node-api" version = "0.4.0" -source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#2a479c447ec4f0041149af111d8ef99da4cb0d11" +source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#d17eb3389550e675350593829218e8949a7dd06b" dependencies = [ "ac-primitives", "bitvec", @@ -47,7 +47,7 @@ dependencies = [ [[package]] name = "ac-primitives" version = "0.7.0" -source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#2a479c447ec4f0041149af111d8ef99da4cb0d11" +source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#d17eb3389550e675350593829218e8949a7dd06b" dependencies = [ "frame-system", "impl-serde 0.4.0", @@ -8949,7 +8949,7 @@ dependencies = [ [[package]] name = "substrate-api-client" version = "0.12.0" -source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#2a479c447ec4f0041149af111d8ef99da4cb0d11" +source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#d17eb3389550e675350593829218e8949a7dd06b" dependencies = [ "ac-compose-macros", "ac-node-api", @@ -8998,7 +8998,7 @@ dependencies = [ [[package]] name = "substrate-client-keystore" version = "0.9.0" -source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#2a479c447ec4f0041149af111d8ef99da4cb0d11" +source = "git+https://github.com/scs/substrate-api-client.git?branch=polkadot-v0.9.42#d17eb3389550e675350593829218e8949a7dd06b" dependencies = [ "array-bytes", "async-trait", diff --git a/client/src/cli_args.rs b/client/src/cli_args.rs index 2afe5d94..03c0c6ea 100644 --- a/client/src/cli_args.rs +++ b/client/src/cli_args.rs @@ -19,6 +19,7 @@ const DRYRUN_FLAG: &str = "dryrun"; const TX_PAYMENT_CID_ARG: &str = "tx-payment-cid"; const MEETUP_INDEX_ARG: &str = "meetup-index"; const AT_BLOCK_ARG: &str = "at"; +const VERBOSE_FLAG: &str = "verbose"; pub trait EncointerArgs<'b> { fn account_arg(self) -> Self; @@ -40,6 +41,7 @@ pub trait EncointerArgs<'b> { fn tx_payment_cid_arg(self) -> Self; fn meetup_index_arg(self) -> Self; fn at_block_arg(self) -> Self; + fn verbose_flag(self) -> Self; } pub trait EncointerArgsExtractor { @@ -62,6 +64,7 @@ pub trait EncointerArgsExtractor { fn tx_payment_cid_arg(&self) -> Option<&str>; fn meetup_index_arg(&self) -> Option; fn at_block_arg(&self) -> Option; + fn verbose_flag(&self) -> bool; } impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { @@ -257,6 +260,18 @@ impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { .help("block hash at which to query"), ) } + + fn verbose_flag(self) -> Self { + self.arg( + Arg::with_name(VERBOSE_FLAG) + .short("v") + .long("verbose") + .global(true) + .takes_value(false) + .required(false) + .help("print extra information"), + ) + } } impl<'a> EncointerArgsExtractor for ArgMatches<'a> { @@ -332,4 +347,7 @@ impl<'a> EncointerArgsExtractor for ArgMatches<'a> { Hash::from_slice(&vec) }) } + fn verbose_flag(&self) -> bool { + self.is_present(VERBOSE_FLAG) + } } diff --git a/client/src/main.rs b/client/src/main.rs index 3f9544c5..cfe37145 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -54,6 +54,7 @@ use encointer_primitives::{ ceremonies::{ AttestationIndexType, ClaimOfAttendance, CommunityCeremony, CommunityReputation, MeetupIndexType, ParticipantIndexType, ProofOfAttendance, Reputation, + ReputationLifetimeType, }, communities::{CidName, CommunityIdentifier}, fixed::transcendental::exp, @@ -659,7 +660,7 @@ fn main() { // >>>> add some debug info as well let bn = get_block_number(&api, None); debug!("block number: {}", bn); - let cindex = get_ceremony_index(&api); + let cindex = get_ceremony_index(&api, None); info!("ceremony index: {}", cindex); let tnext: Moment = api.get_next_phase_timestamp().unwrap(); debug!("next phase timestamp: {}", tnext); @@ -728,7 +729,7 @@ fn main() { extract_and_execute( matches, |api, cid| -> ApiResult<()>{ - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex = matches.ceremony_index_arg() .map_or_else(|| current_ceremony_index , |ci| into_effective_cindex(ci, current_ceremony_index)); @@ -776,7 +777,7 @@ fn main() { extract_and_execute( matches, |api, cid| -> ApiResult<()>{ - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex = matches.ceremony_index_arg() .map_or_else(|| current_ceremony_index , |ci| into_effective_cindex(ci, current_ceremony_index)); @@ -824,7 +825,7 @@ fn main() { extract_and_execute( matches, |api, cid| -> ApiResult<()>{ - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex = matches.ceremony_index_arg() .map_or_else(|| current_ceremony_index , |ci| into_effective_cindex(ci, current_ceremony_index)); @@ -853,7 +854,7 @@ fn main() { extract_and_execute( matches, |api, cid| -> ApiResult<()>{ - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex = matches.ceremony_index_arg() .map_or_else(|| current_ceremony_index , |ci| into_effective_cindex(ci, current_ceremony_index)); @@ -924,6 +925,56 @@ fn main() { Ok(()) }), ) + .add_cmd( + Command::new("list-reputables") + .description("list all reputables for all cycles within the current reputation-lifetime for all communities") + .options(|app| { + app.setting(AppSettings::ColoredHelp) + .at_block_arg() + .verbose_flag() + }) + .runner(|_args: &str, matches: &ArgMatches<'_>| { + let api = get_chain_api(matches); + + let is_verbose = matches.verbose_flag(); + let at_block = matches.at_block_arg(); + + let lifetime = get_reputation_lifetime(&api, at_block); + let current_ceremony_index = get_ceremony_index(&api, at_block); + + + let last_ceremony_index_of_interest = current_ceremony_index - lifetime; + let ceremony_indeces: Vec = if last_ceremony_index_of_interest > 0 { + (last_ceremony_index_of_interest..current_ceremony_index).collect() + } else { + (0..current_ceremony_index).collect() + }; + + let community_ids = get_cid_names(&api).unwrap().into_iter().map(|names| names.cid); + + let mut reputables_csv = Vec::new(); + + println!("Listing the number of reputables for each community and ceremony for the last {:?} cycles", ceremony_indeces.len()); + for community_id in community_ids { + println!("Community ID: {community_id:?}"); + for ceremony_index in &ceremony_indeces { + let reputables = get_reputables_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); + println!("Ceremony ID {ceremony_index:?}: Total reputables: {:?}", reputables.len()); + for reputable in reputables { + reputables_csv.push(format!("{community_id:?},{ceremony_index:?},{}", reputable.to_ss58check())); + } + + } + } + + if is_verbose { + for reputable in reputables_csv { + println!("{reputable}"); + } + } + Ok(()) + }), + ) .add_cmd( Command::new("register-participant") .description("Register encointer ceremony participant for supplied community") @@ -941,7 +992,7 @@ fn main() { }; let api = get_chain_api(matches); - let cindex = get_ceremony_index(&api); + let cindex = get_ceremony_index(&api, None); let cid = verify_cid(&api, matches .cid_arg() @@ -1003,7 +1054,7 @@ fn main() { }; let api = get_chain_api(matches); - let cindex = get_ceremony_index(&api); + let cindex = get_ceremony_index(&api, None); let cid = verify_cid(&api, matches .cid_arg() @@ -1079,7 +1130,7 @@ fn main() { let cc = match matches.ceremony_index_arg() { Some(cindex_arg) => { - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex = into_effective_cindex(cindex_arg, current_ceremony_index); Some((cid, cindex)) }, @@ -1164,7 +1215,7 @@ fn main() { let accountid = get_accountid_from_str(arg_who); let api = get_chain_api(matches); - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let cindex_arg = matches.ceremony_index_arg().unwrap_or(-1); let cindex = into_effective_cindex(cindex_arg, current_ceremony_index); @@ -1298,7 +1349,7 @@ fn main() { set_api_extrisic_params_builder(&mut api, tx_payment_cid_arg); if matches.all_flag() { - let mut cindex = get_ceremony_index(&api); + let mut cindex = get_ceremony_index(&api, None); if api.get_current_phase().unwrap() == CeremonyPhaseType::Registering { cindex -= 1; } @@ -1462,7 +1513,7 @@ fn main() { let mut api = get_chain_api(matches); api.set_signer(signer); - let current_ceremony_index = get_ceremony_index(&api); + let current_ceremony_index = get_ceremony_index(&api, None); let from_cindex_arg = matches.from_cindex_arg().unwrap_or(0); let to_cindex_arg = matches.to_cindex_arg().unwrap_or(0); @@ -1780,8 +1831,8 @@ fn get_demurrage_per_block(api: &Api, cid: CommunityIdentifier) -> Demurrage { } } -fn get_ceremony_index(api: &Api) -> CeremonyIndexType { - api.get_storage("EncointerScheduler", "CurrentCeremonyIndex", None) +fn get_ceremony_index(api: &Api, at_block: Option) -> CeremonyIndexType { + api.get_storage("EncointerScheduler", "CurrentCeremonyIndex", at_block) .unwrap() .unwrap() } @@ -1792,6 +1843,40 @@ fn get_attestee_count(api: &Api, key: CommunityCeremony) -> ParticipantIndexType .unwrap_or(0) } +fn get_reputables_for_community_ceremony( + api: &Api, + community_ceremony: CommunityCeremony, + at_block: Option, +) -> Vec { + let key_prefix = api + .get_storage_double_map_key_prefix( + "EncointerCeremonies", + "ReputableRegistry", + community_ceremony, + ) + .unwrap(); + let max_keys = u32::MAX; + let storage_keys = + api.get_storage_keys_paged(Some(key_prefix), max_keys, None, at_block).unwrap(); + + let mut reputables = Vec::new(); + + for storage_key in storage_keys.iter() { + let maybe_account: Option = + api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap(); + if let Some(account_id) = maybe_account { + reputables.push(account_id); + }; + } + reputables +} + +fn get_reputation_lifetime(api: &Api, at_block: Option) -> ReputationLifetimeType { + api.get_storage("EncointerCeremonies", "ReputationLifetime", at_block) + .unwrap() + .unwrap_or(5) +} + fn get_participant_attestation_index( api: &Api, key: CommunityCeremony, @@ -1807,7 +1892,7 @@ fn new_claim_for( cid: CommunityIdentifier, n_participants: u32, ) -> Vec { - let cindex = get_ceremony_index(api); + let cindex = get_ceremony_index(api, None); let mindex = api .get_meetup_index(&(cid, cindex), &claimant.public().into()) .unwrap() From bda43b6f469155225d1bc5e1f53e704ef8c1cccf Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Thu, 15 Jun 2023 13:54:11 +0200 Subject: [PATCH 2/8] naming and underflow fix --- client/src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index 8ee6b342..1c2fcb71 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -944,9 +944,9 @@ async fn main() { let current_ceremony_index = get_ceremony_index(&api, at_block); - let last_ceremony_index_of_interest = current_ceremony_index - lifetime; - let ceremony_indeces: Vec = if last_ceremony_index_of_interest > 0 { - (last_ceremony_index_of_interest..current_ceremony_index).collect() + let first_ceremony_index_of_interest = current_ceremony_index.saturating_sub(lifetime); + let ceremony_indices: Vec = if first_ceremony_index_of_interest > 0 { + (first_ceremony_index_of_interest..current_ceremony_index).collect() } else { (0..current_ceremony_index).collect() }; @@ -955,10 +955,10 @@ async fn main() { let mut reputables_csv = Vec::new(); - println!("Listing the number of reputables for each community and ceremony for the last {:?} cycles", ceremony_indeces.len()); + println!("Listing the number of reputables for each community and ceremony for the last {:?} cycles", ceremony_indices.len()); for community_id in community_ids { println!("Community ID: {community_id:?}"); - for ceremony_index in &ceremony_indeces { + for ceremony_index in &ceremony_indices { let reputables = get_reputables_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); println!("Ceremony ID {ceremony_index:?}: Total reputables: {:?}", reputables.len()); for reputable in reputables { From d0e168f8d3583644f5c6b4693d35969c27aba590 Mon Sep 17 00:00:00 2001 From: haerdib Date: Thu, 15 Jun 2023 18:20:42 +0200 Subject: [PATCH 3/8] fix option query and max numbers --- client/src/main.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index cfe37145..3156ff1e 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1855,18 +1855,16 @@ fn get_reputables_for_community_ceremony( community_ceremony, ) .unwrap(); - let max_keys = u32::MAX; + let max_keys = 1000; let storage_keys = api.get_storage_keys_paged(Some(key_prefix), max_keys, None, at_block).unwrap(); let mut reputables = Vec::new(); for storage_key in storage_keys.iter() { - let maybe_account: Option = + let account_id: AccountId = api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap(); - if let Some(account_id) = maybe_account { - reputables.push(account_id); - }; + reputables.push(account_id); } reputables } From ae15bd2c63f82be928886727331333e114838430 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 16 Jun 2023 14:55:27 +0200 Subject: [PATCH 4/8] refactor names and change to correct storage. not yet ok --- client/src/main.rs | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index 3cd5ddbe..f18a25cc 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -955,19 +955,20 @@ async fn main() { let mut reputables_csv = Vec::new(); - println!("Listing the number of reputables for each community and ceremony for the last {:?} cycles", ceremony_indices.len()); + println!("Listing the number of attested attendees for each community and ceremony for cycles [{:}:{:}]", ceremony_indices.first().unwrap(), ceremony_indices.last().unwrap()); for community_id in community_ids { println!("Community ID: {community_id:?}"); + let mut reputables: HashMap = HashMap::new(); for ceremony_index in &ceremony_indices { - let reputables = get_reputables_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); - println!("Ceremony ID {ceremony_index:?}: Total reputables: {:?}", reputables.len()); - for reputable in reputables { - reputables_csv.push(format!("{community_id:?},{ceremony_index:?},{}", reputable.to_ss58check())); + let attendees = get_attendees_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); + println!("Cycle ID {ceremony_index:?}: Total attested attendees: {:?}", attendees.len()); + for attendee in attendees { + reputables_csv.push(format!("{community_id:?},{ceremony_index:?},{}", attendee.to_ss58check())); + *reputables.entry(attendee.clone()).or_insert(0) += 1; } - } + println!("Reputables in {community_id:?} (unique accounts with at least one attendance) {:}", reputables.keys().len()); } - if is_verbose { for reputable in reputables_csv { println!("{reputable}"); @@ -1844,7 +1845,7 @@ fn get_attestee_count(api: &Api, key: CommunityCeremony) -> ParticipantIndexType .unwrap_or(0) } -fn get_reputables_for_community_ceremony( +fn get_attendees_for_community_ceremony( api: &Api, community_ceremony: CommunityCeremony, at_block: Option, @@ -1852,7 +1853,7 @@ fn get_reputables_for_community_ceremony( let key_prefix = api .get_storage_double_map_key_prefix( "EncointerCeremonies", - "ReputableRegistry", + "ParticipantReputation", community_ceremony, ) .unwrap(); @@ -1860,14 +1861,19 @@ fn get_reputables_for_community_ceremony( let storage_keys = api.get_storage_keys_paged(Some(key_prefix), max_keys, None, at_block).unwrap(); - let mut reputables = Vec::new(); - + if storage_keys.len() == max_keys as usize { + error!("results can be wrong because max keys reached for query") + } + let mut attendees = Vec::new(); for storage_key in storage_keys.iter() { - let account_id: AccountId = - api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap(); - reputables.push(account_id); + match api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap() { + Reputation::VerifiedUnlinked | Reputation::VerifiedLinked => { + attendees.push(AccountId::decode(&mut storage_key.as_ref()).unwrap()); + }, + _ => (), + } } - reputables + attendees } fn get_reputation_lifetime(api: &Api, at_block: Option) -> ReputationLifetimeType { From 844baa5ea63cc3a1e6cab73a145cb28657004038 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 16 Jun 2023 15:08:03 +0200 Subject: [PATCH 5/8] extracting AccountId key from doublemap storagekey tail --- client/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/main.rs b/client/src/main.rs index f18a25cc..f0f8fe69 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1868,7 +1868,10 @@ fn get_attendees_for_community_ceremony( for storage_key in storage_keys.iter() { match api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap() { Reputation::VerifiedUnlinked | Reputation::VerifiedLinked => { - attendees.push(AccountId::decode(&mut storage_key.as_ref()).unwrap()); + let key_postfix = storage_key.as_ref(); + attendees.push( + AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), + ); }, _ => (), } From 03f9346286aecf440f320d9c1c449af0c9f86a2a Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 16 Jun 2023 15:32:11 +0200 Subject: [PATCH 6/8] count noshows as well --- client/src/main.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index f0f8fe69..80c15106 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -945,11 +945,7 @@ async fn main() { let first_ceremony_index_of_interest = current_ceremony_index.saturating_sub(lifetime); - let ceremony_indices: Vec = if first_ceremony_index_of_interest > 0 { - (first_ceremony_index_of_interest..current_ceremony_index).collect() - } else { - (0..current_ceremony_index).collect() - }; + let ceremony_indices: Vec = (first_ceremony_index_of_interest..current_ceremony_index).collect(); let community_ids = get_cid_names(&api).unwrap().into_iter().map(|names| names.cid); @@ -960,8 +956,8 @@ async fn main() { println!("Community ID: {community_id:?}"); let mut reputables: HashMap = HashMap::new(); for ceremony_index in &ceremony_indices { - let attendees = get_attendees_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); - println!("Cycle ID {ceremony_index:?}: Total attested attendees: {:?}", attendees.len()); + let (attendees, noshows) = get_attendees_for_community_ceremony(&api, (community_id, *ceremony_index), at_block); + println!("Cycle ID {ceremony_index:?}: Total attested attendees: {:} (noshows: {:})", attendees.len(), noshows.len()); for attendee in attendees { reputables_csv.push(format!("{community_id:?},{ceremony_index:?},{}", attendee.to_ss58check())); *reputables.entry(attendee.clone()).or_insert(0) += 1; @@ -1849,7 +1845,7 @@ fn get_attendees_for_community_ceremony( api: &Api, community_ceremony: CommunityCeremony, at_block: Option, -) -> Vec { +) -> (Vec, Vec) { let key_prefix = api .get_storage_double_map_key_prefix( "EncointerCeremonies", @@ -1865,6 +1861,7 @@ fn get_attendees_for_community_ceremony( error!("results can be wrong because max keys reached for query") } let mut attendees = Vec::new(); + let mut noshows = Vec::new(); for storage_key in storage_keys.iter() { match api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap() { Reputation::VerifiedUnlinked | Reputation::VerifiedLinked => { @@ -1873,10 +1870,15 @@ fn get_attendees_for_community_ceremony( AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), ); }, - _ => (), + Reputation::UnverifiedReputable | Reputation::Unverified=> { + let key_postfix = storage_key.as_ref(); + noshows.push( + AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), + ); + }, } } - attendees + (attendees, noshows) } fn get_reputation_lifetime(api: &Api, at_block: Option) -> ReputationLifetimeType { From be3f7be2eb80b9704c82fd62aa0cf2f5b0ba072e Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 16 Jun 2023 15:35:15 +0200 Subject: [PATCH 7/8] fmt --- client/src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/main.rs b/client/src/main.rs index 80c15106..8db55b25 100644 --- a/client/src/main.rs +++ b/client/src/main.rs @@ -1861,7 +1861,7 @@ fn get_attendees_for_community_ceremony( error!("results can be wrong because max keys reached for query") } let mut attendees = Vec::new(); - let mut noshows = Vec::new(); + let mut noshows = Vec::new(); for storage_key in storage_keys.iter() { match api.get_storage_by_key(storage_key.clone(), at_block).unwrap().unwrap() { Reputation::VerifiedUnlinked | Reputation::VerifiedLinked => { @@ -1870,15 +1870,15 @@ fn get_attendees_for_community_ceremony( AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), ); }, - Reputation::UnverifiedReputable | Reputation::Unverified=> { - let key_postfix = storage_key.as_ref(); - noshows.push( - AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), - ); - }, + Reputation::UnverifiedReputable | Reputation::Unverified => { + let key_postfix = storage_key.as_ref(); + noshows.push( + AccountId::decode(&mut key_postfix[key_postfix.len() - 32..].as_ref()).unwrap(), + ); + }, } } - (attendees, noshows) + (attendees, noshows) } fn get_reputation_lifetime(api: &Api, at_block: Option) -> ReputationLifetimeType { From 53e22984807e20181cfde5e2f68b14b0244ea129 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 17 Jun 2023 08:49:35 +0200 Subject: [PATCH 8/8] fix the merge --- client/src/cli_args.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/cli_args.rs b/client/src/cli_args.rs index 1f4c7bf1..2eccb7d2 100644 --- a/client/src/cli_args.rs +++ b/client/src/cli_args.rs @@ -321,7 +321,6 @@ impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { .help("the meetup index for which to claim rewards"), ) } - fn at_block_arg(self) -> Self { self.arg( Arg::with_name(AT_BLOCK_ARG) @@ -333,7 +332,6 @@ impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { .help("block hash at which to query"), ) } - fn verbose_flag(self) -> Self { self.arg( Arg::with_name(VERBOSE_FLAG) @@ -343,7 +341,8 @@ impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { .takes_value(false) .required(false) .help("print extra information"), - + ) + } fn faucet_balance_arg(self) -> Self { self.arg( Arg::with_name(FAUCET_BALANCE_ARG) @@ -353,7 +352,6 @@ impl<'a, 'b> EncointerArgs<'b> for App<'a, 'b> { .help("faucet balance"), ) } - fn faucet_drip_amount_arg(self) -> Self { self.arg( Arg::with_name(FAUCET_DRIP_AMOUNT_ARG) @@ -467,6 +465,7 @@ impl<'a> EncointerArgsExtractor for ArgMatches<'a> { } fn verbose_flag(&self) -> bool { self.is_present(VERBOSE_FLAG) + } fn faucet_balance_arg(&self) -> Option { self.value_of(FAUCET_BALANCE_ARG).map(|v| v.parse().unwrap()) }