Skip to content

Commit

Permalink
Deactivate ics29 middleware for wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
alpe committed Nov 21, 2022
1 parent 2ce07c9 commit 1625b3a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
5 changes: 3 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,10 @@ func NewWasmApp(
icaHostStack = ibcfee.NewIBCMiddleware(icaHostStack, app.IBCFeeKeeper)

// Create fee enabled wasm ibc Stack
var wasmStack porttypes.IBCModule
var wasmStack porttypes.IBCModule //nolint:gosimple
wasmStack = wasm.NewIBCHandler(app.WasmKeeper, app.IBCKeeper.ChannelKeeper)
wasmStack = ibcfee.NewIBCMiddleware(wasmStack, app.IBCFeeKeeper)
// Note: IBC29 fee middleware is currently not supported due to version decoding issues in wasm/ibc.go
// wasmStack = ibcfee.NewIBCMiddleware(wasmStack, app.IBCFeeKeeper)

// Create static IBC router, add app routes, then set and seal it
ibcRouter := porttypes.NewRouter().
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/ibc_fees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func TestIBCFeesTransfer(t *testing.T) {
}

func TestIBCFeesWasm(t *testing.T) {
t.Skip("Deactivated until ibc middleware is setup for wasm")
// scenario:
// given 2 chains with cw20-ibc on chain A and native ics20 module on B
// and an ibc channel established
Expand Down
12 changes: 1 addition & 11 deletions x/wasm/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ package wasm

import (
"math"
"strings"

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"
ibcfees "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
channeltypes "github.com/cosmos/ibc-go/v4/modules/core/04-channel/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
host "github.com/cosmos/ibc-go/v4/modules/core/24-host"
Expand Down Expand Up @@ -230,19 +228,11 @@ func (i IBCHandler) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string
}

func toWasmVMChannel(portID, channelID string, channelInfo channeltypes.Channel) wasmvmtypes.IBCChannel {
version := channelInfo.Version
if strings.TrimSpace(version) != "" {
// check for ics-29 middleware versions
var versionMetadata ibcfees.Metadata
if err := types.ModuleCdc.UnmarshalJSON([]byte(channelInfo.Version), &versionMetadata); err == nil {
version = versionMetadata.AppVersion
}
}
return wasmvmtypes.IBCChannel{
Endpoint: wasmvmtypes.IBCEndpoint{PortID: portID, ChannelID: channelID},
CounterpartyEndpoint: wasmvmtypes.IBCEndpoint{PortID: channelInfo.Counterparty.PortId, ChannelID: channelInfo.Counterparty.ChannelId},
Order: channelInfo.Ordering.String(),
Version: version,
Version: channelInfo.Version, // this is the raw version and will cause issues when overloaded in ibc middleware
ConnectionID: channelInfo.ConnectionHops[0], // At the moment this list must be of length 1. In the future multi-hop channels may be supported.
}
}
Expand Down

0 comments on commit 1625b3a

Please sign in to comment.