Skip to content

Commit

Permalink
need found senquence
Browse files Browse the repository at this point in the history
  • Loading branch information
vuong177 committed Dec 14, 2022
1 parent 4cdc407 commit c943ccb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion x/wasm/ibc_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func TestOnChanOpenInitVersion(t *testing.T) {
const startVersion = "v1"
const startVersion = "v2"
specs := map[string]struct {
contractRsp *wasmvmtypes.IBC3ChannelOpenResponse
expVersion string
Expand Down
7 changes: 7 additions & 0 deletions x/wasm/keeper/handler_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ func (h IBCRawPacketHandler) DispatchMsg(ctx sdk.Context, _ sdk.AccAddress, cont
return nil, nil, sdkerrors.Wrapf(types.ErrEmpty, "ibc channel")
}

_, found := h.channelKeeper.GetNextSequenceSend(ctx, contractIBCPortID, contractIBCChannelID)
if !found {
return nil, nil, sdkerrors.Wrapf(channeltypes.ErrSequenceSendNotFound,
"source port: %s, source channel: %s", contractIBCPortID, contractIBCChannelID,
)
}

channelCap, ok := h.capabilityKeeper.GetCapability(ctx, host.ChannelCapabilityPath(contractIBCPortID, contractIBCChannelID))
if !ok {
return nil, nil, sdkerrors.Wrap(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability")
Expand Down
8 changes: 8 additions & 0 deletions x/wasm/keeper/handler_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ func TestIBCRawPacketHandler(t *testing.T) {
SourceChannel: sourceChannel,
TimeoutHeight: timeoutHeight,
TimeoutTimestamp: timeoutTimestamp,
Data: data,
}
return 1, nil
},
Expand Down Expand Up @@ -292,6 +293,13 @@ func TestIBCRawPacketHandler(t *testing.T) {
return 0, false
},
},

capKeeper: wasmtesting.MockCapabilityKeeper{
GetCapabilityFn: func(ctx sdk.Context, name string) (*capabilitytypes.Capability, bool) {
return nil, false
},
},

expErr: channeltypes.ErrSequenceSendNotFound,
},
"capability not found returns error": {
Expand Down

0 comments on commit c943ccb

Please sign in to comment.