Skip to content

Commit

Permalink
chore(gov): remove community spend proposal (#13)
Browse files Browse the repository at this point in the history
Closes #11
  • Loading branch information
tbruyelle authored Feb 13, 2024
1 parent eefd7ed commit 17c12d6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
([#4](https://github.com/atomone-hub/govgen/pull/4)).
* Removed ability for validators to vote on proposals
([#10](https://github.com/atomone-hub/govgen/pull/10)).
* Remove community spend proposal
([#13](https://github.com/atomone-hub/govgen/pull/13)).

### STATE BREAKING
5 changes: 2 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package keepers

import (
tmos "github.com/tendermint/tendermint/libs/os"

govkeeper "github.com/atomone-hub/govgen/v1/x/gov/keeper"
govtypes "github.com/atomone-hub/govgen/v1/x/gov/types"
tmos "github.com/tendermint/tendermint/libs/os"

// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"
Expand All @@ -22,7 +23,6 @@ import (
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
Expand Down Expand Up @@ -208,7 +208,6 @@ func NewAppKeeper(
govRouter.
AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
AddRoute(paramproposal.RouterKey, govtypes.WrapSDKHandler(params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper))).
AddRoute(distrtypes.RouterKey, govtypes.WrapSDKHandler(distr.NewCommunityPoolSpendProposalHandler(appKeepers.DistrKeeper))).
AddRoute(upgradetypes.RouterKey, govtypes.WrapSDKHandler(upgrade.NewSoftwareUpgradeProposalHandler(appKeepers.UpgradeKeeper)))

/*
Expand Down
2 changes: 0 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
Expand Down Expand Up @@ -64,7 +63,6 @@ var ModuleBasics = module.NewBasicManager(
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.ProposalHandler,
upgradeclient.CancelProposalHandler,
),
Expand Down
11 changes: 10 additions & 1 deletion app/sim/sim_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ import (
"fmt"
"os"

govgen "github.com/atomone-hub/govgen/v1/app"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

govgen "github.com/atomone-hub/govgen/v1/app"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp/helpers"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/kv"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
distrsim "github.com/cosmos/cosmos-sdk/x/distribution/simulation"
)

// SetupSimulation creates the config, db (levelDB), temporary directory and logger for
Expand Down Expand Up @@ -70,6 +72,13 @@ func SimulationOperations(app *govgen.GovGenApp, cdc codec.JSONCodec, config sim

simState.ParamChanges = app.SimulationManager().GenerateParamChanges(config.Seed)
simState.Contents = app.SimulationManager().GetProposalContents(simState)
// Remove disabled community spend proposal
for i := 0; i < len(simState.Contents); i++ {
if simState.Contents[i].AppParamsKey() == distrsim.OpWeightSubmitCommunitySpendProposal {
simState.Contents = append(simState.Contents[:i], simState.Contents[i+1:]...)
break
}
}
return app.SimulationManager().WeightedOperations(simState)
}

Expand Down
7 changes: 0 additions & 7 deletions x/gov/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
paramsproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)
Expand Down Expand Up @@ -41,10 +40,6 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
(*Content)(nil),
&paramsproposal.ParameterChangeProposal{},
)
registry.RegisterImplementations(
(*Content)(nil),
&distrtypes.CommunityPoolSpendProposal{},
)
registry.RegisterImplementations(
(*Content)(nil),
&upgradetypes.SoftwareUpgradeProposal{},
Expand Down Expand Up @@ -85,8 +80,6 @@ func init() {

// Register proposal types (this is actually done in related modules, but
// since we are using an other gov module, we need to do it manually).
RegisterProposalType(distrtypes.ProposalTypeCommunityPoolSpend)
RegisterProposalTypeCodec(&distrtypes.CommunityPoolSpendProposal{}, "cosmos-sdk/CommunityPoolSpendProposal")
RegisterProposalType(paramsproposal.ProposalTypeChange)
RegisterProposalTypeCodec(&paramsproposal.ParameterChangeProposal{}, "cosmos-sdk/ParameterChangeProposal")
RegisterProposalType(upgradetypes.ProposalTypeSoftwareUpgrade)
Expand Down

0 comments on commit 17c12d6

Please sign in to comment.