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

[TODOs] grace_period_end_offset_blocks validation & cleanup #667

Merged
merged 9 commits into from
Jul 15, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Jul 9, 2024

Summary

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

Summary by CodeRabbit

  • Bug Fixes

    • Improved validation logic for session parameters to ensure better consistency and reliability.
  • Refactor

    • Updated logic for comparing session IDs to use getter methods, enhancing code readability and maintainability.
  • Tests

    • Adjusted expected error messages in tests to improve clarity and accuracy.
  • Chores

    • Removed outdated comments and TODOs for cleaner code and better maintenance.

@bryanchriswhite bryanchriswhite added the code health Cleans up some code label Jul 9, 2024
@bryanchriswhite bryanchriswhite self-assigned this Jul 9, 2024
Copy link

coderabbitai bot commented Jul 9, 2024

Walkthrough

The recent updates focus on refining validation logic, clarifying error messages, and cleaning up code comments across various modules. Key changes include enhancing parameter validation in params.go, updating session ID comparison methods in relay_verifier.go, and maintaining clear error messaging in tests. Additionally, there was a removal of obsolete comments and TODOs to improve code clarity and maintainability.

Changes

File Path Summary
x/shared/types/params.go Updated validation logic by adding two new functions and removed a TODO_BLOCKER comment.
x/tokenomics/keeper/msg_update_params.go Removed a TODO_BLOCKER comment related to address validation and authority checking.
pkg/relayer/proxy/relay_verifier.go Updated logic for session ID comparison and revised a comment for clarity.
pkg/relayer/proxy/proxy_test.go Modified expected error message in a test from "session mismatch" to "session ID mismatch".
x/session/keeper/session_hydrator.go Removed commented code and associated TODO comments related to retrieving suppliers at a block height.

Poem

In the code's garden, changes bloom bright,
Validation strengthened in the night.
Errors now clearer, sessions aligned,
Comments pruned, the code refined.
🐇 Celebrating the clarity, we code on in delight! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bryanchriswhite bryanchriswhite changed the title Issues/584/todo/cleanup [TODOs] grace_period_end_offset_blocks validation & cleanup Jul 9, 2024
@bryanchriswhite bryanchriswhite added push-image CI related - pushes images to ghcr.io devnet-test-e2e labels Jul 9, 2024
Copy link

github-actions bot commented Jul 9, 2024

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 E2E tests, please add devnet-test-e2e label.

Copy link

github-actions bot commented Jul 9, 2024

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks.

You may need to run make trigger_ci to submit an empty commit that'll trigger the tests.

GCP workloads (requires changing the namespace to 667)
Grafana network dashboard for devnet-issue-{issue-id}

@github-actions github-actions bot added the devnet label Jul 9, 2024
@bryanchriswhite bryanchriswhite linked an issue Jul 9, 2024 that may be closed by this pull request
15 tasks
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between bdbc365 and 369282a.

Files selected for processing (2)
  • x/shared/types/params.go (4 hunks)
  • x/tokenomics/keeper/msg_update_params.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/tokenomics/keeper/msg_update_params.go
Additional comments not posted (3)
x/shared/types/params.go (3)

116-119: LGTM! Ensure that the added validation functions are correctly integrated.

The addition of validateGracePeriodOffsetBlocksIsLessThanNumBlocksPerSession and validateClaimWindowOpenOffsetIsAtLeastGracePeriodEndOffset in the ValidateBasic method looks good.

However, verify that these validation functions are correctly integrated into the larger codebase.


Line range hint 182-195:
LGTM! Ensure the godoc comment is clear and complete.

The function validateClaimWindowOpenOffsetIsAtLeastGracePeriodEndOffset correctly validates that ClaimWindowOpenOffsetBlocks is at least as large as GracePeriodEndOffsetBlocks.

However, verify that the godoc comment is clear and complete.


197-206: LGTM! Ensure the godoc comment is clear and complete.

The function validateGracePeriodOffsetBlocksIsLessThanNumBlocksPerSession correctly validates that GracePeriodEndOffsetBlocks is less than NumBlocksPerSession.

However, verify that the godoc comment is clear and complete.

(cherry picked from commit d3bd78a)
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 369282a and 642eaf6.

Files selected for processing (1)
  • pkg/relayer/proxy/relay_verifier.go (1 hunks)
Additional comments not posted (3)
pkg/relayer/proxy/relay_verifier.go (3)

68-73: Good use of getter methods for session IDs.

The change improves encapsulation and code readability.


Line range hint 52-54:
Clear and concise comment on applicationAddress.

The revised comment provides a better understanding of the guarantee provided by the relay request signature verification.


Line range hint 1-93:
Overall changes are consistent and improve code quality.

The changes integrate well with the existing code, improving encapsulation and clarity.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 642eaf6 and c7a23c9.

Files selected for processing (1)
  • pkg/relayer/proxy/proxy_test.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • pkg/relayer/proxy/proxy_test.go

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c7a23c9 and ab6333b.

Files selected for processing (1)
  • x/session/keeper/session_hydrator.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • x/session/keeper/session_hydrator.go

@@ -163,11 +163,6 @@ func (k Keeper) hydrateSessionApplication(ctx context.Context, sh *sessionHydrat
func (k Keeper) hydrateSessionSuppliers(ctx context.Context, sh *sessionHydrator) error {
logger := k.Logger().With("method", "hydrateSessionSuppliers")

// TODO_BLOCKER(@Olshansk): Retrieve the suppliers at SessionStartBlockHeight,
Copy link
Contributor Author

@bryanchriswhite bryanchriswhite Jul 10, 2024

Choose a reason for hiding this comment

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

Resolved by #666 👹

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.

Left a few comments worth discussing.

x/shared/types/params.go Show resolved Hide resolved
x/session/keeper/session_hydrator.go Show resolved Hide resolved
@bryanchriswhite bryanchriswhite removed the push-image CI related - pushes images to ghcr.io label Jul 15, 2024
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.

LGTM!

@bryanchriswhite bryanchriswhite added push-image CI related - pushes images to ghcr.io devnet-test-e2e labels Jul 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 E2E tests, 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.

You may need to run make trigger_ci to submit an empty commit that'll trigger the tests.

GCP workloads (requires changing the namespace to 667)
Grafana network dashboard for devnet-issue-{issue-id}

@bryanchriswhite bryanchriswhite merged commit 234ad58 into main Jul 15, 2024
10 checks passed
bryanchriswhite added a commit that referenced this pull request Jul 16, 2024
…ation-overserviced

* pokt/main:
  [TODO] Blockers @okdas (#674)
  [TODO_BLOCKER] chore: Remove stale TODO_BLOCKERs (#694)
  [TODO] refactor: query expiring claims w/ index (#671)
  [TODOs] `grace_period_end_offset_blocks` validation & cleanup (#667)
  [Testing] add account balance coverage to account settlement (#670)
  [Application] Auto-undelegation of unstaked gateways (#692)
  [RelayMiner] Fix LeanClient mutiple suppliers support (#662)
bryanchriswhite added a commit that referenced this pull request Jul 16, 2024
…-root

* pokt/main:
  [TODO] Blockers @okdas (#674)
  [TODO_BLOCKER] chore: Remove stale TODO_BLOCKERs (#694)
  [TODO] refactor: query expiring claims w/ index (#671)
  [TODOs] `grace_period_end_offset_blocks` validation & cleanup (#667)
  [Testing] add account balance coverage to account settlement (#670)
  [Application] Auto-undelegation of unstaked gateways (#692)
  [RelayMiner] Fix LeanClient mutiple suppliers support (#662)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Cleans up some code devnet devnet-test-e2e push-image CI related - pushes images to ghcr.io
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

[TODO] @Olshansk's (and now @Bryan's) Blocker TODOs
2 participants