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

fix(x/accounts/defaults/lockup): rename lockup go.mod properly #19899

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

julienrbrt
Copy link
Member

@julienrbrt julienrbrt commented Mar 28, 2024

Description

The lockup module was improperly named, leading to an impossibility to fetch it: e.g https://github.com/julienrbrt/simapp/actions/runs/8461029501/job/23180175644

ref: cosmos/vanity#66


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • updated the relevant documentation or specification, including comments for documenting Go code
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic, API design and naming, documentation is accurate, tests and test coverage

Summary by CodeRabbit

  • Refactor
    • Improved detection for Nix development setup in the project's scripts.
    • Updated import paths across various files to align with the new project structure.
  • Chores
    • Updated module paths and dependencies in multiple go.mod files to reflect the new structure and ensure compatibility with the latest versions of dependencies.

@julienrbrt julienrbrt requested a review from a team as a code owner March 28, 2024 19:44
Copy link
Contributor

coderabbitai bot commented Mar 28, 2024

Walkthrough

The changes involve updating module paths and dependencies across several files in a Go project, specifically focusing on the lockup package within the cosmossdk.io domain. Modifications include correcting the setup for Nix environments, adjusting import paths to align with a restructured project directory, and updating module paths in go.mod files to reflect these changes. Additionally, dependencies were added or removed as necessary to maintain compatibility and functionality.

Changes

Files Change Summary
scripts/go-mod-tidy-all.sh Modified conditional block for Nix setup to correctly check for nix and gomod2nix.
simapp/app.go, x/accounts/.../lockup/lockup.go Updated import paths for lockup and lockuptypes packages.
simapp/go.mod, x/accounts/.../lockup/go.mod Updated module path to cosmossdk.io/x/accounts/defaults/lockup and modified dependencies.
store/go.mod Changed required dependencies by adding and removing golang.org/x/exp version.
tests/go.mod, tests/starship/tests/go.mod Renamed module path in require and replace sections to cosmossdk.io/x/accounts/defaults/lockup.
x/accounts/.../lockup/*.go Updated lockuptypes import path and simplified type assertion in periodic_locking_account.go.

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.

@julienrbrt julienrbrt changed the title refactor!: rename lockup module properly fix(x/accounts/defaults/lockup): rename lockup go.mod properly Mar 28, 2024
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: 1

Configuration used: .coderabbit.yml

Commits Files that changed from the base of the PR and between d54e940 and 5ce15c8.
Files selected for processing (13)
  • scripts/go-mod-tidy-all.sh (1 hunks)
  • simapp/app.go (1 hunks)
  • simapp/go.mod (2 hunks)
  • store/go.mod (2 hunks)
  • tests/go.mod (2 hunks)
  • tests/starship/tests/go.mod (2 hunks)
  • x/accounts/defaults/lockup/continuous_locking_account.go (1 hunks)
  • x/accounts/defaults/lockup/delayed_locking_account.go (1 hunks)
  • x/accounts/defaults/lockup/go.mod (9 hunks)
  • x/accounts/defaults/lockup/go.sum (22 hunks)
  • x/accounts/defaults/lockup/lockup.go (1 hunks)
  • x/accounts/defaults/lockup/periodic_locking_account.go (1 hunks)
  • x/accounts/defaults/lockup/permanent_locking_account.go (1 hunks)
Files not summarized due to errors (1)
  • x/accounts/defaults/lockup/go.sum: Error: Message exceeds token limit
Path instructions used (7)
x/accounts/defaults/lockup/permanent_locking_account.go (1)

**/*.go
Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/accounts/defaults/lockup/delayed_locking_account.go (1)

**/*.go
Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/accounts/defaults/lockup/continuous_locking_account.go (1)

**/*.go
Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

x/accounts/defaults/lockup/periodic_locking_account.go (1)

**/*.go
Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

tests/go.mod (1)

tests/**/*
Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request

tests/starship/tests/go.mod (1)

tests/**/*
Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request

x/accounts/defaults/lockup/lockup.go (1)

**/*.go
Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.

Files not reviewed due to errors (1)
  • (no review received)
Files skipped from review due to trivial changes (1)
  • simapp/app.go
Additional comments (34)
scripts/go-mod-tidy-all.sh (1)
  • 13-21: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [5-5]

Consider using find ... -exec or a while read loop for better handling of filenames with spaces or special characters.

store/go.mod (1)
  • 62-62: Adding golang.org/x/exp as an indirect dependency. Ensure that this addition is necessary for the project and that the specified version aligns with the project's compatibility requirements.
x/accounts/defaults/lockup/delayed_locking_account.go (1)
  • 9-9: The import path for lockuptypes has been updated to reflect the new directory structure. Ensure that all references to this package within the project have been updated accordingly.
x/accounts/defaults/lockup/continuous_locking_account.go (1)
  • 11-11: The import path for lockuptypes has been updated to reflect the new directory structure. Ensure that all references to this package within the project have been updated accordingly.
x/accounts/defaults/lockup/go.mod (2)
  • 1-1: The module path has been updated to reflect the new directory structure. This is a critical change that affects imports and dependencies throughout the project.
  • 12-25: > 📝 NOTE

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

Dependencies have been updated, including the addition of new indirect dependencies and the update of existing ones. Ensure that these changes are aligned with the project's requirements and that all necessary version constraints are met.

x/accounts/defaults/lockup/periodic_locking_account.go (2)
  • 12-12: The import path for lockuptypes has been updated to reflect the new directory structure. Ensure that all references to this package within the project have been updated accordingly.
  • 20-20: The simplification of the type assertion for PeriodicLockingAccount is a minor but positive change for readability.
tests/go.mod (2)
  • 62-62: The update of the module path in the require section aligns with the PR's objective of renaming the lockup module. This change is correctly implemented.
  • 239-239: The update of the module path in the replace section is correctly implemented and necessary for local development and testing, aligning with the PR's objective of renaming the lockup module.
tests/starship/tests/go.mod (2)
  • 23-23: The update to the module path in the replace section is correct and aligns with the PR's objective to rename the lockup module properly.
  • 70-70: The update to the module path in the require section is correct and necessary for the proper resolution of dependencies following the lockup module's renaming.
simapp/go.mod (2)
  • 16-16: The update to the module path in the require section is correct and aligns with the PR's objective to rename the lockup module properly.
  • 243-243: The update to the module path in the replace section is correct and necessary for the proper resolution of dependencies following the lockup module's renaming.
x/accounts/defaults/lockup/lockup.go (20)
  • 16-16: The import path for the lockuptypes package has been updated to reflect the new module structure, aligning with the PR's objective to correct the module's naming and organization.
  • 13-19: > 📝 NOTE

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

Global variable names such as OriginalLockingPrefix, DelegatedFreePrefix, etc., are clear and descriptive, following the best practices for naming. However, consider grouping related constants within a single const block for better organization and readability.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [27-30]

The naming of constants for account types (CONTINUOUS_LOCKING_ACCOUNT, DELAYED_LOCKING_ACCOUNT, etc.) follows the upper snake case convention, which is consistent with Go's style for constant names. This is good practice.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [32-34]

The type alias getLockedCoinsFunc is well-named, clearly indicating its purpose. However, it's good practice to add a comment above type declarations, especially for public or exported types, to improve code documentation.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [36-44]

The function newBaseLockup is correctly named following Go's naming conventions. It's private to the package, which is indicated by the lowercase first letter, aligning with the principle of exposing only what is necessary. However, consider adding a comment above the function to briefly describe its purpose, following best practices for code documentation.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [46-58]

The BaseLockup struct is well-organized, with fields grouped logically. Field names are clear and descriptive. It's good practice to add comments to exported types and their fields to improve code documentation, especially for complex structures like this one.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [60-125]

The method Init on the BaseLockup struct is well-structured and follows Go's naming conventions. The use of early returns to handle errors is a good practice that improves readability. However, consider adding more detailed comments within the method to explain the logic and purpose of each major step, enhancing maintainability and readability for future developers.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [127-176]

The Delegate method correctly handles errors and uses early returns, which is good practice. The method's logic is clear, but adding comments to explain the purpose of each block of code would improve readability and maintainability. Additionally, ensure that all external dependencies and methods called within this function are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [178-227]

Similar to previous methods, the Undelegate method is well-structured and follows good practices with error handling. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, verify that external calls within this method are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [229-281]

The SendCoins method follows good practices with clear error handling and early returns. To improve code quality, consider adding comments to explain the logic and purpose of each major step. Additionally, ensure that all external dependencies and methods called are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [283-377]

The WithdrawUnlockedCoins method is well-implemented with clear error handling. Adding comments to explain the logic and purpose of each major step would enhance readability and maintainability. Also, ensure that all external dependencies and methods called within this function are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [379-391]

The checkSender method is concise and follows good practices with error handling. Adding a brief comment to describe its purpose would improve code documentation. Ensure that the addressCodec.StringToBytes method properly handles all potential error cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [393-405]

The sendMessage function is concise and follows good practices. Consider adding a brief comment to describe its purpose and any important considerations regarding its use, such as error handling in the ExecModuleUntyped and PackAny methods.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [407-470]

The TrackDelegation method is well-structured and follows good practices with clear error handling. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, ensure that all external dependencies and methods called within this function are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [472-520]

The TrackUndelegation method follows good practices with clear error handling and early returns. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, verify that external calls within this method are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [522-538]

The getBalance method is concise and follows good practices. Adding a brief comment to describe its purpose would improve code documentation. Ensure that the QueryModule method properly handles all potential error cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [540-579]

The checkTokensSendable method is well-implemented with clear error handling. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, ensure that all external dependencies and methods called within this function are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [581-590]

The IterateCoinEntries method is concise and follows good practices. Consider adding a brief comment to describe its purpose and any important considerations regarding its use, such as error handling in the entries.Walk method.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [592-606]

The GetNotBondedLockedCoin method is well-implemented with clear error handling. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, verify that external calls within this method are properly handling errors and edge cases.

  • 13-19: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [608-641]

The QueryLockupAccountBaseInfo method is well-structured and follows good practices with error handling. Adding comments to explain the logic and purpose of each major step would enhance readability. Also, ensure that all external dependencies and methods called within this function are properly handling errors and edge cases.

scripts/go-mod-tidy-all.sh Show resolved Hide resolved
Copy link
Contributor

@julienrbrt your pull request is missing a changelog!

@julienrbrt julienrbrt enabled auto-merge March 28, 2024 20:03
@julienrbrt julienrbrt added this pull request to the merge queue Mar 28, 2024
Merged via the queue into main with commit cb5d34e Mar 28, 2024
61 of 62 checks passed
@julienrbrt julienrbrt deleted the julien/lockup branch March 28, 2024 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants