File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 11use catalyst_toolbox:: stats:: distribution:: Stats ;
22use catalyst_toolbox:: stats:: voters:: calculate_active_wallet_distribution;
3+ use color_eyre:: Report ;
34use std:: ops:: Range ;
45use std:: path:: PathBuf ;
56use structopt:: StructOpt ;
@@ -26,7 +27,7 @@ pub enum Command {
2627}
2728
2829impl ActiveVotersCommand {
29- pub fn exec ( & self ) -> Result < ( ) , catalyst_toolbox :: stats :: Error > {
30+ pub fn exec ( & self ) -> Result < ( ) , Report > {
3031 match self . command {
3132 Command :: Count => calculate_active_wallet_distribution (
3233 Stats :: new ( self . threshold ) ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ mod active;
22mod initials;
33
44use active:: ActiveVotersCommand ;
5+ use color_eyre:: Report ;
56use initials:: InitialVotersCommand ;
67use structopt:: StructOpt ;
78
@@ -12,7 +13,7 @@ pub enum VotersCommand {
1213}
1314
1415impl VotersCommand {
15- pub fn exec ( self ) -> Result < ( ) , catalyst_toolbox :: stats :: Error > {
16+ pub fn exec ( self ) -> Result < ( ) , Report > {
1617 match self {
1718 Self :: Initials ( initials) => initials. exec ( ) ,
1819 Self :: Active ( active) => active. exec ( ) ,
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ fn levels(threshold: u64) -> Vec<Range<u64>> {
55 vec ! [
66 ( 0 ..450 ) ,
77 ( 450 ..threshold) ,
8- ( 500 ..1_000 ) ,
8+ ( threshold ..1_000 ) ,
99 ( 1_000 ..2_000 ) ,
1010 ( 2_000 ..5_000 ) ,
1111 ( 5_000 ..10_000 ) ,
@@ -98,7 +98,9 @@ impl Stats {
9898}
9999
100100fn format_big_number ( n : u64 ) -> String {
101- if n % 1_000_000_000 == 0 {
101+ if n == 0 {
102+ n. to_string ( )
103+ } else if n % 1_000_000_000 == 0 {
102104 format ! ( "{} MLD" , n / 1_000_000 )
103105 } else if n % 1_00000 == 0 {
104106 format ! ( "{} M" , n / 1_000_000 )
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ use std::path::Path;
1313fn blacklist_addresses ( genesis : & Block0Configuration ) -> Vec < Address > {
1414 let discrimination = genesis. blockchain_configuration . discrimination ;
1515
16- #[ allow( clippy:: needless_collect) ]
1716 genesis
1817 . blockchain_configuration
1918 . committees
@@ -40,12 +39,13 @@ fn vote_counts_as_addresses(
4039 votes_count : VoteCount ,
4140 genesis : & Block0Configuration ,
4241) -> Vec < ( InitialUTxO , u32 ) > {
43- votes_count
42+ genesis
43+ . initial
4444 . iter ( )
45- . filter_map ( |( address , votes_count ) | {
46- for initials in & genesis . initial {
47- if let Initial :: Fund ( funds ) = initials {
48- if let Some ( utxo ) = funds . iter ( ) . find ( |utxo | {
45+ . filter_map ( |initials | {
46+ if let Initial :: Fund ( funds ) = initials {
47+ for utxo in funds {
48+ if let Some ( ( _ , votes_count ) ) = votes_count . iter ( ) . find ( |( address , _ ) | {
4949 account_hex_to_address (
5050 address. to_string ( ) ,
5151 genesis. blockchain_configuration . discrimination ,
You can’t perform that action at this time.
0 commit comments