From a9d122e7878362d524f63ac0e1ab3f350aa74eac Mon Sep 17 00:00:00 2001 From: Thomas Bruyelle Date: Tue, 11 Apr 2023 18:18:42 +0200 Subject: [PATCH] migrate goc #2 --- app/consumer-democracy/app.go | 2 +- app/provider/app.go | 2 +- tests/integration/democracy.go | 2 +- testutil/integration/interfaces.go | 3 ++- x/ccv/democracy/governance/module.go | 20 +++++++++++--------- x/ccv/provider/client/proposal_handler.go | 2 +- x/ccv/provider/proposal_handler.go | 2 +- x/ccv/provider/proposal_handler_test.go | 2 +- x/ccv/provider/types/codec.go | 2 +- x/ccv/provider/types/proposal.go | 2 +- x/ccv/provider/types/proposal_test.go | 2 +- 11 files changed, 22 insertions(+), 19 deletions(-) diff --git a/app/consumer-democracy/app.go b/app/consumer-democracy/app.go index ff22370a3e..c0ebe193c0 100644 --- a/app/consumer-democracy/app.go +++ b/app/consumer-democracy/app.go @@ -929,7 +929,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(gov.ProvideKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) diff --git a/app/provider/app.go b/app/provider/app.go index 09acfbd43d..4e16eeab5f 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -867,7 +867,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(minttypes.ModuleName) paramsKeeper.Subspace(distrtypes.ModuleName) paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable()) + paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(gov.ProvideKeyTable()) paramsKeeper.Subspace(crisistypes.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(ibcexported.ModuleName) diff --git a/tests/integration/democracy.go b/tests/integration/democracy.go index 55217f4b2c..97cd080a80 100644 --- a/tests/integration/democracy.go +++ b/tests/integration/democracy.go @@ -11,7 +11,7 @@ import ( icstestingutils "github.com/cosmos/interchain-security/testutil/ibc_testing" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal" testutil "github.com/cosmos/interchain-security/testutil/integration" diff --git a/testutil/integration/interfaces.go b/testutil/integration/interfaces.go index 308843d08d..4d419d4017 100644 --- a/testutil/integration/interfaces.go +++ b/testutil/integration/interfaces.go @@ -9,7 +9,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -139,6 +139,7 @@ type TestMintKeeper interface { } type TestGovKeeper interface { + // TODO fix methods here GetDepositParams(ctx sdk.Context) govtypes.DepositParams GetVotingParams(ctx sdk.Context) govtypes.VotingParams SetVotingParams(ctx sdk.Context, votingParams govtypes.VotingParams) diff --git a/x/ccv/democracy/governance/module.go b/x/ccv/democracy/governance/module.go index 35ad0e23c9..fc0a4d30bc 100644 --- a/x/ccv/democracy/governance/module.go +++ b/x/ccv/democracy/governance/module.go @@ -11,6 +11,8 @@ import ( gov "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( @@ -28,11 +30,11 @@ type AppModule struct { gov.AppModule keeper keeper.Keeper - isProposalWhitelisted func(govtypes.Content) bool + isProposalWhitelisted func(govv1beta1.Content) bool } // NewAppModule creates a new AppModule object using the native x/governance module AppModule constructor. -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak govtypes.AccountKeeper, bk govtypes.BankKeeper, isProposalWhitelisted func(govtypes.Content) bool) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak govtypes.AccountKeeper, bk govtypes.BankKeeper, isProposalWhitelisted func(govv1beta1.Content) bool) AppModule { govAppModule := gov.NewAppModule(cdc, keeper, ak, bk) return AppModule{ AppModule: govAppModule, @@ -42,7 +44,7 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, ak govtypes.AccountKeep } func (am AppModule) EndBlock(ctx sdk.Context, request abci.RequestEndBlock) []abci.ValidatorUpdate { - am.keeper.IterateActiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal govtypes.Proposal) bool { + am.keeper.IterateActiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal govv1.Proposal) bool { // if there are forbidden proposals in active proposals queue, refund deposit, delete votes for that proposal // and delete proposal from all storages deleteForbiddenProposal(ctx, am, proposal) @@ -52,7 +54,7 @@ func (am AppModule) EndBlock(ctx sdk.Context, request abci.RequestEndBlock) []ab return am.AppModule.EndBlock(ctx, request) } -func deleteForbiddenProposal(ctx sdk.Context, am AppModule, proposal govtypes.Proposal) { +func deleteForbiddenProposal(ctx sdk.Context, am AppModule, proposal govv1.Proposal) { if am.isProposalWhitelisted(proposal.GetContent()) { return } @@ -63,13 +65,13 @@ func deleteForbiddenProposal(ctx sdk.Context, am AppModule, proposal govtypes.Pr // private and cannot be called directly from the overridden app module am.keeper.Tally(ctx, proposal) - am.keeper.DeleteProposal(ctx, proposal.ProposalId) - am.keeper.RefundDeposits(ctx, proposal.ProposalId) + am.keeper.DeleteProposal(ctx, proposal.Id) + am.keeper.RefundAndDeleteDeposits(ctx, proposal.Id) ctx.EventManager().EmitEvent( sdk.NewEvent( govtypes.EventTypeActiveProposal, - sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposal.ProposalId)), + sdk.NewAttribute(govtypes.AttributeKeyProposalID, fmt.Sprintf("%d", proposal.Id)), sdk.NewAttribute(govtypes.AttributeKeyProposalResult, AttributeValueProposalForbidden), ), ) @@ -77,7 +79,7 @@ func deleteForbiddenProposal(ctx sdk.Context, am AppModule, proposal govtypes.Pr logger := am.keeper.Logger(ctx) logger.Info( "proposal is not whitelisted; deleted", - "proposal", proposal.ProposalId, + "proposal", proposal.Id, "title", proposal.GetTitle(), - "total_deposit", proposal.TotalDeposit.String()) + "total_deposit", proposal.TotalDeposit) } diff --git a/x/ccv/provider/client/proposal_handler.go b/x/ccv/provider/client/proposal_handler.go index aa4d83693b..dbaa7fed4a 100644 --- a/x/ccv/provider/client/proposal_handler.go +++ b/x/ccv/provider/client/proposal_handler.go @@ -11,7 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" "github.com/cosmos/interchain-security/x/ccv/provider/types" "github.com/spf13/cobra" diff --git a/x/ccv/provider/proposal_handler.go b/x/ccv/provider/proposal_handler.go index 01ffd88dac..c1bbf428e8 100644 --- a/x/ccv/provider/proposal_handler.go +++ b/x/ccv/provider/proposal_handler.go @@ -3,7 +3,7 @@ package provider import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/cosmos/interchain-security/x/ccv/provider/keeper" "github.com/cosmos/interchain-security/x/ccv/provider/types" ) diff --git a/x/ccv/provider/proposal_handler_test.go b/x/ccv/provider/proposal_handler_test.go index 4a50a34d1b..774482d382 100644 --- a/x/ccv/provider/proposal_handler_test.go +++ b/x/ccv/provider/proposal_handler_test.go @@ -12,7 +12,7 @@ import ( clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" testkeeper "github.com/cosmos/interchain-security/testutil/keeper" "github.com/cosmos/interchain-security/x/ccv/provider" providertypes "github.com/cosmos/interchain-security/x/ccv/provider/types" diff --git a/x/ccv/provider/types/codec.go b/x/ccv/provider/types/codec.go index 97772e7f00..9efa63afa6 100644 --- a/x/ccv/provider/types/codec.go +++ b/x/ccv/provider/types/codec.go @@ -5,7 +5,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types diff --git a/x/ccv/provider/types/proposal.go b/x/ccv/provider/types/proposal.go index 0abb6c0274..15e1ccd874 100644 --- a/x/ccv/provider/types/proposal.go +++ b/x/ccv/provider/types/proposal.go @@ -8,7 +8,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ccvtypes "github.com/cosmos/interchain-security/x/ccv/types" ) diff --git a/x/ccv/provider/types/proposal_test.go b/x/ccv/provider/types/proposal_test.go index cbdb550768..5ea460658b 100644 --- a/x/ccv/provider/types/proposal_test.go +++ b/x/ccv/provider/types/proposal_test.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"