Skip to content

Commit

Permalink
rm ibchooks (need to permission per #475 frey)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 9, 2023
1 parent 5b4d446 commit 1d76182
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 54 deletions.
55 changes: 30 additions & 25 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package keepers
import (
"path/filepath"

ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
// ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"

"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
Expand Down Expand Up @@ -54,8 +54,9 @@ import (
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
ibchookskeeper "github.com/osmosis-labs/osmosis/x/ibc-hooks/keeper"

// ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
// ibchookskeeper "github.com/osmosis-labs/osmosis/x/ibc-hooks/keeper"

packetforward "github.com/strangelove-ventures/packet-forward-middleware/v4/router"
packetforwardkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper"
Expand Down Expand Up @@ -102,14 +103,15 @@ type AppKeepers struct {
ParamsKeeper paramskeeper.Keeper
IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
IBCFeeKeeper ibcfeekeeper.Keeper
IBCHooksKeeper *ibchookskeeper.Keeper
PacketForwardKeeper *packetforwardkeeper.Keeper
EvidenceKeeper evidencekeeper.Keeper
TransferKeeper ibctransferkeeper.Keeper
AuthzKeeper authzkeeper.Keeper
FeeGrantKeeper feegrantkeeper.Keeper
FeeShareKeeper feesharekeeper.Keeper
ContractKeeper *wasmkeeper.PermissionedKeeper

// IBCHooksKeeper *ibchookskeeper.Keeper
// ContractKeeper *wasmkeeper.PermissionedKeeper

// OracleKeeper oraclekeeper.Keeper

Expand All @@ -130,8 +132,8 @@ type AppKeepers struct {
TokenFactoryKeeper tokenfactorykeeper.Keeper

// Middleware wrapper
Ics20WasmHooks *ibchooks.WasmHooks
HooksICS4Wrapper ibchooks.ICS4Middleware
// Ics20WasmHooks *ibchooks.WasmHooks
// HooksICS4Wrapper ibchooks.ICS4Middleware
}

func NewAppKeepers(
Expand Down Expand Up @@ -285,18 +287,18 @@ func NewAppKeepers(
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(appKeepers.IBCKeeper.ClientKeeper))

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(
appKeepers.keys[ibchookstypes.StoreKey],
)
appKeepers.IBCHooksKeeper = &hooksKeeper

junoPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
wasmHooks := ibchooks.NewWasmHooks(appKeepers.IBCHooksKeeper, nil, junoPrefix) // The contract keeper needs to be set later
appKeepers.Ics20WasmHooks = &wasmHooks
appKeepers.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.Ics20WasmHooks,
)
// hooksKeeper := ibchookskeeper.NewKeeper(
// appKeepers.keys[ibchookstypes.StoreKey],
// )
// appKeepers.IBCHooksKeeper = &hooksKeeper

// junoPrefix := sdk.GetConfig().GetBech32AccountAddrPrefix()
// wasmHooks := ibchooks.NewWasmHooks(appKeepers.IBCHooksKeeper, nil, junoPrefix) // The contract keeper needs to be set later
// appKeepers.Ics20WasmHooks = &wasmHooks
// appKeepers.HooksICS4Wrapper = ibchooks.NewICS4Middleware(
// appKeepers.IBCKeeper.ChannelKeeper,
// appKeepers.Ics20WasmHooks,
// )

// Initialize packet forward middleware router
appKeepers.PacketForwardKeeper = packetforwardkeeper.NewKeeper(
Expand All @@ -311,9 +313,11 @@ func NewAppKeepers(
)

appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper(
appCodec, appKeepers.keys[ibcfeetypes.StoreKey],
appCodec,
appKeepers.keys[ibcfeetypes.StoreKey],
appKeepers.GetSubspace(ibcfeetypes.ModuleName), // this isn't even used in the keeper but is required?
appKeepers.HooksICS4Wrapper, // replaced with IBC middleware
// appKeepers.HooksICS4Wrapper, // replaced with IBC middleware
appKeepers.IBCKeeper.ChannelKeeper, // TODO: replace this line with the above line for v13-part2
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
Expand All @@ -326,7 +330,8 @@ func NewAppKeepers(
appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
// The ICS4Wrapper is replaced by the PacketForwardKeeper instead of the channel so that sending can be overridden by the middleware
appKeepers.PacketForwardKeeper,
// appKeepers.PacketForwardKeeper,
appKeepers.IBCKeeper.ChannelKeeper, // TODO: replace this with the above line for v13-part2
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
Expand Down Expand Up @@ -465,7 +470,7 @@ func NewAppKeepers(
packetforwardkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)
transferStack = ibcfee.NewIBCMiddleware(transferStack, appKeepers.IBCFeeKeeper)
transferStack = ibchooks.NewIBCMiddleware(transferStack, &appKeepers.HooksICS4Wrapper)
// transferStack = ibchooks.NewIBCMiddleware(transferStack, &appKeepers.HooksICS4Wrapper)

// RecvPacket, message that originates from core IBC and goes down to app, the flow is:
// channel.RecvPacket -> fee.OnRecvPacket -> icaHost.OnRecvPacket
Expand Down Expand Up @@ -499,8 +504,8 @@ func NewAppKeepers(
// appKeepers.ScopedInterTxKeeper = scopedInterTxKeeper

// set the contract keeper for the Ics20WasmHooks
appKeepers.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper)
appKeepers.Ics20WasmHooks.ContractKeeper = appKeepers.ContractKeeper
// appKeepers.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper)
// appKeepers.Ics20WasmHooks.ContractKeeper = appKeepers.ContractKeeper

return appKeepers
}
Expand Down
5 changes: 3 additions & 2 deletions app/keepers/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import (
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"

// ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
// intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
// oracletypes "github.com/CosmosContracts/juno/v13/x/oracle/types"
Expand All @@ -45,8 +46,8 @@ func (appKeepers *AppKeepers) GenerateKeys() {
icacontrollertypes.StoreKey,
feesharetypes.StoreKey,
packetforwardtypes.StoreKey,
ibchookstypes.StoreKey,
ibcfeetypes.StoreKey,
// ibchookstypes.StoreKey,
// intertxtypes.StoreKey,
// oracletypes.StoreKey,
)
Expand Down
30 changes: 15 additions & 15 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ import (
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
packetforward "github.com/strangelove-ventures/packet-forward-middleware/v4/router"
packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
// intertx "github.com/cosmos/interchain-accounts/x/inter-tx"
// intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
// "github.com/CosmosContracts/juno/v13/x/oracle"
// oracletypes "github.com/CosmosContracts/juno/v13/x/oracle/types"
// ibchooks "github.com/osmosis-labs/osmosis/x/ibc-hooks"
// ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
)

// module account permissions
Expand Down Expand Up @@ -101,11 +101,11 @@ var ModuleBasics = module.NewBasicManager(
tokenfactory.AppModuleBasic{},
wasm.AppModuleBasic{},
ica.AppModuleBasic{},
// oracle.AppModuleBasic{},
// intertx.AppModuleBasic{},
feeshare.AppModuleBasic{},
ibchooks.AppModuleBasic{},
packetforward.AppModuleBasic{},
// ibchooks.AppModuleBasic{},
// oracle.AppModuleBasic{},
// intertx.AppModuleBasic{},
)

func appModules(
Expand Down Expand Up @@ -144,7 +144,7 @@ func appModules(
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
// intertx.NewAppModule(appCodec, app.InterTxKeeper),
// oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper),
ibchooks.NewAppModule(app.AccountKeeper),
// ibchooks.NewAppModule(app.AccountKeeper),
packetforward.NewAppModule(app.PacketForwardKeeper),
}
}
Expand Down Expand Up @@ -205,13 +205,13 @@ func orderBeginBlockers() []string {
ibctransfertypes.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
// intertxtypes.ModuleName,
ibcfeetypes.ModuleName,
// oracletypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
// intertxtypes.ModuleName,
// oracletypes.ModuleName,
// ibchookstypes.ModuleName,
}
}

Expand All @@ -238,13 +238,13 @@ func orderEndBlockers() []string {
ibctransfertypes.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
// intertxtypes.ModuleName,
ibcfeetypes.ModuleName,
// oracletypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
// intertxtypes.ModuleName,
// oracletypes.ModuleName,
// ibchookstypes.ModuleName,
}
}

Expand All @@ -271,12 +271,12 @@ func orderInitBlockers() []string {
ibctransfertypes.ModuleName,
icatypes.ModuleName,
packetforwardtypes.ModuleName,
// oracletypes.ModuleName,
// intertxtypes.ModuleName,
ibcfeetypes.ModuleName,
tokenfactorytypes.ModuleName,
feesharetypes.ModuleName,
wasm.ModuleName,
ibchookstypes.ModuleName,
// oracletypes.ModuleName,
// intertxtypes.ModuleName,
// ibchookstypes.ModuleName,
}
}
7 changes: 3 additions & 4 deletions app/upgrades/v13part1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import (
store "github.com/cosmos/cosmos-sdk/store/types"
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"

ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
packetforwardtypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
// ibchookstypes "github.com/osmosis-labs/osmosis/x/ibc-hooks/types"
// intertxtypes "github.com/cosmos/interchain-accounts/x/inter-tx/types"
// oracletypes "github.com/CosmosContracts/juno/v13/x/oracle/types"
)
Expand All @@ -26,10 +25,10 @@ var Upgrade = upgrades.Upgrade{
packetforwardtypes.StoreKey,
feesharetypes.ModuleName,
tokenfactorytypes.ModuleName,
ibchookstypes.StoreKey,

icacontrollertypes.StoreKey,
ibcfeetypes.ModuleName,

// ibchookstypes.StoreKey,
// oracletypes.ModuleName,
// intertxtypes.ModuleName,
},
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230201151635-ef43e092d196
// github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230201151635-ef43e092d196
github.com/prometheus/client_golang v1.14.0
github.com/spf13/cast v1.5.0
github.com/spf13/cobra v1.6.1
Expand Down Expand Up @@ -112,7 +112,7 @@ require (
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/opencontainers/runc v1.1.3 // indirect
github.com/ory/dockertest/v3 v3.9.1
github.com/osmosis-labs/osmosis/osmoutils v0.0.3-rc0 // indirect
// github.com/osmosis-labs/osmosis/osmoutils v0.0.3-rc0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
8 changes: 2 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
Expand Down Expand Up @@ -705,8 +705,8 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
Expand All @@ -733,10 +733,6 @@ github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh
github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA=
github.com/ory/dockertest/v3 v3.9.1 h1:v4dkG+dlu76goxMiTT2j8zV7s4oPPEppKT8K8p2f1kY=
github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM=
github.com/osmosis-labs/osmosis/osmoutils v0.0.3-rc0 h1:u91mXL0DbbQdLy95gCkLrM6cxya9b53fuiNkLO04KOE=
github.com/osmosis-labs/osmosis/osmoutils v0.0.3-rc0/go.mod h1:rO4YKI0ZQkS3o4UDhFuQFy+j4eM/as8GLvuBDNBStkQ=
github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230201151635-ef43e092d196 h1:V8OgwzvHwvGt2yEHRFsiWUPC647qez2LNgcvLzXgw8U=
github.com/osmosis-labs/osmosis/x/ibc-hooks v0.0.0-20230201151635-ef43e092d196/go.mod h1:eoSRNkeqi3ufOmvY8XcW8y0NgbbaPyBTEn7DTxq8XY4=
github.com/otiai10/copy v1.6.0 h1:IinKAryFFuPONZ7cm6T6E2QX/vcJwSnlaA5lfoaXIiQ=
github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down

0 comments on commit 1d76182

Please sign in to comment.