Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

fix(cosmos): fix typos #1457

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

fix(cosmos): fix typos #1457

wants to merge 3 commits into from

Conversation

dbadoy
Copy link
Contributor

@dbadoy dbadoy commented Jan 23, 2024

Small typos 😃

Summary by CodeRabbit

  • Refactor

    • Improved naming conventions for clarity in governance and staking modules.
  • Bug Fixes

    • Corrected typos in method names enhancing consistency.
  • New Features

    • Enhanced staking functionality with the ability to cancel unbonding delegations.

Copy link

coderabbitai bot commented Jan 23, 2024

Walkthrough

The recent updates in the Cosmos codebase reflect significant semantic changes to improve clarity and accuracy in naming. Functions and methods have been renamed to better describe their operations, such as converting validator addresses, tallying votes, and managing staking processes. Additionally, a function in the EVM module has been updated to reflect its actual functionality, indicating a reversal of action.

Changes

File Path Change Summary
cosmos/precompile/distribution/.../distribution.go Renamed ConvertValAddressFromBech32 to ConvertValAddressFromString
cosmos/precompile/governance/.../governance.go Renamed GetProposalVotes to GetProposalTallyResult; Renamed GetProposalVoteByVoter to GetParams
cosmos/precompile/staking/.../staking.go Renamed GetBondedValidatorsByPoweer to GetBondedValidatorsByPower; Renamed GetValidators to GetValidator; Renamed CancelRedelegate to CancelUnbondingDelegation
cosmos/x/evm/types/tx.go Renamed WrapPayload to UnwrapPayload

🐇
In the cosmos code, changes abound,
Where functions and methods are soundly unbound.
Renaming for clarity, the devs did leap,
And now the codebase takes a more accurate sweep. 🌌🚀

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.
  • 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 from git 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

@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: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between db20452 and aeff1b3.
Files selected for processing (4)
  • cosmos/precompile/distribution/distribution.go (1 hunks)
  • cosmos/precompile/governance/governance.go (2 hunks)
  • cosmos/precompile/staking/staking.go (3 hunks)
  • cosmos/x/evm/types/tx.go (1 hunks)
Files skipped from review due to trivial changes (1)
  • cosmos/precompile/staking/staking.go
Additional comments: 2
cosmos/x/evm/types/tx.go (1)
  • 63-63: The function WrapPayload has been renamed to UnwrapPayload. Verify that this change is consistent and that all references to this function have been updated accordingly.
cosmos/precompile/distribution/distribution.go (1)
  • 298-298: The function ConvertValAddressFromBech32 has been renamed to ConvertValAddressFromString. Verify that this change is consistent and that all references to this function have been updated accordingly.
Verification successful

The function ConvertValAddressFromBech32 has been successfully renamed to ConvertValAddressFromString, and all references within the distribution.go file have been updated to reflect this change.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any remaining references to the old function name.
rg --type go 'ConvertValAddressFromBech32' cosmos/precompile/distribution/
# Search for references to the new function name to ensure it's being used.
rg --type go 'ConvertValAddressFromString' cosmos/precompile/distribution/

Length of output: 549

@@ -343,7 +343,7 @@ func (c *Contract) GetProposalDepositsByDepositor(
return deposits, nil
}

// GetProposalVotes is the method for the `getProposalVotes` method of the
// GetProposalTallyResult is the method for the `getProposalTallyResult` method of the
Copy link

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The method GetProposalVotes has not been fully renamed to GetProposalTallyResult across the codebase. Active references to the old method name still exist in both the governance.go and governance_test.go files, indicating that the renaming was not comprehensively applied.

Analysis chain

The method GetProposalVotes has been renamed to GetProposalTallyResult. Verify that this change is consistent and that all references to this method have been updated accordingly.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Search for any remaining references to the old method name.
rg --type go 'GetProposalVotes' cosmos/precompile/governance/
# Search for references to the new method name to ensure it's being used.
rg --type go 'GetProposalTallyResult' cosmos/precompile/governance/

Length of output: 1320



Script:

#!/bin/bash
# Check if the occurrences of `GetProposalVotes` are in comments or active code.
rg --type go --context 2 'GetProposalVotes' cosmos/precompile/governance/

Length of output: 2149

@@ -445,7 +445,7 @@
}, nil
}

// GetProposalVoteByVoter is the method for the `getProposalVoteByVoter`
// getParams is the method for the `getParams`
Copy link

Choose a reason for hiding this comment

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

The method GetProposalVoteByVoter has been renamed to getParams, which seems incorrect as it does not reflect the functionality based on the method's content. This change should be reviewed to ensure that the method name accurately describes its purpose.

- func (c *Contract) GetParams(
+ func (c *Contract) GetProposalVoteByVoter(

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
// getParams is the method for the `getParams`
// GetProposalVoteByVoter is the method for the `GetProposalVoteByVoter`

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between aeff1b3 and 45cebe5.
Files selected for processing (1)
  • cosmos/precompile/governance/governance.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • cosmos/precompile/governance/governance.go

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants