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

fix: solve proposal handler route conflict #2828

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import (
ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
Expand Down Expand Up @@ -96,11 +97,9 @@ import (
tibcnfttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer"
tibcnfttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/keeper"
tibcnfttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/types"
tibcclient "github.com/bianjieai/tibc-go/modules/tibc/core/02-client"
tibcclienttypes "github.com/bianjieai/tibc-go/modules/tibc/core/02-client/types"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibcrouting "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing"
tibcroutingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
tibccli "github.com/bianjieai/tibc-go/modules/tibc/core/client/cli"
tibckeeper "github.com/bianjieai/tibc-go/modules/tibc/core/keeper"

srvflags "github.com/evmos/ethermint/server/flags"
Expand Down Expand Up @@ -525,9 +524,8 @@ func NewIrisApp(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(tibcclienttypes.RouterKey, tibcclient.NewClientProposalHandler(app.TIBCKeeper.ClientKeeper)).
AddRoute(tibcroutingtypes.RouterKey, tibcrouting.NewSetRoutingProposalHandler(app.TIBCKeeper.RoutingKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(tibchost.RouterKey, tibccli.NewProposalHandler(app.TIBCKeeper)).
AddRoute(farmtypes.RouterKey, farm.NewCommunityPoolCreateFarmProposalHandler(app.FarmKeeper))

govConfig := govtypes.DefaultConfig()
Expand Down
25 changes: 11 additions & 14 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ import (
tibcnfttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer"
tibcnfttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/types"
tibc "github.com/bianjieai/tibc-go/modules/tibc/core"
tibcclient "github.com/bianjieai/tibc-go/modules/tibc/core/02-client"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibcrouting "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing"
tibccli "github.com/bianjieai/tibc-go/modules/tibc/core/client/cli"

"github.com/evmos/ethermint/x/evm"
evmtypes "github.com/evmos/ethermint/x/evm/types"
Expand All @@ -88,6 +87,15 @@ import (
)

var (
legacyProposalHandlers = []govclient.ProposalHandler{
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
Expand All @@ -101,18 +109,7 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
tibcclient.CreateClientProposalHandler,
tibcclient.UpgradeClientProposalHandler,
tibcclient.RegisterRelayerProposalHandler,
tibcrouting.SetRoutingRulesProposalHandler,
},
append(legacyProposalHandlers, tibccli.GovHandlers...),
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
cosmossdk.io/math v1.0.0-beta.4
github.com/bianjieai/tibc-go v0.4.3-rc1
github.com/bianjieai/tibc-go v0.4.3-rc1.0.20230407110346-39868b8fc901
github.com/cosmos/cosmos-sdk v0.46.9
github.com/cosmos/ibc-go/v5 v5.2.0
github.com/evmos/ethermint v0.20.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s=
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/bianjieai/tibc-go v0.4.3-rc1 h1:4CxDwdCcknnYhSZ6IkRkqxKk9vDgc/s70IE/xywrrlY=
github.com/bianjieai/tibc-go v0.4.3-rc1/go.mod h1:G4U1RRB4uu9oi5jITFPIzpBpP45MBZxD5ya9wpZrkIw=
github.com/bianjieai/tibc-go v0.4.3-rc1.0.20230407110346-39868b8fc901 h1:1ETLCD2k45uop9AlkLJPOygF8ukFJQyxPPBsOzMe7lM=
github.com/bianjieai/tibc-go v0.4.3-rc1.0.20230407110346-39868b8fc901/go.mod h1:G4U1RRB4uu9oi5jITFPIzpBpP45MBZxD5ya9wpZrkIw=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8=
Expand Down
33 changes: 16 additions & 17 deletions simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v5/modules/core"
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
"github.com/irisnet/irismod/modules/token"

simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
"github.com/irisnet/irismod/modules/coinswap"
Expand Down Expand Up @@ -127,6 +128,7 @@ import (
"github.com/irisnet/irismod/modules/farm"
farmkeeper "github.com/irisnet/irismod/modules/farm/keeper"
farmtypes "github.com/irisnet/irismod/modules/farm/types"
"github.com/irisnet/irismod/modules/token"

tibcmttransfer "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer"
tibcmttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/mt_transfer/keeper"
Expand All @@ -135,11 +137,9 @@ import (
tibcnfttransferkeeper "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/keeper"
tibcnfttypes "github.com/bianjieai/tibc-go/modules/tibc/apps/nft_transfer/types"
tibc "github.com/bianjieai/tibc-go/modules/tibc/core"
tibcclient "github.com/bianjieai/tibc-go/modules/tibc/core/02-client"
tibcclienttypes "github.com/bianjieai/tibc-go/modules/tibc/core/02-client/types"
tibchost "github.com/bianjieai/tibc-go/modules/tibc/core/24-host"
tibcrouting "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing"
tibcroutingtypes "github.com/bianjieai/tibc-go/modules/tibc/core/26-routing/types"
tibccli "github.com/bianjieai/tibc-go/modules/tibc/core/client/cli"
tibckeeper "github.com/bianjieai/tibc-go/modules/tibc/core/keeper"
)

Expand All @@ -154,6 +154,15 @@ var (
// overwite sdk reDnmString
reDnmString = `[a-zA-Z][a-zA-Z0-9/-]{2,127}`

legacyProposalHandlers = []govclient.ProposalHandler{
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
ibcclientclient.UpdateClientProposalHandler,
ibcclientclient.UpgradeProposalHandler,
}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
// and genesis verification.
Expand All @@ -167,16 +176,7 @@ var (
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
distrclient.ProposalHandler,
upgradeclient.LegacyProposalHandler,
upgradeclient.LegacyCancelProposalHandler,
tibcclient.CreateClientProposalHandler,
tibcclient.UpgradeClientProposalHandler,
tibcclient.RegisterRelayerProposalHandler,
tibcrouting.SetRoutingRulesProposalHandler,
},
append(legacyProposalHandlers, tibccli.GovHandlers...),
),
params.AppModuleBasic{},
crisis.AppModuleBasic{},
Expand Down Expand Up @@ -649,9 +649,8 @@ func NewSimApp(
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)).
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)).
AddRoute(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(tibcclienttypes.RouterKey, tibcclient.NewClientProposalHandler(app.TIBCKeeper.ClientKeeper)).
AddRoute(tibcroutingtypes.RouterKey, tibcrouting.NewSetRoutingProposalHandler(app.TIBCKeeper.RoutingKeeper)).
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(tibchost.RouterKey, tibccli.NewProposalHandler(app.TIBCKeeper)).
AddRoute(farmtypes.RouterKey, farm.NewCommunityPoolCreateFarmProposalHandler(app.FarmKeeper))

govConfig := govtypes.DefaultConfig()
Expand Down