-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cli: improve vote-account vote-authority display #95
Conversation
Also, a question: I think the json output of vote authorities should properly be an array (echoes this issue), ie:
instead of current:
Too breaking to change? (Or maybe okay after v2 version bump?) |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #95 +/- ##
=========================================
- Coverage 81.8% 81.8% -0.1%
=========================================
Files 838 838
Lines 225940 225947 +7
=========================================
- Hits 184937 184884 -53
- Misses 41003 41063 +60 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while part of me wishes it didn't, lgtm 😅
@@ -1648,7 +1648,21 @@ impl VerboseDisplay for CliAuthorizedVoters {} | |||
|
|||
impl fmt::Display for CliAuthorizedVoters { | |||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { | |||
write!(f, "{:?}", self.authorized_voters) | |||
if let Some((_epoch, current_authorized_voter)) = self.authorized_voters.first_key_value() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"surely we can't resolve the curre... why the hell do we do all of this superfluous work for every vote?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a good question!
cli-output/src/cli_output.rs
Outdated
} | ||
if self.authorized_voters.len() > 1 { | ||
let (epoch, upcoming_authorized_voter) = | ||
self.authorized_voters.last_key_value().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: prefer expect("why?")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
* Simplify vote-authority display * Add handling for new vote authority * Add proper None handling, because unit test (shouldn't happen IRL, though) * Unwrap->expect
Problem
In
solana vote-account
output, the Vote Authority line is not clear. It returns a map of one or more numbers to address strings, eg:The number is in fact an epoch, the epoch the respective authority is active. This is usually the current epoch, but in the case of a vote-authority update, it is the epoch in which the new vote authority will go into effect.
Cleaning up small, old Labs issues: solana-labs#11273
Summary of Changes
Simplify normal display:
If a new vote authority has been authorized, display its information, eg:
Fixes solana-labs#11273