Skip to content

[Utility][RPC][CLI] Querying governance parameters (Issue #619)#622

Merged
h5law merged 32 commits intomainfrom
rpc-query-params
Apr 7, 2023
Merged

[Utility][RPC][CLI] Querying governance parameters (Issue #619)#622
h5law merged 32 commits intomainfrom
rpc-query-params

Conversation

@h5law
Copy link
Copy Markdown
Contributor

@h5law h5law commented Mar 26, 2023

Description

This PR introduces the ability to query v1/query/allChainParmas with a GET request in order to retrieve the current values for all governance parameters stored in the node's PostgreSQL database. This is defined in the OpenAPI YAML RPC specification and its logic is implemented in rpc/handlers.go

The CLI endpoint is a subcommand under the System command that allows for the querying of this RPC endpoint and is used by the make target query_node_params to quickly enable the querying of governance parameters on localnet.

In addition to this the GovParamMetadatMap has been moved to shared/utils/gov_utils.go where it is being initialised and used in persistance and utility. The owner tags have been added to the genesis.proto file to show which parameters own which, this allows for an easy lookup and reduces the code footprint of the getParamOwner function greatly.

There has also been a lot of code cleanup in utility simplifying governance parameter accessor functions and their tests

Issue

Fixes #619

Type of change

Please mark the relevant option(s):

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Major breaking change
  • Documentation
  • Other

List of changes

  • Add GetAllParams() function to the persistence read interface to retrieve the current value of each parameter
  • Add the v1/query/allChainParams RPC endpoint to the RPC specification, and implement its logic
  • Add the Query subcommand in the CLI
  • Add the AllChainParams subcommand to the Query CLI endpoint to query v1/query/allChainParams
  • Add make query_chain_params target to easily query the parameters on a localnet
  • Move parameter metadata logic into shared/utils/gov.go
  • Reduce code footprint of gov parameters, their accessor functions and tests

Testing

  • make develop_test
  • LocalNet w/ all of the steps outlined in the README

Required Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added, or updated, godoc format comments on touched members (see: tip.golang.org/doc/comment)
  • I have tested my changes using the available tooling
  • I have updated the corresponding CHANGELOG

If Applicable Checklist

  • I have updated the corresponding README(s); local and/or global
  • I have added tests that prove my fix is effective or that my feature works
  • I have added, or updated, mermaid.js diagrams in the corresponding README(s)
  • I have added, or updated, documentation and mermaid.js diagrams in shared/docs/* if I updated shared/*README(s)

@h5law h5law added utility Utility specific changes client work needed to interface with the node (rpc, cli, etc..) labels Mar 26, 2023
@h5law h5law added this to the M3: Pocket RoS (Relay or Slash) milestone Mar 26, 2023
@h5law h5law requested a review from Olshansk March 26, 2023 17:02
@h5law h5law self-assigned this Mar 26, 2023
github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

@h5law h5law changed the title [Utility][RPC][CLI] Querying governance parameters (Issue #619) [WIP][Utility][RPC][CLI] Querying governance parameters (Issue #619) Mar 27, 2023
@h5law h5law marked this pull request as draft March 27, 2023 21:01
…owner= protobuf tags to enable easy param owner lookup
github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

github-actions[bot]

This comment was marked as duplicate.

Copy link
Copy Markdown
Collaborator

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

👨‍⚖️ 👍

@cr-gpt
Copy link
Copy Markdown

cr-gpt bot commented Apr 7, 2023

Seems you are using me but didn't get OPENAI_API_KEY seted in Variables for this repo. you could follow readme for more information

@github-actions github-actions bot dismissed stale reviews from themself April 7, 2023 22:47

The check succeeded, dismissing the review comment.

@reviewpad
Copy link
Copy Markdown

reviewpad bot commented Apr 7, 2023

AI-Generated Summary: This pull request introduces several changes across multiple files, primarily focused on refactoring and improving the retrieval and handling of governance parameters. Key changes include the replacement of specific accessor functions with more generic getGovParam calls, the introduction of new utility functions and test cases for governance parameters, and the addition of new API endpoints and RPC functions for querying data. The code has been made more maintainable, modular, and efficient through these updates, and additional functionality has been provided for querying on-chain data and handling metadata from protobuf-generated structures. Updates to the CHANGELOG.md files document the version changes and features introduced in these updates.

@h5law h5law merged commit 6b9b2db into main Apr 7, 2023
@h5law h5law deleted the rpc-query-params branch April 7, 2023 23:03
bryanchriswhite added a commit that referenced this pull request Apr 10, 2023
* pokt/main:
  [Utility][RPC][CLI] Querying governance parameters (Issue #619) (#622)
  [Persistence][Utility] Separate all CreateAndApply functions into more functional components - Issue #508 (#652)
  [Persistence][Utility] Pools Address hack removal + state accessor fix for params and flags (#654)
  [PERSISTENCE] SavePoints and Rollbacks design document (Issue #493) (#533)
  Update reviewpad.yml
  Added ChatGPT-CodeReview workflow (#649)
  Update reviewpad.yml
  Added default reviewpad.yml file (#648)
  [DevNet] tweaks for remote environments (#601)
  [Documentation] Swap validator and non-validator triggers when finished synching (#646)
  [Consensus] Configuration entry point state sync (#528)
bryanchriswhite added a commit to bryanchriswhite/pocket that referenced this pull request Apr 10, 2023
…p-modules

* pokt/main:
  [Utility][RPC][CLI] Querying governance parameters (Issue pokt-network#619) (pokt-network#622)
  [Persistence][Utility] Separate all CreateAndApply functions into more functional components - Issue pokt-network#508 (pokt-network#652)
  [Persistence][Utility] Pools Address hack removal + state accessor fix for params and flags (pokt-network#654)
  [PERSISTENCE] SavePoints and Rollbacks design document (Issue pokt-network#493) (pokt-network#533)
  Update reviewpad.yml
  Added ChatGPT-CodeReview workflow (pokt-network#649)
  Update reviewpad.yml
  Added default reviewpad.yml file (pokt-network#648)
  [DevNet] tweaks for remote environments (pokt-network#601)
  [Documentation] Swap validator and non-validator triggers when finished synching (pokt-network#646)
  [Consensus] Configuration entry point state sync (pokt-network#528)
bryanchriswhite added a commit that referenced this pull request Apr 12, 2023
…p-modules

* pokt/main:
  update pocket repo read.me (#667)
  Update reviewpad.yml
  [KEYBASE] Add improve comment on keybase config (#665)
  [E2E] Chore: Doc updates (#663)
  [E2E] Adds staking, unstaking, and sending tests (#653)
  [Utility][RPC][CLI] Querying governance parameters (Issue #619) (#622)
  [Persistence][Utility] Separate all CreateAndApply functions into more functional components - Issue #508 (#652)
  [Persistence][Utility] Pools Address hack removal + state accessor fix for params and flags (#654)
  [PERSISTENCE] SavePoints and Rollbacks design document (Issue #493) (#533)
  Update reviewpad.yml
  Added ChatGPT-CodeReview workflow (#649)
  Update reviewpad.yml
  Added default reviewpad.yml file (#648)
  [DevNet] tweaks for remote environments (#601)
  [Documentation] Swap validator and non-validator triggers when finished synching (#646)
  [Consensus] Configuration entry point state sync (#528)
bryanchriswhite added a commit that referenced this pull request Apr 12, 2023
…p-modules

* pokt/main:
  update pocket repo read.me (#667)
  Update reviewpad.yml
  [KEYBASE] Add improve comment on keybase config (#665)
  [E2E] Chore: Doc updates (#663)
  [E2E] Adds staking, unstaking, and sending tests (#653)
  [Utility][RPC][CLI] Querying governance parameters (Issue #619) (#622)
  [Persistence][Utility] Separate all CreateAndApply functions into more functional components - Issue #508 (#652)
  [Persistence][Utility] Pools Address hack removal + state accessor fix for params and flags (#654)
  [PERSISTENCE] SavePoints and Rollbacks design document (Issue #493) (#533)
  Update reviewpad.yml
  Added ChatGPT-CodeReview workflow (#649)
  Update reviewpad.yml
  Added default reviewpad.yml file (#648)
  [DevNet] tweaks for remote environments (#601)
  [Documentation] Swap validator and non-validator triggers when finished synching (#646)
  [Consensus] Configuration entry point state sync (#528)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client work needed to interface with the node (rpc, cli, etc..) utility Utility specific changes waiting-for-review

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Tooling][Utility] CLI - Querying governance params

2 participants