parent
fea231556a
commit
793c6f17ff
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
||||
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/types"
|
||||
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||
ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types"
|
||||
)
|
||||
|
@ -305,7 +306,7 @@ func (suite *KeeperTestSuite) TestVerifyPacketAcknowledgement() {
|
|||
|
||||
tc.malleate()
|
||||
connection := suite.chainA.createConnection(testConnectionIDA, testConnectionIDB, testClientIDA, testClientIDB, exported.OPEN)
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort1, testChannel1, 1, ack)
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort1, testChannel1, 1, channeltypes.CommitAcknowledgement(ack))
|
||||
suite.chainB.updateClient(suite.chainA)
|
||||
|
||||
// TODO check this proof height
|
||||
|
|
|
@ -241,7 +241,8 @@ func (k Keeper) PacketExecuted(
|
|||
ctx.EventManager().EmitEvents(sdk.Events{
|
||||
sdk.NewEvent(
|
||||
types.EventTypeRecvPacket,
|
||||
sdk.NewAttribute(types.AttributeKeyData, string(acknowledgement)),
|
||||
sdk.NewAttribute(types.AttributeKeyData, string(packet.GetData())),
|
||||
sdk.NewAttribute(types.AttributeKeyAck, string(acknowledgement)),
|
||||
sdk.NewAttribute(types.AttributeKeyTimeout, fmt.Sprintf("%d", packet.GetTimeoutHeight())),
|
||||
sdk.NewAttribute(types.AttributeKeySequence, fmt.Sprintf("%d", packet.GetSequence())),
|
||||
sdk.NewAttribute(types.AttributeKeySrcPort, packet.GetSourcePort()),
|
||||
|
|
|
@ -268,7 +268,7 @@ func (suite *KeeperTestSuite) TestAcknowledgePacket() {
|
|||
suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.ORDERED, testConnectionIDA)
|
||||
suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.ORDERED, testConnectionIDB)
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet))
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, ack)
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, types.CommitAcknowledgement(ack))
|
||||
}, true},
|
||||
{"channel not found", func() {}, false},
|
||||
{"channel not open", func() {
|
||||
|
@ -350,7 +350,7 @@ func (suite *KeeperTestSuite) TestCleanupPacket() {
|
|||
suite.chainB.createChannel(testPort1, testChannel1, testPort2, testChannel2, exported.OPEN, exported.UNORDERED, testConnectionIDA)
|
||||
suite.chainA.createChannel(testPort2, testChannel2, testPort1, testChannel1, exported.OPEN, exported.UNORDERED, testConnectionIDB)
|
||||
suite.chainB.App.IBCKeeper.ChannelKeeper.SetPacketCommitment(suite.chainB.GetContext(), testPort1, testChannel1, 1, types.CommitPacket(packet))
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, ack)
|
||||
suite.chainA.App.IBCKeeper.ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), testPort2, testChannel2, 1, types.CommitAcknowledgement(ack))
|
||||
}, true},
|
||||
{"channel not found", func() {}, false},
|
||||
{"channel not open", func() {
|
||||
|
|
|
@ -21,6 +21,7 @@ const (
|
|||
EventTypeTimeoutPacket = "timeout_packet"
|
||||
|
||||
AttributeKeyData = "packet_data"
|
||||
AttributeKeyAck = "packet_ack"
|
||||
AttributeKeyTimeout = "packet_timeout"
|
||||
AttributeKeySequence = "packet_sequence"
|
||||
AttributeKeySrcPort = "packet_src_port"
|
||||
|
|
|
@ -12,6 +12,7 @@ import (
|
|||
clienttypes "github.com/cosmos/cosmos-sdk/x/ibc/02-client/types"
|
||||
connectionexported "github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
|
||||
channelexported "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
|
||||
channeltypes "github.com/cosmos/cosmos-sdk/x/ibc/04-channel/types"
|
||||
commitmentexported "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/exported"
|
||||
commitmenttypes "github.com/cosmos/cosmos-sdk/x/ibc/23-commitment/types"
|
||||
ibctypes "github.com/cosmos/cosmos-sdk/x/ibc/types"
|
||||
|
@ -250,7 +251,7 @@ func (cs ClientState) VerifyPacketAcknowledgement(
|
|||
return err
|
||||
}
|
||||
|
||||
if err := proof.VerifyMembership(consensusState.GetRoot(), path, acknowledgement); err != nil {
|
||||
if err := proof.VerifyMembership(consensusState.GetRoot(), path, channeltypes.CommitAcknowledgement(acknowledgement)); err != nil {
|
||||
return sdkerrors.Wrap(clienttypes.ErrFailedPacketAckVerification, err.Error())
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ func NewHandler(k Keeper) sdk.Handler {
|
|||
|
||||
case channel.MsgAcknowledgement:
|
||||
// Lookup module by channel capability
|
||||
module, _, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel)
|
||||
module, _, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
||||
if !ok {
|
||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ func NewHandler(k Keeper) sdk.Handler {
|
|||
|
||||
case channel.MsgTimeout:
|
||||
// Lookup module by channel capability
|
||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.DestinationPort, msg.Packet.DestinationChannel)
|
||||
module, cap, ok := k.ChannelKeeper.LookupModuleByChannel(ctx, msg.Packet.SourcePort, msg.Packet.SourceChannel)
|
||||
if !ok {
|
||||
return nil, sdkerrors.Wrap(channel.ErrChannelCapabilityNotFound, "could not retrieve module from channel capability")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue