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

[Protocol] Centralized Proof & Tokenomics param updating #486

Merged
merged 61 commits into from
May 15, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Apr 18, 2024

Summary

  • Use authz to grant the DAO (a.k.a. "PNF" or "foundation") permissions for each type of module parameter update message.
  • Add new MsgUpdateParam message type & handler to tokenomics & proof modules for updating individual params.

See: #322 & "governance schemes" in notion - Gov Prams.

Changes

  • Add/update makefile targets:
    • update_tokenomics_params_all
    • update_tokenomics_param_compute_units_to_tokens_mulitplier
    • update_proof_params_all
    • update_proof_param_min_relay_difficulty_bits
  • Scaffold (& refactor) an MsgUpdateParam message to both tokenomics & proof modules for updating an individual param by name
  • Inject localnet genesis authz grants necessary for updating localnet params

Demo

authz_gov.webm
# Print the DAO's account address.
poktrolld keys show pnf --keyring-backend test

# Print the governance module's account address.
poktrolld query auth module-account gov --node tcp://127.0.0.1:36657  

# Print any grants by the governance module account to the DAO account.
poktrolld query authz grants pokt10d07y265gmmuvt4z0w9aw880jnsr700j8yv32t pokt1eeeksh2tvkh7wzmfrljnhw4wrhs55lcuvmekkw --node tcp://127.0.0.1:36657

## Tokenomics Module - All Params
# Print the current tokenomics module params.
poktrolld query tokenomics params --node tcp://127.0.0.1:36657

# Print the `MsgUpdateParams` that will be executed by authz when updating all tokenomics module params.
cat ./tools/scripts/params/tokenomics_all.json

# Use `poktrolld authz exec ...` to execute the `MsgUpdateParams` to update all tokenomics module params.
make update_tokenomics_params_all

# Print the updated tokenomics params.
poktrolld query tokenomics params --node tcp://127.0.0.1:36657

## Proof Module - All Params
# Print the current proof module params.
poktrolld query proof params --node tcp://127.0.0.1:36657

# Print the `MsgUpdateParams` that will be executed by authz when updating all proof module params.
cat ./tools/scripts/params/proof_all.json

# Use `poktrolld authz exec ...` to execute the `MsgUpdateParams` to update all proof module params.
make update_proof_params_all

# Print the updated proof module params.
poktrolld query proof params --node tcp://127.0.0.1:36657

## Proof Module - Individual Param
# Print the `MsgUpdateParam`(s) that will be executed by authz when updating `min_relay_difficulty_bits`.
cat ./tools/scripts/params/proof_param_min_relay_difficulty_bits.json

# Use `poktrolld authz exec ...` to execute the `MsgUpdateParams` to update `min_relay_difficulty_bits.
make update_proof_param_min_relay_difficulty_bits

# Print the updated proof module params.
poktrolld query proof params --node tcp://127.0.0.1:36657

Issue

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

Documentation changes (only if making doc changes)

  • make docusaurus_start; only needed if you make doc changes

Local Testing (only if making code changes)

  • Unit Tests: make go_develop_and_test
  • LocalNet E2E Tests: make test_e2e
  • See quickstart guide for instructions

PR Testing (only if making code changes)

  • DevNet E2E Tests: Add the devnet-test-e2e label to the PR.
    • THIS IS VERY EXPENSIVE, so only do it after all the reviews are complete.
    • Optionally run make trigger_ci if you want to re-trigger tests without any code changes
    • If tests fail, try re-running failed tests only using the GitHub UI as shown here

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have commented my code
  • I have performed a self-review of my own code; both comments & source code
  • I create and reference any new tickets, if applicable
  • I have left TODOs throughout the codebase, if applicable

@bryanchriswhite bryanchriswhite added the on-chain On-chain business logic label Apr 18, 2024
@bryanchriswhite bryanchriswhite self-assigned this Apr 18, 2024
x/proof/keeper/msg_update_params_test.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
x/proof/keeper/msg_update_params_test.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
testutil/keeper/proof.go Outdated Show resolved Hide resolved
@bryanchriswhite

This comment was marked as outdated.

@bryanchriswhite bryanchriswhite changed the title [Protocol] Governance params proof-of-concept [Protocol] Authz-based Proof & Tokenomics param updating Apr 22, 2024
e2e/tests/update_params.feature Outdated Show resolved Hide resolved
e2e/tests/update_params.feature Outdated Show resolved Hide resolved
e2e/tests/update_params_test.go Outdated Show resolved Hide resolved
e2e/tests/update_params_test.go Show resolved Hide resolved
tempFile, err := os.CreateTemp("", "exec.json")
require.NoError(s, err)

defer func(f *os.File) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it possible to just call defer tempFile.Close()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is but once we turn on more linters, one should complain about the ignored error return from #Close().

Copy link
Member

@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.

  1. A couple small comments from me
  2. In support of the other comments left
  3. Pre-emtively approving so we can get this in!

e2e/tests/params_tx_test.go Outdated Show resolved Hide resolved
e2e/tests/params_keys_test.go Outdated Show resolved Hide resolved
Comment on lines 215 to 216
// ensureOnChainAccount sends a minimal amount of upokt tokens to the given address
// to ensure it has an on-chain account.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// ensureOnChainAccount sends a minimal amount of upokt tokens to the given address
// to ensure it has an on-chain account.
// ensureOnChainAccount sends a minimal amount of upokt tokens to the given address
// to ensure it has an on-chain account. This means that the public key is retrievable when
// queried for by address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This means that the public key is retrievable when queried for by address.

I don't believe that this is accurate. Funding the address ensures that it has a balance in the bank module; however, it doesn't have any effect on the auth module AFAIK, which is where the public key is stored. My understanding is that a tx would have to be submitted which was signed by that key in order to get the public key on-chain. While funding the address is a prerequisite for this, they are distinct steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did a bit of renaming/refactoring to improve readability:

image

image

…cept

* pokt/main:
  [Documentation] Improve RelayMiner staking related documentation (#524)
  A couple comment improvements
  Update google drive video to youtube video
Co-authored-by: Redouane Lakrache <[email protected]>
@bryanchriswhite
Copy link
Contributor Author

bryanchriswhite commented May 15, 2024

TODO:

  • update load test logic to use authz to update params (instead of directly). (86fe8bc)

@bryanchriswhite bryanchriswhite merged commit 7dfea8b into main May 15, 2024
10 checks passed
@bryanchriswhite bryanchriswhite deleted the issues/322/proof-of-concept branch May 15, 2024 10:44
@bryanchriswhite bryanchriswhite removed push-image CI related - pushes images to ghcr.io devnet-test-e2e labels May 16, 2024
@github-actions github-actions bot removed the devnet label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-chain On-chain business logic
Projects
Status: ✅ Done
4 participants