Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamer-zq committed Jun 4, 2024
1 parent 5976fd4 commit e7940d9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ When bumping the dependencies of [IBC-Go](https://github.com/cosmos/ibc-go)、 [

To summarize: **All our nft-transfer releases allow chains to communicate successfully with any chain running any version of our code**. That is to say, we are still using IBC protocol specification v1.0.

We ensure all major releases are supported by relayers ([hermes](https://github.com/informalsystems/ibc-rs), [rly](https://github.com/strangelove-ventures/relayer) and [ts-relayer](https://github.com/confio/ts-relayer) at the moment) which can relay between the new major release and older releases. We have no plans of upgrading to an IBC protocol specification v2.0, as this would be very disruptive to the ecosystem.
We ensure all major releases are supported by relayers ([hermes](https://github.com/informalsystems/ibc-rs), [rly](https://github.com/cosmos/relayer) and [ts-relayer](https://github.com/confio/ts-relayer) at the moment) which can relay between the new major release and older releases. We have no plans of upgrading to an IBC protocol specification v2.0, as this would be very disruptive to the ecosystem.

## Release cycle

Expand Down
12 changes: 3 additions & 9 deletions keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package keeper_test
import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/query"

"github.com/bianjieai/nft-transfer/types"
Expand Down Expand Up @@ -63,8 +62,7 @@ func (suite *KeeperTestSuite) TestQueryClassTrace() {
suite.SetupTest() // reset

tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
res, err := suite.queryClient.ClassTrace(ctx, req)
res, err := suite.queryClient.ClassTrace(suite.chainA.GetContext(), req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -136,9 +134,7 @@ func (suite *KeeperTestSuite) TestQueryClassTraces() {
suite.SetupTest() // reset

tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.ClassTraces(ctx, req)
res, err := suite.queryClient.ClassTraces(suite.chainA.GetContext(), req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down Expand Up @@ -239,10 +235,8 @@ func (suite *KeeperTestSuite) TestQueryParams() {
suite.Run(fmt.Sprintf("Case %s", tc.name), func() {
suite.SetupTest() // reset

ctx := sdk.WrapSDKContext(suite.chainA.GetContext())
tc.malleate()

res, err := suite.queryClient.Params(ctx, &types.QueryParamsRequest{})
res, err := suite.queryClient.Params(suite.chainA.GetContext(), &types.QueryParamsRequest{})
if (err != nil) != tc.wantErr {
suite.Require().Error(err)
} else {
Expand Down
4 changes: 1 addition & 3 deletions testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v8/modules/core"
ibcclient "github.com/cosmos/ibc-go/v8/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types"
Expand Down Expand Up @@ -439,8 +438,7 @@ func NewSimApp(
// See: https://docs.cosmos.network/main/modules/gov#proposal-messages
govRouter := govv1beta1.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler).
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper))
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper))
govConfig := govtypes.DefaultConfig()
/*
Example of setting gov params:
Expand Down
19 changes: 14 additions & 5 deletions types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
}

var (
amino = codec.NewLegacyAmino()

// ModuleCdc references the global nft-transfer module codec. Note, the codec
// should ONLY be used in certain instances of tests and for JSON encoding.
//
Expand All @@ -40,14 +38,25 @@ var (
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())

// AminoCdc is a amino codec created to support amino json compatible msgs.
AminoCdc = codec.NewAminoCodec(amino)
AminoCdc = codec.NewLegacyAmino()
)

func init() {
RegisterLegacyAminoCodec(amino)
amino.Seal()
RegisterLegacyAminoCodec(AminoCdc)
AminoCdc.Seal()
}

// MustProtoMarshalJSON marshals a protobuf message to JSON and panics if there is an error.
//
// It takes a protobuf message as input and returns the JSON-encoded byte array.
// The function uses the provided anyResolver to resolve any protobuf Any types in the message.
// If there is an error during the marshaling process, the function panics.
//
// Parameters:
// - msg: The protobuf message to be marshaled.
//
// Returns:
// - []byte: The JSON-encoded byte array.
func MustProtoMarshalJSON(msg proto.Message) []byte {
anyResolver := codectypes.NewInterfaceRegistry()
bz, err := ProtoMarshalJSON(msg, anyResolver)
Expand Down

0 comments on commit e7940d9

Please sign in to comment.