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

[Relayminer] Query for on-chain session param num_blocks_per_session #538

Merged
merged 77 commits into from
May 29, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented May 17, 2024

Summary

Refactors the relayminer to query for the current num_blocks_per_session each (or even multiple) time(s) it's used. This is a naive implementation to just get the relayminer using the on-chain param instead of the const that's still defined in the session keeper pkg but which will be removed in forthcoming work.

Next Steps

  1. Implement ModuleParamsClient[P any] (see: notion - ModuleParamsClient).
  2. Refactor sessionQuerier to use ModuleParamsClient[sessiontypes.Params] to avoid excessive querying.
  3. ...

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

🚀 This description was created by Ellipsis for commit bf24e6c

Summary:

Refactors the relayminer to dynamically query the num_blocks_per_session parameter from the blockchain, updating relevant classes to utilize this new approach.

Key points:

  • Refactor relayminer to dynamically query num_blocks_per_session.
  • Update SessionQueryClient interface with new methods for session parameters.
  • Implement new methods in sessionQuerier.
  • Utilize new session parameter methods in relayerProxy and related classes.
  • Prepare for future enhancements in session handling and grace period calculations.

Generated with ❤️ by ellipsis.dev

@bryanchriswhite bryanchriswhite added relayminer Changes related to the Relayminer off-chain Off-chain business logic labels May 17, 2024
@bryanchriswhite bryanchriswhite self-assigned this May 17, 2024
@bryanchriswhite bryanchriswhite force-pushed the issues/517/refactor/session-params_relayminer branch from d2e94e5 to a635c4e Compare May 17, 2024 07:21
@bryanchriswhite bryanchriswhite linked an issue May 17, 2024 that may be closed by this pull request
10 tasks
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.

@github-actions github-actions bot added devnet push-image CI related - pushes images to ghcr.io labels May 17, 2024
@bryanchriswhite bryanchriswhite force-pushed the issues/517/refactor/session-params_relayminer branch from f9355f2 to 163f9ba Compare May 21, 2024 11:45
…/refactor/move-num_blocks_per_session

* refs/remotes/pokt/main:
  [On-chain] scaffold: module shared (#545)

# Conflicts:
#	api/poktroll/shared/params.pulsar.go
#	proto/poktroll/shared/params.proto
#	x/shared/keeper/msg_update_params.go
#	x/shared/keeper/msg_update_params_test.go
#	x/shared/types/errors.go
#	x/shared/types/genesis.go
#	x/shared/types/genesis_test.go
#	x/shared/types/msg_update_params.go
#	x/shared/types/params.go
#	x/shared/types/params.pb.go
…ssues/517/refactor/session-params_relayminer
…ssues/517/refactor/session-params_relayminer
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.

Just a few minor comments but the only blocking ones are in x/shared/session.go

// GetParams queries & returns the shared module on-chain parameters.
//
// TODO_TECHDEBT(#543): We don't really want to have to query the params for every method call.
// Once `ModuleParamsClient` is implemented, use its replay observable's `#Last` method
Copy link
Member

Choose a reason for hiding this comment

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

When will we have this?

Copy link
Contributor Author

@bryanchriswhite bryanchriswhite May 28, 2024

Choose a reason for hiding this comment

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

Depends on how we prioritize it. From our discussion about historical params, I got the impression that ModuleParamsClient wouldn't be a high priority for the same reason. It would reduce background network overhead but until we have a reason to believe that that's significantly impacting performance, I don't see another reason that needs to be a high priority.

pkg/client/query/sharedquerier.go Outdated Show resolved Hide resolved
pkg/relayer/session/session.go Outdated Show resolved Hide resolved
x/shared/session.go Show resolved Hide resolved
x/shared/session.go Show resolved Hide resolved
x/shared/session.go Show resolved Hide resolved
x/shared/session.go Show resolved Hide resolved
…ssues/517/refactor/session-params_relayminer

* issues/517/refactor/move-num_blocks_per_session:
  fix: update_params.feature reset
@bryanchriswhite bryanchriswhite requested a review from Olshansk May 28, 2024 06:52
…sion-params_relayminer

* pokt/main:
  refactor: move `num_blocks_per_session` param to shared module (#546)
@bryanchriswhite bryanchriswhite changed the base branch from issues/517/refactor/move-num_blocks_per_session to main May 28, 2024 06:54
Copy link
Contributor

@red-0ne red-0ne left a comment

Choose a reason for hiding this comment

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

Looks good to me! Many parts are waiting for #516 and #517, Eager to see how all of these will fit together.

@bryanchriswhite bryanchriswhite merged commit 7507dc5 into main May 29, 2024
10 checks passed
bryanchriswhite added a commit that referenced this pull request May 29, 2024
…sessions

* pokt/main:
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
@bryanchriswhite
Copy link
Contributor Author

bryanchriswhite commented May 29, 2024

🚨 Do not delete this branch until #555 changes bases! 🚨

bryanchriswhite added a commit that referenced this pull request May 29, 2024
…-module

* pokt/main:
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
@bryanchriswhite bryanchriswhite deleted the issues/517/refactor/session-params_relayminer branch May 29, 2024 07:59
bryanchriswhite added a commit that referenced this pull request May 29, 2024
…r/ring-client

* issues/517/refactor/app-module:
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
  chore: udpate comments
  refactor: rename methods which use default shared params with suffix `WithDefaultParams`
  [Relay Mining] Relay Mining math helpers (#549)
  [Relay Mining] Scaffold the RelayMiningDifficulty type (#548)
bryanchriswhite added a commit that referenced this pull request May 29, 2024
…to issues/517/refactor/session-module

* pokt/issues/517/refactor/app-module:
  [Code Health] test: add makefile target for E2E param update tests (#558)
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
  chore: udpate comments
  refactor: rename methods which use default shared params with suffix `WithDefaultParams`
  [Relay Mining] Relay Mining math helpers (#549)
  [Relay Mining] Scaffold the RelayMiningDifficulty type (#548)
bryanchriswhite added a commit that referenced this pull request May 29, 2024
…re/cleanup

* issues/517/refactor/session-module:
  chore: review improvements
  chore: review improvements
  [Code Health] test: add makefile target for E2E param update tests (#558)
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
  chore: udpate comments
  refactor: rename methods which use default shared params with suffix `WithDefaultParams`
  [Relay Mining] Relay Mining math helpers (#549)
  [Relay Mining] Scaffold the RelayMiningDifficulty type (#548)
bryanchriswhite added a commit that referenced this pull request May 29, 2024
…le-param-update-msg

* issues/517/chore/cleanup:
  chore: rename localnet load test makefile target to improve discoverability
  refactor: relay stress test to use queried shared params
  chore: review improvements
  chore: review improvements
  [Code Health] test: add makefile target for E2E param update tests (#558)
  [Relayminer] Query for on-chain session param `num_blocks_per_session` (#538)
  chore: udpate comments
  refactor: rename methods which use default shared params with suffix `WithDefaultParams`
  [Relay Mining] Relay Mining math helpers (#549)
  [Relay Mining] Scaffold the RelayMiningDifficulty type (#548)
  Empty commit
okdas pushed a commit that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devnet devnet-test-e2e off-chain Off-chain business logic push-image CI related - pushes images to ghcr.io relayminer Changes related to the Relayminer
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[Protocol] Add a NumBlocksPerSession governance parameter
3 participants