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(x/gov, x/authz): use cosmossdk.io/core/codec instead of github.com/cosmos/cosmos-sdk/codec #23292

Merged
merged 14 commits into from
Jan 13, 2025
2 changes: 1 addition & 1 deletion x/staking/migrations/v5/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"cosmossdk.io/store/prefix"
storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"
)

func migrateDelegationsByValidatorIndex(store storetypes.KVStore) error {
Expand Down
2 changes: 1 addition & 1 deletion x/staking/migrations/v6/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

storetypes "cosmossdk.io/store/types"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Fix import ordering according to project guidelines.

The imports need to be reordered following the pattern: standard libs, default libs, cosmossdk.io prefix, github.com/cosmos/cosmos-sdk prefix.

import (
	"context"

	storetypes "cosmossdk.io/store/types"
-	"cosmossdk.io/core/codec"
+
+	"cosmossdk.io/core/codec"
)
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"cosmossdk.io/core/codec"
import (
"context"
storetypes "cosmossdk.io/store/types"
"cosmossdk.io/core/codec"
)
🧰 Tools
🪛 golangci-lint (1.62.2)

8-8: File is not gci-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order

(gci)

🪛 GitHub Actions: Lint

[error] 6-8: File is not properly formatted with gci. Import ordering needs to follow: --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order

)

// MigrateStore performs in-place store migrations from v5 to v6.
Expand Down
17 changes: 1 addition & 16 deletions x/staking/types/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"cosmossdk.io/errors"
"cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -150,21 +150,6 @@ func (v Validators) UnpackInterfaces(c gogoprotoany.AnyUnpacker) error {
return nil
}

// return the redelegation
func MustMarshalValidator(cdc codec.BinaryCodec, validator *Validator) []byte {
return cdc.MustMarshal(validator)
}

// unmarshal a redelegation from a store value
func MustUnmarshalValidator(cdc codec.BinaryCodec, value []byte) Validator {
validator, err := UnmarshalValidator(cdc, value)
if err != nil {
panic(err)
}

return validator
}

// unmarshal a redelegation from a store value
func UnmarshalValidator(cdc codec.BinaryCodec, value []byte) (v Validator, err error) {
err = cdc.Unmarshal(value, &v)
Expand Down
Loading