penumbra-zone / penumbra

Penumbra is a fully private proof-of-stake network and decentralized exchange for the Cosmos ecosystem.
https://penumbra.zone
Apache License 2.0
363 stars 288 forks source link

`pcli query governance list-proposals` is hard to read #4480

Open plaidfinch opened 1 month ago

plaidfinch commented 1 month ago

Describe the bug

$ pcli query governance list-proposals -i
#0 ProposalState { state: Some(Finished(Finished { outcome: Some(ProposalOutcome { outcome: Some(Passed(Passed)) }) })) }    lower proposal voting duration to 4h
#1 ProposalState { state: Some(Finished(Finished { outcome: Some(ProposalOutcome { outcome: Some(Slashed(Slashed { withdrawn: None })) }) })) }    lower proposal voting duration to 4h (#2)
#2 ProposalState { state: Some(Finished(Finished { outcome: Some(ProposalOutcome { outcome: Some(Passed(Passed)) }) })) }    lower proposal voting duration to 1h
#3 ProposalState { state: Some(Finished(Finished { outcome: Some(ProposalOutcome { outcome: Some(Failed(Failed { withdrawn: None })) }) })) }    coffee or tea?
#4 ProposalState { state: Some(Finished(Finished { outcome: Some(ProposalOutcome { outcome: Some(Passed(Passed)) }) })) }    upgrade to 0.76.0

This presents information in a way that is very hard to scan because it uses the debug representation of the proposal outcome.

Expected behavior

It should probably look something like this:

$ pcli query governance list-proposals -i
#0 [PASSED] lower proposal voting duration to 4h
#1 [SLASHED] lower proposal voting duration to 4h (#2)
#2 [PASSED] lower proposal voting duration to 1h
#3 [FAILED] coffee or tea?
#4 [PASSED] upgrade to 0.76.0

To do this, likely the most expedient way is to make a Display impl for ProposalState and use it.

hdevalence commented 1 month ago

It would be nice if this were nicer abstractly but I guess the bigger picture question is do we expect most users to be using pcli to interact with governance, or using a web frontend with Prax?

plaidfinch commented 1 month ago

Few users should be using pcli to interact with governance. However, until we have threshold custody support in Prax, there are a comparatively small (by number) but large (by voting power) set of users who will be using pcli to interact with governance: anyone who needs to vote as a delegator or as a validator whose tokens are custodied via threshold. I think it should be reasonably easy for them to read the CLI output, though I agree we should not put a lot of effort into it.