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

chore: rename ClientKeeper interface functions #6017

Merged
merged 4 commits into from
Mar 19, 2024

Conversation

crodriguezvega
Copy link
Contributor

@crodriguezvega crodriguezvega commented Mar 18, 2024

Description

I thought this is more consistent with the other functions in the interface. See my comment here. Happy to close the PR if people think it's ok as is.

closes: #XXXX


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against the correct branch (see CONTRIBUTING.md).
  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/).
  • Added relevant godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Include a descriptive changelog entry when appropriate. This may be left to the discretion of the PR reviewers. (e.g. chores should be omitted from changelog)
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

Summary by CodeRabbit

  • Refactor
    • Renamed functions related to client height and timestamp retrieval across various modules for better specificity and alignment with functionality.
    • Updated function calls in test suites and interfaces to reflect the new, more descriptive names.

Copy link
Contributor

coderabbitai bot commented Mar 18, 2024

Walkthrough

Walkthrough

The recent updates focus on renaming specific functions within the IBC core modules to more accurately reflect their purpose related to client operations. Functions dealing with retrieving the latest height and timestamp for a client have been renamed to include 'Client' in their names, enhancing clarity and consistency across the codebase. This change affects both the core client and channel modules, as well as their corresponding test suites and interfaces, ensuring a unified approach to naming conventions.

Changes

Files Change Summary
.../02-client/keeper/keeper.go,
.../expected_keepers.go,
testing/chain.go
Renamed GetLatestHeight to GetClientLatestHeight and GetTimestampAtHeight to GetClientTimestampAtHeight.
.../02-client/keeper/keeper_test.go Updated test function names to TestGetClientLatestHeight and TestGetClientTimestampAtHeight.
.../04-channel/keeper/packet.go,
.../04-channel/keeper/timeout.go,
.../04-channel/keeper/upgrade.go,
.../04-channel/keeper/packet_test.go
Updated function calls to use GetClientTimestampAtHeight instead of GetTimestampAtHeight.

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-tests 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 tests 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 tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between d327c07 and 4cd5f40.
Files selected for processing (8)
  • modules/core/02-client/keeper/keeper.go (2 hunks)
  • modules/core/02-client/keeper/keeper_test.go (3 hunks)
  • modules/core/04-channel/keeper/packet.go (1 hunks)
  • modules/core/04-channel/keeper/packet_test.go (2 hunks)
  • modules/core/04-channel/keeper/timeout.go (1 hunks)
  • modules/core/04-channel/keeper/upgrade.go (1 hunks)
  • modules/core/04-channel/types/expected_keepers.go (1 hunks)
  • testing/chain.go (1 hunks)
Additional comments: 11
modules/core/04-channel/types/expected_keepers.go (1)
  • 17-18: Renaming GetLatestHeight to GetClientLatestHeight and GetTimestampAtHeight to GetClientTimestampAtHeight improves clarity by indicating these methods relate to a client. Ensure all references to these methods are updated across the codebase for consistency.
modules/core/04-channel/keeper/timeout.go (1)
  • 66-66: The update from GetTimestampAtHeight to GetClientTimestampAtHeight aligns with the renamed method in the ClientKeeper interface. Consider adding a comment explaining the reason for this change to aid future maintainability.
modules/core/04-channel/keeper/packet.go (1)
  • 71-72: Updating method calls from GetLatestHeight to GetClientLatestHeight and from GetTimestampAtHeight to GetClientTimestampAtHeight in the SendPacket function aligns with the renamed methods in the ClientKeeper interface. Ensure the functionality remains unchanged and verify that all references to these methods are correctly updated across the codebase.
modules/core/02-client/keeper/keeper.go (2)
  • 480-482: The function GetClientLatestHeight has been correctly renamed from GetLatestHeight to align with the PR's objective of enhancing naming consistency within the ClientKeeper interface. This change makes the function's purpose clearer, specifically that it retrieves the latest height of a client state for a given client identifier.
  • 500-501: The function GetClientTimestampAtHeight has been correctly renamed from GetTimestampAtHeight to GetClientTimestampAtHeight, which is in line with the PR's goal of improving naming consistency. This renaming clarifies that the function returns the timestamp of the consensus state at a given height for a specific client.
testing/chain.go (1)
  • 617-617: The update from GetLatestHeight to GetClientLatestHeight aligns with the PR's objective of improving naming consistency. Ensure that all references to the old function name across the codebase have been updated accordingly.
Verification successful

The occurrences of GetLatestHeight found outside testing/chain.go are in contexts not directly related to the ClientKeeper interface renaming effort. These include a test function, a function within a different context (solomachine.go), and a protobuf-generated method, indicating that the renaming to GetClientLatestHeight within the ClientKeeper interface does not conflict with these instances. The original review comment remains valid within its specific context of improving naming consistency within the ClientKeeper interface.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify that the old function name is no longer used in the codebase.
rg --type go "GetLatestHeight" --glob '!testing/chain.go'

Length of output: 459

modules/core/02-client/keeper/keeper_test.go (2)
  • 455-461: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [458-502]

The renaming of TestGetLatestHeight to TestGetClientLatestHeight aligns with the PR's objective to improve naming consistency within the ClientKeeper interface. This change makes the function's purpose clearer, indicating it specifically relates to client operations. The test logic remains unchanged, focusing on validating the GetClientLatestHeight function's behavior under various conditions. The test cases are well-structured, covering success and failure scenarios effectively.

  • 574-574: The renaming of TestGetTimestampAtHeight to TestGetClientTimestampAtHeight is consistent with the PR's goal of enhancing naming clarity. This adjustment specifies that the function deals with obtaining timestamps related to client heights, which is more descriptive. The test scenarios provided are comprehensive, testing the function's response to different client and consensus state conditions. This thorough testing approach ensures the renamed function's reliability across various scenarios.
modules/core/04-channel/keeper/upgrade.go (1)
  • 748-748: The change from GetTimestampAtHeight to GetClientTimestampAtHeight aligns with the PR's objective to enhance naming consistency within the ClientKeeper interface. This modification ensures that the function's purpose is more explicitly communicated, indicating that it retrieves a timestamp associated with a client at a specific height. This change is consistent with the broader goal of improving code readability and maintainability without altering the underlying functionality.
modules/core/04-channel/keeper/packet_test.go (2)
  • 161-161: The method GetTimestampAtHeight has been correctly updated to GetClientTimestampAtHeight in line with the PR's objective to rename certain functions for consistency. This change is accurately reflected in the TestSendPacket function.
  • 178-178: The method GetTimestampAtHeight has been correctly updated to GetClientTimestampAtHeight in the TestSendPacket function for the solomachine case. This change aligns with the PR's objective and ensures consistency across the interface.

@charleenfei
Copy link
Contributor

I don't feel v strongly about this either way, as i don't think it adds clarity as both functions are being called on the ClientKeeper so one would naturally understand they are for the client... but I wouldn't block this merge.

Copy link
Member

@damiannolan damiannolan left a comment

Choose a reason for hiding this comment

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

I don't feel strongly either way

Copy link
Contributor

@DimitrisJim DimitrisJim left a comment

Choose a reason for hiding this comment

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

def would prefer em w/o GetClient prefix but considering there's already precedent for it might as well go with consistency!

Copy link

Quality Gate Passed Quality Gate passed for 'ibc-go'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between 4cd5f40 and 4a2b508.
Files selected for processing (1)
  • modules/core/02-client/keeper/keeper.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • modules/core/02-client/keeper/keeper.go

@crodriguezvega crodriguezvega merged commit deb7aa2 into main Mar 19, 2024
83 checks passed
@crodriguezvega crodriguezvega deleted the carlos/rename-interface-functions branch March 19, 2024 12:46
damiannolan pushed a commit that referenced this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants