From f740dae543cb29a38651ccaf472cb388253b0359 Mon Sep 17 00:00:00 2001 From: Jacob Gadikian Date: Sat, 19 Mar 2022 14:29:26 +0700 Subject: [PATCH 01/10] push smol thing to github so can work with Mr. Vuong --- app/ante.go | 8 ++-- app/app.go | 39 +++++++++++++------ app/sim_test.go | 4 +- app/test_access.go | 4 +- go.mod | 2 +- go.sum | 13 +++++-- .../applications/transfer/v1/genesis.proto | 2 +- .../ibc/applications/transfer/v1/query.proto | 2 +- .../applications/transfer/v1/transfer.proto | 2 +- .../ibc/applications/transfer/v1/tx.proto | 2 +- .../ibc/applications/transfer/v2/packet.proto | 2 +- .../proto/ibc/core/channel/v1/channel.proto | 2 +- .../proto/ibc/core/channel/v1/genesis.proto | 2 +- .../proto/ibc/core/channel/v1/query.proto | 2 +- .../proto/ibc/core/channel/v1/tx.proto | 2 +- .../proto/ibc/core/client/v1/client.proto | 2 +- .../proto/ibc/core/client/v1/genesis.proto | 2 +- .../proto/ibc/core/client/v1/query.proto | 2 +- third_party/proto/ibc/core/client/v1/tx.proto | 2 +- .../ibc/core/commitment/v1/commitment.proto | 2 +- .../ibc/core/connection/v1/connection.proto | 2 +- .../ibc/core/connection/v1/genesis.proto | 2 +- .../proto/ibc/core/connection/v1/query.proto | 2 +- .../proto/ibc/core/connection/v1/tx.proto | 2 +- .../proto/ibc/core/port/v1/query.proto | 2 +- .../proto/ibc/core/types/v1/genesis.proto | 2 +- .../lightclients/localhost/v1/localhost.proto | 2 +- .../solomachine/v1/solomachine.proto | 2 +- .../solomachine/v2/solomachine.proto | 2 +- .../tendermint/v1/tendermint.proto | 2 +- x/wasm/ibc.go | 8 ++-- x/wasm/ibc_reflect_test.go | 4 +- x/wasm/ibc_test.go | 4 +- x/wasm/ibctesting/chain.go | 20 +++++----- x/wasm/ibctesting/coordinator.go | 6 +-- x/wasm/ibctesting/endpoint.go | 16 ++++---- x/wasm/ibctesting/event_utils.go | 4 +- x/wasm/ibctesting/path.go | 2 +- x/wasm/ibctesting/wasm.go | 2 +- x/wasm/keeper/handler_plugin.go | 4 +- x/wasm/keeper/handler_plugin_encoders.go | 6 +-- x/wasm/keeper/handler_plugin_encoders_test.go | 6 +-- x/wasm/keeper/handler_plugin_test.go | 6 +-- x/wasm/keeper/ibc.go | 2 +- x/wasm/keeper/query_plugins.go | 2 +- x/wasm/keeper/query_plugins_test.go | 2 +- x/wasm/keeper/test_common.go | 10 ++--- x/wasm/keeper/wasmtesting/mock_keepers.go | 4 +- x/wasm/relay_pingpong_test.go | 8 ++-- x/wasm/relay_test.go | 8 ++-- x/wasm/types/expected_keepers.go | 6 +-- 51 files changed, 135 insertions(+), 113 deletions(-) diff --git a/app/ante.go b/app/ante.go index 1bca9a8f85..fe894d17e0 100644 --- a/app/ante.go +++ b/app/ante.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper" - ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante" + channelkeeper "github.com/cosmos/ibc-go/v3/modules/core/04-channel/keeper" + ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -60,8 +60,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSigGasConsumeDecorator(options.AccountKeeper, sigGasConsumer), ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), - ibcante.NewAnteDecorator(options.IBCChannelkeeper), - } + ibcante.NewAnteDecorator(options.IBCKeeper), +as aa } return sdk.ChainAnteDecorators(anteDecorators...), nil } diff --git a/app/app.go b/app/app.go index fdd1089506..79d6dcd0dd 100644 --- a/app/app.go +++ b/app/app.go @@ -75,16 +75,16 @@ 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" - transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v2/modules/core" - ibcclient "github.com/cosmos/ibc-go/v2/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "github.com/gorilla/mux" "github.com/rakyll/statik/fs" "github.com/spf13/cast" @@ -431,11 +431,26 @@ func NewWasmApp( app.bankKeeper, scopedTransferKeeper, ) + transferModule := transfer.NewAppModule(app.transferKeeper) - // create static IBC router, add transfer route, then set and seal it + icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) + + // initialize ICA module with mock module as the authentication module on the controller side + icaAuthModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp("", scopedICAMockKeeper)) + app.ICAAuthModule = icaAuthModule + + icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthModule) + icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) + + // Create static IBC router, add app routes, then set and seal it ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferModule) + ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). + AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) + AddRoute(ibctransfertypes.ModuleName, transferIBCModule). + AddRoute(ibcmock.ModuleName, mockIBCModule) + app.IBCKeeper.SetRouter(ibcRouter) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( diff --git a/app/sim_test.go b/app/sim_test.go index 25b7134f5e..60daa7aed2 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -25,8 +25,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/libs/log" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" diff --git a/app/test_access.go b/app/test_access.go index 8770d713ef..c906043dc5 100644 --- a/app/test_access.go +++ b/app/test_access.go @@ -12,8 +12,8 @@ import ( bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v2/modules/apps/transfer/keeper" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "github.com/CosmWasm/wasmd/x/wasm" ) diff --git a/go.mod b/go.mod index 296920eba4..fb5c1b0da5 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/CosmWasm/wasmvm v1.0.0-beta10 github.com/cosmos/cosmos-sdk v0.45.4 github.com/cosmos/iavl v0.17.3 - github.com/cosmos/ibc-go/v2 v2.2.0 + github.com/cosmos/ibc-go/v3 v3.0.0 github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 diff --git a/go.sum b/go.sum index 2d47702284..bb728911b3 100644 --- a/go.sum +++ b/go.sum @@ -27,6 +27,7 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.98.0/go.mod h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -233,8 +234,8 @@ github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4 github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= github.com/cosmos/iavl v0.17.3 h1:s2N819a2olOmiauVa0WAhoIJq9EhSXE9HDBAoR9k+8Y= github.com/cosmos/iavl v0.17.3/go.mod h1:prJoErZFABYZGDHka1R6Oay4z9PrNeFFiMKHDAMOi4w= -github.com/cosmos/ibc-go/v2 v2.2.0 h1:nqpvElI9ku5oQZtKvLerhZ/UXH7QoL44VBTWwZkS4C8= -github.com/cosmos/ibc-go/v2 v2.2.0/go.mod h1:rAHRlBcRiHPP/JszN+08SJx3pegww9bcVncIb9QLx7I= +github.com/cosmos/ibc-go/v3 v3.0.0 h1:XUNplHVS51Q2gMnTFsFsH9QJ7flsovMamnltKbEgPQ4= +github.com/cosmos/ibc-go/v3 v3.0.0/go.mod h1:Mb+1NXiPOLd+CPFlOC6BKeAUaxXlhuWenMmRiUiSmwY= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= @@ -505,6 +506,7 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= +github.com/hashicorp/consul/api v1.11.0/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -876,6 +878,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sagikazarmark/crypt v0.3.0/go.mod h1:uD/D+6UF4SrIR1uGEv7bBNkNqLGqUr43MRiaGWX1Nig= github.com/sagikazarmark/crypt v0.4.0/go.mod h1:ALv2SRj7GxYV4HO9elxH9nS6M9gW+xDNxqmyJ6RfDFM= github.com/sagikazarmark/crypt v0.5.0/go.mod h1:l+nzl7KWh51rpzp2h7t4MZWyiEWdhNpOAnclKvg+mdA= github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= @@ -916,6 +919,7 @@ github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tL github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= +github.com/spf13/cobra v1.3.0/go.mod h1:BrRVncBjOJa/eUcVVm9CE+oC6as8k+VYr4NY7WCi9V4= github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= @@ -930,6 +934,7 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= +github.com/spf13/viper v1.10.0/go.mod h1:SoyBPwAtKDzypXNDFKN5kzH7ppppbGZtls1UpIy5AsM= github.com/spf13/viper v1.10.1/go.mod h1:IGlFPqhNAPKRxohIzWpI5QEy4kuI7tcl5WvR+8qy1rU= github.com/spf13/viper v1.11.0 h1:7OX/1FS6n7jHD1zGrZTM7WtY13ZELRyosK4k93oPr44= github.com/spf13/viper v1.11.0/go.mod h1:djo0X/bA5+tYVoCn+C7cAYJGcVn/qYLFTG8gdUsX7Zk= @@ -1458,6 +1463,7 @@ google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqiv google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= google.golang.org/api v0.59.0/go.mod h1:sT2boj7M9YJxZzgeZqXogmhfmRWDtPzT31xkieUbuZU= google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.62.0/go.mod h1:dKmwPCydfsad4qCH08MSdgWjfHOyfpd4VtDGgRFdavw= google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= google.golang.org/api v0.67.0/go.mod h1:ShHKP8E60yPsKNw/w8w+VYaj9H6buA5UqDp8dhbQZ6g= google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/SkfA= @@ -1538,6 +1544,8 @@ google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ6 google.golang.org/genproto v0.0.0-20211008145708-270636b82663/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211028162531-8db9c33dc351/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211129164237-f09f9a12af12/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211203200212-54befc351ae9/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= @@ -1583,7 +1591,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4= gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= diff --git a/third_party/proto/ibc/applications/transfer/v1/genesis.proto b/third_party/proto/ibc/applications/transfer/v1/genesis.proto index 73d9fdddf9..0b5c0e0d12 100644 --- a/third_party/proto/ibc/applications/transfer/v1/genesis.proto +++ b/third_party/proto/ibc/applications/transfer/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "ibc/applications/transfer/v1/transfer.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/query.proto b/third_party/proto/ibc/applications/transfer/v1/query.proto index f2faa87b83..12876608db 100644 --- a/third_party/proto/ibc/applications/transfer/v1/query.proto +++ b/third_party/proto/ibc/applications/transfer/v1/query.proto @@ -7,7 +7,7 @@ import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/applications/transfer/v1/transfer.proto"; import "google/api/annotations.proto"; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { diff --git a/third_party/proto/ibc/applications/transfer/v1/transfer.proto b/third_party/proto/ibc/applications/transfer/v1/transfer.proto index 10ce92f90d..7a99485c58 100644 --- a/third_party/proto/ibc/applications/transfer/v1/transfer.proto +++ b/third_party/proto/ibc/applications/transfer/v1/transfer.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v1/tx.proto b/third_party/proto/ibc/applications/transfer/v1/tx.proto index dfc480d07a..b8b4e1e75b 100644 --- a/third_party/proto/ibc/applications/transfer/v1/tx.proto +++ b/third_party/proto/ibc/applications/transfer/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; import "gogoproto/gogo.proto"; import "cosmos/base/v1beta1/coin.proto"; diff --git a/third_party/proto/ibc/applications/transfer/v2/packet.proto b/third_party/proto/ibc/applications/transfer/v2/packet.proto index 593392a900..850320df34 100644 --- a/third_party/proto/ibc/applications/transfer/v2/packet.proto +++ b/third_party/proto/ibc/applications/transfer/v2/packet.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.applications.transfer.v2; -option go_package = "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"; // FungibleTokenPacketData defines a struct for the packet payload // See FungibleTokenPacketData spec: diff --git a/third_party/proto/ibc/core/channel/v1/channel.proto b/third_party/proto/ibc/core/channel/v1/channel.proto index c7f42dbf99..68c6ec17b1 100644 --- a/third_party/proto/ibc/core/channel/v1/channel.proto +++ b/third_party/proto/ibc/core/channel/v1/channel.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/genesis.proto b/third_party/proto/ibc/core/channel/v1/genesis.proto index 38b57ed6c3..d95c891b6c 100644 --- a/third_party/proto/ibc/core/channel/v1/genesis.proto +++ b/third_party/proto/ibc/core/channel/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/query.proto b/third_party/proto/ibc/core/channel/v1/query.proto index 212cb645a9..ceb13d0009 100644 --- a/third_party/proto/ibc/core/channel/v1/query.proto +++ b/third_party/proto/ibc/core/channel/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "ibc/core/client/v1/client.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/channel/v1/tx.proto b/third_party/proto/ibc/core/channel/v1/tx.proto index dab45080ff..c9322c1def 100644 --- a/third_party/proto/ibc/core/channel/v1/tx.proto +++ b/third_party/proto/ibc/core/channel/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.channel.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/client.proto b/third_party/proto/ibc/core/client/v1/client.proto index 0733770201..91ad0c97e7 100644 --- a/third_party/proto/ibc/core/client/v1/client.proto +++ b/third_party/proto/ibc/core/client/v1/client.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/client/v1/genesis.proto b/third_party/proto/ibc/core/client/v1/genesis.proto index 6668f2cad6..0ca29d224b 100644 --- a/third_party/proto/ibc/core/client/v1/genesis.proto +++ b/third_party/proto/ibc/core/client/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "ibc/core/client/v1/client.proto"; import "gogoproto/gogo.proto"; diff --git a/third_party/proto/ibc/core/client/v1/query.proto b/third_party/proto/ibc/core/client/v1/query.proto index b6f8eb4744..91a906fe54 100644 --- a/third_party/proto/ibc/core/client/v1/query.proto +++ b/third_party/proto/ibc/core/client/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "cosmos/base/query/v1beta1/pagination.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/core/client/v1/tx.proto b/third_party/proto/ibc/core/client/v1/tx.proto index 82df96dec0..06dbfbd0df 100644 --- a/third_party/proto/ibc/core/client/v1/tx.proto +++ b/third_party/proto/ibc/core/client/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.client.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/commitment/v1/commitment.proto b/third_party/proto/ibc/core/commitment/v1/commitment.proto index b460b9a1e4..f0118b7165 100644 --- a/third_party/proto/ibc/core/commitment/v1/commitment.proto +++ b/third_party/proto/ibc/core/commitment/v1/commitment.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.commitment.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types"; import "gogoproto/gogo.proto"; import "confio/proofs.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/connection.proto b/third_party/proto/ibc/core/connection/v1/connection.proto index 74c39e26e3..7fd2a6909a 100644 --- a/third_party/proto/ibc/core/connection/v1/connection.proto +++ b/third_party/proto/ibc/core/connection/v1/connection.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/commitment/v1/commitment.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/genesis.proto b/third_party/proto/ibc/core/connection/v1/genesis.proto index ec5be64285..1a53422c94 100644 --- a/third_party/proto/ibc/core/connection/v1/genesis.proto +++ b/third_party/proto/ibc/core/connection/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "ibc/core/connection/v1/connection.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/query.proto b/third_party/proto/ibc/core/connection/v1/query.proto index d668c3d28d..f28578f5fc 100644 --- a/third_party/proto/ibc/core/connection/v1/query.proto +++ b/third_party/proto/ibc/core/connection/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; diff --git a/third_party/proto/ibc/core/connection/v1/tx.proto b/third_party/proto/ibc/core/connection/v1/tx.proto index 9d4e577e21..e7e09c84cf 100644 --- a/third_party/proto/ibc/core/connection/v1/tx.proto +++ b/third_party/proto/ibc/core/connection/v1/tx.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.connection.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types"; import "gogoproto/gogo.proto"; import "google/protobuf/any.proto"; diff --git a/third_party/proto/ibc/core/port/v1/query.proto b/third_party/proto/ibc/core/port/v1/query.proto index 3c7fb7cb90..4ae44a5db7 100644 --- a/third_party/proto/ibc/core/port/v1/query.proto +++ b/third_party/proto/ibc/core/port/v1/query.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.port.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/05-port/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/core/types/v1/genesis.proto b/third_party/proto/ibc/core/types/v1/genesis.proto index e39f6cdbba..fbddbf3035 100644 --- a/third_party/proto/ibc/core/types/v1/genesis.proto +++ b/third_party/proto/ibc/core/types/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.core.types.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/genesis.proto"; diff --git a/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto b/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto index 4fe05b7857..4305680154 100644 --- a/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto +++ b/third_party/proto/ibc/lightclients/localhost/v1/localhost.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.localhost.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/09-localhost/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/09-localhost/types"; import "gogoproto/gogo.proto"; import "ibc/core/client/v1/client.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto index b9b8a3a2af..c279f5e728 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v1/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/core/02-client/legacy/v100"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/core/02-client/legacy/v100"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto index 0c8c638c13..e626c18ac6 100644 --- a/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto +++ b/third_party/proto/ibc/lightclients/solomachine/v2/solomachine.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.solomachine.v2; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/06-solomachine/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/06-solomachine/types"; import "ibc/core/connection/v1/connection.proto"; import "ibc/core/channel/v1/channel.proto"; diff --git a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto index 54e229b28d..ac39341dbf 100644 --- a/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto +++ b/third_party/proto/ibc/lightclients/tendermint/v1/tendermint.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package ibc.lightclients.tendermint.v1; -option go_package = "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types"; +option go_package = "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types"; import "tendermint/types/validator.proto"; import "tendermint/types/types.proto"; diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 2e9e9b71f9..1b662e8814 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -3,15 +3,15 @@ package wasm import ( "math" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v2/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" types "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/ibc_reflect_test.go b/x/wasm/ibc_reflect_test.go index 91a0647f57..16a10c8b74 100644 --- a/x/wasm/ibc_reflect_test.go +++ b/x/wasm/ibc_reflect_test.go @@ -5,8 +5,8 @@ import ( "github.com/stretchr/testify/assert" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/stretchr/testify/require" diff --git a/x/wasm/ibc_test.go b/x/wasm/ibc_test.go index 7540b523a0..767ccbe9aa 100644 --- a/x/wasm/ibc_test.go +++ b/x/wasm/ibc_test.go @@ -4,8 +4,8 @@ import ( "testing" wasmvmtypes "github.com/CosmWasm/wasmvm/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" ) diff --git a/x/wasm/ibctesting/chain.go b/x/wasm/ibctesting/chain.go index f7f468b38a..3158663826 100644 --- a/x/wasm/ibctesting/chain.go +++ b/x/wasm/ibctesting/chain.go @@ -20,16 +20,16 @@ import ( stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" "github.com/cosmos/cosmos-sdk/x/staking/teststaking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - "github.com/cosmos/ibc-go/v2/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" - "github.com/cosmos/ibc-go/v2/modules/core/types" - ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" - "github.com/cosmos/ibc-go/v2/testing/mock" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + "github.com/cosmos/ibc-go/v3/modules/core/types" + ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" + "github.com/cosmos/ibc-go/v3/testing/mock" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/crypto/tmhash" diff --git a/x/wasm/ibctesting/coordinator.go b/x/wasm/ibctesting/coordinator.go index 13a0fcbc1d..5e2fb55662 100644 --- a/x/wasm/ibctesting/coordinator.go +++ b/x/wasm/ibctesting/coordinator.go @@ -6,9 +6,9 @@ import ( "testing" "time" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibctesting "github.com/cosmos/ibc-go/v3/testing" "github.com/stretchr/testify/require" abci "github.com/tendermint/tendermint/abci/types" diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index e39ebdb9a7..ba7f28c981 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -3,18 +3,18 @@ package ibctesting import ( "fmt" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctesting "github.com/cosmos/ibc-go/v3/testing" // sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - commitmenttypes "github.com/cosmos/ibc-go/v2/modules/core/23-commitment/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" - "github.com/cosmos/ibc-go/v2/modules/core/exported" - ibctmtypes "github.com/cosmos/ibc-go/v2/modules/light-clients/07-tendermint/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + commitmenttypes "github.com/cosmos/ibc-go/v3/modules/core/23-commitment/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" + "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibctmtypes "github.com/cosmos/ibc-go/v3/modules/light-clients/07-tendermint/types" ) // Endpoint is a which represents a channel endpoint and its associated diff --git a/x/wasm/ibctesting/event_utils.go b/x/wasm/ibctesting/event_utils.go index 5188d8a8a8..6463515ffa 100644 --- a/x/wasm/ibctesting/event_utils.go +++ b/x/wasm/ibctesting/event_utils.go @@ -4,8 +4,8 @@ import ( "strconv" "strings" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" abci "github.com/tendermint/tendermint/abci/types" ) diff --git a/x/wasm/ibctesting/path.go b/x/wasm/ibctesting/path.go index 29ac881e46..2ce5e044a6 100644 --- a/x/wasm/ibctesting/path.go +++ b/x/wasm/ibctesting/path.go @@ -5,7 +5,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ) // Path contains two endpoints representing two chains connected over IBC diff --git a/x/wasm/ibctesting/wasm.go b/x/wasm/ibctesting/wasm.go index 4b661be1d9..6957f63404 100644 --- a/x/wasm/ibctesting/wasm.go +++ b/x/wasm/ibctesting/wasm.go @@ -10,7 +10,7 @@ import ( wasmd "github.com/CosmWasm/wasmd/app" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctesting "github.com/cosmos/ibc-go/v3/testing" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/golang/protobuf/proto" //nolint diff --git a/x/wasm/keeper/handler_plugin.go b/x/wasm/keeper/handler_plugin.go index 9e4ab35f55..c138e5ed00 100644 --- a/x/wasm/keeper/handler_plugin.go +++ b/x/wasm/keeper/handler_plugin.go @@ -9,8 +9,8 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/handler_plugin_encoders.go b/x/wasm/keeper/handler_plugin_encoders.go index 624af0d187..e8e49d4fe2 100644 --- a/x/wasm/keeper/handler_plugin_encoders.go +++ b/x/wasm/keeper/handler_plugin_encoders.go @@ -12,9 +12,9 @@ import ( distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/handler_plugin_encoders_test.go b/x/wasm/keeper/handler_plugin_encoders_test.go index 67417be002..ead9bd0834 100644 --- a/x/wasm/keeper/handler_plugin_encoders_test.go +++ b/x/wasm/keeper/handler_plugin_encoders_test.go @@ -5,9 +5,9 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/golang/protobuf/proto" "github.com/stretchr/testify/assert" diff --git a/x/wasm/keeper/handler_plugin_test.go b/x/wasm/keeper/handler_plugin_test.go index 2b9e59f0c7..6684f0100d 100644 --- a/x/wasm/keeper/handler_plugin_test.go +++ b/x/wasm/keeper/handler_plugin_test.go @@ -11,9 +11,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/ibc.go b/x/wasm/keeper/ibc.go index 5d52d72a44..f6f928df62 100644 --- a/x/wasm/keeper/ibc.go +++ b/x/wasm/keeper/ibc.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - host "github.com/cosmos/ibc-go/v2/modules/core/24-host" + host "github.com/cosmos/ibc-go/v3/modules/core/24-host" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/keeper/query_plugins.go b/x/wasm/keeper/query_plugins.go index 856134da8f..b0e095b12c 100644 --- a/x/wasm/keeper/query_plugins.go +++ b/x/wasm/keeper/query_plugins.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/CosmWasm/wasmd/x/wasm/types" diff --git a/x/wasm/keeper/query_plugins_test.go b/x/wasm/keeper/query_plugins_test.go index f10f3ca1c5..edde68444b 100644 --- a/x/wasm/keeper/query_plugins_test.go +++ b/x/wasm/keeper/query_plugins_test.go @@ -10,7 +10,7 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index 55767c1236..ed5bec8ebd 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -53,11 +53,11 @@ 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/v2/modules/apps/transfer" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v2/modules/core" - ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" + "github.com/cosmos/ibc-go/v3/modules/apps/transfer" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v3/modules/core" + ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go index 2d2c99f21a..4a3f72603d 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -3,8 +3,8 @@ package wasmtesting import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" "github.com/CosmWasm/wasmd/x/wasm/types" ) diff --git a/x/wasm/relay_pingpong_test.go b/x/wasm/relay_pingpong_test.go index c7e832122c..ca06d876ff 100644 --- a/x/wasm/relay_pingpong_test.go +++ b/x/wasm/relay_pingpong_test.go @@ -5,15 +5,15 @@ import ( "fmt" "testing" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" wasmvm "github.com/CosmWasm/wasmvm" wasmvmtypes "github.com/CosmWasm/wasmvm/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/relay_test.go b/x/wasm/relay_test.go index 6786272148..6e70332c65 100644 --- a/x/wasm/relay_test.go +++ b/x/wasm/relay_test.go @@ -10,10 +10,10 @@ import ( wasmvmtypes "github.com/CosmWasm/wasmvm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types" - clienttypes "github.com/cosmos/ibc-go/v2/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v2/testing" + ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index 873e906e0f..d902b8cfac 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -8,9 +8,9 @@ import ( capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - connectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v2/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v2/modules/core/exported" + connectiontypes "github.com/cosmos/ibc-go/v3/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" ) // BankViewKeeper defines a subset of methods implemented by the cosmos-sdk bank keeper From 97e067e0069fa41aafcd14b004ad227b7131c0ad Mon Sep 17 00:00:00 2001 From: vuong Date: Mon, 21 Mar 2022 13:50:16 +0700 Subject: [PATCH 02/10] add counterpartyChannelID param to wasm IBCHandler.OnChainOpenAck --- app/ante.go | 4 ++-- x/wasm/ibc.go | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/ante.go b/app/ante.go index fe894d17e0..f5c4796e93 100644 --- a/app/ante.go +++ b/app/ante.go @@ -61,7 +61,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), ibcante.NewAnteDecorator(options.IBCKeeper), -as aa } - + } + return sdk.ChainAnteDecorators(anteDecorators...), nil } diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 1b662e8814..e6d93ad646 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -77,16 +77,16 @@ func (i IBCHandler) OnChanOpenTry( portID, channelID string, chanCap *capabilitytypes.Capability, counterParty channeltypes.Counterparty, - version, counterpartyVersion string, -) error { + counterpartyVersion string, +) (string, error) { // ensure port, version, capability if err := ValidateChannelParams(channelID); err != nil { - return err + return "", err } contractAddr, err := ContractFromPortID(portID) if err != nil { - return sdkerrors.Wrapf(err, "contract port id") + return "", sdkerrors.Wrapf(err, "contract port id") } msg := wasmvmtypes.IBCChannelOpenMsg{ @@ -95,7 +95,7 @@ func (i IBCHandler) OnChanOpenTry( Endpoint: wasmvmtypes.IBCEndpoint{PortID: portID, ChannelID: channelID}, CounterpartyEndpoint: wasmvmtypes.IBCEndpoint{PortID: counterParty.PortId, ChannelID: counterParty.ChannelId}, Order: order.String(), - Version: version, + Version: counterpartyVersion, ConnectionID: connectionHops[0], // At the moment this list must be of length 1. In the future multi-hop channels may be supported. }, CounterpartyVersion: counterpartyVersion, @@ -104,7 +104,7 @@ func (i IBCHandler) OnChanOpenTry( err = i.keeper.OnOpenChannel(ctx, contractAddr, msg) if err != nil { - return err + return "", err } // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos // (ie chainA and chainB both call ChanOpenInit before one of them calls ChanOpenTry) @@ -113,10 +113,10 @@ func (i IBCHandler) OnChanOpenTry( if !i.keeper.AuthenticateCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)) { // Only claim channel capability passed back by IBC module if we do not already own it if err := i.keeper.ClaimCapability(ctx, chanCap, host.ChannelCapabilityPath(portID, channelID)); err != nil { - return sdkerrors.Wrap(err, "claim capability") + return "", sdkerrors.Wrap(err, "claim capability") } } - return nil + return counterpartyVersion, nil } // OnChanOpenAck implements the IBCModule interface @@ -124,6 +124,7 @@ func (i IBCHandler) OnChanOpenAck( ctx sdk.Context, portID, channelID string, counterpartyVersion string, + counterpartyChannelID string, ) error { contractAddr, err := ContractFromPortID(portID) if err != nil { @@ -133,6 +134,7 @@ func (i IBCHandler) OnChanOpenAck( if !ok { return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } + channelInfo.Counterparty.ChannelId = counterpartyChannelID msg := wasmvmtypes.IBCChannelConnectMsg{ OpenAck: &wasmvmtypes.IBCOpenAck{ Channel: toWasmVMChannel(portID, channelID, channelInfo), From f5bba58741d7dc7e3f5a02e5e45404519e6613e3 Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 22 Mar 2022 03:47:04 +0700 Subject: [PATCH 03/10] update ChannelKeeper for ibc v3 --- x/wasm/ibc.go | 1 + x/wasm/types/expected_keepers.go | 1 + 2 files changed, 2 insertions(+) diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index e6d93ad646..8d9b87040e 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -135,6 +135,7 @@ func (i IBCHandler) OnChanOpenAck( return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } channelInfo.Counterparty.ChannelId = counterpartyChannelID + i.channelKeeper.SetChannel(ctx, portID, channelID, channelInfo) msg := wasmvmtypes.IBCChannelConnectMsg{ OpenAck: &wasmvmtypes.IBCOpenAck{ Channel: toWasmVMChannel(portID, channelID, channelInfo), diff --git a/x/wasm/types/expected_keepers.go b/x/wasm/types/expected_keepers.go index d902b8cfac..0cdd4d80e0 100644 --- a/x/wasm/types/expected_keepers.go +++ b/x/wasm/types/expected_keepers.go @@ -75,6 +75,7 @@ type ChannelKeeper interface { ChanCloseInit(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error GetAllChannels(ctx sdk.Context) (channels []channeltypes.IdentifiedChannel) IterateChannels(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) + SetChannel(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) } // ClientKeeper defines the expected IBC client keeper From f79a46b396cd9ae5ab3e78df657cf0ccafdb376a Mon Sep 17 00:00:00 2001 From: vuong Date: Tue, 22 Mar 2022 03:47:58 +0700 Subject: [PATCH 04/10] update test --- x/wasm/keeper/test_common.go | 1 + x/wasm/keeper/wasmtesting/mock_keepers.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index ed5bec8ebd..fec6581806 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -118,6 +118,7 @@ var TestingStakeParams = stakingtypes.Params{ MaxEntries: 10, HistoricalEntries: 10, BondDenom: "stake", + MinCommissionRate: sdk.NewDec(0), } type TestFaucet struct { diff --git a/x/wasm/keeper/wasmtesting/mock_keepers.go b/x/wasm/keeper/wasmtesting/mock_keepers.go index 4a3f72603d..4295b24ef0 100644 --- a/x/wasm/keeper/wasmtesting/mock_keepers.go +++ b/x/wasm/keeper/wasmtesting/mock_keepers.go @@ -16,6 +16,7 @@ type MockChannelKeeper struct { ChanCloseInitFn func(ctx sdk.Context, portID, channelID string, chanCap *capabilitytypes.Capability) error GetAllChannelsFn func(ctx sdk.Context) []channeltypes.IdentifiedChannel IterateChannelsFn func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) + SetChannelFn func(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) } func (m *MockChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) { @@ -60,6 +61,13 @@ func (m *MockChannelKeeper) IterateChannels(ctx sdk.Context, cb func(channeltype m.IterateChannelsFn(ctx, cb) } +func (m *MockChannelKeeper) SetChannel(ctx sdk.Context, portID, channelID string, channel channeltypes.Channel) { + if m.GetChannelFn == nil { + panic("not supposed to be called!") + } + m.SetChannelFn(ctx, portID, channelID, channel) +} + func MockChannelKeeperIterator(s []channeltypes.IdentifiedChannel) func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) { return func(ctx sdk.Context, cb func(channeltypes.IdentifiedChannel) bool) { for _, channel := range s { From 5c82f4edd0ca904cf95939e878e546f8fbd5ef16 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 17:20:45 +0200 Subject: [PATCH 05/10] Fixups --- app/ante.go | 6 ++-- app/app.go | 68 ++++++++++++++++++++++-------------- x/wasm/keeper/test_common.go | 1 - 3 files changed, 44 insertions(+), 31 deletions(-) diff --git a/app/ante.go b/app/ante.go index f5c4796e93..5928b46747 100644 --- a/app/ante.go +++ b/app/ante.go @@ -4,8 +4,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - channelkeeper "github.com/cosmos/ibc-go/v3/modules/core/04-channel/keeper" ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" + "github.com/cosmos/ibc-go/v3/modules/core/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -16,7 +16,7 @@ import ( type HandlerOptions struct { ante.HandlerOptions - IBCChannelkeeper channelkeeper.Keeper + IBCKeeper *keeper.Keeper WasmConfig *wasmTypes.WasmConfig TXCounterStoreKey sdk.StoreKey } @@ -62,6 +62,6 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { ante.NewIncrementSequenceDecorator(options.AccountKeeper), ibcante.NewAnteDecorator(options.IBCKeeper), } - + return sdk.ChainAnteDecorators(anteDecorators...), nil } diff --git a/app/app.go b/app/app.go index 79d6dcd0dd..e179f89efa 100644 --- a/app/app.go +++ b/app/app.go @@ -20,7 +20,6 @@ import ( "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest" @@ -240,10 +239,12 @@ type WasmApp struct { paramsKeeper paramskeeper.Keeper ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly evidenceKeeper evidencekeeper.Keeper - transferKeeper ibctransferkeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - AuthzKeeper authzkeeper.Keeper - wasmKeeper wasm.Keeper + // icaControllerKeeper icacontrollerkeeper.Keeper + // icaHostKeeper icahostkeeper.Keeper + transferKeeper ibctransferkeeper.Keeper + feeGrantKeeper feegrantkeeper.Keeper + authzKeeper authzkeeper.Keeper + wasmKeeper wasm.Keeper scopedIBCKeeper capabilitykeeper.ScopedKeeper scopedTransferKeeper capabilitykeeper.ScopedKeeper @@ -280,7 +281,6 @@ func NewWasmApp( bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) - bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) keys := sdk.NewKVStoreKeys( @@ -340,12 +340,12 @@ func NewWasmApp( app.getSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), ) - app.AuthzKeeper = authzkeeper.NewKeeper( + app.authzKeeper = authzkeeper.NewKeeper( keys[authzkeeper.StoreKey], appCodec, app.BaseApp.MsgServiceRouter(), ) - app.FeeGrantKeeper = feegrantkeeper.NewKeeper( + app.feeGrantKeeper = feegrantkeeper.NewKeeper( appCodec, keys[feegrant.StoreKey], app.accountKeeper, @@ -434,23 +434,38 @@ func NewWasmApp( transferModule := transfer.NewAppModule(app.transferKeeper) - icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) + // TODO: enable ICA something like this - // initialize ICA module with mock module as the authentication module on the controller side - icaAuthModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp("", scopedICAMockKeeper)) - app.ICAAuthModule = icaAuthModule + // icaModule := ica.NewAppModule(&app.icaControllerKeeper, &app.icaHostKeeper) - icaControllerIBCModule := icacontroller.NewIBCModule(app.ICAControllerKeeper, icaAuthModule) - icaHostIBCModule := icahost.NewIBCModule(app.ICAHostKeeper) + // // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do + // // not replicate if you do not need to test core IBC or light clients. + // mockModule := ibcmock.NewAppModule(&app.ibcKeeper.PortKeeper) + // mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) + + // app.icaControllerKeeper = icacontrollerkeeper.NewKeeper( + // appCodec, keys[icacontrollertypes.StoreKey], app.getSubspace(icacontrollertypes.SubModuleName), + // app.ibcKeeper.ChannelKeeper, // may be replaced with middleware such as ics29 fee + // app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper, + // scopedicaControllerKeeper, app.MsgServiceRouter(), + // ) + + // // initialize ICA module with mock module as the authentication module on the controller side + // icaAuthModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewMockIBCApp("", scopedICAMockKeeper)) + // app.icaAuthModule = icaAuthModule + + // icaControllerIBCModule := icacontroller.NewIBCModule(app.icaControllerKeeper, icaAuthModule) + // icaHostIBCModule := icahost.NewIBCModule(app.icaHostKeeper) // Create static IBC router, add app routes, then set and seal it ibcRouter := porttypes.NewRouter() - ibcRouter.AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). - AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) - AddRoute(ibctransfertypes.ModuleName, transferIBCModule). - AddRoute(ibcmock.ModuleName, mockIBCModule) - app.IBCKeeper.SetRouter(ibcRouter) + ibcRouter. + // AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + // AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). + // AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) + AddRoute(ibctransfertypes.ModuleName, transferModule). + // AddRoute(ibcmock.ModuleName, mockIBCModule) + app.ibcKeeper.SetRouter(ibcRouter) // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( @@ -533,8 +548,8 @@ func NewWasmApp( upgrade.NewAppModule(app.upgradeKeeper), wasm.NewAppModule(appCodec, &app.wasmKeeper, app.stakingKeeper, app.accountKeeper, app.bankKeeper), evidence.NewAppModule(app.evidenceKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), + feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), ibc.NewAppModule(app.ibcKeeper), params.NewAppModule(app.paramsKeeper), transferModule, @@ -639,8 +654,8 @@ func NewWasmApp( auth.NewAppModule(appCodec, app.accountKeeper, authsims.RandomGenesisAccounts), bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper), capability.NewAppModule(appCodec, *app.capabilityKeeper), - feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), + feegrantmodule.NewAppModule(appCodec, app.accountKeeper, app.bankKeeper, app.feeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry), gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper), mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper), staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper), @@ -654,7 +669,6 @@ func NewWasmApp( ) app.sm.RegisterStoreDecoders() - // initialize stores app.MountKVStores(keys) app.MountTransientStores(tkeys) @@ -665,11 +679,11 @@ func NewWasmApp( HandlerOptions: ante.HandlerOptions{ AccountKeeper: app.accountKeeper, BankKeeper: app.bankKeeper, - FeegrantKeeper: app.FeeGrantKeeper, + FeegrantKeeper: app.feeGrantKeeper, SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), SigGasConsumer: ante.DefaultSigVerificationGasConsumer, }, - IBCChannelkeeper: app.ibcKeeper.ChannelKeeper, + IBCKeeper: app.ibcKeeper, WasmConfig: &wasmConfig, TXCounterStoreKey: keys[wasm.StoreKey], }, diff --git a/x/wasm/keeper/test_common.go b/x/wasm/keeper/test_common.go index fec6581806..ed5bec8ebd 100644 --- a/x/wasm/keeper/test_common.go +++ b/x/wasm/keeper/test_common.go @@ -118,7 +118,6 @@ var TestingStakeParams = stakingtypes.Params{ MaxEntries: 10, HistoricalEntries: 10, BondDenom: "stake", - MinCommissionRate: sdk.NewDec(0), } type TestFaucet struct { From bd68315e7a1bac8a77b1dedca4c909f30ed03cd5 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 17:42:26 +0200 Subject: [PATCH 06/10] Code compiles, but ibc transfer disabled --- app/app.go | 26 +++++++++++++++----------- x/wasm/ibctesting/endpoint.go | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/app.go b/app/app.go index e179f89efa..66a45d13a8 100644 --- a/app/app.go +++ b/app/app.go @@ -425,6 +425,7 @@ func NewWasmApp( appCodec, keys[ibctransfertypes.StoreKey], app.getSubspace(ibctransfertypes.ModuleName), + nil, // TODO: need "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types".ICS4Wrapper app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper, app.accountKeeper, @@ -457,16 +458,6 @@ func NewWasmApp( // icaControllerIBCModule := icacontroller.NewIBCModule(app.icaControllerKeeper, icaAuthModule) // icaHostIBCModule := icahost.NewIBCModule(app.icaHostKeeper) - // Create static IBC router, add app routes, then set and seal it - ibcRouter := porttypes.NewRouter() - ibcRouter. - // AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). - // AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). - // AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) - AddRoute(ibctransfertypes.ModuleName, transferModule). - // AddRoute(ibcmock.ModuleName, mockIBCModule) - app.ibcKeeper.SetRouter(ibcRouter) - // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( appCodec, @@ -505,11 +496,24 @@ func NewWasmApp( wasmOpts..., ) + // Create static IBC router, add app routes, then set and seal it + ibcRouter := porttypes.NewRouter() + // The gov proposal types can be individually enabled if len(enabledProposals) != 0 { govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, enabledProposals)) } - ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) + ibcRouter. + AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) + // TODO: why does this fail??? + // AddRoute(ibctransfertypes.ModuleName, transferModule) + + // FIXME: these are for ICA later + // AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). + // AddRoute(icahosttypes.SubModuleName, icaHostIBCModule). + // AddRoute(ibcmock.ModuleName+icacontrollertypes.SubModuleName, icaControllerIBCModule). // ica with mock auth module stack route to ica (top level of middleware stack) + // AddRoute(ibcmock.ModuleName, mockIBCModule) + app.ibcKeeper.SetRouter(ibcRouter) app.govKeeper = govkeeper.NewKeeper( diff --git a/x/wasm/ibctesting/endpoint.go b/x/wasm/ibctesting/endpoint.go index ba7f28c981..722013daa1 100644 --- a/x/wasm/ibctesting/endpoint.go +++ b/x/wasm/ibctesting/endpoint.go @@ -418,7 +418,7 @@ func (endpoint *Endpoint) WriteAcknowledgement(ack exported.Acknowledgement, pac channelCap := endpoint.Chain.GetChannelCapability(packet.GetDestPort(), packet.GetDestChannel()) // no need to send message, acting as a handler - err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack.Acknowledgement()) + err := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.WriteAcknowledgement(endpoint.Chain.GetContext(), channelCap, packet, ack) if err != nil { return err } From cd2e949cfaa464a13796e76f13a967e02680b77c Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 19:43:32 +0200 Subject: [PATCH 07/10] Proper wiring of ibc transfer module --- app/app.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index 66a45d13a8..4a7b1a964c 100644 --- a/app/app.go +++ b/app/app.go @@ -425,7 +425,7 @@ func NewWasmApp( appCodec, keys[ibctransfertypes.StoreKey], app.getSubspace(ibctransfertypes.ModuleName), - nil, // TODO: need "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types".ICS4Wrapper + app.ibcKeeper.ChannelKeeper, app.ibcKeeper.ChannelKeeper, &app.ibcKeeper.PortKeeper, app.accountKeeper, @@ -434,6 +434,7 @@ func NewWasmApp( ) transferModule := transfer.NewAppModule(app.transferKeeper) + transferIBCModule := transfer.NewIBCModule(app.transferKeeper) // TODO: enable ICA something like this @@ -504,9 +505,8 @@ func NewWasmApp( govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.wasmKeeper, enabledProposals)) } ibcRouter. - AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)) - // TODO: why does this fail??? - // AddRoute(ibctransfertypes.ModuleName, transferModule) + AddRoute(wasm.ModuleName, wasm.NewIBCHandler(app.wasmKeeper, app.ibcKeeper.ChannelKeeper)). + AddRoute(ibctransfertypes.ModuleName, transferIBCModule) // FIXME: these are for ICA later // AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). From b4c36e4d7a8ca6ad8d43fe040e1ac8f6e069e0a2 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 20:41:54 +0200 Subject: [PATCH 08/10] Fix reflect test --- app/app.go | 2 ++ x/wasm/ibc.go | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 4a7b1a964c..f9c17824ca 100644 --- a/app/app.go +++ b/app/app.go @@ -202,6 +202,8 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + // TODO: ICA + // icatypes.ModuleName: nil, wasm.ModuleName: {authtypes.Burner}, } ) diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index 8d9b87040e..ebf7b9d7c3 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -53,8 +53,9 @@ func (i IBCHandler) OnChanOpenInit( Endpoint: wasmvmtypes.IBCEndpoint{PortID: portID, ChannelID: channelID}, CounterpartyEndpoint: wasmvmtypes.IBCEndpoint{PortID: counterParty.PortId, ChannelID: counterParty.ChannelId}, Order: order.String(), - Version: version, - ConnectionID: connectionHops[0], // At the moment this list must be of length 1. In the future multi-hop channels may be supported. + // DESIGN V3: this may be "" ?? + Version: version, + ConnectionID: connectionHops[0], // At the moment this list must be of length 1. In the future multi-hop channels may be supported. }, }, } @@ -102,6 +103,7 @@ func (i IBCHandler) OnChanOpenTry( }, } + // DESIGN V3: Allow contracts to return a version (or default to counterpartyVersion if unset) err = i.keeper.OnOpenChannel(ctx, contractAddr, msg) if err != nil { return "", err @@ -123,8 +125,8 @@ func (i IBCHandler) OnChanOpenTry( func (i IBCHandler) OnChanOpenAck( ctx sdk.Context, portID, channelID string, - counterpartyVersion string, counterpartyChannelID string, + counterpartyVersion string, ) error { contractAddr, err := ContractFromPortID(portID) if err != nil { From b6a796313c5213edcb6566782611f0877cf5034e Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Thu, 28 Apr 2022 20:46:53 +0200 Subject: [PATCH 09/10] go fmt for the linter --- app/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index f9c17824ca..8178caef1d 100644 --- a/app/app.go +++ b/app/app.go @@ -204,7 +204,7 @@ var ( ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // TODO: ICA // icatypes.ModuleName: nil, - wasm.ModuleName: {authtypes.Burner}, + wasm.ModuleName: {authtypes.Burner}, } ) From 7704459ad8b59dbbebe2908891cf7e677a9a6989 Mon Sep 17 00:00:00 2001 From: Ethan Frey Date: Wed, 4 May 2022 10:42:38 +0200 Subject: [PATCH 10/10] Add comments --- x/wasm/ibc.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x/wasm/ibc.go b/x/wasm/ibc.go index ebf7b9d7c3..6c138e9ab8 100644 --- a/x/wasm/ibc.go +++ b/x/wasm/ibc.go @@ -118,6 +118,9 @@ func (i IBCHandler) OnChanOpenTry( return "", sdkerrors.Wrap(err, "claim capability") } } + + // In the future, we can negotiate (see design comment above), but for now, we only error if we disagee + // with the proposed version return counterpartyVersion, nil } @@ -137,6 +140,11 @@ func (i IBCHandler) OnChanOpenAck( return sdkerrors.Wrapf(channeltypes.ErrChannelNotFound, "port ID (%s) channel ID (%s)", portID, channelID) } channelInfo.Counterparty.ChannelId = counterpartyChannelID + // This is a bit ugly, but it is set AFTER the callback is done, yet we want to provide the contract + // access to the channel in queries. We can revisit how to better integrate with ibc-go in the future, + // but this is the best/safest we can do now. (If you remove this, you error when sending a packet during the + // OnChanOpenAck entry point) + // https://github.com/cosmos/ibc-go/pull/647/files#diff-54b5be375a2333c56f2ae1b5b4dc13ac9c734561e30286505f39837ee75762c7R25 i.channelKeeper.SetChannel(ctx, portID, channelID, channelInfo) msg := wasmvmtypes.IBCChannelConnectMsg{ OpenAck: &wasmvmtypes.IBCOpenAck{