diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 0eeff647971..164017ca3b2 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -830,6 +830,7 @@ RegisteredRelayerAddress contains the address and counterparty address for a spe | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | | | `counterparty_address` | [string](#string) | | | +| `channel_id` | [string](#string) | | | @@ -1041,6 +1042,7 @@ MsgRegisterCounterpartyAddress is the request type for registering the counterpa | ----- | ---- | ----- | ----------- | | `address` | [string](#string) | | | | `counterparty_address` | [string](#string) | | | +| `channel_id` | [string](#string) | | | diff --git a/modules/apps/29-fee/client/cli/cli.go b/modules/apps/29-fee/client/cli/cli.go index e5ff524dee7..9e18b088dc4 100644 --- a/modules/apps/29-fee/client/cli/cli.go +++ b/modules/apps/29-fee/client/cli/cli.go @@ -25,14 +25,14 @@ func GetQueryCmd() *cobra.Command { func NewTxCmd() *cobra.Command { txCmd := &cobra.Command{ Use: "ibc-fee", - Short: "", // TODO + Short: "Transaction subcommand for IBC relayer incentivization", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } txCmd.AddCommand( - // TODO + NewPayPacketFeeAsyncTxCmd(), ) return txCmd diff --git a/modules/apps/29-fee/client/cli/tx.go b/modules/apps/29-fee/client/cli/tx.go index e8878f3e042..a9f66a71007 100644 --- a/modules/apps/29-fee/client/cli/tx.go +++ b/modules/apps/29-fee/client/cli/tx.go @@ -1,3 +1,99 @@ package cli -// TODO +import ( + "fmt" + "strconv" + "strings" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/version" + "github.com/spf13/cobra" + + "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" +) + +const ( + flagRecvFee = "recv-fee" + flagAckFee = "ack-fee" + flagTimeoutFee = "timeout-fee" +) + +// NewPayPacketFeeAsyncTxCmd returns the command to create a MsgPayPacketFeeAsync +func NewPayPacketFeeAsyncTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "pay-packet-fee [src-port] [src-channel] [sequence]", + Short: "Pay a fee to incentivize an existing IBC packet", + Long: strings.TrimSpace(`Pay a fee to incentivize an existing IBC packet.`), + Example: fmt.Sprintf("%s tx pay-packet-fee transfer channel-0 1 --recv-fee 10stake --ack-fee 10stake --timeout-fee 10stake", version.AppName), + Args: cobra.ExactArgs(3), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + // NOTE: specifying non-nil relayers is currently unsupported + var relayers []string + + sender := clientCtx.GetFromAddress().String() + seq, err := strconv.ParseUint(args[2], 10, 64) + if err != nil { + return err + } + + packetID := channeltypes.NewPacketId(args[1], args[0], seq) + + recvFeeStr, err := cmd.Flags().GetString(flagRecvFee) + if err != nil { + return err + } + + recvFee, err := sdk.ParseCoinsNormalized(recvFeeStr) + if err != nil { + return err + } + + ackFeeStr, err := cmd.Flags().GetString(flagAckFee) + if err != nil { + return err + } + + ackFee, err := sdk.ParseCoinsNormalized(ackFeeStr) + if err != nil { + return err + } + + timeoutFeeStr, err := cmd.Flags().GetString(flagTimeoutFee) + if err != nil { + return err + } + + timeoutFee, err := sdk.ParseCoinsNormalized(timeoutFeeStr) + if err != nil { + return err + } + + fee := types.Fee{ + RecvFee: recvFee, + AckFee: ackFee, + TimeoutFee: timeoutFee, + } + + identifiedPacketFee := types.NewIdentifiedPacketFee(packetID, fee, sender, relayers) + + msg := types.NewMsgPayPacketFeeAsync(identifiedPacketFee) + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + cmd.Flags().String(flagRecvFee, "", "Fee paid to a relayer for relaying a packet receive.") + cmd.Flags().String(flagAckFee, "", "Fee paid to a relayer for relaying a packet acknowledgement.") + cmd.Flags().String(flagTimeoutFee, "", "Fee paid to a relayer for relaying a packet timeout.") + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/modules/apps/29-fee/ibc_module.go b/modules/apps/29-fee/ibc_module.go index 5f24e78442f..a4c3cb5292e 100644 --- a/modules/apps/29-fee/ibc_module.go +++ b/modules/apps/29-fee/ibc_module.go @@ -116,7 +116,7 @@ func (im IBCModule) OnChanOpenAck( } if versionMetadata.FeeVersion != types.Version { - return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty version: %s, got: %s", types.Version, versionMetadata.FeeVersion) + return sdkerrors.Wrapf(types.ErrInvalidVersion, "expected counterparty fee version: %s, got: %s", types.Version, versionMetadata.FeeVersion) } // call underlying app's OnChanOpenAck callback with the counterparty app version. @@ -203,7 +203,7 @@ func (im IBCModule) OnRecvPacket( } // if forwardRelayer is not found we refund recv_fee - forwardRelayer, _ := im.keeper.GetCounterpartyAddress(ctx, relayer.String()) + forwardRelayer, _ := im.keeper.GetCounterpartyAddress(ctx, relayer.String(), packet.GetSourceChannel()) return types.NewIncentivizedAcknowledgement(forwardRelayer, ack.Acknowledgement(), ack.Success()) } diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index ff992a61f1d..8d6ebb8fcc9 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -487,7 +487,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { { "forward address is not found", func() { - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), "") + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), "", suite.path.EndpointB.ChannelID) }, false, true, @@ -514,7 +514,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { cbs, ok := suite.chainB.App.GetIBCKeeper().Router.GetRoute(module) suite.Require().True(ok) - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String()) + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointB.ChannelID) // malleate test case tc.malleate() diff --git a/modules/apps/29-fee/keeper/genesis.go b/modules/apps/29-fee/keeper/genesis.go index 3e998f5b237..5cf26a52ac3 100644 --- a/modules/apps/29-fee/keeper/genesis.go +++ b/modules/apps/29-fee/keeper/genesis.go @@ -12,8 +12,8 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { k.SetFeeInEscrow(ctx, fee) } - for _, addr := range state.RegisteredRelayers { - k.SetCounterpartyAddress(ctx, addr.Address, addr.CounterpartyAddress) + for _, relayer := range state.RegisteredRelayers { + k.SetCounterpartyAddress(ctx, relayer.Address, relayer.CounterpartyAddress, relayer.ChannelId) } for _, forwardAddr := range state.ForwardRelayers { diff --git a/modules/apps/29-fee/keeper/genesis_test.go b/modules/apps/29-fee/keeper/genesis_test.go index 21e9f9d17ff..0b3dcb4bad6 100644 --- a/modules/apps/29-fee/keeper/genesis_test.go +++ b/modules/apps/29-fee/keeper/genesis_test.go @@ -43,6 +43,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { { Address: sender, CounterpartyAddress: counterparty, + ChannelId: ibctesting.FirstChannelID, }, }, } @@ -59,7 +60,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { suite.Require().True(isEnabled) // check relayers - addr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainA.GetContext(), sender) + addr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainA.GetContext(), sender, ibctesting.FirstChannelID) suite.Require().True(found) suite.Require().Equal(genesisState.RegisteredRelayers[0].CounterpartyAddress, addr) } @@ -84,7 +85,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { sender := suite.chainA.SenderAccount.GetAddress().String() counterparty := suite.chainB.SenderAccount.GetAddress().String() // set counterparty address - suite.chainA.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainA.GetContext(), sender, counterparty) + suite.chainA.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainA.GetContext(), sender, counterparty, ibctesting.FirstChannelID) // set forward relayer address suite.chainA.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainA.GetContext(), packetID, sender) diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 2cae8cdce4f..b867d05a2c2 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -135,15 +135,15 @@ func (k Keeper) DisableAllChannels(ctx sdk.Context) { // SetCounterpartyAddress maps the destination chain relayer address to the source relayer address // The receiving chain must store the mapping from: address -> counterpartyAddress for the given channel -func (k Keeper) SetCounterpartyAddress(ctx sdk.Context, address, counterpartyAddress string) { +func (k Keeper) SetCounterpartyAddress(ctx sdk.Context, address, counterpartyAddress, channelID string) { store := ctx.KVStore(k.storeKey) - store.Set(types.KeyRelayerAddress(address), []byte(counterpartyAddress)) + store.Set(types.KeyCounterpartyRelayer(address, channelID), []byte(counterpartyAddress)) } // GetCounterpartyAddress gets the relayer counterparty address given a destination relayer address -func (k Keeper) GetCounterpartyAddress(ctx sdk.Context, address string) (string, bool) { +func (k Keeper) GetCounterpartyAddress(ctx sdk.Context, address, channelID string) (string, bool) { store := ctx.KVStore(k.storeKey) - key := types.KeyRelayerAddress(address) + key := types.KeyCounterpartyRelayer(address, channelID) if !store.Has(key) { return "", false @@ -156,7 +156,7 @@ func (k Keeper) GetCounterpartyAddress(ctx sdk.Context, address string) (string, // GetAllRelayerAddresses returns all registered relayer addresses func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []types.RegisteredRelayerAddress { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, []byte(types.RelayerAddressKeyPrefix)) + iterator := sdk.KVStorePrefixIterator(store, []byte(types.CounterpartyRelayerAddressKeyPrefix)) defer iterator.Close() var registeredAddrArr []types.RegisteredRelayerAddress @@ -166,6 +166,7 @@ func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []types.RegisteredRelaye addr := types.RegisteredRelayerAddress{ Address: keySplit[1], CounterpartyAddress: string(iterator.Value()), + ChannelId: keySplit[2], } registeredAddrArr = append(registeredAddrArr, addr) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 3fbfa96406d..103fad7968c 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -152,12 +152,13 @@ func (suite *KeeperTestSuite) TestGetAllRelayerAddresses() { sender := suite.chainA.SenderAccount.GetAddress().String() counterparty := suite.chainB.SenderAccount.GetAddress().String() - suite.chainA.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainA.GetContext(), sender, counterparty) + suite.chainA.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainA.GetContext(), sender, counterparty, ibctesting.FirstChannelID) expectedAddr := []types.RegisteredRelayerAddress{ { Address: sender, CounterpartyAddress: counterparty, + ChannelId: ibctesting.FirstChannelID, }, } diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index a87962c518b..ef918905c8b 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -18,7 +18,7 @@ func (k Keeper) RegisterCounterpartyAddress(goCtx context.Context, msg *types.Ms ctx := sdk.UnwrapSDKContext(goCtx) k.SetCounterpartyAddress( - ctx, msg.Address, msg.CounterpartyAddress, + ctx, msg.Address, msg.CounterpartyAddress, msg.ChannelId, ) k.Logger(ctx).Info("Registering counterparty address for relayer.", "Address:", msg.Address, "Counterparty Address:", msg.CounterpartyAddress) diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index f541dd3fd36..0a8ad4b7d06 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v3/testing" ) func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { @@ -35,14 +36,14 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { sender = suite.chainA.SenderAccount.GetAddress().String() counterparty = suite.chainB.SenderAccount.GetAddress().String() tc.malleate() - msg := types.NewMsgRegisterCounterpartyAddress(sender, counterparty) + msg := types.NewMsgRegisterCounterpartyAddress(sender, counterparty, ibctesting.FirstChannelID) _, err := suite.chainA.SendMsgs(msg) if tc.expPass { suite.Require().NoError(err) // message committed - counterpartyAddress, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(ctx, suite.chainA.SenderAccount.GetAddress().String()) + counterpartyAddress, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(ctx, suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) suite.Require().Equal(counterparty, counterpartyAddress) } else { suite.Require().Error(err) diff --git a/modules/apps/29-fee/keeper/relay.go b/modules/apps/29-fee/keeper/relay.go index 80eceaaf391..76b410bb09e 100644 --- a/modules/apps/29-fee/keeper/relay.go +++ b/modules/apps/29-fee/keeper/relay.go @@ -33,12 +33,12 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C // it is possible that a relayer has not registered a counterparty address. // if there is no registered counterparty address then write acknowledgement with empty relayer address and refund recv_fee. - forwardRelayer, _ := k.GetCounterpartyAddress(ctx, relayer) - - k.DeleteForwardRelayerAddress(ctx, packetId) + forwardRelayer, _ := k.GetCounterpartyAddress(ctx, relayer, packet.GetSourceChannel()) ack := types.NewIncentivizedAcknowledgement(forwardRelayer, acknowledgement.Acknowledgement(), acknowledgement.Success()) + k.DeleteForwardRelayerAddress(ctx, packetId) + // ics4Wrapper may be core IBC or higher-level middleware return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack) } diff --git a/modules/apps/29-fee/keeper/relay_test.go b/modules/apps/29-fee/keeper/relay_test.go index a1e6c22aa07..4f366b8682a 100644 --- a/modules/apps/29-fee/keeper/relay_test.go +++ b/modules/apps/29-fee/keeper/relay_test.go @@ -15,7 +15,7 @@ func (suite *KeeperTestSuite) TestWriteAcknowledgementAsync() { "success", func() { suite.chainB.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainB.GetContext(), channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, suite.path.EndpointA.ChannelConfig.PortID, 1), suite.chainA.SenderAccount.GetAddress().String()) - suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String()) + suite.chainB.GetSimApp().IBCFeeKeeper.SetCounterpartyAddress(suite.chainB.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) }, true, }, diff --git a/modules/apps/29-fee/transfer_test.go b/modules/apps/29-fee/transfer_test.go index 863b728d45f..a07d841d07c 100644 --- a/modules/apps/29-fee/transfer_test.go +++ b/modules/apps/29-fee/transfer_test.go @@ -46,7 +46,7 @@ func (suite *FeeTestSuite) TestFeeTransfer() { // to differentiate from the chainA.SenderAccount for checking successful relay payouts relayerAddress := suite.chainB.SenderAccount.GetAddress() - msgRegister := types.NewMsgRegisterCounterpartyAddress(suite.chainB.SenderAccount.GetAddress().String(), relayerAddress.String()) + msgRegister := types.NewMsgRegisterCounterpartyAddress(suite.chainB.SenderAccount.GetAddress().String(), relayerAddress.String(), ibctesting.FirstChannelID) _, err = suite.chainB.SendMsgs(msgRegister) suite.Require().NoError(err) // message committed diff --git a/modules/apps/29-fee/types/genesis.pb.go b/modules/apps/29-fee/types/genesis.pb.go index c939c190429..1ae5e9b195d 100644 --- a/modules/apps/29-fee/types/genesis.pb.go +++ b/modules/apps/29-fee/types/genesis.pb.go @@ -150,6 +150,7 @@ func (m *FeeEnabledChannel) GetChannelId() string { type RegisteredRelayerAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` CounterpartyAddress string `protobuf:"bytes,2,opt,name=counterparty_address,json=counterpartyAddress,proto3" json:"counterparty_address,omitempty" yaml:"counterparty_address"` + ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` } func (m *RegisteredRelayerAddress) Reset() { *m = RegisteredRelayerAddress{} } @@ -199,6 +200,13 @@ func (m *RegisteredRelayerAddress) GetCounterpartyAddress() string { return "" } +func (m *RegisteredRelayerAddress) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + // ForwardRelayerAddress contains the forward relayer address and packetId used for async acknowledgements type ForwardRelayerAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` @@ -264,43 +272,44 @@ func init() { } var fileDescriptor_7191992e856dff95 = []byte{ - // 573 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcd, 0x6e, 0xd4, 0x3c, - 0x14, 0x9d, 0xb4, 0x55, 0xfb, 0xd5, 0xfd, 0xd4, 0x1f, 0xb7, 0xa5, 0x51, 0x11, 0x99, 0x62, 0x84, - 0x54, 0x01, 0x4d, 0x34, 0x2d, 0x2c, 0x60, 0xc7, 0x20, 0x8a, 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0x12, 0xdb, 0x68, 0x25, 0xd0, 0xa5, 0xd6, 0xa7, 0xf5, - 0x27, 0xa6, 0x68, 0x27, 0xe2, 0x83, 0x5c, 0x81, 0x28, 0x02, 0xa1, 0x46, 0x7e, 0x0d, 0xd3, 0xb2, - 0xed, 0xc9, 0x35, 0x98, 0x87, 0x22, 0x74, 0x7b, 0x7a, 0xd9, 0xa8, 0x91, 0xaf, 0x16, 0xda, 0x9d, - 0x1b, 0xe7, 0x3f, 0x7c, 0xbc, 0x43, 0xab, 0x45, 0x75, 0xf9, 0xeb, 0x7f, 0x5e, 0x3b, 0xbe, 0x53, - 0x9d, 0x55, 0x39, 0x7e, 0x6e, 0x3d, 0x73, 0xc3, 0x8e, 0xab, 0x47, 0xa4, 0x17, 0x77, 0x6d, 0x73, - 0x34, 0x9b, 0x26, 0xc6, 0x9a, 0x4d, 0xe8, 0x7f, 0x45, 0x8d, 0x79, 0x7d, 0x7e, 0xe9, 0x58, 0x17, - 0x97, 0x8e, 0xf5, 0xeb, 0xd2, 0xb1, 0x7e, 0x5c, 0x39, 0xad, 0x8b, 0x2b, 0xa7, 0xf5, 0xf3, 0xca, - 0x69, 0xbd, 0x7f, 0x92, 0x32, 0x75, 0x36, 0x08, 0xdd, 0x88, 0xf7, 0xbd, 0x88, 0xcb, 0x3e, 0x97, - 0x1e, 0x0b, 0xa3, 0xa3, 0x94, 0x7b, 0xc3, 0x13, 0xaf, 0xcf, 0xe3, 0x41, 0x06, 0xb2, 0x7c, 0x1d, - 0xa4, 0x77, 0xfc, 0xf4, 0xa8, 0x7c, 0x18, 0xd4, 0xa8, 0x00, 0x19, 0x2e, 0x57, 0x53, 0x7f, 0xf2, - 0x3b, 0x00, 0x00, 0xff, 0xff, 0x3f, 0x8c, 0xa1, 0x29, 0x93, 0x04, 0x00, 0x00, + // 581 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x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a, + 0xe6, 0x20, 0x83, 0xe5, 0xf2, 0xad, 0x38, 0xf9, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x19, 0xed, 0x5e, + 0x39, 0xc9, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -439,6 +448,13 @@ func (m *RegisteredRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x1a + } if len(m.CounterpartyAddress) > 0 { i -= len(m.CounterpartyAddress) copy(dAtA[i:], m.CounterpartyAddress) @@ -571,6 +587,10 @@ func (m *RegisteredRelayerAddress) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -988,6 +1008,38 @@ func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { } m.CounterpartyAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/modules/apps/29-fee/types/keys.go b/modules/apps/29-fee/types/keys.go index ec5132fab1a..d65d8efcbef 100644 --- a/modules/apps/29-fee/types/keys.go +++ b/modules/apps/29-fee/types/keys.go @@ -24,8 +24,8 @@ const ( // FeeEnabledPrefix is the key prefix for storing fee enabled flag FeeEnabledKeyPrefix = "feeEnabled" - // RelayerAddressKeyPrefix is the key prefix for relayer address mapping - RelayerAddressKeyPrefix = "relayerAddress" + // CounterpartyRelayerAddressKeyPrefix is the key prefix for relayer address mapping + CounterpartyRelayerAddressKeyPrefix = "relayerAddress" // FeeInEscrowPrefix is the key prefix for fee in escrow mapping FeeInEscrowPrefix = "feeInEscrow" @@ -47,9 +47,9 @@ func FeeEnabledKey(portID, channelID string) []byte { return []byte(fmt.Sprintf("%s/%s/%s", FeeEnabledKeyPrefix, portID, channelID)) } -// KeyRelayerAddress returns the key for relayer address -> counteryparty address mapping -func KeyRelayerAddress(address string) []byte { - return []byte(fmt.Sprintf("%s/%s", RelayerAddressKeyPrefix, address)) +// KeyCounterpartyRelayer returns the key for relayer address -> counteryparty address mapping +func KeyCounterpartyRelayer(address, channelID string) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", CounterpartyRelayerAddressKeyPrefix, address, channelID)) } // KeyForwardRelayerAddress returns the key for packetID -> forwardAddress mapping diff --git a/modules/apps/29-fee/types/keys_test.go b/modules/apps/29-fee/types/keys_test.go index fbe2c2bbdde..a49532b753b 100644 --- a/modules/apps/29-fee/types/keys_test.go +++ b/modules/apps/29-fee/types/keys_test.go @@ -9,11 +9,12 @@ import ( "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" ) -func TestKeyRelayerAddress(t *testing.T) { +func TestKeyCounterpartyRelayer(t *testing.T) { var ( relayerAddress = "relayer_address" + channelID = "channel-0" ) - key := types.KeyRelayerAddress(relayerAddress) - require.Equal(t, string(key), fmt.Sprintf("%s/relayer_address", types.RelayerAddressKeyPrefix)) + key := types.KeyCounterpartyRelayer(relayerAddress, channelID) + require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.CounterpartyRelayerAddressKeyPrefix, relayerAddress, channelID)) } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index f3abe737472..50e6584e26b 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -17,10 +17,11 @@ const ( ) // NewMsgRegisterCounterpartyAddress creates a new instance of MsgRegisterCounterpartyAddress -func NewMsgRegisterCounterpartyAddress(address, counterpartyAddress string) *MsgRegisterCounterpartyAddress { +func NewMsgRegisterCounterpartyAddress(address, counterpartyAddress, channelID string) *MsgRegisterCounterpartyAddress { return &MsgRegisterCounterpartyAddress{ Address: address, CounterpartyAddress: counterpartyAddress, + ChannelId: channelID, } } @@ -35,6 +36,11 @@ func (msg MsgRegisterCounterpartyAddress) ValidateBasic() error { return ErrCounterpartyAddressEmpty } + // validate channelId + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + return err + } + return nil } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index 57b38a07086..c4ee1a477f1 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -5,18 +5,20 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" + "github.com/stretchr/testify/require" "github.com/tendermint/tendermint/crypto/secp256k1" ) var ( - validChannelID = "channel-1" - validPortID = "validPortId" - invalidID = "this identifier is too long to be used as a valid identifier" - validCoins = sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}} - invalidCoins = sdk.Coins{sdk.Coin{Denom: "invalid-denom", Amount: sdk.NewInt(-2)}} - validAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() - invalidAddr = "invalid_address" + validChannelID = "channel-1" + invalidChannelID = "ch-1" + validPortID = "validPortId" + invalidID = "this identifier is too long to be used as a valid identifier" + validCoins = sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}} + invalidCoins = sdk.Coins{sdk.Coin{Denom: "invalid-denom", Amount: sdk.NewInt(-2)}} + validAddr = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() + invalidAddr = "invalid_address" ) // TestMsgTransferValidation tests ValidateBasic for MsgTransfer @@ -26,10 +28,11 @@ func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { msg *MsgRegisterCounterpartyAddress expPass bool }{ - {"validate with correct sdk.AccAddress", NewMsgRegisterCounterpartyAddress(validAddr, validAddr), true}, - {"validate with incorrect destination relayer address", NewMsgRegisterCounterpartyAddress(invalidAddr, validAddr), false}, - {"invalid counterparty address", NewMsgRegisterCounterpartyAddress(validAddr, ""), false}, - {"invalid counterparty address: whitespaced empty string", NewMsgRegisterCounterpartyAddress(validAddr, " "), false}, + {"validate with correct sdk.AccAddress", NewMsgRegisterCounterpartyAddress(validAddr, validAddr, validChannelID), true}, + {"validate with incorrect destination relayer address", NewMsgRegisterCounterpartyAddress(invalidAddr, validAddr, validChannelID), false}, + {"invalid counterparty address", NewMsgRegisterCounterpartyAddress(validAddr, "", validChannelID), false}, + {"invalid counterparty address: whitespaced empty string", NewMsgRegisterCounterpartyAddress(validAddr, " ", validChannelID), false}, + {"invalid channelID", NewMsgRegisterCounterpartyAddress(validAddr, validAddr, invalidChannelID), false}, } for i, tc := range testCases { @@ -46,7 +49,7 @@ func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { func TestRegisterCountepartyAddressGetSigners(t *testing.T) { addr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) // build message - msg := NewMsgRegisterCounterpartyAddress(addr.String(), "counterparty") + msg := NewMsgRegisterCounterpartyAddress(addr.String(), "counterparty", validChannelID) // GetSigners res := msg.GetSigners() diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index 624c6d8279a..a7f8e1d3bee 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -32,6 +32,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgRegisterCounterpartyAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` CounterpartyAddress string `protobuf:"bytes,2,opt,name=counterparty_address,json=counterpartyAddress,proto3" json:"counterparty_address,omitempty" yaml:"counterparty_address"` + ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` } func (m *MsgRegisterCounterpartyAddress) Reset() { *m = MsgRegisterCounterpartyAddress{} } @@ -280,44 +281,45 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 577 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x4f, 0xdb, 0x4c, - 0x10, 0xc6, 0x6d, 0xc2, 0xcb, 0x0b, 0x5b, 0x54, 0x84, 0x09, 0x25, 0x98, 0xc8, 0x4e, 0xad, 0xaa, - 0xca, 0xa1, 0xb1, 0x4b, 0x28, 0xaa, 0xca, 0x05, 0x11, 0x24, 0xd4, 0x1c, 0xa2, 0x46, 0x3e, 0xf6, - 0x12, 0x39, 0xeb, 0x89, 0xd9, 0x36, 0xf1, 0x5a, 0xbb, 0x9b, 0xa8, 0xfe, 0x02, 0xa8, 0x47, 0x6e, - 0xed, 0x91, 0x6b, 0xbf, 0x09, 0x47, 0x8e, 0x3d, 0x45, 0x55, 0x72, 0xe9, 0x39, 0x9f, 0xa0, 0xb2, - 0x9d, 0x84, 0x84, 0xfc, 0x11, 0xed, 0xcd, 0xbb, 0xfb, 0x9b, 0x67, 0x66, 0x1e, 0x8f, 0x06, 0xe5, - 0x48, 0x1d, 0x5b, 0x4e, 0x10, 0x34, 0x09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, 0xf9, 0x65, 0x82, 0x93, 0xa4, 0xfa, 0xfa, 0xb1, 0xe4, 0x38, 0x57, 0x88, - 0xb6, 0x67, 0xff, 0x6a, 0xe1, 0xb1, 0x32, 0x31, 0xae, 0x1e, 0xff, 0x15, 0x3e, 0x4a, 0x5d, 0xfa, - 0x70, 0xdb, 0xd3, 0xe4, 0xbb, 0x9e, 0x26, 0xff, 0xea, 0x69, 0xf2, 0x75, 0x5f, 0x93, 0xee, 0xfa, - 0x9a, 0xf4, 0xb3, 0xaf, 0x49, 0x1f, 0x8f, 0x3d, 0x22, 0x2e, 0xdb, 0x75, 0x13, 0xd3, 0x96, 0x85, - 0x29, 0x6f, 0x51, 0x6e, 0x91, 0x3a, 0x2e, 0x78, 0xd4, 0xea, 0x1c, 0x59, 0x2d, 0xea, 0xb6, 0x9b, - 0xc0, 0xa3, 0x25, 0xc5, 0xad, 0xe2, 0xbb, 0x42, 0xb4, 0x9f, 0x44, 0x18, 0x00, 0xaf, 0xaf, 0xc5, - 0xfb, 0xe9, 0xe8, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x81, 0xea, 0x8a, 0x9a, 0x15, 0x05, 0x00, - 0x00, + // 594 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4d, 0x4f, 0xdb, 0x4c, + 0x10, 0xc7, 0x6d, 0xc2, 0xc3, 0x03, 0x5b, 0x54, 0x84, 0x81, 0x62, 0x4c, 0x64, 0x53, 0xab, 0xaa, + 0x72, 0x28, 0x76, 0x79, 0x53, 0x55, 0x2e, 0x88, 0x20, 0xa1, 0x72, 0x40, 0x8d, 0x7c, 0xec, 0x25, + 0x72, 0xd6, 0x13, 0xb3, 0x6d, 0xe2, 0xb5, 0xbc, 0x9b, 0xa8, 0xfe, 0x02, 0xa8, 0x47, 0x6e, 0xbd, + 0x72, 0xed, 0x37, 0xe1, 0x54, 0x71, 0xec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 0x4f, 0x14, 0xd6, 0xad, 0x35, 0x32, 0x5e, 0x5a, 0x18, 0x43, 0x45, 0xe5, + 0x49, 0xad, 0x66, 0xb3, 0xec, 0x5f, 0x97, 0x50, 0xe9, 0x92, 0xb9, 0xd2, 0x57, 0x11, 0x6d, 0xcf, + 0x7a, 0xf9, 0x6f, 0xa6, 0xb6, 0x3e, 0xfb, 0x89, 0x29, 0x27, 0xff, 0x58, 0x98, 0x75, 0x28, 0x7d, + 0x44, 0xcb, 0x23, 0xef, 0xb2, 0x32, 0x4b, 0xb0, 0x48, 0x2a, 0xaf, 0x1f, 0x4b, 0xe6, 0x67, 0x85, + 0x68, 0x75, 0xfc, 0x56, 0x77, 0x1f, 0x2b, 0x93, 0xe0, 0xca, 0xd1, 0x5f, 0xe1, 0xd9, 0xd1, 0xd5, + 0xf7, 0x77, 0x3d, 0x55, 0xbc, 0xef, 0xa9, 0xe2, 0xcf, 0x9e, 0x2a, 0xde, 0xf4, 0x55, 0xe1, 0xbe, + 0xaf, 0x0a, 0x3f, 0xfa, 0xaa, 0xf0, 0xe1, 0xc8, 0x25, 0xfc, 0xaa, 0xd3, 0x30, 0x30, 0x6d, 0x9b, + 0x98, 0xb2, 0x36, 0x65, 0x26, 0x69, 0xe0, 0x5d, 0x97, 0x9a, 0xdd, 0x03, 0xb3, 0x4d, 0x9d, 0x4e, + 0x0b, 0x58, 0xfc, 0xb5, 0x31, 0x73, 0xff, 0xed, 0x6e, 0xfc, 0xab, 0xf1, 0xd0, 0x07, 0xd6, 0x58, + 0x48, 0x7e, 0xb5, 0x83, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xcf, 0x27, 0xb3, 0x4f, 0x4b, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -514,6 +516,13 @@ func (m *MsgRegisterCounterpartyAddress) MarshalToSizedBuffer(dAtA []byte) (int, _ = i var l int _ = l + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x1a + } if len(m.CounterpartyAddress) > 0 { i -= len(m.CounterpartyAddress) copy(dAtA[i:], m.CounterpartyAddress) @@ -721,6 +730,10 @@ func (m *MsgRegisterCounterpartyAddress) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -890,6 +903,38 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { } m.CounterpartyAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/proto/ibc/applications/fee/v1/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto index 4780a68f72e..134a16be850 100644 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ b/proto/ibc/applications/fee/v1/genesis.proto @@ -27,6 +27,7 @@ message FeeEnabledChannel { message RegisteredRelayerAddress { string address = 1; string counterparty_address = 2 [(gogoproto.moretags) = "yaml:\"counterparty_address\""]; + string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; } // ForwardRelayerAddress contains the forward relayer address and packetId used for async acknowledgements diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index 900764f9343..532524cd4b2 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -32,6 +32,7 @@ message MsgRegisterCounterpartyAddress { string address = 1; string counterparty_address = 2 [(gogoproto.moretags) = "yaml:\"counterparty_address\""]; + string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; } // MsgRegisterCounterpartyAddressResponse defines the Msg/RegisterCounterypartyAddress response type