Skip to content
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

feat(cmd): Add support for governance operations #91

Merged
merged 2 commits into from Jun 21, 2023

Conversation

kostko
Copy link
Member

@kostko kostko commented Jun 8, 2023

Adds oasis network governance command with the following subcommands:

  • list lists all governance proposals
  • show moved from oasis network governance-proposal
  • cast-vote votes for the proposal with yes/no/abstein
  • create-proposal registers new proposal

@kostko kostko requested a review from matevz June 8, 2023 12:49
@kostko kostko force-pushed the kostko/feature/governance branch from dc14811 to dcbd0b2 Compare June 8, 2023 13:03
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Some refactoring suggestions.

cmd/account/governance.go Outdated Show resolved Hide resolved
cmd/account/governance.go Outdated Show resolved Hide resolved
cmd/account/governance.go Outdated Show resolved Hide resolved
cmd/account/governance.go Outdated Show resolved Hide resolved
@kostko kostko force-pushed the kostko/feature/governance branch 2 times, most recently from 4aadab2 to 03b8f56 Compare June 14, 2023 07:50
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Current example output for Testnet:

$ ./oasis acc gov show 7
Proposal passed, results: map[yes:50502292650718313]

Voted stake: 50502292650718313 (99.74%), total voting stake: 50632443796309264
Voted yes stake: 50502292650718313 (100.00%), voted stake: 50502292650718313, threshold: 68%

Validators voted:
oasis1qz2tg4hsatlxfaf8yut9gxgv8990ujaz4sldgmzx,<none>,10103361401282754 (19.95%)
oasis1qqv25adrld8jjquzxzg769689lgf9jxvwgjs8tha,<none>,10101056743564861 (19.95%)
oasis1qq2vzcvxn0js5unsch5me2xz4kr43vcasv0d5eq4,<none>,10099736164903599 (19.95%)
oasis1qz424yg28jqmgfq3xvly6ky64jqnmlylfc27d7cp,<none>,10099128300187338 (19.95%)
oasis1qr37y56g92chzvsew54kj7gu47cxyly7jytt5rm0,<none>,10099010040779761 (19.95%)

Validators not voted:
oasis1qrwncs459lauc77zw23efdn9dmfcp23cxv095l5z,GateOmega,36925612846659 (0.07%)
oasis1qq60zmsfca0gvmm3v8906pn5zqtt4ee2ssexramg,Validatrium,33743956828846 (0.07%)
oasis1qzjm0zwfg4egs9kk4d9rkujudzk8pjp5rvxyr3ag,Munay Network,11702422579124 (0.02%)
oasis1qpq97fm6lf87jzms9agd6z902nh7axtxvus6m352,LDV,10378819794784 (0.02%)
oasis1qpz97gfrvj5xzx8jx7x9zweeq0rcf2q6jg4a09qz,Stardust Staking,10086070309641 (0.02%)
oasis1qr2jxg57ch6p3787t2a8973v8zn8g82nxuex0773,Doorgod,9076788760953 (0.02%)
oasis1qz9x0zpja6n25hc5242k2e60l6a7ke2zsq9cqrqz,SerGo,5044216011403 (0.01%)
oasis1qqxxut9x74dutu587f9nj8787qz4dm0ueu05l88c,Princess Stake,2823252249537 (0.01%)
oasis1qq45am6gzaur2rxhk26av9qf7ryhgca6ecg28clu,Jr,2017758254984 (0.00%)
oasis1qzlzczsdme4scprjjh4h4vtljnmx3ag4vgpdnqln,Alexander (aka Bambarello) Validator,1593638024547 (0.00%)
oasis1qrq7hgvv26003hy89klcmy3mnedrmyd7lvf0k6qn,Perfect Stake,1403980986777 (0.00%)
oasis1qzwe6xywazp29tp20974wgxhdcpdf6yxfcn2jxvv,Simply Staking,1261098909212 (0.00%)
oasis1qphcvmsh6mw98vtg0cg4dvdsen5tm0g3e58eqpnp,Appload,1108526799775 (0.00%)
oasis1qpc66dgff4wrkj8kac4njrl2uvww3c9m5ycjwar2,<none>,1008643976345 (0.00%)
oasis1qpswaz4djukz0zanquyh2vswk59up22emysq5am9,StakeService,798000138962 (0.00%)
oasis1qr6a9jyxhvnxuq5kmtvntr0uv6mntvzvuyv57aqc,Orion.Money,480502898774 (0.00%)
oasis1qr4vsan850vmztuy9r2pex4fj4wxnmhvlgclg500,<none>,297535440854 (0.00%)
oasis1qqgvqelw8kmcd8k4cqypcsyajkl3gq6ppc4t34n2,AnkaStake,200251058019 (0.00%)
oasis1qzw6ljanmz8h4pjggemlgcysdnamaj830vlwu8c7,Mirror Frequency,200069721755 (0.00%)

I'm picky, but let's make printing more consistent with other commands:

  • add Network: Testnet
  • add Proposal ID: 7
  • then something like Status: PASSED
  • followed by Results:
  • map[yes:50502292650718313] should be
       Yes: 50502292650718313
       No: 0
       Abstein: 0
    
  • and then === VALIDATORS VOTED === with enumerated list of voters and the same for === VALIDATORS NOT VOTED ===

cmd/account/governance/list.go Outdated Show resolved Hide resolved
@matevz matevz force-pushed the kostko/feature/governance branch from b9439de to ffaeb8e Compare June 21, 2023 10:58
@matevz
Copy link
Member

matevz commented Jun 21, 2023

Moved governance cmd from account to network. New output:

$ oasis network governance show 7
Network:     localhost_testnet
Proposal ID: 7
Status:      passed
Results:
  - yes: 50502292650718313
  - no: 0
  - abstain: 0

=== VOTED STAKE ===
Total voting stake: 50632443796309264
Voted stake:        50502292650718313 (99.74%)
Voted yes stake:    50502292650718313 (100.00%)
Threshold:          68%

=== VALIDATORS VOTED ===
  1. oasis1qz2tg4hsatlxfaf8yut9gxgv8990ujaz4sldgmzx,<none>,10103361401282754 (19.95%)
  2. oasis1qqv25adrld8jjquzxzg769689lgf9jxvwgjs8tha,<none>,10101056743564861 (19.95%)
  3. oasis1qq2vzcvxn0js5unsch5me2xz4kr43vcasv0d5eq4,<none>,10099736164903599 (19.95%)
  4. oasis1qz424yg28jqmgfq3xvly6ky64jqnmlylfc27d7cp,<none>,10099128300187338 (19.95%)
  5. oasis1qr37y56g92chzvsew54kj7gu47cxyly7jytt5rm0,<none>,10099010040779761 (19.95%)

=== VALIDATORS NOT VOTED ===
  1. oasis1qrwncs459lauc77zw23efdn9dmfcp23cxv095l5z,GateOmega,36925612846659 (0.07%)
  2. oasis1qq60zmsfca0gvmm3v8906pn5zqtt4ee2ssexramg,Validatrium,33743956828846 (0.07%)
  3. oasis1qzjm0zwfg4egs9kk4d9rkujudzk8pjp5rvxyr3ag,Munay Network,11702422579124 (0.02%)
  4. oasis1qpq97fm6lf87jzms9agd6z902nh7axtxvus6m352,LDV,10378819794784 (0.02%)
  5. oasis1qpz97gfrvj5xzx8jx7x9zweeq0rcf2q6jg4a09qz,Stardust Staking,10086070309641 (0.02%)
  6. oasis1qr2jxg57ch6p3787t2a8973v8zn8g82nxuex0773,Doorgod,9076788760953 (0.02%)
  7. oasis1qz9x0zpja6n25hc5242k2e60l6a7ke2zsq9cqrqz,SerGo,5044216011403 (0.01%)
  8. oasis1qqxxut9x74dutu587f9nj8787qz4dm0ueu05l88c,Princess Stake,2823252249537 (0.01%)
  9. oasis1qq45am6gzaur2rxhk26av9qf7ryhgca6ecg28clu,Jr,2017758254984 (0.00%)
  10. oasis1qzlzczsdme4scprjjh4h4vtljnmx3ag4vgpdnqln,Alexander (aka Bambarello) Validator,1593638024547 (0.00%)
  11. oasis1qrq7hgvv26003hy89klcmy3mnedrmyd7lvf0k6qn,Perfect Stake,1403980986777 (0.00%)
  12. oasis1qzwe6xywazp29tp20974wgxhdcpdf6yxfcn2jxvv,Simply Staking,1261098909212 (0.00%)
  13. oasis1qphcvmsh6mw98vtg0cg4dvdsen5tm0g3e58eqpnp,Appload,1108526799775 (0.00%)
  14. oasis1qpc66dgff4wrkj8kac4njrl2uvww3c9m5ycjwar2,<none>,1008643976345 (0.00%)
  15. oasis1qpswaz4djukz0zanquyh2vswk59up22emysq5am9,StakeService,798000138962 (0.00%)
  16. oasis1qr6a9jyxhvnxuq5kmtvntr0uv6mntvzvuyv57aqc,Orion.Money,480502898774 (0.00%)
  17. oasis1qr4vsan850vmztuy9r2pex4fj4wxnmhvlgclg500,<none>,297535440854 (0.00%)
  18. oasis1qqgvqelw8kmcd8k4cqypcsyajkl3gq6ppc4t34n2,AnkaStake,200251058019 (0.00%)
  19. oasis1qzw6ljanmz8h4pjggemlgcysdnamaj830vlwu8c7,Mirror Frequency,200069721755 (0.00%)

@matevz matevz enabled auto-merge June 21, 2023 13:15
@matevz matevz force-pushed the kostko/feature/governance branch from ffaeb8e to 579fe7b Compare June 21, 2023 13:15
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

LGTM

@matevz matevz merged commit 67d1bca into master Jun 21, 2023
3 checks passed
@matevz matevz deleted the kostko/feature/governance branch June 21, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants