diff --git a/custom/auth/ante/fee_tax.go b/custom/auth/ante/fee_tax.go index c972ce6eb..27bd3a7d1 100644 --- a/custom/auth/ante/fee_tax.go +++ b/custom/auth/ante/fee_tax.go @@ -69,7 +69,7 @@ func FilterMsgAndComputeTax(ctx sdk.Context, te taxexemptionkeeper.Keeper, tk Tr case *authz.MsgExec: messages, err := msg.GetMessages() if err == nil { - taxes = taxes.Add(FilterMsgAndComputeTax(ctx, tk, messages...)...) + taxes = taxes.Add(FilterMsgAndComputeTax(ctx, te, tk, messages...)...) } } } diff --git a/x/taxexemption/client/cli/gov_tx.go b/x/taxexemption/client/cli/gov_tx.go index f25fa7505..6f374d519 100644 --- a/x/taxexemption/client/cli/gov_tx.go +++ b/x/taxexemption/client/cli/gov_tx.go @@ -90,7 +90,7 @@ $ %s tx gov submit-proposal add-tax-exemption-zone zonexyz terra1dczz24r33fwlj0q sdkMsg := []sdk.Msg{&msg} - submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta)) + submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta), proposalTitle, proposalDescr) if err != nil { return err } @@ -163,7 +163,7 @@ $ %s tx gov submit-proposal remove-tax-exemption-zone zonexyz --title "remove ta sdkMsg := []sdk.Msg{&msg} - submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta)) + submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta), proposalTitle, proposalDescr) if err != nil { return err } @@ -250,7 +250,7 @@ $ %s tx gov submit-proposal modify-tax-exemption-zone zonexyz --exempt-outgoing sdkMsg := []sdk.Msg{&msg} - submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta)) + submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta), proposalTitle, proposalDescr) if err != nil { return err } @@ -325,7 +325,7 @@ $ %s tx gov submit-proposal add-tax-exemption-address zonexyz terra1dczz24r33fwl sdkMsg := []sdk.Msg{&msg} - submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta)) + submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta), proposalTitle, proposalDescr) if err != nil { return err } @@ -396,7 +396,7 @@ $ %s tx gov submit-proposal remove-tax-exemption-address zonexyz terra1dczz24r33 sdkMsg := []sdk.Msg{&msg} - submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta)) + submitMsg, err := govv1.NewMsgSubmitProposal(sdkMsg, deposit, clientCtx.GetFromAddress().String(), string(jsonMeta), proposalTitle, proposalDescr) if err != nil { return err } diff --git a/x/taxexemption/keeper/keeper.go b/x/taxexemption/keeper/keeper.go index 4675ea9cd..580e9f06f 100644 --- a/x/taxexemption/keeper/keeper.go +++ b/x/taxexemption/keeper/keeper.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" @@ -11,8 +12,6 @@ import ( accountkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" - "github.com/classic-terra/core/v3/x/taxexemption/types" ) diff --git a/x/taxexemption/keeper/keeper_test.go b/x/taxexemption/keeper/keeper_test.go index 01cb9ab0e..6f089ffe5 100644 --- a/x/taxexemption/keeper/keeper_test.go +++ b/x/taxexemption/keeper/keeper_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/secp256k1" + "github.com/cometbft/cometbft/crypto/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/taxexemption/keeper/legacy_querier.go b/x/taxexemption/keeper/legacy_querier.go deleted file mode 100644 index 79e7da3c1..000000000 --- a/x/taxexemption/keeper/legacy_querier.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/classic-terra/core/v3/x/taxexemption/types" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewLegacyQuerier is the module level router for state queries -func NewLegacyQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err error) { - return nil, sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "unknown %s query endpoint: %s", types.ModuleName, path[0]) - } -} diff --git a/x/taxexemption/keeper/test_utils.go b/x/taxexemption/keeper/test_utils.go index a9e7d48f7..b527286ac 100644 --- a/x/taxexemption/keeper/test_utils.go +++ b/x/taxexemption/keeper/test_utils.go @@ -7,35 +7,32 @@ import ( "github.com/CosmWasm/wasmd/x/wasm" "github.com/stretchr/testify/require" - customauth "github.com/classic-terra/core/v2/custom/auth" - custombank "github.com/classic-terra/core/v2/custom/bank" - customdistr "github.com/classic-terra/core/v2/custom/distribution" - customparams "github.com/classic-terra/core/v2/custom/params" - customstaking "github.com/classic-terra/core/v2/custom/staking" - core "github.com/classic-terra/core/v2/types" - "github.com/classic-terra/core/v2/x/market" - "github.com/classic-terra/core/v2/x/oracle" + simappparams "cosmossdk.io/simapp/params" + customauth "github.com/classic-terra/core/v3/custom/auth" + custombank "github.com/classic-terra/core/v3/custom/bank" + customdistr "github.com/classic-terra/core/v3/custom/distribution" + customparams "github.com/classic-terra/core/v3/custom/params" + customstaking "github.com/classic-terra/core/v3/custom/staking" + core "github.com/classic-terra/core/v3/types" + "github.com/classic-terra/core/v3/x/market" + "github.com/classic-terra/core/v3/x/oracle" "github.com/classic-terra/core/v3/x/taxexemption/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/simapp" - simparams "github.com/cosmos/cosmos-sdk/simapp/params" - "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" ) @@ -54,28 +51,15 @@ func MakeTestCodec(t *testing.T) codec.Codec { return MakeEncodingConfig(t).Codec } -func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := codectypes.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) - - std.RegisterInterfaces(interfaceRegistry) - std.RegisterLegacyAminoCodec(amino) - - ModuleBasics.RegisterLegacyAminoCodec(amino) - ModuleBasics.RegisterInterfaces(interfaceRegistry) - - return simparams.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: codec, - TxConfig: txCfg, - Amino: amino, - } +func MakeEncodingConfig(_ *testing.T) simappparams.EncodingConfig { + encodingConfig := simappparams.MakeTestEncodingConfig() + ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) + ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) + return encodingConfig } var ( - ValPubKeys = simapp.CreateTestPubKeys(5) + ValPubKeys = simtestutil.CreateTestPubKeys(5) PubKeys = []crypto.PubKey{ secp256k1.GenPrivKey().PubKey(), @@ -130,10 +114,10 @@ func CreateTestInput(t *testing.T) TestInput { } paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) - accountKeeper := authkeeper.NewAccountKeeper(appCodec, aKeyParams, paramsKeeper.Subspace(authtypes.ModuleName), + accountKeeper := authkeeper.NewAccountKeeper(appCodec, aKeyParams, authtypes.ProtoBaseAccount, maccPerms, - sdk.GetConfig().GetBech32AccountAddrPrefix()) + sdk.GetConfig().GetBech32AccountAddrPrefix(), string(authtypes.NewModuleAddress(govtypes.ModuleName))) taxexemptionKeeper := NewKeeper(appCodec, keyTaxExemption, paramsKeeper.Subspace(types.ModuleName), diff --git a/x/taxexemption/module.go b/x/taxexemption/module.go index 775d515fa..9f02438d4 100644 --- a/x/taxexemption/module.go +++ b/x/taxexemption/module.go @@ -3,22 +3,21 @@ package taxexemption import ( "context" "encoding/json" - "math/rand" - "github.com/classic-terra/core/v2/x/market/simulation" + "github.com/classic-terra/core/v3/x/market/simulation" "github.com/classic-terra/core/v3/x/taxexemption/client/cli" "github.com/classic-terra/core/v3/x/taxexemption/keeper" "github.com/classic-terra/core/v3/x/taxexemption/types" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - abci "github.com/tendermint/tendermint/abci/types" ) var ( @@ -112,11 +111,6 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json. return nil } -// LegacyQuerierHandler returns the taxexemption module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return keeper.NewLegacyQuerier(am.keeper, legacyQuerierCdc) -} - // QuerierRoute returns the taxexemption module's querier route name. func (AppModule) QuerierRoute() string { return types.QuerierRoute } @@ -131,11 +125,6 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) } -// Route returns the message routing key for the taxexemption module. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // GenerateGenesisState creates a randomized GenState of the taxexemption module. func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } @@ -146,12 +135,6 @@ func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.Weight return []simtypes.WeightedProposalContent{} } -// RandomizedParams creates randomized taxexemption param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - // workaround to make the sim work with staking module - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder for taxexemption module's types func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) diff --git a/x/taxexemption/types/proposal.go b/x/taxexemption/types/proposal.go index d800c956f..06a796e44 100644 --- a/x/taxexemption/types/proposal.go +++ b/x/taxexemption/types/proposal.go @@ -18,15 +18,10 @@ const ( func init() { govv1beta1.RegisterProposalType(ProposalTypeAddTaxExemptionZone) - govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&AddTaxExemptionZoneProposal{}, "taxexemption/AddTaxExemptionZoneProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeRemoveTaxExemptionZone) - govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&RemoveTaxExemptionZoneProposal{}, "taxexemption/RemoveTaxExemptionZoneProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeModifyTaxExemptionZone) - govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&ModifyTaxExemptionZoneProposal{}, "taxexemption/ModifyTaxExemptionZoneProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeAddTaxExemptionAddress) - govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&AddTaxExemptionAddressProposal{}, "taxexemption/AddTaxExemptionAddressProposal", nil) govv1beta1.RegisterProposalType(ProposalTypeRemoveTaxExemptionAddress) - govv1beta1.ModuleCdc.LegacyAmino.RegisterConcrete(&RemoveTaxExemptionAddressProposal{}, "taxexemption/RemoveTaxExemptionAddressProposal", nil) } var (