diff --git a/module/.golangci.yml b/module/.golangci.yml index 230cb21c7..b25c7790c 100644 --- a/module/.golangci.yml +++ b/module/.golangci.yml @@ -1,8 +1,6 @@ linters: enable: - bodyclose - - deadcode - - depguard - dogsled - dupl - goconst @@ -13,14 +11,10 @@ linters: - govet - ineffassign - staticcheck - - structcheck - typecheck - unused - - varcheck - exhaustruct - errcheck - # - gosec - # - goimports linters-settings: govet: diff --git a/module/app/ante/ante.go b/module/app/ante/ante.go index 1818bcbf2..5c754cf72 100644 --- a/module/app/ante/ante.go +++ b/module/app/ante/ante.go @@ -9,8 +9,8 @@ import ( authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante" + ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" ) // NewAnteHandler Constructs a new sdk.AnteHandler for the Gravity app. diff --git a/module/app/app.go b/module/app/app.go index c5b1700ee..eb04e656d 100644 --- a/module/app/app.go +++ b/module/app/app.go @@ -86,16 +86,16 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" // Cosmos IBC-Go - 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" + transfer "github.com/cosmos/ibc-go/v4/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v4/modules/core" + ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client" + ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client" + ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" + 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" // Osmosis-Labs Bech32-IBC "github.com/althea-net/bech32-ibc/x/bech32ibc" diff --git a/module/app/sim_test.go b/module/app/sim_test.go index ecd497d21..53786c631 100644 --- a/module/app/sim_test.go +++ b/module/app/sim_test.go @@ -29,8 +29,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/v3/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" ) func init() { diff --git a/module/app/upgrades/polaris/handler.go b/module/app/upgrades/polaris/handler.go index b7da0212d..aa539d7fc 100644 --- a/module/app/upgrades/polaris/handler.go +++ b/module/app/upgrades/polaris/handler.go @@ -5,8 +5,8 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" ) func GetPolarisUpgradeHandler( diff --git a/module/app/upgrades/register.go b/module/app/upgrades/register.go index f8033e8e3..1ba4aebef 100644 --- a/module/app/upgrades/register.go +++ b/module/app/upgrades/register.go @@ -11,7 +11,7 @@ import ( mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" "github.com/Gravity-Bridge/Gravity-Bridge/module/app/upgrades/orion" "github.com/Gravity-Bridge/Gravity-Bridge/module/app/upgrades/singlestep" diff --git a/module/cmd/gravity/cmd/migrate.go b/module/cmd/gravity/cmd/migrate.go index d55de396c..434493c52 100644 --- a/module/cmd/gravity/cmd/migrate.go +++ b/module/cmd/gravity/cmd/migrate.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - v100 "github.com/cosmos/ibc-go/v3/modules/core/legacy/v100" + v100 "github.com/cosmos/ibc-go/v4/modules/core/legacy/v100" tmtypes "github.com/tendermint/tendermint/types" "github.com/pkg/errors" diff --git a/module/go.mod b/module/go.mod index 12769a13e..21e56c8f0 100644 --- a/module/go.mod +++ b/module/go.mod @@ -3,14 +3,29 @@ module github.com/Gravity-Bridge/Gravity-Bridge/module go 1.19 require ( - github.com/cosmos/cosmos-sdk v0.45.15 - github.com/cosmos/ibc-go/v3 v3.4.0 + github.com/althea-net/bech32-ibc v0.4.5 + github.com/cosmos/cosmos-sdk v0.45.16 + github.com/cosmos/ibc-go/v4 v4.3.1 + github.com/evmos/ethermint v0.19.5 // Replaced +) + +replace ( + // Lock us into the v0.45 line + github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.16 + + // Althea-net fork removes ibc-go v3 dep, tendermint->cometbft issue + github.com/evmos/ethermint => github.com/althea-net/ethermint v0.19.5 + + github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + + github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27 + + google.golang.org/grpc => google.golang.org/grpc v1.33.2 ) require ( - github.com/althea-net/bech32-ibc v0.4.2 + github.com/cosmos/ibc-go/v3 v3.4.0 github.com/ethereum/go-ethereum v1.10.19 - github.com/evmos/ethermint v0.19.3 github.com/gogo/protobuf v1.3.3 github.com/golang/protobuf v1.5.2 github.com/gorilla/mux v1.8.0 @@ -113,7 +128,7 @@ require ( github.com/klauspost/compress v1.15.11 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect - github.com/lib/pq v1.10.6 // indirect + github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/linxGnu/grocksdb v1.7.10 // indirect github.com/magiconair/properties v1.8.6 // indirect @@ -170,17 +185,3 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect nhooyr.io/websocket v1.8.6 // indirect ) - -replace ( - // Lock us into the v0.45 line - github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.45.15 - - // Lock us into ethermint v0.19 - github.com/evmos/ethermint => github.com/evmos/ethermint v0.19.3 - - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - - github.com/tendermint/tendermint => github.com/cometbft/cometbft v0.34.27 - - google.golang.org/grpc => google.golang.org/grpc v1.33.2 -) diff --git a/module/go.sum b/module/go.sum index 5c8bf8529..b1ce5a96d 100644 --- a/module/go.sum +++ b/module/go.sum @@ -106,8 +106,10 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/althea-net/bech32-ibc v0.4.2 h1:ilIgAbCmw8RBPrysBvLEI93oXFtdKzAul3LuCu9WUJo= -github.com/althea-net/bech32-ibc v0.4.2/go.mod h1:QLv8oeJYempEl67DioKxIdtcIR9lsTsvmePyBZxGZLE= +github.com/althea-net/bech32-ibc v0.4.5 h1:eSa/SXETkXPCZJGCkAVj/shKtHnPCs3dHFBx3XzU+G4= +github.com/althea-net/bech32-ibc v0.4.5/go.mod h1:K6tei/HzcT93nj910sM1dlFSl2cRucf/WCMkLERvmqE= +github.com/althea-net/ethermint v0.19.5 h1:w2s8tIGL4z+XzQKK+NbQ69txzRA7xfqlXmKHUptKWBM= +github.com/althea-net/ethermint v0.19.5/go.mod h1:D1Jfhqtrb0q12IQLLB6w0jfjcSl/EMRCR3VKJVVPXSM= github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= @@ -238,8 +240,8 @@ github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32 h1:zlCp9n3uwQieEL github.com/cosmos/cosmos-db v0.0.0-20221226095112-f3c38ecb5e32/go.mod h1:kwMlEC4wWvB48zAShGKVqboJL6w4zCLesaNQ3YLU2BQ= github.com/cosmos/cosmos-proto v1.0.0-beta.1 h1:iDL5qh++NoXxG8hSy93FdYJut4XfgbShIocllGaXx/0= github.com/cosmos/cosmos-proto v1.0.0-beta.1/go.mod h1:8k2GNZghi5sDRFw/scPL8gMSowT1vDA+5ouxL8GjaUE= -github.com/cosmos/cosmos-sdk v0.45.15 h1:yyLZ9PylnR1DADf9FYGxnn8t3+Y5K2mMUXNUN38MI5A= -github.com/cosmos/cosmos-sdk v0.45.15/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40= +github.com/cosmos/cosmos-sdk v0.45.16 h1:5ba/Bh5/LE55IwHQuCU4fiG4eXeDKtSWzehXRpaKDcw= +github.com/cosmos/cosmos-sdk v0.45.16/go.mod h1:bScuNwWAP0TZJpUf+SHXRU3xGoUPp+X9nAzfeIXts40= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= @@ -249,6 +251,8 @@ github.com/cosmos/iavl v0.19.5 h1:rGA3hOrgNxgRM5wYcSCxgQBap7fW82WZgY78V9po/iY= github.com/cosmos/iavl v0.19.5/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= github.com/cosmos/ibc-go/v3 v3.4.0 h1:ha3cqEG36pqMWqA1D+kxDWBTZXpeFMd/aZIQF7I0xro= github.com/cosmos/ibc-go/v3 v3.4.0/go.mod h1:VwB/vWu4ysT5DN2aF78d17LYmx3omSAdq6gpKvM7XRA= +github.com/cosmos/ibc-go/v4 v4.3.1 h1:xbg0CaCdxK3lvgGvSaI91ROOLd7s30UqEcexH6Ba4Ys= +github.com/cosmos/ibc-go/v4 v4.3.1/go.mod h1:89E+K9CxpkS/etLEcG026jPM/RSnVMcfesvRYp/0aKI= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= @@ -319,8 +323,6 @@ github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHj github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/ethereum/go-ethereum v1.10.19 h1:EOR5JbL4MD5yeOqv8W2iC1s4NximrTjqFccUz8lyBRA= github.com/ethereum/go-ethereum v1.10.19/go.mod h1:IJBNMtzKcNHPtllYihy6BL2IgK1u+32JriaTbdt4v+w= -github.com/evmos/ethermint v0.19.3 h1:Tc2tIiEK9b+rp1a0aWfzzggRDgecLa8gOHyXT3tH/1A= -github.com/evmos/ethermint v0.19.3/go.mod h1:2A25AF6mes32UL6j+r0wT0FnbzN7tzGYp2URxy+ZNmY= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= @@ -686,8 +688,8 @@ github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2 github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= +github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= @@ -795,8 +797,8 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= -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/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY= 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= diff --git a/module/x/gravity/handler_test.go b/module/x/gravity/handler_test.go index b12755bea..a14bea20b 100644 --- a/module/x/gravity/handler_test.go +++ b/module/x/gravity/handler_test.go @@ -12,7 +12,7 @@ import ( "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/keeper" "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/types" sdk "github.com/cosmos/cosmos-sdk/types" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/module/x/gravity/ibc_middleware.go b/module/x/gravity/ibc_middleware.go index bceeff2e4..220efb0b6 100644 --- a/module/x/gravity/ibc_middleware.go +++ b/module/x/gravity/ibc_middleware.go @@ -4,9 +4,9 @@ import ( "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/keeper" sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" - "github.com/cosmos/ibc-go/v3/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" + "github.com/cosmos/ibc-go/v4/modules/core/exported" ) var _ porttypes.Middleware = &IBCMiddleware{} @@ -26,6 +26,14 @@ func NewIBCMiddleware(app porttypes.IBCModule, k keeper.Keeper) IBCMiddleware { } } +func (im IBCMiddleware) GetAppVersion( + ctx sdk.Context, + portID, + channelID string, +) (string, bool) { + return im.keeper.GetAppVersion(ctx, portID, channelID) +} + // OnRecvPacket implements the IBCModule interface. // If fees are not enabled, this callback will default to the ibc-core packet callback. func (im IBCMiddleware) OnRecvPacket( @@ -92,7 +100,7 @@ func (im IBCMiddleware) OnChanOpenInit( chanCap *capabilitytypes.Capability, counterparty channeltypes.Counterparty, version string, -) error { +) (string, error) { return im.app.OnChanOpenInit(ctx, order, connectionHops, portID, channelID, chanCap, counterparty, version) diff --git a/module/x/gravity/keeper/ibc_auto_forward.go b/module/x/gravity/keeper/ibc_auto_forward.go index bdbde7fcd..0fff1b3a1 100644 --- a/module/x/gravity/keeper/ibc_auto_forward.go +++ b/module/x/gravity/keeper/ibc_auto_forward.go @@ -18,8 +18,8 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" ) // ValidatePendingIbcAutoForward performs basic validation, asserts the nonce is not ahead of what gravity is aware of, diff --git a/module/x/gravity/keeper/ibc_callback.go b/module/x/gravity/keeper/ibc_callback.go index c8d7ec759..963becb5a 100644 --- a/module/x/gravity/keeper/ibc_callback.go +++ b/module/x/gravity/keeper/ibc_callback.go @@ -9,10 +9,10 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v3/modules/core/exported" + ibcexported "github.com/cosmos/ibc-go/v4/modules/core/exported" ) // IsModuleAccount returns true if the given account is a module account @@ -102,7 +102,7 @@ func (k Keeper) OnRecvPacket( // Receiver become sender when send evm_prefix + contract_address token to evm sender, err := sdk.AccAddressFromBech32(data.Receiver) if err != nil { - return channeltypes.NewErrorAcknowledgement(err.Error()) + return channeltypes.NewErrorAcknowledgement(err) } senderAcc := k.accountKeeper.GetAccount(ctx, sender) @@ -121,15 +121,15 @@ func (k Keeper) OnRecvPacket( dest, err := types.NewEthAddress(ethDest) if err != nil { - return channeltypes.NewErrorAcknowledgement(err.Error()) + return channeltypes.NewErrorAcknowledgement(err) } _, erc20, err := k.DenomToERC20Lookup(ctx, evmChainPrefix, coin.Denom) if err != nil { - return channeltypes.NewErrorAcknowledgement(err.Error()) + return channeltypes.NewErrorAcknowledgement(err) } if k.InvalidSendToEthAddress(ctx, evmChainPrefix, *dest, *erc20) { - return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrap(types.ErrInvalid, "destination address is invalid or blacklisted").Error()) + return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrap(types.ErrInvalid, "destination address is invalid or blacklisted")) } batchFees := sdk.ZeroInt() @@ -142,7 +142,7 @@ func (k Keeper) OnRecvPacket( // finally add to outgoing pool and waiting for gbt to submit it via MsgRequestBatch txID, err := k.AddToOutgoingPool(ctx, evmChainPrefix, sender, *dest, coin, sdk.Coin{Denom: coin.Denom, Amount: batchFees}) if err != nil { - return channeltypes.NewErrorAcknowledgement(err.Error()) + return channeltypes.NewErrorAcknowledgement(err) } ctx.EventManager().EmitTypedEvent( @@ -168,3 +168,8 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, ack ibcexported.Acknowledgement) error { return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) } + +// GetAppVersion calls the ICS4Wrapper GetAppVersion function. +func (k Keeper) GetAppVersion(ctx sdk.Context, portID, channelID string) (string, bool) { + return k.ics4Wrapper.GetAppVersion(ctx, portID, channelID) +} diff --git a/module/x/gravity/keeper/ibc_callback_test.go b/module/x/gravity/keeper/ibc_callback_test.go index 540076f86..23a4ddf7b 100644 --- a/module/x/gravity/keeper/ibc_callback_test.go +++ b/module/x/gravity/keeper/ibc_callback_test.go @@ -8,10 +8,10 @@ import ( "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/types" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "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" - ibcmock "github.com/cosmos/ibc-go/v3/testing/mock" + transfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + clienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types" + ibcmock "github.com/cosmos/ibc-go/v4/testing/mock" "github.com/stretchr/testify/require" ) diff --git a/module/x/gravity/keeper/keeper.go b/module/x/gravity/keeper/keeper.go index fbf98c20a..4c545410c 100644 --- a/module/x/gravity/keeper/keeper.go +++ b/module/x/gravity/keeper/keeper.go @@ -17,14 +17,14 @@ import ( slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" "github.com/tendermint/tendermint/libs/log" bech32ibckeeper "github.com/althea-net/bech32-ibc/x/bech32ibc/keeper" "github.com/Gravity-Bridge/Gravity-Bridge/module/x/gravity/types" "github.com/cosmos/cosmos-sdk/store/prefix" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types" ) // Check that our expected keeper types are implemented diff --git a/module/x/gravity/keeper/test_common.go b/module/x/gravity/keeper/test_common.go index d4bb55df3..e668e0f59 100644 --- a/module/x/gravity/keeper/test_common.go +++ b/module/x/gravity/keeper/test_common.go @@ -62,10 +62,10 @@ import ( tmversion "github.com/tendermint/tendermint/proto/tendermint/version" dbm "github.com/tendermint/tm-db" - ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" - ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host" - ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types" + ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host" + ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper" bech32ibckeeper "github.com/althea-net/bech32-ibc/x/bech32ibc/keeper" bech32ibctypes "github.com/althea-net/bech32-ibc/x/bech32ibc/types"