Skip to content

Commit

Permalink
Create Parent Proposal and use gov-created client in Handshake (#5)
Browse files Browse the repository at this point in the history
* port parent proposal to new repo

* fix tests

* Apply suggestions from code review

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>

* address rest of colin comments

* Apply suggestions from code review

Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>

* add binary hash

* create client on behalf of proposer

* add parameterized template client and clean up proto organization

* turn disabled flag to params

Co-authored-by: colin axnér <25233464+colin-axner@users.noreply.github.com>
Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 11, 2021
1 parent 84bb789 commit 7865e67
Show file tree
Hide file tree
Showing 47 changed files with 4,081 additions and 628 deletions.
29 changes: 17 additions & 12 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/cosmos/ibc-go/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/modules/apps/transfer/types"
Expand All @@ -77,7 +78,9 @@ import (
ibchost "github.com/cosmos/ibc-go/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/modules/core/keeper"
ibctesting "github.com/cosmos/ibc-go/testing"

"github.com/spf13/cast"

abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
Expand All @@ -90,6 +93,7 @@ import (
ibcparent "github.com/cosmos/interchain-security/x/ccv/parent"
ibcparentkeeper "github.com/cosmos/interchain-security/x/ccv/parent/keeper"
ibcparenttypes "github.com/cosmos/interchain-security/x/ccv/parent/types"
ccv "github.com/cosmos/interchain-security/x/ccv/types"

"github.com/tendermint/spm/cosmoscmd"
"github.com/tendermint/spm/openapiconsole"
Expand Down Expand Up @@ -324,13 +328,23 @@ func New(
appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper,
)

// Create CCV child and parent keepers and modules
app.ChildKeeper = ibcchildkeeper.NewKeeper(appCodec, keys[ibcchildtypes.StoreKey], app.GetSubspace(ibcchildtypes.ModuleName), scopedIBCChildKeeper,
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper,
)
childModule := ibcchild.NewAppModule(app.ChildKeeper)
app.ParentKeeper = ibcparentkeeper.NewKeeper(appCodec, keys[ibcparenttypes.StoreKey], app.GetSubspace(ibcparenttypes.ModuleName), scopedIBCParentKeeper,
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper, nil)
parentModule := ibcparent.NewAppModule(app.ParentKeeper)

// register the proposal types
govRouter := govtypes.NewRouter()
govRouter.AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
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(ibchost.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)).
AddRoute(ccv.RouterKey, ibcparent.NewCreateChildChainHandler(app.ParentKeeper))

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
Expand All @@ -352,17 +366,6 @@ func New(
&stakingKeeper, govRouter,
)

// Create CCV child and parent keepers and modules
app.ChildKeeper = ibcchildkeeper.NewKeeper(appCodec, keys[ibcchildtypes.StoreKey], scopedIBCChildKeeper,
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper,
)
childModule := ibcchild.NewAppModule(app.ChildKeeper)
app.ParentKeeper = ibcparentkeeper.NewKeeper(appCodec, keys[ibcparenttypes.StoreKey], scopedIBCParentKeeper,
app.IBCKeeper.ChannelKeeper, &app.IBCKeeper.PortKeeper, app.IBCKeeper.ConnectionKeeper, app.IBCKeeper.ClientKeeper, nil)
parentModule := ibcparent.NewAppModule(app.ParentKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

// Create static IBC router, add transfer route, then set and seal it
ibcRouter := ibcporttypes.NewRouter()
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule)
Expand Down Expand Up @@ -654,6 +657,8 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(crisistypes.ModuleName)
paramsKeeper.Subspace(ibctransfertypes.ModuleName)
paramsKeeper.Subspace(ibchost.ModuleName)
paramsKeeper.Subspace(ibcparenttypes.ModuleName)
paramsKeeper.Subspace(ibcchildtypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
8 changes: 6 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ require (
github.com/cosmos/iavl v0.17.1 // indirect
github.com/cosmos/ibc-go v1.2.1-0.20211111105346-12a60b13a024
github.com/gogo/protobuf v1.3.3
github.com/golangci/golangci-lint v1.42.1 // indirect
github.com/golang/protobuf v1.5.2
github.com/google/go-cmp v0.5.6 // indirect
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/improbable-eng/grpc-web v0.14.1 // indirect
github.com/jhump/protoreflect v1.9.0 // indirect
github.com/lib/pq v1.10.2 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/onsi/ginkgo v1.16.4 // indirect
github.com/onsi/gomega v1.13.0 // indirect
github.com/prometheus/common v0.30.0 // indirect
github.com/rs/zerolog v1.25.0 // indirect
github.com/spf13/cast v1.4.1
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/cosmos-rosetta-gateway v0.3.0-rc2.0.20210304154332-87d6ca4410df // indirect
github.com/tendermint/spm v0.1.5
github.com/tendermint/tendermint v0.34.14
github.com/tendermint/tm-db v0.6.4
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83
google.golang.org/grpc v1.40.0
google.golang.org/protobuf v1.27.1
)

replace (
Expand Down
Loading

0 comments on commit 7865e67

Please sign in to comment.