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

[Session] add num_blocks_per_session param #530

Merged
merged 18 commits into from
May 22, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented May 14, 2024

Summary

This is the first step towards the objective outlined in #517: introduce the NumBlocksPerSession parameter to the session module.

(This PR is dependent on the param related E2E tests added in #486)

Next steps:

  1. Add support for querying for session module params to SessionQueryClient & SupplierClient.
  2. Refactor RelayMiner to query dependent params on demand (naive implementation).
  3. Add session keeper dependency to application keeper.
  4. Remove & refactor outstanding usages of sessionkeeper.NumBlocksPerSession placeholder constant (depends on 1 & 2).
  5. Add support for updating individual params to the session module (scaffold MsgUpdateParam).
  6. Refactor RelayMiner & SessionQueryClient to react to param updates.

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 session Changes related to Session management on-chain On-chain business logic labels May 14, 2024
@bryanchriswhite bryanchriswhite added this to the Shannon MainNet milestone May 14, 2024
@bryanchriswhite bryanchriswhite self-assigned this May 14, 2024
Copy link

gitguardian bot commented May 14, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@bryanchriswhite bryanchriswhite changed the base branch from main to issues/322/proof-of-concept May 14, 2024 12:56
@bryanchriswhite bryanchriswhite linked an issue May 14, 2024 that may be closed by this pull request
10 tasks
@bryanchriswhite bryanchriswhite force-pushed the issues/517/param-num_blocks_per_session branch 3 times, most recently from 179ad01 to 8c0604e Compare May 15, 2024 10:00
@bryanchriswhite bryanchriswhite added push-image CI related - pushes images to ghcr.io devnet-test-e2e labels May 15, 2024
Copy link

The image is going to be pushed after the next commit. You can use make trigger_ci to push an empty commit. If you also want to run an E2E test, please add devnet-test-e2e label.

Copy link

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks. If you just created a pull request, you might need to push another commit to produce a container image DevNet can utilize to spin up infrastructure. You can use make trigger_ci to push an empty commit.

@bryanchriswhite bryanchriswhite force-pushed the issues/517/param-num_blocks_per_session branch 2 times, most recently from 707e002 to 5846990 Compare May 15, 2024 10:41
@bryanchriswhite bryanchriswhite changed the base branch from issues/322/proof-of-concept to main May 15, 2024 10:43
@bryanchriswhite bryanchriswhite force-pushed the issues/517/param-num_blocks_per_session branch from f81089a to 05e631a Compare May 15, 2024 12:10
@bryanchriswhite bryanchriswhite marked this pull request as ready for review May 15, 2024 12:36
x/session/types/params.go Outdated Show resolved Hide resolved
x/application/types/params.go Outdated Show resolved Hide resolved
x/session/types/params.go Outdated Show resolved Hide resolved
x/session/types/params.go Outdated Show resolved Hide resolved
x/session/types/params.go Outdated Show resolved Hide resolved
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.

This is setting some really great standards that others will just copy-pasta to add more params. Love it!

@@ -9,7 +9,10 @@ import (
// DefaultAddServiceFee is the default value for the add service fee
// parameter in the genesis state of the service module.
// TODO_BLOCKER: Revisit default param values for service fee
const DefaultAddServiceFee = 1000000000 // 1000 POKT
const (
ParamAddServiceFee = "add_service_fee"
Copy link
Member

Choose a reason for hiding this comment

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

Excited to add the champion business logic here soon!

cc @moatus

@okdas
Copy link
Member

okdas commented May 21, 2024

@bryanchriswhite I saw this is blocked due to e2e test failing on CI. Looking at the output of the test, it seems like the reason is the accounts were not fully initialized due to send transactions not working correctly. It appears we've recently introduced some fees. Here's the error:

raw_log: ‘insufficient fees; got:  required: 2000upokt: insufficient fee’

I'll see how to address that, and I'll probably end up pushing a fix in your PR.

@Olshansk Olshansk requested a review from okdas May 21, 2024 20:19
@okdas
Copy link
Member

okdas commented May 21, 2024

We started having this issue because the minimum-gas-prices was set to "0.01upokt" (I put it there while changing this config on TestNet).

On LocalNet, we have this set to 0upokt. Originally, I started fixing the tests to account for the new fee, but it would take more time than I originally thought, so I just rolled back that configuration on DevNets keeping it on TestNet.

E2E tests mostly pass. There's this e2e test error though, which seems to be related to that PR:
Screenshot 2024-05-21 at 4 44 07 PM

@bryanchriswhite is this error expected?

@bryanchriswhite
Copy link
Contributor Author

bryanchriswhite commented May 22, 2024

Thanks for investigating and for the context @okdas!

E2E tests mostly pass. There's this e2e test error though, which seems to be related to that PR: Screenshot 2024-05-21 at 4 44 07 PM

@bryanchriswhite is this error expected?

This is not expected; however, it makes sense if the DevNet state is not reset between E2E test runs and a previous run failed after altering DevNet state. The test attempts to reset all module params to their default values after each scenario but depending on how the test fails, it seems, this may not happen as expected. 🤔

It might be better to add the "unauthorized" key to the config.yaml instead of adding it to the keyring during the test. I've noticed this also seems to cause errors locally when running make acc_initialize_pubkeys after running E2E tests; although, I don't think it actually causes any functional issue.

After re-building and -running CI, it's passing. 👍 Thanks!

@bryanchriswhite
Copy link
Contributor Author

It might be better to add the "unauthorized" key to the config.yaml instead of adding it to the keyring during the test.

Done in 6c6ec62.

@bryanchriswhite bryanchriswhite merged commit da70c0e into main May 22, 2024
10 checks passed
@bryanchriswhite
Copy link
Contributor Author

bryanchriswhite commented May 22, 2024

🚨 DO NOT delete this branch until #538 has changed its base branch off of this branch! 🚨

bryanchriswhite added a commit that referenced this pull request May 23, 2024
…sion-params_relayminer

* pokt/main:
  [SDK] Track pb.go files  (#544)
  [Session] add `num_blocks_per_session` param (#530)
@bryanchriswhite bryanchriswhite deleted the issues/517/param-num_blocks_per_session branch May 23, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devnet devnet-test-e2e on-chain On-chain business logic push-image CI related - pushes images to ghcr.io session Changes related to Session management
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Protocol] Add a NumBlocksPerSession governance parameter
3 participants