Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Improve vote-account for logical flow/reasoning#15237

Merged
ryoqun merged 3 commits intosolana-labs:masterfrom
ryoqun:vote-account-improvement
Feb 11, 2021
Merged

Improve vote-account for logical flow/reasoning#15237
ryoqun merged 3 commits intosolana-labs:masterfrom
ryoqun:vote-account-improvement

Conversation

@ryoqun
Copy link
Copy Markdown
Contributor

@ryoqun ryoqun commented Feb 10, 2021

Problem

My last periodic inflation checkup was mislead to a false bug hunting due to my hurried look at solana vote-account.

I'd say this subcommand needs more love. ;)

Summary of Changes

  • Consistent ordering in each sections (newest => oldest); I think Recent warrants reverse-chronological order as this is done for rewards.
  • From top to the bottom of the output: newest votes => oldest votes => newest credits => oldest credits; so flow of information is ordered accordingly.
  • Also, I intended to make these vote/credit/rooting relations self-evident by watch solana vote-account-ing for awhile.
  • Hint about maximum entry for each sections and possible truncation
  • Also, this breaks cli output compatibility, which I think is safe for only v1.6. (Ideally, I want this in v1.5 as well)

(Originally, I wanted to hide these additions under verbose, but I found that wiring takes some more work. I don't think this new by-default output impedes understanding for general consumption.)

BEFORE:

$ solana vote-account FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk
Account Balance: 31.350967575 SOL
Validator Identity: DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP
Authorized Voters: {149: "BEYL4vi8LbqtE8LZnitTkyYzN5qwvbzPipPwXxpW4W8c"}
Authorized Withdrawer: 3bfD7Vt3552r2Kgzm7jQF6W3HToRBfGocerCsDokwVQ4
Credits: 52982912
Commission: 7%
Root Slot: 64759037
Recent Timestamp: 2021-02-10T13:14:39Z from slot 64759076
Recent Votes:
- slot: 64759038
  confirmation count: 31
- slot: 64759039
  confirmation count: 30
- slot: 64759040
  confirmation count: 29
- slot: 64759041
  confirmation count: 28
- slot: 64759042
  confirmation count: 27
- slot: 64759043
  confirmation count: 26
- slot: 64759045
  confirmation count: 25
- slot: 64759046
  confirmation count: 24
- slot: 64759047
  confirmation count: 23
- slot: 64759048
  confirmation count: 22
- slot: 64759049
  confirmation count: 21
- slot: 64759056
  confirmation count: 20
- slot: 64759057
  confirmation count: 19
- slot: 64759058
  confirmation count: 18
- slot: 64759059
  confirmation count: 17
- slot: 64759060
  confirmation count: 16
- slot: 64759061
  confirmation count: 15
- slot: 64759062
  confirmation count: 14
- slot: 64759063
  confirmation count: 13
- slot: 64759064
  confirmation count: 12
- slot: 64759065
  confirmation count: 11
- slot: 64759066
  confirmation count: 10
- slot: 64759067
  confirmation count: 9
- slot: 64759069
  confirmation count: 8
- slot: 64759070
  confirmation count: 7
- slot: 64759071
  confirmation count: 6
- slot: 64759072
  confirmation count: 5
- slot: 64759073
  confirmation count: 4
- slot: 64759074
  confirmation count: 3
- slot: 64759075
  confirmation count: 2
- slot: 64759076
  confirmation count: 1
Epoch Voting History:
* missed credits include slots unavailable to vote on due to delinquent leaders
- epoch: 86
  credits range: [31093438..31485431)
  credits/slots: 391993/432000
- epoch: 87
  credits range: [31485431..31872155)
  credits/slots: 386724/432000
- epoch: 88
  credits range: [31872155..32276705)
  credits/slots: 404550/432000
- epoch: 89
  credits range: [32276705..32675022)
  credits/slots: 398317/432000
- epoch: 90
  credits range: [32675022..33088998)
  credits/slots: 413976/432000
- epoch: 91
  credits range: [33088998..33492073)
  credits/slots: 403075/432000
- epoch: 92
  credits range: [33492073..33890924)
  credits/slots: 398851/432000
- epoch: 93
  credits range: [33890924..34292439)
  credits/slots: 401515/432000
- epoch: 94
  credits range: [34292439..34683616)
  credits/slots: 391177/432000
- epoch: 95
  credits range: [34683616..35047515)
  credits/slots: 363899/432000
- epoch: 96
  credits range: [35047515..35395144)
  credits/slots: 347629/432000
- epoch: 97
  credits range: [35395144..35804273)
  credits/slots: 409129/432000
- epoch: 98
  credits range: [35804273..36220258)
  credits/slots: 415985/432000
- epoch: 99
  credits range: [36220258..36627990)
  credits/slots: 407732/432000
- epoch: 100
  credits range: [36627990..37011736)
  credits/slots: 383746/432000
- epoch: 101
  credits range: [37011736..37410490)
  credits/slots: 398754/432000
- epoch: 102
  credits range: [37410490..37815801)
  credits/slots: 405311/432000
- epoch: 103
  credits range: [37815801..38208577)
  credits/slots: 392776/432000
- epoch: 104
  credits range: [38208577..38605894)
  credits/slots: 397317/432000
- epoch: 105
  credits range: [38605894..39008709)
  credits/slots: 402815/432000
- epoch: 106
  credits range: [39008709..39416873)
  credits/slots: 408164/432000
- epoch: 107
  credits range: [39416873..39824022)
  credits/slots: 407149/432000
- epoch: 108
  credits range: [39824022..40208585)
  credits/slots: 384563/432000
- epoch: 109
  credits range: [40208585..40578382)
  credits/slots: 369797/432000
- epoch: 110
  credits range: [40578382..40960490)
  credits/slots: 382108/432000
- epoch: 111
  credits range: [40960490..41347523)
  credits/slots: 387033/432000
- epoch: 112
  credits range: [41347523..41744495)
  credits/slots: 396972/432000
- epoch: 113
  credits range: [41744495..42130454)
  credits/slots: 385959/432000
- epoch: 114
  credits range: [42130454..42507929)
  credits/slots: 377475/432000
- epoch: 115
  credits range: [42507929..42888558)
  credits/slots: 380629/432000
- epoch: 116
  credits range: [42888558..43234394)
  credits/slots: 345836/432000
- epoch: 117
  credits range: [43234394..43561785)
  credits/slots: 327391/432000
- epoch: 118
  credits range: [43561785..43905947)
  credits/slots: 344162/432000
- epoch: 119
  credits range: [43905947..44234409)
  credits/slots: 328462/432000
- epoch: 120
  credits range: [44234409..44569202)
  credits/slots: 334793/432000
- epoch: 121
  credits range: [44569202..44855864)
  credits/slots: 286662/432000
- epoch: 122
  credits range: [44855864..45187857)
  credits/slots: 331993/432000
- epoch: 123
  credits range: [45187857..45546135)
  credits/slots: 358278/432000
- epoch: 124
  credits range: [45546135..45905338)
  credits/slots: 359203/432000
- epoch: 125
  credits range: [45905338..46117575)
  credits/slots: 212237/432000
- epoch: 126
  credits range: [46117575..46357064)
  credits/slots: 239489/432000
- epoch: 127
  credits range: [46357064..46623556)
  credits/slots: 266492/432000
- epoch: 128
  credits range: [46623556..46861905)
  credits/slots: 238349/432000
- epoch: 129
  credits range: [46861905..47069022)
  credits/slots: 207117/432000
- epoch: 130
  credits range: [47069022..47331463)
  credits/slots: 262441/432000
- epoch: 131
  credits range: [47331463..47523324)
  credits/slots: 191861/432000
- epoch: 132
  credits range: [47523324..47732454)
  credits/slots: 209130/432000
- epoch: 133
  credits range: [47732454..47929955)
  credits/slots: 197501/432000
- epoch: 134
  credits range: [47929955..48156316)
  credits/slots: 226361/432000
- epoch: 135
  credits range: [48156316..48383843)
  credits/slots: 227527/432000
- epoch: 136
  credits range: [48383843..48671276)
  credits/slots: 287433/432000
- epoch: 137
  credits range: [48671276..49005812)
  credits/slots: 334536/432000
- epoch: 138
  credits range: [49005812..49328994)
  credits/slots: 323182/432000
- epoch: 139
  credits range: [49328994..49646559)
  credits/slots: 317565/432000
- epoch: 140
  credits range: [49646559..49989489)
  credits/slots: 342930/432000
- epoch: 141
  credits range: [49989489..50306830)
  credits/slots: 317341/432000
- epoch: 142
  credits range: [50306830..50612612)
  credits/slots: 305782/432000
- epoch: 143
  credits range: [50612612..50956316)
  credits/slots: 343704/432000
- epoch: 144
  credits range: [50956316..51318093)
  credits/slots: 361777/432000
- epoch: 145
  credits range: [51318093..51677751)
  credits/slots: 359658/432000
- epoch: 146
  credits range: [51677751..52049937)
  credits/slots: 372186/432000
- epoch: 147
  credits range: [52049937..52386068)
  credits/slots: 336131/432000
- epoch: 148
  credits range: [52386068..52683859)
  credits/slots: 297791/432000
- epoch: 149
  credits range: [52683859..52982912)
  credits/slots: 299053/432000
Epoch Rewards:
  Epoch   Reward Slot  Amount            New Balance       Percent Change             APR
  148     64368000     ◎1.507476849       ◎31.350967575             5.05%         599.42%
  147     63936000     ◎1.647750662       ◎29.843490726             5.84%         720.44%
  146     63504000     ◎1.740032636       ◎28.195740064             6.58%         913.18%
  145     63072004     ◎1.532238646       ◎26.455707428             6.15%         816.94%
  144     62640000     ◎1.645030818       ◎24.923468782             7.07%         927.32%
  143     62208000     ◎2.014101233       ◎23.278437964             9.47%        1249.28%
  142     61776000     ◎2.685118569       ◎21.264336731            14.45%        1847.81%
  141     61344004     ◎2.471243465       ◎18.579218162            15.34%        1977.63%
  140     60912004     ◎1.913246446       ◎16.107974697            13.48%        1225.68%
  139     60480000     ◎1.725177229       ◎14.194728251            13.84%        1970.12%
  138     60048001     ◎1.966582520       ◎12.469551022            18.72%        2666.31%
  137     59616008     ◎1.802008387       ◎10.502968502            20.71%        2949.13%
  136     59184000     ◎1.740846306       ◎8.700960115             25.01%        3561.67%
  135     58752000     ◎1.737414700       ◎6.960113809             33.27%        4933.88%
  134     58320000     ◎1.730364010       ◎5.222699109             49.55%        7428.25%
  133     57888004     ◎1.743403550       ◎3.492335099             99.68%       14654.57%
  132     57456000     ◎1.722072909       ◎1.748931549           6411.62%      961067.52%

AFTER:

$ ./target/debug/solana vote-account FKsC411dik9ktS6xPADxs4Fk2SCENvAiuccQHLAPndvk
Account Balance: 1266.151350355 SOL
Validator Identity: DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP
Authorized Voters: {150: "BEYL4vi8LbqtE8LZnitTkyYzN5qwvbzPipPwXxpW4W8c"}
Authorized Withdrawer: 3bfD7Vt3552r2Kgzm7jQF6W3HToRBfGocerCsDokwVQ4
Credits: 53062534
Commission: 7%
Root Slot: 64878691
Recent Timestamp: 2021-02-11T10:35:15Z from slot 64878755
Recent Votes (using 31/31 entries):
- slot: 64878755 (confirmation count: 1)
- slot: 64878754 (confirmation count: 2)
- slot: 64878753 (confirmation count: 3)
- slot: 64878752 (confirmation count: 4)
- slot: 64878751 (confirmation count: 5)
- slot: 64878750 (confirmation count: 6)
- slot: 64878749 (confirmation count: 7)
- slot: 64878747 (confirmation count: 8)
- slot: 64878746 (confirmation count: 9)
- slot: 64878745 (confirmation count: 10)
- slot: 64878719 (confirmation count: 11)
- slot: 64878718 (confirmation count: 12)
- slot: 64878717 (confirmation count: 13)
- slot: 64878716 (confirmation count: 14)
- slot: 64878709 (confirmation count: 15)
- slot: 64878708 (confirmation count: 16)
- slot: 64878707 (confirmation count: 17)
- slot: 64878706 (confirmation count: 18)
- slot: 64878705 (confirmation count: 19)
- slot: 64878703 (confirmation count: 20)
- slot: 64878702 (confirmation count: 21)
- slot: 64878701 (confirmation count: 22)
- slot: 64878700 (confirmation count: 23)
- slot: 64878699 (confirmation count: 24)
- slot: 64878698 (confirmation count: 25)
- slot: 64878697 (confirmation count: 26)
- slot: 64878696 (confirmation count: 27)
- slot: 64878695 (confirmation count: 28)
- slot: 64878694 (confirmation count: 29)
- slot: 64878693 (confirmation count: 30)
- slot: 64878692 (confirmation count: 31)
- ... (truncated 53062534 rooted votes, which have been credited)
Recent Epoch Voting History (using 64/64 entries):
* missed credits include slots unavailable to vote on due to delinquent leaders
- epoch: 150
  credits range: (53007811..53062534]
  credits/slots: 54723/432000
- epoch: 149
  credits range: (52683859..53007811]
  credits/slots: 323952/432000
- epoch: 148
  credits range: (52386068..52683859]
  credits/slots: 297791/432000
- epoch: 147
  credits range: (52049937..52386068]
  credits/slots: 336131/432000
- epoch: 146
  credits range: (51677751..52049937]
  credits/slots: 372186/432000
- epoch: 145
  credits range: (51318093..51677751]
  credits/slots: 359658/432000
- epoch: 144
  credits range: (50956316..51318093]
  credits/slots: 361777/432000
- epoch: 143
  credits range: (50612612..50956316]
  credits/slots: 343704/432000
- epoch: 142
  credits range: (50306830..50612612]
  credits/slots: 305782/432000
- epoch: 141
  credits range: (49989489..50306830]
  credits/slots: 317341/432000
- epoch: 140
  credits range: (49646559..49989489]
  credits/slots: 342930/432000
- epoch: 139
  credits range: (49328994..49646559]
  credits/slots: 317565/432000
- epoch: 138
  credits range: (49005812..49328994]
  credits/slots: 323182/432000
- epoch: 137
  credits range: (48671276..49005812]
  credits/slots: 334536/432000
- epoch: 136
  credits range: (48383843..48671276]
  credits/slots: 287433/432000
- epoch: 135
  credits range: (48156316..48383843]
  credits/slots: 227527/432000
- epoch: 134
  credits range: (47929955..48156316]
  credits/slots: 226361/432000
- epoch: 133
  credits range: (47732454..47929955]
  credits/slots: 197501/432000
- epoch: 132
  credits range: (47523324..47732454]
  credits/slots: 209130/432000
- epoch: 131
  credits range: (47331463..47523324]
  credits/slots: 191861/432000
- epoch: 130
  credits range: (47069022..47331463]
  credits/slots: 262441/432000
- epoch: 129
  credits range: (46861905..47069022]
  credits/slots: 207117/432000
- epoch: 128
  credits range: (46623556..46861905]
  credits/slots: 238349/432000
- epoch: 127
  credits range: (46357064..46623556]
  credits/slots: 266492/432000
- epoch: 126
  credits range: (46117575..46357064]
  credits/slots: 239489/432000
- epoch: 125
  credits range: (45905338..46117575]
  credits/slots: 212237/432000
- epoch: 124
  credits range: (45546135..45905338]
  credits/slots: 359203/432000
- epoch: 123
  credits range: (45187857..45546135]
  credits/slots: 358278/432000
- epoch: 122
  credits range: (44855864..45187857]
  credits/slots: 331993/432000
- epoch: 121
  credits range: (44569202..44855864]
  credits/slots: 286662/432000
- epoch: 120
  credits range: (44234409..44569202]
  credits/slots: 334793/432000
- epoch: 119
  credits range: (43905947..44234409]
  credits/slots: 328462/432000
- epoch: 118
  credits range: (43561785..43905947]
  credits/slots: 344162/432000
- epoch: 117
  credits range: (43234394..43561785]
  credits/slots: 327391/432000
- epoch: 116
  credits range: (42888558..43234394]
  credits/slots: 345836/432000
- epoch: 115
  credits range: (42507929..42888558]
  credits/slots: 380629/432000
- epoch: 114
  credits range: (42130454..42507929]
  credits/slots: 377475/432000
- epoch: 113
  credits range: (41744495..42130454]
  credits/slots: 385959/432000
- epoch: 112
  credits range: (41347523..41744495]
  credits/slots: 396972/432000
- epoch: 111
  credits range: (40960490..41347523]
  credits/slots: 387033/432000
- epoch: 110
  credits range: (40578382..40960490]
  credits/slots: 382108/432000
- epoch: 109
  credits range: (40208585..40578382]
  credits/slots: 369797/432000
- epoch: 108
  credits range: (39824022..40208585]
  credits/slots: 384563/432000
- epoch: 107
  credits range: (39416873..39824022]
  credits/slots: 407149/432000
- epoch: 106
  credits range: (39008709..39416873]
  credits/slots: 408164/432000
- epoch: 105
  credits range: (38605894..39008709]
  credits/slots: 402815/432000
- epoch: 104
  credits range: (38208577..38605894]
  credits/slots: 397317/432000
- epoch: 103
  credits range: (37815801..38208577]
  credits/slots: 392776/432000
- epoch: 102
  credits range: (37410490..37815801]
  credits/slots: 405311/432000
- epoch: 101
  credits range: (37011736..37410490]
  credits/slots: 398754/432000
- epoch: 100
  credits range: (36627990..37011736]
  credits/slots: 383746/432000
- epoch: 99
  credits range: (36220258..36627990]
  credits/slots: 407732/432000
- epoch: 98
  credits range: (35804273..36220258]
  credits/slots: 415985/432000
- epoch: 97
  credits range: (35395144..35804273]
  credits/slots: 409129/432000
- epoch: 96
  credits range: (35047515..35395144]
  credits/slots: 347629/432000
- epoch: 95
  credits range: (34683616..35047515]
  credits/slots: 363899/432000
- epoch: 94
  credits range: (34292439..34683616]
  credits/slots: 391177/432000
- epoch: 93
  credits range: (33890924..34292439]
  credits/slots: 401515/432000
- epoch: 92
  credits range: (33492073..33890924]
  credits/slots: 398851/432000
- epoch: 91
  credits range: (33088998..33492073]
  credits/slots: 403075/432000
- epoch: 90
  credits range: (32675022..33088998]
  credits/slots: 413976/432000
- epoch: 89
  credits range: (32276705..32675022]
  credits/slots: 398317/432000
- epoch: 88
  credits range: (31872155..32276705]
  credits/slots: 404550/432000
- epoch: 87
  credits range: (31485431..31872155]
  credits/slots: 386724/432000
- ... (omitting 31485431 past rooted votes, which have already been credited)
Epoch Rewards:
  Epoch   Reward Slot  Amount            New Balance       Percent Change             APR
  149     64800004     ◎1234.800382780    ◎1266.151350355        3938.64%      467382.96%
  148     64368000     ◎1.507476849       ◎31.350967575             5.05%         599.42%
  147     63936000     ◎1.647750662       ◎29.843490726             5.84%         720.44%
  146     63504000     ◎1.740032636       ◎28.195740064             6.58%         913.18%
  145     63072004     ◎1.532238646       ◎26.455707428             6.15%         816.94%
  144     62640000     ◎1.645030818       ◎24.923468782             7.07%         927.32%
  143     62208000     ◎2.014101233       ◎23.278437964             9.47%        1249.28%
  142     61776000     ◎2.685118569       ◎21.264336731            14.45%        1847.81%
  141     61344004     ◎2.471243465       ◎18.579218162            15.34%        1977.63%
  140     60912004     ◎1.913246446       ◎16.107974697            13.48%        1225.68%
  139     60480000     ◎1.725177229       ◎14.194728251            13.84%        1970.12%
  138     60048001     ◎1.966582520       ◎12.469551022            18.72%        2666.31%
  137     59616008     ◎1.802008387       ◎10.502968502            20.71%        2949.13%
  136     59184000     ◎1.740846306       ◎8.700960115             25.01%        3561.67%
  135     58752000     ◎1.737414700       ◎6.960113809             33.27%        4933.88%
  134     58320000     ◎1.730364010       ◎5.222699109             49.55%        7428.25%
  133     57888004     ◎1.743403550       ◎3.492335099             99.68%       14654.57%
  132     57456000     ◎1.722072909       ◎1.748931549           6411.62%      961067.52%


@ryoqun ryoqun requested a review from t-nelson February 10, 2021 13:20
Comment thread cli-output/src/cli_output.rs Outdated

writeln!(
f,
"- ... (truncated older history covering {} credits/rooted votes)",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bike shedding: covering or including or containing?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omitting {} past rooted votes, which have already been credited ?


// Maximum number of credits history to keep around
const MAX_EPOCH_CREDITS_HISTORY: usize = 64;
pub const MAX_EPOCH_CREDITS_HISTORY: usize = 64;
Copy link
Copy Markdown
Contributor Author

@ryoqun ryoqun Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this const pub shouldn't create much burden for us for maintainability or compatibility as this is very sensitive to the abi. So, we won't change this in near future.

writeln!(
f,
" credits range: [{}..{})",
" credits range: ({}..{}]",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this run.sh sample shows this is more proper range notation... I was wrong at #13374 in hindsight after more deeper understanding of staking:

$ ./target/release/solana -ul vote-account 3vZMFHQPt618pUnjEnnw5yXbNgEK6PMzLNHEZrroe8Qn
Account Balance: 0.02685864 SOL
Validator Identity: A9ZHywzYR3G17utyPs8kb5Tm7pcrbuaGC56AWuuWLNEp
Authorized Voters: {0: "A9ZHywzYR3G17utyPs8kb5Tm7pcrbuaGC56AWuuWLNEp"}
Authorized Withdrawer: A9ZHywzYR3G17utyPs8kb5Tm7pcrbuaGC56AWuuWLNEp
Credits: 1
Commission: 100%
Root Slot: 0
Recent Timestamp: 2021-02-10T05:49:58Z from slot 31
Recent Votes (using 31/31 entries):
- slot: 31 (confirmation count: 1)
- slot: 30 (confirmation count: 2)
- slot: 29 (confirmation count: 3)
- slot: 28 (confirmation count: 4)
- slot: 27 (confirmation count: 5)
- slot: 26 (confirmation count: 6)
- slot: 25 (confirmation count: 7)
- slot: 24 (confirmation count: 8)
- slot: 23 (confirmation count: 9)
- slot: 22 (confirmation count: 10)
- slot: 21 (confirmation count: 11)
- slot: 20 (confirmation count: 12)
- slot: 19 (confirmation count: 13)
- slot: 18 (confirmation count: 14)
- slot: 17 (confirmation count: 15)
- slot: 16 (confirmation count: 16)
- slot: 15 (confirmation count: 17)
- slot: 14 (confirmation count: 18)
- slot: 13 (confirmation count: 19)
- slot: 12 (confirmation count: 20)
- slot: 11 (confirmation count: 21)
- slot: 10 (confirmation count: 22)
- slot: 9 (confirmation count: 23)
- slot: 8 (confirmation count: 24)
- slot: 7 (confirmation count: 25)
- slot: 6 (confirmation count: 26)
- slot: 5 (confirmation count: 27)
- slot: 4 (confirmation count: 28)
- slot: 3 (confirmation count: 29)
- slot: 2 (confirmation count: 30)
- slot: 1 (confirmation count: 31)
- ... (truncated older 1 votes, which was rooted and became credits)
All Epoch Voting History (using 1/64 entries):
* missed credits include slots unavailable to vote on due to delinquent leaders
- epoch: 0
  credits range: (0..1]
  credits/slots: 1/128

)?;
}

if !epoch_voting_history.is_empty() {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, originally, showed titles for no good reason even if is_empty()...

Comment thread cli-output/src/cli_output.rs Outdated
if let Some(newest) = epoch_voting_history.iter().rev().next() {
writeln!(
f,
"- ... (truncated older {} votes, which was rooted and became credits)",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This serves two purposes:

  • Actually indicate this list is truncated
  • Also, as a logical cue for the relation of rooted votes <=> credits and popping-out nature

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, another word bike shedding:

became or converted or translated to? (I wanted to indicate the 1-by-1 nature of votes/credits)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about truncated {} rooted votes, which have been credited ?

Comment thread cli-output/src/cli_output.rs Outdated
Comment on lines -615 to -616
writeln!(f, "- slot: {}", vote.slot)?;
writeln!(f, " confirmation count: {}", vote.confirmation_count)?;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Condensed this two lines to one for the precious vertical screen estate. :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: What do you think about saving the per-line field name redundancy with a header line at the top?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I actually like this epoch-info-style (key: value). I might do this once I got enough motivation in the future. :)

Comment on lines +647 to +651
(if epoch_voting_history.len() < MAX_EPOCH_CREDITS_HISTORY {
"All"
} else {
"Recent"
}),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made this section dynamic; similar treatment was applied to the votes section for consistentcy. ... so that we can quickly determine the existence of truncation by looking either at the top or bottom of possibly long list. :)

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 10, 2021

Codecov Report

Merging #15237 (8ac27e7) into master (8c49985) will decrease coverage by 0.0%.
The diff coverage is 0.0%.

@@            Coverage Diff            @@
##           master   #15237     +/-   ##
=========================================
- Coverage    79.5%    79.5%   -0.1%     
=========================================
  Files         402      402             
  Lines      102337   102359     +22     
=========================================
  Hits        81446    81446             
- Misses      20891    20913     +22     

writeln!(
f,
"* missed credits include slots unavailable to vote on due to delinquent leaders",
"{} Votes (using {}/{} entries):",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The subtle thing here is that 29/31 is possible even if vote truncation started because fork switch. So, the Recent/All title switching and this number indicator isn't strictly-speaking redundant information.

t-nelson
t-nelson previously approved these changes Feb 10, 2021
Copy link
Copy Markdown
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This looks much cleaner!

LGTM as is, I did offer some rewording suggestions where you had questions and a couple nits where we can take the cleanup a little further should you feel like it

Comment thread cli-output/src/cli_output.rs Outdated
if let Some(newest) = epoch_voting_history.iter().rev().next() {
writeln!(
f,
"- ... (truncated older {} votes, which was rooted and became credits)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about truncated {} rooted votes, which have been credited ?

Comment thread cli-output/src/cli_output.rs Outdated

writeln!(
f,
"- ... (truncated older history covering {} credits/rooted votes)",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omitting {} past rooted votes, which have already been credited ?

Comment on lines -615 to -616
writeln!(f, "- slot: {}", vote.slot)?;
writeln!(f, " confirmation count: {}", vote.confirmation_count)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: What do you think about saving the per-line field name redundancy with a header line at the top?

)?;
}

for entry in epoch_voting_history.iter().rev() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Maybe give this block the single-line treatment as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, I rather keep this as-is. Maybe, the single-line style condenses too much information in a single line.

@mergify mergify Bot dismissed t-nelson’s stale review February 11, 2021 10:40

Pull request has been modified.

@ryoqun
Copy link
Copy Markdown
Contributor Author

ryoqun commented Feb 11, 2021

@t-nelson thanks for the review. :)

@ryoqun ryoqun merged commit ab0f4c6 into solana-labs:master Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants