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

refactor!(staking): remove comet crypto as a dep #20295

Merged
merged 4 commits into from
May 7, 2024

Conversation

tac0turtle
Copy link
Member

@tac0turtle tac0turtle commented May 6, 2024

Description

this pr removes some extra comet crypto imports in the staking module as part of minimising the complex dependency graph.

the caller of GetConsPubkey must now translate it to the comet type instead of staking handling it


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
    • Updated public key handling across various modules to use cryptotypes.PubKey instead of cmtprotocrypto.PublicKey.
  • Bug Fixes
    • Fixed public key conversion functions to enhance the validation of vote extensions.
  • Documentation
    • Updated CHANGELOG entries to reflect changes in public key return types.

Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

Walkthrough

The recent updates involve transitioning from the cmtprotocrypto package to cryptotypes across various files. These changes impact public key handling, function signatures, and test utilities alignment. Import statements are updated, function signatures in interfaces and implementations are modified, and test utilities are adjusted to reflect these updates.

Changes

Files Summary
baseapp/abci_test.go, baseapp/abci_utils_test.go Updated imports, replaced tmPk with pk, and adjusted public key conversion tests.
baseapp/abci_utils.go, x/staking/keeper/validator.go, x/staking/types/expected_keepers.go, x/staking/types/validator.go Replaced cmtprotocrypto with cryptotypes in function signatures and public key handling.
baseapp/testutil/mock/mocks.go, x/staking/testutil/expected_keepers_mocks.go Changes in function signatures to accommodate new types from cryptotypes and updated import paths.
types/staking.go, x/staking/CHANGELOG.md Removed TmConsPublicKey() method and updated change logs to reflect new return types for public keys.

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.

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

@itsdevbear
Copy link
Contributor

utack

@tac0turtle tac0turtle marked this pull request as ready for review May 7, 2024 09:25
@tac0turtle tac0turtle requested a review from a team as a code owner May 7, 2024 09:25
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.

Actionable comments posted: 1

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0175670 and 7784a8d.
Files selected for processing (10)
  • baseapp/abci_test.go (4 hunks)
  • baseapp/abci_utils.go (4 hunks)
  • baseapp/abci_utils_test.go (2 hunks)
  • baseapp/testutil/mock/mocks.go (7 hunks)
  • types/staking.go (2 hunks)
  • x/staking/CHANGELOG.md (1 hunks)
  • x/staking/keeper/validator.go (3 hunks)
  • x/staking/testutil/expected_keepers_mocks.go (2 hunks)
  • x/staking/types/expected_keepers.go (2 hunks)
  • x/staking/types/validator.go (2 hunks)
Files not reviewed due to errors (1)
  • baseapp/abci_utils_test.go (no review received)
Additional Context Used
LanguageTool (41)
x/staking/CHANGELOG.md (41)

Near line 30: Unpaired symbol: ‘[’ seems to be missing
Context: ...## [Unreleased] ### Features * [#19537](https://github.com/cosmos/cosmos-sdk/pu...


Near line 34: Unpaired symbol: ‘[’ seems to be missing
Context: ...validators. ### Improvements * [#19779](https://github.com/cosmos/cosmos-sdk/pu...


Near line 36: Unpaired symbol: ‘[’ seems to be missing
Context: ...ing unbonding_time to zero. * [#19277](https://github.com/cosmos/cosmos-sdk/pu...


Near line 37: Unpaired symbol: ‘[’ seems to be missing
Context: ...g just like other hooks calls. * [#18636](https://github.com/cosmos/cosmos-sdk/pu...


Near line 38: Unpaired symbol: ‘[’ seems to be missing
Context: ...ad returns appropriate errors. * [#18506](https://github.com/cosmos/cosmos-sdk/pu...


Near line 42: Unpaired symbol: ‘[’ seems to be missing
Context: ...prevent panic. ### Bug Fixes * [#19226](https://github.com/cosmos/cosmos-sdk/pu...


Near line 46: Unpaired symbol: ‘[’ seems to be missing
Context: ...rs. ### API Breaking Changes * [#20238](https://github.com/cosmos/cosmos-sdk/pu...


Near line 47: Unpaired symbol: ‘[’ seems to be missing
Context: ...ervice` as its last argument. * [#19788](https://github.com/cosmos/cosmos-sdk/pu...


Near line 48: Unpaired symbol: ‘[’ seems to be missing
Context: ...alidatorUpdateIsZero` instead. * [#19754](https://github.com/cosmos/cosmos-sdk/pu...


Near line 49: Unpaired symbol: ‘[’ seems to be missing
Context: ...AndReturnValidatorSetUpdates`. * [#19414](https://github.com/cosmos/cosmos-sdk/pu...


Near line 50: Unpaired symbol: ‘[’ seems to be missing
Context: ...nstead of individual services. * [#19742](https://github.com/cosmos/cosmos-sdk/pu...


Near line 51: Unpaired symbol: ‘[’ seems to be missing
Context: ...s address.Codec as argument. * [#19735](https://github.com/cosmos/cosmos-sdk/pu...


Near line 52: Unpaired symbol: ‘[’ seems to be missing
Context: ...pmodule.HasGenesis` interface. * [#18198](https://github.com/cosmos/cosmos-sdk/pu...


Near line 53: Unpaired symbol: ‘[’ seems to be missing
Context: ...y on staking in other modules. * [#17778](https://github.com/cosmos/cosmos-sdk/pu...


Near line 55: Unpaired symbol: ‘[’ seems to be missing
Context: ...per: GetParams, SetParams` * [#17486](https://github.com/cosmos/cosmos-sdk/pu...


Near line 58: Unpaired symbol: ‘[’ seems to be missing
Context: ...: RedelegationQueueIterator` * [#17562](https://github.com/cosmos/cosmos-sdk/pu...


Near line 61: Unpaired symbol: ‘[’ seems to be missing
Context: ...per: ValidatorQueueIterator` * [#17498](https://github.com/cosmos/cosmos-sdk/pu...


Near line 64: Unpaired symbol: ‘[’ seems to be missing
Context: ...ator, IterateLastValidators` * [#17291](https://github.com/cosmos/cosmos-sdk/pu...


Near line 68: Unpaired symbol: ‘[’ seems to be missing
Context: ...ValidatorMissedBlockBitmapKey` * [#17481](https://github.com/cosmos/cosmos-sdk/pu...


Near line 71: Unpaired symbol: ‘[’ seems to be missing
Context: ...GetUnbondingDelegationTimeKey` * [#17123](https://github.com/cosmos/cosmos-sdk/pu...


Near line 72: Unpaired symbol: ‘[’ seems to be missing
Context: ...e collections for Validators * [#17270](https://github.com/cosmos/cosmos-sdk/pu...


Near line 75: Unpaired symbol: ‘[’ seems to be missing
Context: ...DelegatorUnbondingDelegations` * [#17336](https://github.com/cosmos/cosmos-sdk/pu...


Near line 77: Unpaired symbol: ‘[’ seems to be missing
Context: ...ey, GetREDsToValDstIndexKey` * [#17332](https://github.com/cosmos/cosmos-sdk/pu...


Near line 79: Unpaired symbol: ‘[’ seems to be missing
Context: ..., GetREDsFromValSrcIndexKey` * [#17315](https://github.com/cosmos/cosmos-sdk/pu...


Near line 81: Unpaired symbol: ‘[’ seems to be missing
Context: ...om keeper: GetRedelegation * [#17260](https://github.com/cosmos/cosmos-sdk/pu...


Near line 83: Unpaired symbol: ‘[’ seems to be missing
Context: ...ationKey, GetDelegationsKey` * [#17288](https://github.com/cosmos/cosmos-sdk/pu...


Near line 85: Unpaired symbol: ‘[’ seems to be missing
Context: ...ypes: GetUnbondingIndexKey`. * [#17256](https://github.com/cosmos/cosmos-sdk/pu...


Near line 86: Unpaired symbol: ‘[’ seems to be missing
Context: ...collections for UnbondingID. * [#17260](https://github.com/cosmos/cosmos-sdk/pu...


Near line 88: Unpaired symbol: ‘[’ seems to be missing
Context: ...: GetValidatorByConsAddrKey` * [#17248](https://github.com/cosmos/cosmos-sdk/pu...


Near line 90: Unpaired symbol: ‘[’ seems to be missing
Context: ...types: GetUnbondingTypeKey`. * [#17063](https://github.com/cosmos/cosmos-sdk/pu...


Near line 92: Unpaired symbol: ‘[’ seems to be missing
Context: ...icalInfo, SetHistoricalInfo` * [#17062](https://github.com/cosmos/cosmos-sdk/pu...


Near line 93: Unpaired symbol: ‘[’ seems to be missing
Context: ...nd ValidatorUpdates storage. * [#17026](https://github.com/cosmos/cosmos-sdk/pu...


Near line 95: Unpaired symbol: ‘[’ seems to be missing
Context: ...talPower, GetLastTotalPower` * [#17335](https://github.com/cosmos/cosmos-sdk/pu...


Near line 95: Consider a shorter alternative to avoid wordiness.
Context: ...pi/cosmos/staking/v1beta1".Infraction_` in order to remove dependency between modules on st...


Near line 96: Unpaired symbol: ‘[’ seems to be missing
Context: ...ncy between modules on staking * [#17655](https://github.com/cosmos/cosmos-sdk/pu...


Near line 97: Unpaired symbol: ‘[’ seems to be missing
Context: ...d marked Hist as deprecated. * [#20295](https://github.com/cosmos/cosmos-sdk/pu...


Near line 101: Unpaired symbol: ‘[’ seems to be missing
Context: ... ### State Breaking changes * [#18841](https://github.com/cosmos/cosmos-sdk/pu...


Near line 101: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ub.com//pull/18841) In a undelegation or redelegation if the sha...


Near line 102: Unpaired symbol: ‘[’ seems to be missing
Context: ...ntire delegation gets removed. * [#18142](https://github.com/cosmos/cosmos-sdk/pu...


Near line 103: Unpaired symbol: ‘[’ seems to be missing
Context: ...e fees while rotating the keys * [#17655](https://github.com/cosmos/cosmos-sdk/pu...


Near line 104: Unpaired symbol: ‘[’ seems to be missing
Context: ...y keep what is needed for IBC. * [#19740](https://github.com/cosmos/cosmos-sdk/pu...

Path-based Instructions (10)
types/staking.go (1)

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

x/staking/types/expected_keepers.go (1)

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

x/staking/CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

baseapp/testutil/mock/mocks.go (1)

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

x/staking/types/validator.go (1)

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

baseapp/abci_utils.go (1)

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

x/staking/keeper/validator.go (1)

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

baseapp/abci_utils_test.go (2)

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


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

x/staking/testutil/expected_keepers_mocks.go (1)

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

baseapp/abci_test.go (2)

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


Pattern **/*_test.go: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"

Learnings (2)
x/staking/types/expected_keepers.go (1)
User: alexanderbez
PR: cosmos/cosmos-sdk#18506
File: x/staking/keeper/msg_server.go:64-65
Timestamp: 2023-11-20T18:25:05.369Z
Learning: The error message in the `CreateValidator` function within `x/staking/keeper/msg_server.go` should clearly indicate the expected type `cryptotypes.PubKey` when a type assertion fails.
x/staking/keeper/validator.go (1)
User: alexanderbez
PR: cosmos/cosmos-sdk#18506
File: x/staking/keeper/msg_server.go:64-65
Timestamp: 2023-11-20T18:25:05.369Z
Learning: The error message in the `CreateValidator` function within `x/staking/keeper/msg_server.go` should clearly indicate the expected type `cryptotypes.PubKey` when a type assertion fails.
Additional comments not posted (9)
types/staking.go (1)

1-1: File types/staking.go reviewed.

x/staking/types/expected_keepers.go (1)

75-75: The method GetPubKeyByConsAddr now correctly returns cryptotypes.PubKey as per the PR objectives.

x/staking/CHANGELOG.md (1)

97-97: The changelog entry correctly documents the change in the return type of GetValidatorByConsAddr to cryptotypes.PubKey.

baseapp/testutil/mock/mocks.go (1)

40-43: The mock method GetPubKeyByConsAddr correctly simulates the updated interface, returning cryptotypes.PubKey.

x/staking/types/validator.go (1)

478-484: The method CmtConsPublicKey has been updated to return cryptotypes.PubKey, aligning with the PR's objectives to remove dependencies on Comet crypto.

baseapp/abci_utils.go (2)

19-20: Imports updated to use Cosmos SDK's crypto/codec and crypto/types instead of Comet crypto.


30-30: Updated GetPubKeyByConsAddr to return cryptotypes.PubKey, aligning with the removal of Comet crypto dependencies.

x/staking/testutil/expected_keepers_mocks.go (1)

314-317: Change in GetPubKeyByConsAddr method signature correctly reflects the removal of Comet crypto dependency.

baseapp/abci_test.go (1)

41-41: Update import to use cryptocodec from Cosmos SDK.

This change aligns with the PR's objective to remove dependencies on the Comet crypto library and use Cosmos SDK's cryptotypes instead.

Comment on lines 597 to 606
// Caller receives a Cosmos SDK Pubkey type and must cast it to a comet type
func (k Keeper) GetPubKeyByConsAddr(ctx context.Context, addr sdk.ConsAddress) (cryptotypes.PubKey, error) {
v, err := k.GetValidatorByConsAddr(ctx, addr)
if err != nil {
return cmtprotocrypto.PublicKey{}, err
return nil, err
}

pubkey, err := v.CmtConsPublicKey()
if err != nil {
return cmtprotocrypto.PublicKey{}, err
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

Several files in the codebase might be using an incorrect or undefined type for PubKey.

  • The mock implementations in expected_keepers_mocks.go and mocks.go reference types1.PubKey and types.PubKey, which do not appear to be aliases of cryptotypes.PubKey based on the script results.
  • Further investigation is needed to correct these references to ensure consistency across the codebase.
Analysis chain

Updated GetPubKeyByConsAddr to return cryptotypes.PubKey, aligning with the removal of Comet crypto dependencies. Ensure that all callers handle the new return type correctly.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all function calls to `GetPubKeyByConsAddr` handle the new return type correctly.

# Test: Search for the function usage. Expect: Only occurrences of the new return type being handled.
rg --type go $'GetPubKeyByConsAddr'

Length of output: 2603



Script:

#!/bin/bash
# Description: Verify the type definitions of `types1.PubKey` and `types.PubKey` to confirm if they are aliases of `cryptotypes.PubKey`.

# Check the type definition of `types1.PubKey`
rg --type go "type PubKey" | grep "types1"

# Check the type definition of `types.PubKey`
rg --type go "type PubKey" | grep "types"

Length of output: 186

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.

Actionable comments posted: 1

Out of diff range and nitpick comments (2)
x/staking/CHANGELOG.md (2)

Line range hint 102-102: Correct grammatical error in the changelog entry.

- * [#18841](https://github.com/cosmos/cosmos-sdk/pull/18841) In a undelegation or redelegation if the shares being left delegated correspond to less than 1 token (in base denom) the entire delegation gets removed.
+ * [#18841](https://github.com/cosmos/cosmos-sdk/pull/18841) In an undelegation or redelegation if the shares being left delegated correspond to less than 1 token (in base denom) the entire delegation gets removed.

Use "an" instead of "a" before words that start with a vowel sound to ensure proper grammar.


Line range hint 54-98: Correct the indentation of list items in the changelog.

-    * remove from `Keeper`: `GetParams`, `SetParams`
-    * remove from `types`: `GetRedelegationTimeKey`
-    * remove from `Keeper`: `RedelegationQueueIterator`
-    * remove from `types`: `GetValidatorQueueKey`, `ParseValidatorQueueKey`
-    * remove from `Keeper`: `ValidatorQueueIterator`
-    * remove from `types`: `GetLastValidatorPowerKey`
-    * remove from `Keeper`: `LastValidatorsIterator`, `IterateLastValidators`
-    * remove from `types`: `ValidatorMissedBlockBitmapPrefixKey`, `ValidatorMissedBlockBitmapKey`
-    * remove from `Keeper`: `UBDQueueIterator`
-    * remove from `types`: `GetUnbondingDelegationTimeKey`
-    * remove from `types`: `GetUBDsKey`
-    * remove from `Keeper`: `IterateUnbondingDelegations`, `IterateDelegatorUnbondingDelegations`
-    * remove from `types`: `GetREDByValDstIndexKey`, `GetREDsToValDstIndexKey`
-    * remove from `types`: `GetREDKeyFromValSrcIndexKey`, `GetREDsFromValSrcIndexKey`
-    * remove from `keeper`: `GetRedelegation`
-    * remove from `types`: `GetDelegationKey`, `GetDelegationsKey`
-    * remove from `types`: `GetUnbondingIndexKey`.
-    * remove from `types`: `GetValidatorByConsAddrKey`
-    * remove from `types`: `GetUnbondingTypeKey`.
-    * remove from `Keeper`: `GetHistoricalInfo`, `SetHistoricalInfo`
-    * remove from `Keeper`: `SetLastTotalPower`, `GetLastTotalPower`
+  * remove from `Keeper`: `GetParams`, `SetParams`
+  * remove from `types`: `GetRedelegationTimeKey`
+  * remove from `Keeper`: `RedelegationQueueIterator`
+  * remove from `types`: `GetValidatorQueueKey`, `ParseValidatorQueueKey`
+  * remove from `Keeper`: `ValidatorQueueIterator`
+  * remove from `types`: `GetLastValidatorPowerKey`
+  * remove from `Keeper`: `LastValidatorsIterator`, `IterateLastValidators`
+  * remove from `types`: `ValidatorMissedBlockBitmapPrefixKey`, `ValidatorMissedBlockBitmapKey`
+  * remove from `Keeper`: `UBDQueueIterator`
+  * remove from `types`: `GetUnbondingDelegationTimeKey`
+  * remove from `types`: `GetUBDsKey`
+  * remove from `Keeper`: `IterateUnbondingDelegations`, `IterateDelegatorUnbondingDelegations`
+  * remove from `types`: `GetREDByValDstIndexKey`, `GetREDsToValDstIndexKey`
+  * remove from `types`: `GetREDKeyFromValSrcIndexKey`, `GetREDsFromValSrcIndexKey`
+  * remove from `keeper`: `GetRedelegation`
+  * remove from `types`: `GetDelegationKey`, `GetDelegationsKey`
+  * remove from `types`: `GetUnbondingIndexKey`.
+  * remove from `types`: `GetValidatorByConsAddrKey`
+  * remove from `types`: `GetUnbondingTypeKey`.
+  * remove from `Keeper`: `GetHistoricalInfo`, `SetHistoricalInfo`
+  * remove from `Keeper`: `SetLastTotalPower`, `GetLastTotalPower`

Adjust the indentation of list items to maintain consistency and readability in the changelog.

Review Details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 7784a8d and ba88f50.
Files selected for processing (3)
  • x/staking/CHANGELOG.md (1 hunks)
  • x/staking/keeper/validator.go (3 hunks)
  • x/staking/types/validator.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • x/staking/keeper/validator.go
  • x/staking/types/validator.go
Additional Context Used
LanguageTool (41)
x/staking/CHANGELOG.md (41)

Near line 30: Unpaired symbol: ‘[’ seems to be missing
Context: ...## [Unreleased] ### Features * [#19537](https://github.com/cosmos/cosmos-sdk/pu...


Near line 34: Unpaired symbol: ‘[’ seems to be missing
Context: ...validators. ### Improvements * [#19779](https://github.com/cosmos/cosmos-sdk/pu...


Near line 36: Unpaired symbol: ‘[’ seems to be missing
Context: ...ing unbonding_time to zero. * [#19277](https://github.com/cosmos/cosmos-sdk/pu...


Near line 37: Unpaired symbol: ‘[’ seems to be missing
Context: ...g just like other hooks calls. * [#18636](https://github.com/cosmos/cosmos-sdk/pu...


Near line 38: Unpaired symbol: ‘[’ seems to be missing
Context: ...ad returns appropriate errors. * [#18506](https://github.com/cosmos/cosmos-sdk/pu...


Near line 42: Unpaired symbol: ‘[’ seems to be missing
Context: ...prevent panic. ### Bug Fixes * [#19226](https://github.com/cosmos/cosmos-sdk/pu...


Near line 46: Unpaired symbol: ‘[’ seems to be missing
Context: ...rs. ### API Breaking Changes * [#20238](https://github.com/cosmos/cosmos-sdk/pu...


Near line 47: Unpaired symbol: ‘[’ seems to be missing
Context: ...ervice` as its last argument. * [#19788](https://github.com/cosmos/cosmos-sdk/pu...


Near line 48: Unpaired symbol: ‘[’ seems to be missing
Context: ...alidatorUpdateIsZero` instead. * [#19754](https://github.com/cosmos/cosmos-sdk/pu...


Near line 49: Unpaired symbol: ‘[’ seems to be missing
Context: ...AndReturnValidatorSetUpdates`. * [#19414](https://github.com/cosmos/cosmos-sdk/pu...


Near line 50: Unpaired symbol: ‘[’ seems to be missing
Context: ...nstead of individual services. * [#19742](https://github.com/cosmos/cosmos-sdk/pu...


Near line 51: Unpaired symbol: ‘[’ seems to be missing
Context: ...s address.Codec as argument. * [#19735](https://github.com/cosmos/cosmos-sdk/pu...


Near line 52: Unpaired symbol: ‘[’ seems to be missing
Context: ...pmodule.HasGenesis` interface. * [#18198](https://github.com/cosmos/cosmos-sdk/pu...


Near line 53: Unpaired symbol: ‘[’ seems to be missing
Context: ...y on staking in other modules. * [#17778](https://github.com/cosmos/cosmos-sdk/pu...


Near line 55: Unpaired symbol: ‘[’ seems to be missing
Context: ...per: GetParams, SetParams` * [#17486](https://github.com/cosmos/cosmos-sdk/pu...


Near line 58: Unpaired symbol: ‘[’ seems to be missing
Context: ...: RedelegationQueueIterator` * [#17562](https://github.com/cosmos/cosmos-sdk/pu...


Near line 61: Unpaired symbol: ‘[’ seems to be missing
Context: ...per: ValidatorQueueIterator` * [#17498](https://github.com/cosmos/cosmos-sdk/pu...


Near line 64: Unpaired symbol: ‘[’ seems to be missing
Context: ...ator, IterateLastValidators` * [#17291](https://github.com/cosmos/cosmos-sdk/pu...


Near line 68: Unpaired symbol: ‘[’ seems to be missing
Context: ...ValidatorMissedBlockBitmapKey` * [#17481](https://github.com/cosmos/cosmos-sdk/pu...


Near line 71: Unpaired symbol: ‘[’ seems to be missing
Context: ...GetUnbondingDelegationTimeKey` * [#17123](https://github.com/cosmos/cosmos-sdk/pu...


Near line 72: Unpaired symbol: ‘[’ seems to be missing
Context: ...e collections for Validators * [#17270](https://github.com/cosmos/cosmos-sdk/pu...


Near line 75: Unpaired symbol: ‘[’ seems to be missing
Context: ...DelegatorUnbondingDelegations` * [#17336](https://github.com/cosmos/cosmos-sdk/pu...


Near line 77: Unpaired symbol: ‘[’ seems to be missing
Context: ...ey, GetREDsToValDstIndexKey` * [#17332](https://github.com/cosmos/cosmos-sdk/pu...


Near line 79: Unpaired symbol: ‘[’ seems to be missing
Context: ..., GetREDsFromValSrcIndexKey` * [#17315](https://github.com/cosmos/cosmos-sdk/pu...


Near line 81: Unpaired symbol: ‘[’ seems to be missing
Context: ...om keeper: GetRedelegation * [#17260](https://github.com/cosmos/cosmos-sdk/pu...


Near line 83: Unpaired symbol: ‘[’ seems to be missing
Context: ...ationKey, GetDelegationsKey` * [#17288](https://github.com/cosmos/cosmos-sdk/pu...


Near line 85: Unpaired symbol: ‘[’ seems to be missing
Context: ...ypes: GetUnbondingIndexKey`. * [#17256](https://github.com/cosmos/cosmos-sdk/pu...


Near line 86: Unpaired symbol: ‘[’ seems to be missing
Context: ...collections for UnbondingID. * [#17260](https://github.com/cosmos/cosmos-sdk/pu...


Near line 88: Unpaired symbol: ‘[’ seems to be missing
Context: ...: GetValidatorByConsAddrKey` * [#17248](https://github.com/cosmos/cosmos-sdk/pu...


Near line 90: Unpaired symbol: ‘[’ seems to be missing
Context: ...types: GetUnbondingTypeKey`. * [#17063](https://github.com/cosmos/cosmos-sdk/pu...


Near line 92: Unpaired symbol: ‘[’ seems to be missing
Context: ...icalInfo, SetHistoricalInfo` * [#17062](https://github.com/cosmos/cosmos-sdk/pu...


Near line 93: Unpaired symbol: ‘[’ seems to be missing
Context: ...nd ValidatorUpdates storage. * [#17026](https://github.com/cosmos/cosmos-sdk/pu...


Near line 95: Unpaired symbol: ‘[’ seems to be missing
Context: ...talPower, GetLastTotalPower` * [#17335](https://github.com/cosmos/cosmos-sdk/pu...


Near line 95: Consider a shorter alternative to avoid wordiness.
Context: ...pi/cosmos/staking/v1beta1".Infraction_` in order to remove dependency between modules on st...


Near line 96: Unpaired symbol: ‘[’ seems to be missing
Context: ...ncy between modules on staking * [#17655](https://github.com/cosmos/cosmos-sdk/pu...


Near line 97: Unpaired symbol: ‘[’ seems to be missing
Context: ...d marked Hist as deprecated. * [#20295](https://github.com/cosmos/cosmos-sdk/pu...


Near line 102: Unpaired symbol: ‘[’ seems to be missing
Context: .... ### State Breaking changes * [#18841](https://github.com/cosmos/cosmos-sdk/pu...


Near line 102: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...ub.com//pull/18841) In a undelegation or redelegation if the sha...


Near line 103: Unpaired symbol: ‘[’ seems to be missing
Context: ...ntire delegation gets removed. * [#18142](https://github.com/cosmos/cosmos-sdk/pu...


Near line 104: Unpaired symbol: ‘[’ seems to be missing
Context: ...e fees while rotating the keys * [#17655](https://github.com/cosmos/cosmos-sdk/pu...


Near line 105: Unpaired symbol: ‘[’ seems to be missing
Context: ...y keep what is needed for IBC. * [#19740](https://github.com/cosmos/cosmos-sdk/pu...

Path-based Instructions (1)
x/staking/CHANGELOG.md (1)

Pattern **/*.md: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"

Comment on lines +97 to +98
* [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.Pubkey` instead of `cometcrypto.Publickey`. The caller is responsible to translate the returned value to the expected type.
* Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct.
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistency in the naming of cryptographic types.

- * [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.Pubkey` instead of `cometcrypto.Publickey`. The caller is responsible to translate the returned value to the expected type. 
-    * Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct.
+ * [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.PubKey` instead of `cometcrypto.PublicKey`. The caller is responsible to translate the returned value to the expected type. 
+    * Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct.

Ensure that the type names cryptotypes.PubKey and cometcrypto.PublicKey are consistently capitalized as they appear in the code. This helps maintain clarity and accuracy in documentation.


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
* [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.Pubkey` instead of `cometcrypto.Publickey`. The caller is responsible to translate the returned value to the expected type.
* Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct.
* [#20295](https://github.com/cosmos/cosmos-sdk/pull/20295) `GetValidatorByConsAddr` now returns the Cosmos SDK `cryptotypes.PubKey` instead of `cometcrypto.PublicKey`. The caller is responsible to translate the returned value to the expected type.
* Remove `CmtConsPublicKey()` and `TmConsPublicKey()` from `Validator` interface and as methods on the `Validator` struct.

@tac0turtle tac0turtle added this pull request to the merge queue May 7, 2024
Copy link
Contributor

@alpe alpe left a comment

Choose a reason for hiding this comment

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

It is good to refactor and cleanup things 💪

@@ -477,27 +474,6 @@ func (v Validator) ConsPubKey() (cryptotypes.PubKey, error) {
return pk, nil
}

// CmtConsPublicKey casts Validator.ConsensusPubkey to cmtprotocrypto.PubKey.
func (v Validator) CmtConsPublicKey() (cmtprotocrypto.PublicKey, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the methods be deprecated instead to avoid breaking changes?

Copy link
Member Author

Choose a reason for hiding this comment

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

probably, its always nicer to remove things so its easy for us

Merged via the queue into main with commit fc84ff6 May 7, 2024
64 of 68 checks passed
@tac0turtle tac0turtle deleted the marko/staking_cleanup branch May 7, 2024 10:32
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.

7 participants