-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Changes from 3 commits
1b0e4a6
b6d23d9
7784a8d
ba88f50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,13 @@ import ( | |
"strings" | ||
"time" | ||
|
||
cmtprotocrypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1" | ||
|
||
"cosmossdk.io/core/address" | ||
"cosmossdk.io/core/appmodule" | ||
"cosmossdk.io/errors" | ||
"cosmossdk.io/math" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" | ||
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
|
@@ -478,24 +475,13 @@ func (v Validator) ConsPubKey() (cryptotypes.PubKey, error) { | |
} | ||
|
||
// CmtConsPublicKey casts Validator.ConsensusPubkey to cmtprotocrypto.PubKey. | ||
func (v Validator) CmtConsPublicKey() (cmtprotocrypto.PublicKey, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the methods be deprecated instead to avoid breaking changes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. probably, its always nicer to remove things so its easy for us |
||
func (v Validator) CmtConsPublicKey() (cryptotypes.PubKey, error) { | ||
pk, err := v.ConsPubKey() | ||
if err != nil { | ||
return cmtprotocrypto.PublicKey{}, err | ||
} | ||
|
||
tmPk, err := cryptocodec.ToCmtProtoPublicKey(pk) | ||
if err != nil { | ||
return cmtprotocrypto.PublicKey{}, err | ||
return nil, err | ||
} | ||
|
||
return tmPk, nil | ||
} | ||
|
||
// Deprecated: use CmtConsPublicKey instead | ||
// We do not delete this function as it is part of the ValidatorI interface | ||
func (v Validator) TmConsPublicKey() (cmtprotocrypto.PublicKey, error) { | ||
return v.CmtConsPublicKey() | ||
return pk, nil | ||
} | ||
|
||
// GetConsAddr extracts Consensus key address | ||
|
There was a problem hiding this comment.
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
.expected_keepers_mocks.go
andmocks.go
referencetypes1.PubKey
andtypes.PubKey
, which do not appear to be aliases ofcryptotypes.PubKey
based on the script results.Analysis chain
Updated
GetPubKeyByConsAddr
to returncryptotypes.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:
Length of output: 2603
Script:
Length of output: 186