From a0291bd638eec837b02662bc5b84aa65d57054d8 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Fri, 3 Jun 2022 16:20:07 +0200 Subject: [PATCH 01/12] [WIP] adding RegisterDistributionAddress rpc endpoint and implementation. Store funcs, keys.. --- docs/ibc/proto-docs.md | 47 +- modules/apps/29-fee/keeper/keeper.go | 18 + modules/apps/29-fee/keeper/keeper_test.go | 19 + modules/apps/29-fee/keeper/msg_server.go | 28 +- modules/apps/29-fee/keeper/msg_server_test.go | 63 ++ modules/apps/29-fee/types/errors.go | 1 + modules/apps/29-fee/types/keys.go | 20 + modules/apps/29-fee/types/keys_test.go | 43 ++ modules/apps/29-fee/types/msgs.go | 42 ++ modules/apps/29-fee/types/query.pb.go | 160 ++--- modules/apps/29-fee/types/query.pb.gw.go | 248 ++++---- modules/apps/29-fee/types/tx.pb.go | 567 ++++++++++++++++-- proto/ibc/applications/fee/v1/query.proto | 3 +- proto/ibc/applications/fee/v1/tx.proto | 27 +- 14 files changed, 1021 insertions(+), 265 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index ecf3ca2aa87..2495830bdbd 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -72,6 +72,8 @@ - [MsgPayPacketFeeResponse](#ibc.applications.fee.v1.MsgPayPacketFeeResponse) - [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) - [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) + - [MsgRegisterDistributionAddress](#ibc.applications.fee.v1.MsgRegisterDistributionAddress) + - [MsgRegisterDistributionAddressResponse](#ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse) - [Msg](#ibc.applications.fee.v1.Msg) @@ -1207,14 +1209,14 @@ Query defines the ICS29 gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | | `IncentivizedPackets` | [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) | [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) | IncentivizedPackets returns all incentivized packets and their associated fees | GET|/ibc/apps/fee/v1/incentivized_packets| -| `IncentivizedPacket` | [QueryIncentivizedPacketRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketRequest) | [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) | IncentivizedPacket returns all packet fees for a packet given its identifier | GET|/ibc/apps/fee/v1/incentivized_packet/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `IncentivizedPacketsForChannel` | [QueryIncentivizedPacketsForChannelRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest) | [QueryIncentivizedPacketsForChannelResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse) | Gets all incentivized packets for a specific channel | GET|/ibc/apps/fee/v1/incentivized_packets/port/{port_id}/channel/{channel_id}| -| `TotalRecvFees` | [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) | [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) | TotalRecvFees returns the total receive fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_recv_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `TotalAckFees` | [QueryTotalAckFeesRequest](#ibc.applications.fee.v1.QueryTotalAckFeesRequest) | [QueryTotalAckFeesResponse](#ibc.applications.fee.v1.QueryTotalAckFeesResponse) | TotalAckFees returns the total acknowledgement fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_ack_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `TotalTimeoutFees` | [QueryTotalTimeoutFeesRequest](#ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest) | [QueryTotalTimeoutFeesResponse](#ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse) | TotalTimeoutFees returns the total timeout fees for a packet given its identifier | GET|/ibc/apps/fee/v1/total_timeout_fees/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `CounterpartyAddress` | [QueryCounterpartyAddressRequest](#ibc.applications.fee.v1.QueryCounterpartyAddressRequest) | [QueryCounterpartyAddressResponse](#ibc.applications.fee.v1.QueryCounterpartyAddressResponse) | CounterpartyAddress returns the registered counterparty address for forward relaying | GET|/ibc/apps/fee/v1/counterparty_address/{relayer_address}/channel/{channel_id}| +| `IncentivizedPacket` | [QueryIncentivizedPacketRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketRequest) | [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) | IncentivizedPacket returns all packet fees for a packet given its identifier | GET|/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/sequences/{packet_id.sequence}/incentivized_packet| +| `IncentivizedPacketsForChannel` | [QueryIncentivizedPacketsForChannelRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelRequest) | [QueryIncentivizedPacketsForChannelResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsForChannelResponse) | Gets all incentivized packets for a specific channel | GET|/ibc/apps/fee/v1/channels/{channel_id}/ports/{port_id}/incentivized_packets| +| `TotalRecvFees` | [QueryTotalRecvFeesRequest](#ibc.applications.fee.v1.QueryTotalRecvFeesRequest) | [QueryTotalRecvFeesResponse](#ibc.applications.fee.v1.QueryTotalRecvFeesResponse) | TotalRecvFees returns the total receive fees for a packet given its identifier | GET|/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/sequences/{packet_id.sequence}/total_recv_fees| +| `TotalAckFees` | [QueryTotalAckFeesRequest](#ibc.applications.fee.v1.QueryTotalAckFeesRequest) | [QueryTotalAckFeesResponse](#ibc.applications.fee.v1.QueryTotalAckFeesResponse) | TotalAckFees returns the total acknowledgement fees for a packet given its identifier | GET|/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/sequences/{packet_id.sequence}/total_ack_fees| +| `TotalTimeoutFees` | [QueryTotalTimeoutFeesRequest](#ibc.applications.fee.v1.QueryTotalTimeoutFeesRequest) | [QueryTotalTimeoutFeesResponse](#ibc.applications.fee.v1.QueryTotalTimeoutFeesResponse) | TotalTimeoutFees returns the total timeout fees for a packet given its identifier | GET|/ibc/apps/fee/v1/channels/{packet_id.channel_id}/ports/{packet_id.port_id}/sequences/{packet_id.sequence}/total_timeout_fees| +| `CounterpartyAddress` | [QueryCounterpartyAddressRequest](#ibc.applications.fee.v1.QueryCounterpartyAddressRequest) | [QueryCounterpartyAddressResponse](#ibc.applications.fee.v1.QueryCounterpartyAddressResponse) | CounterpartyAddress returns the registered counterparty address for forward relaying | GET|/ibc/apps/fee/v1/channels/{channel_id}/relayers/{relayer_address}/counterparty_address| | `FeeEnabledChannels` | [QueryFeeEnabledChannelsRequest](#ibc.applications.fee.v1.QueryFeeEnabledChannelsRequest) | [QueryFeeEnabledChannelsResponse](#ibc.applications.fee.v1.QueryFeeEnabledChannelsResponse) | FeeEnabledChannels returns a list of all fee enabled channels | GET|/ibc/apps/fee/v1/fee_enabled| -| `FeeEnabledChannel` | [QueryFeeEnabledChannelRequest](#ibc.applications.fee.v1.QueryFeeEnabledChannelRequest) | [QueryFeeEnabledChannelResponse](#ibc.applications.fee.v1.QueryFeeEnabledChannelResponse) | FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel | GET|/ibc/apps/fee/v1/fee_enabled/port/{port_id}/channel/{channel_id}| +| `FeeEnabledChannel` | [QueryFeeEnabledChannelRequest](#ibc.applications.fee.v1.QueryFeeEnabledChannelRequest) | [QueryFeeEnabledChannelResponse](#ibc.applications.fee.v1.QueryFeeEnabledChannelResponse) | FeeEnabledChannel returns true if the provided port and channel identifiers belong to a fee enabled channel | GET|/ibc/apps/fee/v1/channels/{channel_id}/ports/{port_id}/fee_enabled| @@ -1312,6 +1314,34 @@ MsgRegisterCounterpartyAddressResponse defines the response type for the Registe + + + +### MsgRegisterDistributionAddress +MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | the relayer address | +| `distribution_address` | [string](#string) | | the fee distribution address | +| `port_id` | [string](#string) | | unique port identifier | +| `channel_id` | [string](#string) | | unique channel identifier | + + + + + + + + +### MsgRegisterDistributionAddressResponse +MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc + + + + + @@ -1326,7 +1356,8 @@ Msg defines the ICS29 Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, latest counterparty address is always used. | | +| `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | | +| `RegisterDistributionAddress` | [MsgRegisterDistributionAddress](#ibc.applications.fee.v1.MsgRegisterDistributionAddress) | [MsgRegisterDistributionAddressResponse](#ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse) | RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional distribution address to which escrowed packet fees will be paid out. The distribution address should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest distribution address is always used. | | | `PayPacketFee` | [MsgPayPacketFee](#ibc.applications.fee.v1.MsgPayPacketFee) | [MsgPayPacketFeeResponse](#ibc.applications.fee.v1.MsgPayPacketFeeResponse) | PayPacketFee defines a rpc handler method for MsgPayPacketFee PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of the packet at the next sequence NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows initiates the lifecycle of the incentivized packet | | | `PayPacketFeeAsync` | [MsgPayPacketFeeAsync](#ibc.applications.fee.v1.MsgPayPacketFeeAsync) | [MsgPayPacketFeeAsyncResponse](#ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse) | PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of a known packet (i.e. at a particular sequence) | | diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index a4b5a153c33..2c5b9fae145 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -241,6 +241,24 @@ func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltyp store.Delete(key) } +// GetDistributionAddress retrieves the fee distribution address stored in state given the provided channel identifier and relayer address +func (k Keeper) GetDistributionAddress(ctx sdk.Context, address, channelID string) (string, bool) { + store := ctx.KVStore(k.storeKey) + key := types.KeyDistributionAddress(address, channelID) + + if !store.Has(key) { + return "", false + } + + return string(store.Get(key)), true +} + +// SetDistributionAddress stores the fee distribution address in state keyed by the provided channel identifier and relayer address +func (k Keeper) SetDistributionAddress(ctx sdk.Context, address, distributionAddress, channelID string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.KeyDistributionAddress(address, channelID), []byte(distributionAddress)) +} + // GetFeesInEscrow returns all escrowed packet fees for a given packetID func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) (types.PacketFees, bool) { store := ctx.KVStore(k.storeKey) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 7446ecbab64..985d540903f 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -91,6 +91,25 @@ func (suite *KeeperTestSuite) TestEscrowAccountHasBalance() { suite.Require().False(suite.chainA.GetSimApp().IBCFeeKeeper.EscrowAccountHasBalance(suite.chainA.GetContext(), fee.Total())) } +func (suite *KeeperTestSuite) TestGetSetDistributionAddress() { + suite.coordinator.Setup(suite.path) + + distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + suite.Require().False(found) + suite.Require().Empty(distributionAddr) + + suite.chainA.GetSimApp().IBCFeeKeeper.SetDistributionAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), + suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), + suite.path.EndpointA.ChannelID, + ) + + distributionAddr, found = suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + suite.Require().True(found) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) +} + func (suite *KeeperTestSuite) TestFeesInEscrow() { suite.coordinator.Setup(suite.path) diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index e0c78028ea8..3abb1dd46ff 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -27,15 +27,37 @@ func (k Keeper) RegisterCounterpartyAddress(goCtx context.Context, msg *types.Ms return nil, types.ErrFeeNotEnabled } - k.SetCounterpartyAddress( - ctx, msg.Address, msg.CounterpartyAddress, msg.ChannelId, - ) + k.SetCounterpartyAddress(ctx, msg.Address, msg.CounterpartyAddress, msg.ChannelId) k.Logger(ctx).Info("registering counterparty address for relayer", "address", msg.Address, "counterparty address", msg.CounterpartyAddress, "channel", msg.ChannelId) return &types.MsgRegisterCounterpartyAddressResponse{}, nil } +// RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress +// RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional +// distribution address to which escrowed packet fees will be paid out. The distribution address should be registered +// on the source chain from which packets originate as this is where fee distribution takes place. This function may +// be called more than once by a relayer, in which case, the latest distribution address is always used. +func (k Keeper) RegisterDistributionAddress(goCtx context.Context, msg *types.MsgRegisterDistributionAddress) (*types.MsgRegisterDistributionAddressResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // only register distribution address if the channel exists and is fee enabled + if _, found := k.channelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId); !found { + return nil, channeltypes.ErrChannelNotFound + } + + if !k.IsFeeEnabled(ctx, msg.PortId, msg.ChannelId) { + return nil, types.ErrFeeNotEnabled + } + + k.SetDistributionAddress(ctx, msg.Address, msg.DistributionAddress, msg.ChannelId) + + k.Logger(ctx).Info("registering distribution address for relayer", "address", msg.Address, "distribution address", msg.DistributionAddress, "channel", msg.ChannelId) + + return &types.MsgRegisterDistributionAddressResponse{}, nil +} + // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to relay the packet with the next sequence func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) (*types.MsgPayPacketFeeResponse, error) { diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index b4e665e56db..bbe3cd99a60 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -71,6 +71,69 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { } } +// TODO: Rewrite this test +func (suite *KeeperTestSuite) TestRegisterDistributionAddress() { + var ( + sender string + counterparty string + channelID string + ctx sdk.Context + ) + + testCases := []struct { + name string + expPass bool + malleate func() + }{ + { + "success", + true, + func() {}, + }, + { + "counterparty is an arbitrary string", + true, + func() { counterparty = "arbitrary-string" }, + }, + { + "channel does not exist", + false, + func() { channelID = "channel-22" }, + }, + { + "channel is not fee enabled", + false, + func() { + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(ctx, suite.path.EndpointA.ChannelConfig.PortID, channelID) + }, + }, + } + + for _, tc := range testCases { + suite.SetupTest() + ctx = suite.chainA.GetContext() + suite.coordinator.Setup(suite.path) // setup channel + + sender = suite.chainA.SenderAccount.GetAddress().String() + counterparty = suite.chainB.SenderAccount.GetAddress().String() + channelID = suite.path.EndpointA.ChannelID + + tc.malleate() + + msg := types.NewMsgRegisterDistributionAddress(suite.path.EndpointA.ChannelConfig.PortID, channelID, sender, counterparty) + _, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterDistributionAddress(sdk.WrapSDKContext(ctx), msg) + + if tc.expPass { + suite.Require().NoError(err) // message committed + + counterpartyAddress, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(ctx, suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) + suite.Require().Equal(counterparty, counterpartyAddress) + } else { + suite.Require().Error(err) + } + } +} + func (suite *KeeperTestSuite) TestPayPacketFee() { var ( expEscrowBalance sdk.Coins diff --git a/modules/apps/29-fee/types/errors.go b/modules/apps/29-fee/types/errors.go index 812db0a43a4..b8db4ca7b02 100644 --- a/modules/apps/29-fee/types/errors.go +++ b/modules/apps/29-fee/types/errors.go @@ -16,4 +16,5 @@ var ( ErrFeeNotEnabled = sdkerrors.Register(ModuleName, 9, "fee module is not enabled for this channel. If this error occurs after channel setup, fee module may not be enabled") ErrRelayerNotFoundForAsyncAck = sdkerrors.Register(ModuleName, 10, "relayer address must be stored for async WriteAcknowledgement") ErrFeeModuleLocked = sdkerrors.Register(ModuleName, 11, "the fee module is currently locked, a severe bug has been detected") + ErrDistributionAddressEmpty = sdkerrors.Register(ModuleName, 12, "distribution address must not be empty") ) diff --git a/modules/apps/29-fee/types/keys.go b/modules/apps/29-fee/types/keys.go index cf93967f84a..5d64ef19718 100644 --- a/modules/apps/29-fee/types/keys.go +++ b/modules/apps/29-fee/types/keys.go @@ -31,6 +31,9 @@ const ( // CounterpartyRelayerAddressKeyPrefix is the key prefix for relayer address mapping CounterpartyRelayerAddressKeyPrefix = "relayerAddress" + // DistributionAddressKeyPrefix is the key prefix for the fee distribution address stored in state + DistributionAddressKeyPrefix = "distributionAddress" + // FeesInEscrowPrefix is the key prefix for fee in escrow mapping FeesInEscrowPrefix = "feesInEscrow" @@ -87,6 +90,23 @@ func ParseKeyCounterpartyRelayer(key string) (address string, channelID string, return keySplit[1], keySplit[2], nil } +// KeyDistributionAddress returns the key for relayer address -> distribution address mapping +func KeyDistributionAddress(address, channelID string) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", DistributionAddressKeyPrefix, address, channelID)) +} + +// ParseKeyDistributionAddress returns the registered relayer addresss and channelID used to the store the fee distribution address +func ParseKeyDistributionAddress(key string) (address, channelID string, err error) { + keySplit := strings.Split(key, "/") + if len(keySplit) != 3 { + return "", "", sdkerrors.Wrapf( + sdkerrors.ErrLogic, "key provided is incorrect: the key split has incorrect length, expected %d, got %d", 3, len(keySplit), + ) + } + + return keySplit[1], keySplit[2], nil +} + // KeyRelayerAddressForAsyncAck returns the key for packetID -> forwardAddress mapping func KeyRelayerAddressForAsyncAck(packetID channeltypes.PacketId) []byte { return []byte(fmt.Sprintf("%s/%s/%s/%d", ForwardRelayerPrefix, packetID.PortId, packetID.ChannelId, packetID.Sequence)) diff --git a/modules/apps/29-fee/types/keys_test.go b/modules/apps/29-fee/types/keys_test.go index 7cc0b4c9543..0632c5f5e4a 100644 --- a/modules/apps/29-fee/types/keys_test.go +++ b/modules/apps/29-fee/types/keys_test.go @@ -23,6 +23,49 @@ func TestKeyCounterpartyRelayer(t *testing.T) { require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.CounterpartyRelayerAddressKeyPrefix, relayerAddress, channelID)) } +func TestKeyDistributionAddress(t *testing.T) { + var ( + relayerAddress = "relayer_address" + channelID = "channel-0" + ) + + key := types.KeyDistributionAddress(relayerAddress, channelID) + require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.DistributionAddressKeyPrefix, relayerAddress, channelID)) +} + +func TestParseKeyDistributionAddress(t *testing.T) { + relayerAddress := "relayer_address" + + testCases := []struct { + name string + key string + expPass bool + }{ + { + "success", + string(types.KeyDistributionAddress(relayerAddress, ibctesting.FirstChannelID)), + true, + }, + { + "incorrect key - key split has incorrect length", + "distributionAddress/relayer_address/transfer/channel-0", + false, + }, + } + + for _, tc := range testCases { + address, channelID, err := types.ParseKeyDistributionAddress(tc.key) + + if tc.expPass { + require.NoError(t, err) + require.Equal(t, relayerAddress, address) + require.Equal(t, ibctesting.FirstChannelID, channelID) + } else { + require.Error(t, err) + } + } +} + func TestKeyFeesInEscrow(t *testing.T) { key := types.KeyFeesInEscrow(validPacketID) require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s/%d", types.FeesInEscrowPrefix, ibctesting.MockFeePort, ibctesting.FirstChannelID, 1)) diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 0e729edbd17..ead7fa72f89 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -59,6 +59,48 @@ func (msg MsgRegisterCounterpartyAddress) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } +// NewMsgRegisterDistributionAddress creates a new instance of MsgRegisterDistributionAddress +func NewMsgRegisterDistributionAddress(portID, channelID, address, distributionAddress string) *MsgRegisterDistributionAddress { + return &MsgRegisterDistributionAddress{ + Address: address, + DistributionAddress: distributionAddress, + PortId: portID, + ChannelId: channelID, + } +} + +// ValidateBasic implements sdk.Msg and performs basic stateless validation +func (msg MsgRegisterDistributionAddress) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") + } + + if strings.TrimSpace(msg.DistributionAddress) == "" { + return ErrDistributionAddressEmpty + } + + if err := host.PortIdentifierValidator(msg.PortId); err != nil { + return err + } + + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + return err + } + + return nil +} + +// GetSigners implements sdk.Msg +func (msg MsgRegisterDistributionAddress) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(msg.Address) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{signer} +} + // NewMsgPayPacketFee creates a new instance of MsgPayPacketFee func NewMsgPayPacketFee(fee Fee, sourcePortId, sourceChannelId, signer string, relayers []string) *MsgPayPacketFee { return &MsgPayPacketFee{ diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index 32677378fe3..1a9eba1927f 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -966,88 +966,88 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 1281 bytes of a gzipped FileDescriptorProto + // 1285 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x58, 0x4f, 0x6f, 0x1b, 0x45, 0x1c, 0xcd, 0xa4, 0xa1, 0x4d, 0x26, 0xa1, 0x4d, 0xc7, 0xa1, 0x4d, 0x4d, 0x62, 0xa7, 0x53, 0x0a, - 0x21, 0x28, 0xbb, 0x8a, 0x43, 0x9b, 0x96, 0x53, 0x6b, 0x43, 0x68, 0x04, 0x82, 0x76, 0x95, 0x0b, - 0x08, 0xe4, 0xae, 0x77, 0xc7, 0xce, 0x2a, 0xce, 0xce, 0x76, 0x77, 0x6d, 0x70, 0xd3, 0x20, 0x35, - 0x52, 0x84, 0x04, 0x15, 0x42, 0x42, 0xe2, 0x80, 0xb8, 0x22, 0x24, 0x24, 0xb8, 0xf3, 0x0d, 0x7a, - 0xaa, 0x2a, 0x71, 0xe1, 0x64, 0xaa, 0x84, 0x4f, 0x60, 0x71, 0x40, 0xe2, 0x82, 0x76, 0x66, 0x76, - 0xbd, 0xee, 0xee, 0x26, 0xde, 0x92, 0x88, 0x53, 0xec, 0xf9, 0xfd, 0x99, 0xf7, 0xde, 0xfc, 0x3c, - 0xf3, 0x14, 0x78, 0xc1, 0xa8, 0x68, 0xb2, 0x6a, 0x59, 0x75, 0x43, 0x53, 0x5d, 0x83, 0x9a, 0x8e, - 0x5c, 0x25, 0x44, 0x6e, 0x2e, 0xc8, 0x77, 0x1a, 0xc4, 0x6e, 0x49, 0x96, 0x4d, 0x5d, 0x8a, 0xce, - 0x1a, 0x15, 0x4d, 0x0a, 0x27, 0x49, 0x55, 0x42, 0xa4, 0xe6, 0x42, 0x76, 0xa2, 0x46, 0x6b, 0x94, - 0xe5, 0xc8, 0xde, 0x27, 0x9e, 0x9e, 0x9d, 0xaa, 0x51, 0x5a, 0xab, 0x13, 0x59, 0xb5, 0x0c, 0x59, - 0x35, 0x4d, 0xea, 0x8a, 0x22, 0x1e, 0xcd, 0x69, 0xd4, 0xd9, 0xa0, 0x8e, 0x5c, 0x51, 0x1d, 0x6f, - 0xa3, 0x0a, 0x71, 0xd5, 0x05, 0x59, 0xa3, 0x86, 0x29, 0xe2, 0x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, 0x59, 0x2a, 0x04, + 0x08, 0x70, 0xd7, 0xbb, 0x63, 0x67, 0x15, 0x67, 0x67, 0xbb, 0xbb, 0xb6, 0x70, 0xd3, 0x00, 0xad, + 0x88, 0x40, 0x80, 0x00, 0x09, 0x89, 0x03, 0xe2, 0x8a, 0x90, 0x90, 0xf8, 0x00, 0x7c, 0x83, 0x8a, + 0x03, 0x8a, 0xc4, 0x85, 0x93, 0x41, 0x09, 0x27, 0x8e, 0x3e, 0x71, 0x00, 0x09, 0xed, 0xcc, 0xec, + 0x7a, 0xdd, 0xdd, 0x4d, 0xec, 0x60, 0x85, 0x53, 0xec, 0xf9, 0xfd, 0x99, 0xf7, 0xde, 0xfc, 0x3c, + 0xf3, 0x14, 0x78, 0xce, 0x28, 0x69, 0xb2, 0x6a, 0x59, 0x55, 0x43, 0x53, 0x5d, 0x83, 0x9a, 0x8e, + 0x5c, 0x26, 0x44, 0xae, 0x2f, 0xc8, 0x37, 0x6b, 0xc4, 0x6e, 0x48, 0x96, 0x4d, 0x5d, 0x8a, 0x4e, + 0x1b, 0x25, 0x4d, 0x0a, 0x27, 0x49, 0x65, 0x42, 0xa4, 0xfa, 0x42, 0x7a, 0xa2, 0x42, 0x2b, 0x94, + 0xe5, 0xc8, 0xde, 0x27, 0x9e, 0x9e, 0x9e, 0xaa, 0x50, 0x5a, 0xa9, 0x12, 0x59, 0xb5, 0x0c, 0x59, + 0x35, 0x4d, 0xea, 0x8a, 0x22, 0x1e, 0xcd, 0x68, 0xd4, 0x59, 0xa7, 0x8e, 0x5c, 0x52, 0x1d, 0x6f, + 0xa3, 0x12, 0x71, 0xd5, 0x05, 0x59, 0xa3, 0x86, 0x29, 0xe2, 0x73, 0xe1, 0x38, 0x43, 0x11, 0x64, + 0x59, 0x6a, 0xc5, 0x30, 0x59, 0x33, 0x91, 0x7b, 0x36, 0x09, 0xbd, 0x87, 0x8f, 0xa7, 0x9c, 0x4f, + 0x4a, 0xa9, 0x10, 0x93, 0x38, 0x86, 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 0x5b, 0xe2, 0x7b, 0x37, + 0xa2, 0x7c, 0x98, 0x7c, 0x46, 0x81, 0x26, 0x3a, 0x4c, 0xc5, 0x68, 0x22, 0x20, 0x1d, 0x48, 0x12, + 0x14, 0x95, 0x04, 0xff, 0x0c, 0xe0, 0xe3, 0x49, 0xc7, 0xb3, 0x4c, 0xed, 0x02, 0xe7, 0xdb, 0xef, + 0xb9, 0x39, 0x0d, 0x8f, 0x59, 0xd4, 0x66, 0x12, 0x7b, 0xea, 0x8c, 0x28, 0x47, 0xbd, 0xaf, 0x2b, + 0x3a, 0x9a, 0x86, 0x50, 0x48, 0xec, 0xc5, 0x8e, 0xb0, 0xd8, 0x88, 0x58, 0x89, 0x91, 0x76, 0x28, + 0x2a, 0xed, 0x67, 0x00, 0xce, 0x75, 0x43, 0x48, 0xa8, 0x7c, 0xa3, 0x8f, 0x93, 0x17, 0x3f, 0x73, + 0x6f, 0xc1, 0x33, 0x0c, 0xcf, 0x75, 0xea, 0xaa, 0x55, 0x85, 0x68, 0x75, 0x96, 0xda, 0xaf, 0x69, + 0xc3, 0x5f, 0x03, 0x98, 0x8e, 0xeb, 0x2f, 0xf8, 0xdd, 0x86, 0x23, 0x36, 0xd1, 0xea, 0xc5, 0x32, + 0x21, 0x3e, 0xa9, 0x33, 0x1d, 0x07, 0xe6, 0x1f, 0x55, 0x81, 0x1a, 0x66, 0xfe, 0xaa, 0xd7, 0xbc, + 0xd5, 0xcc, 0x8e, 0x37, 0xd4, 0xf5, 0xea, 0x53, 0x38, 0xa8, 0xc4, 0xdf, 0xff, 0x96, 0x9d, 0xad, + 0x18, 0xee, 0x6a, 0xad, 0x24, 0x69, 0x74, 0x5d, 0x16, 0x77, 0x1f, 0xff, 0x33, 0xef, 0xe8, 0x6b, + 0xb2, 0xdb, 0xb0, 0x88, 0xc3, 0x9a, 0x38, 0xca, 0xb0, 0x2d, 0x50, 0xe0, 0x37, 0xe1, 0x64, 0x1b, + 0xdb, 0x15, 0x6d, 0xad, 0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ed, 0xf2, 0x67, 0x2e, 0x6c, 0x93, 0x23, 0x6f, 0xdc, 0x67, 0xa9, 0x36, + 0xe5, 0x38, 0xd7, 0x83, 0x7e, 0x00, 0x10, 0x45, 0xcd, 0xc4, 0x7e, 0x6f, 0x40, 0xa2, 0x19, 0xda, + 0xef, 0x0d, 0x48, 0xf6, 0x2d, 0xf8, 0x11, 0xc6, 0x34, 0x83, 0xa6, 0x22, 0x4c, 0x43, 0xcf, 0x30, + 0xda, 0x06, 0xf0, 0x64, 0xa4, 0x09, 0xba, 0xd8, 0xe3, 0xae, 0x3e, 0xda, 0xa5, 0x9e, 0xeb, 0x04, + 0xd8, 0xe7, 0x19, 0xd8, 0xab, 0x28, 0x7f, 0xc0, 0xdb, 0x37, 0x44, 0x29, 0xff, 0xd2, 0xbd, 0x9d, + 0x0c, 0xd8, 0xde, 0xc9, 0x80, 0xdf, 0x77, 0x32, 0xe0, 0x8b, 0xdd, 0xcc, 0xc0, 0xf6, 0x6e, 0x66, + 0xe0, 0xd7, 0xdd, 0xcc, 0xc0, 0x1b, 0x17, 0xa2, 0x56, 0xde, 0x28, 0x69, 0xf3, 0x15, 0x2a, 0xd7, + 0x17, 0xe5, 0x75, 0xaa, 0xd7, 0xaa, 0xc4, 0xe1, 0x9b, 0xe7, 0x2e, 0xcf, 0x7b, 0xfb, 0x33, 0x77, + 0x5f, 0x3a, 0xca, 0xfe, 0xc1, 0xb4, 0xf8, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x50, 0x32, 0x7d, + 0x07, 0x8d, 0x13, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/modules/apps/29-fee/types/query.pb.gw.go b/modules/apps/29-fee/types/query.pb.gw.go index 9b9e47c5939..712c7f32727 100644 --- a/modules/apps/29-fee/types/query.pb.gw.go +++ b/modules/apps/29-fee/types/query.pb.gw.go @@ -68,7 +68,7 @@ func local_request_Query_IncentivizedPackets_0(ctx context.Context, marshaler ru } var ( - filter_Query_IncentivizedPacket_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "port_id": 1, "channel_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} + filter_Query_IncentivizedPacket_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "channel_id": 1, "port_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} ) func request_Query_IncentivizedPacket_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -82,26 +82,26 @@ func request_Query_IncentivizedPacket_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -138,26 +138,26 @@ func local_request_Query_IncentivizedPacket_0(ctx context.Context, marshaler run _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -184,7 +184,7 @@ func local_request_Query_IncentivizedPacket_0(ctx context.Context, marshaler run } var ( - filter_Query_IncentivizedPacketsForChannel_0 = &utilities.DoubleArray{Encoding: map[string]int{"port_id": 0, "channel_id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} + filter_Query_IncentivizedPacketsForChannel_0 = &utilities.DoubleArray{Encoding: map[string]int{"channel_id": 0, "port_id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} ) func request_Query_IncentivizedPacketsForChannel_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -198,26 +198,26 @@ func request_Query_IncentivizedPacketsForChannel_0(ctx context.Context, marshale _ = err ) - val, ok = pathParams["port_id"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.PortId, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.PortId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } if err := req.ParseForm(); err != nil { @@ -243,26 +243,26 @@ func local_request_Query_IncentivizedPacketsForChannel_0(ctx context.Context, ma _ = err ) - val, ok = pathParams["port_id"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.PortId, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.PortId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } if err := req.ParseForm(); err != nil { @@ -278,7 +278,7 @@ func local_request_Query_IncentivizedPacketsForChannel_0(ctx context.Context, ma } var ( - filter_Query_TotalRecvFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "port_id": 1, "channel_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} + filter_Query_TotalRecvFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "channel_id": 1, "port_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} ) func request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -292,26 +292,26 @@ func request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -348,26 +348,26 @@ func local_request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -394,7 +394,7 @@ func local_request_Query_TotalRecvFees_0(ctx context.Context, marshaler runtime. } var ( - filter_Query_TotalAckFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "port_id": 1, "channel_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} + filter_Query_TotalAckFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "channel_id": 1, "port_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} ) func request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -408,26 +408,26 @@ func request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -464,26 +464,26 @@ func local_request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -510,7 +510,7 @@ func local_request_Query_TotalAckFees_0(ctx context.Context, marshaler runtime.M } var ( - filter_Query_TotalTimeoutFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "port_id": 1, "channel_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} + filter_Query_TotalTimeoutFees_0 = &utilities.DoubleArray{Encoding: map[string]int{"packet_id": 0, "channel_id": 1, "port_id": 2, "sequence": 3}, Base: []int{1, 1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 2, 2, 2, 3, 4, 5}} ) func request_Query_TotalTimeoutFees_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { @@ -524,26 +524,26 @@ func request_Query_TotalTimeoutFees_0(ctx context.Context, marshaler runtime.Mar _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -580,26 +580,26 @@ func local_request_Query_TotalTimeoutFees_0(ctx context.Context, marshaler runti _ = err ) - val, ok = pathParams["packet_id.port_id"] + val, ok = pathParams["packet_id.channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) } - val, ok = pathParams["packet_id.channel_id"] + val, ok = pathParams["packet_id.port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "packet_id.port_id") } - err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.channel_id", val) + err = runtime.PopulateFieldFromPath(&protoReq, "packet_id.port_id", val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "packet_id.port_id", err) } val, ok = pathParams["packet_id.sequence"] @@ -636,26 +636,26 @@ func request_Query_CounterpartyAddress_0(ctx context.Context, marshaler runtime. _ = err ) - val, ok = pathParams["relayer_address"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relayer_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.RelayerAddress, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relayer_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["relayer_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relayer_address") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.RelayerAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relayer_address", err) } msg, err := client.CounterpartyAddress(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -674,26 +674,26 @@ func local_request_Query_CounterpartyAddress_0(ctx context.Context, marshaler ru _ = err ) - val, ok = pathParams["relayer_address"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relayer_address") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.RelayerAddress, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relayer_address", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["relayer_address"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "relayer_address") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.RelayerAddress, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "relayer_address", err) } msg, err := server.CounterpartyAddress(ctx, &protoReq) @@ -748,26 +748,26 @@ func request_Query_FeeEnabledChannel_0(ctx context.Context, marshaler runtime.Ma _ = err ) - val, ok = pathParams["port_id"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.PortId, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.PortId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } msg, err := client.FeeEnabledChannel(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -786,26 +786,26 @@ func local_request_Query_FeeEnabledChannel_0(ctx context.Context, marshaler runt _ = err ) - val, ok = pathParams["port_id"] + val, ok = pathParams["channel_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") } - protoReq.PortId, err = runtime.String(val) + protoReq.ChannelId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) } - val, ok = pathParams["channel_id"] + val, ok = pathParams["port_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "channel_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "port_id") } - protoReq.ChannelId, err = runtime.String(val) + protoReq.PortId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "channel_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "port_id", err) } msg, err := server.FeeEnabledChannel(ctx, &protoReq) @@ -1226,21 +1226,21 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_IncentivizedPackets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "fee", "v1", "incentivized_packets"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_IncentivizedPacket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "incentivized_packet", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_IncentivizedPacket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9, 2, 10}, []string{"ibc", "apps", "fee", "v1", "channels", "packet_id.channel_id", "ports", "packet_id.port_id", "sequences", "packet_id.sequence", "incentivized_packet"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_IncentivizedPacketsForChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8}, []string{"ibc", "apps", "fee", "v1", "incentivized_packets", "port", "port_id", "channel", "channel_id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_IncentivizedPacketsForChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "apps", "fee", "v1", "channels", "channel_id", "ports", "port_id", "incentivized_packets"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_TotalRecvFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_recv_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_TotalRecvFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9, 2, 10}, []string{"ibc", "apps", "fee", "v1", "channels", "packet_id.channel_id", "ports", "packet_id.port_id", "sequences", "packet_id.sequence", "total_recv_fees"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_TotalAckFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_ack_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_TotalAckFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9, 2, 10}, []string{"ibc", "apps", "fee", "v1", "channels", "packet_id.channel_id", "ports", "packet_id.port_id", "sequences", "packet_id.sequence", "total_ack_fees"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_TotalTimeoutFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9, 1, 0, 4, 1, 5, 10}, []string{"ibc", "apps", "fee", "v1", "total_timeout_fees", "port", "packet_id.port_id", "channel", "packet_id.channel_id", "sequence", "packet_id.sequence"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_TotalTimeoutFees_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8, 1, 0, 4, 1, 5, 9, 2, 10}, []string{"ibc", "apps", "fee", "v1", "channels", "packet_id.channel_id", "ports", "packet_id.port_id", "sequences", "packet_id.sequence", "total_timeout_fees"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_CounterpartyAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7}, []string{"ibc", "apps", "fee", "v1", "counterparty_address", "relayer_address", "channel", "channel_id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_CounterpartyAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "apps", "fee", "v1", "channels", "channel_id", "relayers", "relayer_address", "counterparty_address"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_FeeEnabledChannels_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "fee", "v1", "fee_enabled"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_FeeEnabledChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8}, []string{"ibc", "apps", "fee", "v1", "fee_enabled", "port", "port_id", "channel", "channel_id"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_FeeEnabledChannel_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "apps", "fee", "v1", "channels", "channel_id", "ports", "port_id", "fee_enabled"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index 66827e58cc6..a12326a16c9 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -113,6 +113,90 @@ func (m *MsgRegisterCounterpartyAddressResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgRegisterCounterpartyAddressResponse proto.InternalMessageInfo +// MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc +type MsgRegisterDistributionAddress struct { + // the relayer address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // the fee distribution address + DistributionAddress string `protobuf:"bytes,2,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` + // unique port identifier + PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + // unique channel identifier + ChannelId string `protobuf:"bytes,4,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *MsgRegisterDistributionAddress) Reset() { *m = MsgRegisterDistributionAddress{} } +func (m *MsgRegisterDistributionAddress) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterDistributionAddress) ProtoMessage() {} +func (*MsgRegisterDistributionAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_05c93128649f1b96, []int{2} +} +func (m *MsgRegisterDistributionAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterDistributionAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterDistributionAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterDistributionAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterDistributionAddress.Merge(m, src) +} +func (m *MsgRegisterDistributionAddress) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterDistributionAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterDistributionAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterDistributionAddress proto.InternalMessageInfo + +// MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc +type MsgRegisterDistributionAddressResponse struct { +} + +func (m *MsgRegisterDistributionAddressResponse) Reset() { + *m = MsgRegisterDistributionAddressResponse{} +} +func (m *MsgRegisterDistributionAddressResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterDistributionAddressResponse) ProtoMessage() {} +func (*MsgRegisterDistributionAddressResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_05c93128649f1b96, []int{3} +} +func (m *MsgRegisterDistributionAddressResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRegisterDistributionAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRegisterDistributionAddressResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgRegisterDistributionAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterDistributionAddressResponse.Merge(m, src) +} +func (m *MsgRegisterDistributionAddressResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRegisterDistributionAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterDistributionAddressResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRegisterDistributionAddressResponse proto.InternalMessageInfo + // MsgPayPacketFee defines the request type for the PayPacketFee rpc // This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be // paid for @@ -133,7 +217,7 @@ func (m *MsgPayPacketFee) Reset() { *m = MsgPayPacketFee{} } func (m *MsgPayPacketFee) String() string { return proto.CompactTextString(m) } func (*MsgPayPacketFee) ProtoMessage() {} func (*MsgPayPacketFee) Descriptor() ([]byte, []int) { - return fileDescriptor_05c93128649f1b96, []int{2} + return fileDescriptor_05c93128649f1b96, []int{4} } func (m *MsgPayPacketFee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +254,7 @@ func (m *MsgPayPacketFeeResponse) Reset() { *m = MsgPayPacketFeeResponse func (m *MsgPayPacketFeeResponse) String() string { return proto.CompactTextString(m) } func (*MsgPayPacketFeeResponse) ProtoMessage() {} func (*MsgPayPacketFeeResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_05c93128649f1b96, []int{3} + return fileDescriptor_05c93128649f1b96, []int{5} } func (m *MsgPayPacketFeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -212,7 +296,7 @@ func (m *MsgPayPacketFeeAsync) Reset() { *m = MsgPayPacketFeeAsync{} } func (m *MsgPayPacketFeeAsync) String() string { return proto.CompactTextString(m) } func (*MsgPayPacketFeeAsync) ProtoMessage() {} func (*MsgPayPacketFeeAsync) Descriptor() ([]byte, []int) { - return fileDescriptor_05c93128649f1b96, []int{4} + return fileDescriptor_05c93128649f1b96, []int{6} } func (m *MsgPayPacketFeeAsync) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -249,7 +333,7 @@ func (m *MsgPayPacketFeeAsyncResponse) Reset() { *m = MsgPayPacketFeeAsy func (m *MsgPayPacketFeeAsyncResponse) String() string { return proto.CompactTextString(m) } func (*MsgPayPacketFeeAsyncResponse) ProtoMessage() {} func (*MsgPayPacketFeeAsyncResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_05c93128649f1b96, []int{5} + return fileDescriptor_05c93128649f1b96, []int{7} } func (m *MsgPayPacketFeeAsyncResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -281,6 +365,8 @@ var xxx_messageInfo_MsgPayPacketFeeAsyncResponse proto.InternalMessageInfo func init() { proto.RegisterType((*MsgRegisterCounterpartyAddress)(nil), "ibc.applications.fee.v1.MsgRegisterCounterpartyAddress") proto.RegisterType((*MsgRegisterCounterpartyAddressResponse)(nil), "ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse") + proto.RegisterType((*MsgRegisterDistributionAddress)(nil), "ibc.applications.fee.v1.MsgRegisterDistributionAddress") + proto.RegisterType((*MsgRegisterDistributionAddressResponse)(nil), "ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse") proto.RegisterType((*MsgPayPacketFee)(nil), "ibc.applications.fee.v1.MsgPayPacketFee") proto.RegisterType((*MsgPayPacketFeeResponse)(nil), "ibc.applications.fee.v1.MsgPayPacketFeeResponse") proto.RegisterType((*MsgPayPacketFeeAsync)(nil), "ibc.applications.fee.v1.MsgPayPacketFeeAsync") @@ -290,48 +376,51 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 650 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xbf, 0x4f, 0xdb, 0x40, - 0x14, 0xc7, 0x63, 0x42, 0x81, 0x5c, 0x11, 0x34, 0x57, 0x28, 0x21, 0x50, 0x9b, 0x7a, 0xa8, 0x22, - 0x55, 0xd8, 0xe5, 0x97, 0xaa, 0xb2, 0x20, 0x82, 0x84, 0xca, 0x80, 0x8a, 0x4e, 0x9d, 0xaa, 0x4a, - 0xc8, 0x39, 0xbf, 0x18, 0xb7, 0x89, 0xcf, 0xf2, 0x39, 0x51, 0xfd, 0x0f, 0x54, 0x1d, 0xd9, 0xba, - 0xf2, 0xe7, 0x30, 0x32, 0x74, 0xe8, 0x64, 0x55, 0xb0, 0x74, 0xf6, 0xda, 0xa5, 0x3a, 0x9f, 0x1d, - 0x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d, 0x23, 0x1f, 0x78, 0x6b, 0x2a, 0x7d, 0x2d, 0xb7, 0xfe, 0x04, 0x00, 0x00, - 0xff, 0xff, 0xcb, 0x30, 0xa1, 0x30, 0xc6, 0x05, 0x00, 0x00, + // 698 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xbf, 0x4f, 0xdb, 0x40, + 0x14, 0xc7, 0x63, 0x42, 0x81, 0x5c, 0x11, 0x34, 0x06, 0x4a, 0x08, 0xd4, 0xa6, 0x1e, 0xaa, 0x48, + 0x15, 0x76, 0xf9, 0xa5, 0xaa, 0x2c, 0x88, 0x50, 0xa1, 0x32, 0xa0, 0xa2, 0x53, 0xa7, 0xaa, 0x12, + 0x72, 0xce, 0x2f, 0xc6, 0x6d, 0xe2, 0xb3, 0x7c, 0x4e, 0x54, 0xff, 0x07, 0x1d, 0xd9, 0xba, 0xf2, + 0xe7, 0x30, 0x32, 0x74, 0xe8, 0x64, 0x55, 0xb0, 0x74, 0xce, 0xda, 0xa5, 0x3a, 0x9f, 0x1d, 0x39, + 0xa9, 0x13, 0xa5, 0x5d, 0xba, 0xdd, 0xdd, 0xfb, 0xbe, 0x5f, 0x1f, 0xdf, 0xf3, 0xa1, 0x4d, 0xa7, + 0x41, 0x0c, 0xd3, 0xf3, 0x5a, 0x0e, 0x31, 0x03, 0x87, 0xba, 0xcc, 0x68, 0x02, 0x18, 0xdd, 0x6d, + 0x23, 0xf8, 0xac, 0x7b, 0x3e, 0x0d, 0xa8, 0xbc, 0xea, 0x34, 0x88, 0x9e, 0x55, 0xe8, 0x4d, 0x00, + 0xbd, 0xbb, 0x5d, 0x5d, 0xb6, 0xa9, 0x4d, 0x63, 0x8d, 0xc1, 0x57, 0x42, 0x5e, 0x7d, 0x3a, 0x2a, + 0x20, 0xf7, 0xca, 0x48, 0x08, 0xf5, 0xc1, 0x20, 0x97, 0xa6, 0xeb, 0x42,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b, 0x03, 0xb1, 0x9b, 0x00, 0x1a, 0x4e, 0xca, + 0x3c, 0x01, 0xc8, 0x74, 0xac, 0xa0, 0x8d, 0xbc, 0xae, 0xd2, 0xb6, 0x77, 0xae, 0xa7, 0x51, 0xf1, + 0x8c, 0xd9, 0xf2, 0x57, 0x09, 0xad, 0x8f, 0xfb, 0xf3, 0xbc, 0x1c, 0x59, 0xdb, 0xf8, 0xa9, 0xad, + 0x1e, 0xfe, 0xa3, 0x63, 0x5a, 0xe1, 0x40, 0x65, 0x79, 0xb3, 0x3e, 0x51, 0x65, 0x39, 0x8e, 0x93, + 0x55, 0x36, 0x66, 0xc0, 0xe4, 0x8f, 0x68, 0x7e, 0x60, 0xb8, 0x6a, 0xe3, 0x02, 0x66, 0x95, 0xd5, + 0x17, 0x93, 0x2a, 0xfb, 0xb9, 0x42, 0x54, 0xfe, 0xf3, 0x6a, 0x6e, 0x4d, 0x1a, 0x26, 0x96, 0x57, + 0xf7, 0xff, 0x4a, 0x9e, 0xa6, 0xae, 0xbf, 0xbd, 0xb9, 0x53, 0xa4, 0xdb, 0x3b, 0x45, 0xfa, 0x71, + 0xa7, 0x48, 0x57, 0xf7, 0x4a, 0xe1, 0xf6, 0x5e, 0x29, 0x7c, 0xbf, 0x57, 0x0a, 0xef, 0xf7, 0x6d, + 0x27, 0xb8, 0xec, 0x34, 0x74, 0x42, 0xdb, 0x06, 0xa1, 0xac, 0x4d, 0x99, 0xe1, 0x34, 0xc8, 0x96, + 0x4d, 0x8d, 0xee, 0xae, 0xd1, 0xa6, 0x56, 0xa7, 0x05, 0x8c, 0xbf, 0x8b, 0xcc, 0xd8, 0x79, 0xb5, + 0xc5, 0x9f, 0xc4, 0x20, 0xf4, 0x80, 0x35, 0x66, 0xe2, 0xf7, 0x6e, 0xf7, 0x77, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x23, 0xd7, 0x5e, 0xd0, 0x88, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -350,8 +439,14 @@ type MsgClient interface { // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since // destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function - // may be called more than once by a relayer, in which case, latest counterparty address is always used. + // may be called more than once by a relayer, in which case, the latest counterparty address is always used. RegisterCounterpartyAddress(ctx context.Context, in *MsgRegisterCounterpartyAddress, opts ...grpc.CallOption) (*MsgRegisterCounterpartyAddressResponse, error) + // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress + // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + RegisterDistributionAddress(ctx context.Context, in *MsgRegisterDistributionAddress, opts ...grpc.CallOption) (*MsgRegisterDistributionAddressResponse, error) // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -381,6 +476,15 @@ func (c *msgClient) RegisterCounterpartyAddress(ctx context.Context, in *MsgRegi return out, nil } +func (c *msgClient) RegisterDistributionAddress(ctx context.Context, in *MsgRegisterDistributionAddress, opts ...grpc.CallOption) (*MsgRegisterDistributionAddressResponse, error) { + out := new(MsgRegisterDistributionAddressResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/RegisterDistributionAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) PayPacketFee(ctx context.Context, in *MsgPayPacketFee, opts ...grpc.CallOption) (*MsgPayPacketFeeResponse, error) { out := new(MsgPayPacketFeeResponse) err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/PayPacketFee", in, out, opts...) @@ -405,8 +509,14 @@ type MsgServer interface { // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since // destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function - // may be called more than once by a relayer, in which case, latest counterparty address is always used. + // may be called more than once by a relayer, in which case, the latest counterparty address is always used. RegisterCounterpartyAddress(context.Context, *MsgRegisterCounterpartyAddress) (*MsgRegisterCounterpartyAddressResponse, error) + // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress + // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + RegisterDistributionAddress(context.Context, *MsgRegisterDistributionAddress) (*MsgRegisterDistributionAddressResponse, error) // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -426,6 +536,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) RegisterCounterpartyAddress(ctx context.Context, req *MsgRegisterCounterpartyAddress) (*MsgRegisterCounterpartyAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterCounterpartyAddress not implemented") } +func (*UnimplementedMsgServer) RegisterDistributionAddress(ctx context.Context, req *MsgRegisterDistributionAddress) (*MsgRegisterDistributionAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterDistributionAddress not implemented") +} func (*UnimplementedMsgServer) PayPacketFee(ctx context.Context, req *MsgPayPacketFee) (*MsgPayPacketFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PayPacketFee not implemented") } @@ -455,6 +568,24 @@ func _Msg_RegisterCounterpartyAddress_Handler(srv interface{}, ctx context.Conte return interceptor(ctx, in, info, handler) } +func _Msg_RegisterDistributionAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterDistributionAddress) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RegisterDistributionAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/ibc.applications.fee.v1.Msg/RegisterDistributionAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RegisterDistributionAddress(ctx, req.(*MsgRegisterDistributionAddress)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_PayPacketFee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgPayPacketFee) if err := dec(in); err != nil { @@ -499,6 +630,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "RegisterCounterpartyAddress", Handler: _Msg_RegisterCounterpartyAddress_Handler, }, + { + MethodName: "RegisterDistributionAddress", + Handler: _Msg_RegisterDistributionAddress_Handler, + }, { MethodName: "PayPacketFee", Handler: _Msg_PayPacketFee_Handler, @@ -586,6 +721,80 @@ func (m *MsgRegisterCounterpartyAddressResponse) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } +func (m *MsgRegisterDistributionAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterDistributionAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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] = 0x22 + } + if len(m.PortId) > 0 { + i -= len(m.PortId) + copy(dAtA[i:], m.PortId) + i = encodeVarintTx(dAtA, i, uint64(len(m.PortId))) + i-- + dAtA[i] = 0x1a + } + if len(m.DistributionAddress) > 0 { + i -= len(m.DistributionAddress) + copy(dAtA[i:], m.DistributionAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DistributionAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgRegisterDistributionAddressResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgRegisterDistributionAddressResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRegisterDistributionAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func (m *MsgPayPacketFee) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -783,6 +992,40 @@ func (m *MsgRegisterCounterpartyAddressResponse) Size() (n int) { return n } +func (m *MsgRegisterDistributionAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.DistributionAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.PortId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgRegisterDistributionAddressResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func (m *MsgPayPacketFee) Size() (n int) { if m == nil { return 0 @@ -1077,6 +1320,234 @@ func (m *MsgRegisterCounterpartyAddressResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterDistributionAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterDistributionAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", 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.DistributionAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PortId", 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.PortId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + 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:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgRegisterDistributionAddressResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgRegisterDistributionAddressResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRegisterDistributionAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *MsgPayPacketFee) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 0e1caa5d0f7..5f648107323 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -52,7 +52,8 @@ service Query { // CounterpartyAddress returns the registered counterparty address for forward relaying rpc CounterpartyAddress(QueryCounterpartyAddressRequest) returns (QueryCounterpartyAddressResponse) { - option (google.api.http).get = "/ibc/apps/fee/v1/channels/{channel_id}/relayers/{relayer_address}/counterparty_address"; + option (google.api.http).get = + "/ibc/apps/fee/v1/channels/{channel_id}/relayers/{relayer_address}/counterparty_address"; } // FeeEnabledChannels returns a list of all fee enabled channels diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index ca8397e74fd..b2d6c82be0d 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -14,9 +14,16 @@ service Msg { // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since // destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function - // may be called more than once by a relayer, in which case, latest counterparty address is always used. + // may be called more than once by a relayer, in which case, the latest counterparty address is always used. rpc RegisterCounterpartyAddress(MsgRegisterCounterpartyAddress) returns (MsgRegisterCounterpartyAddressResponse); + // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress + // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + rpc RegisterDistributionAddress(MsgRegisterDistributionAddress) returns (MsgRegisterDistributionAddressResponse); + // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -48,6 +55,24 @@ message MsgRegisterCounterpartyAddress { // MsgRegisterCounterpartyAddressResponse defines the response type for the RegisterCounterpartyAddress rpc message MsgRegisterCounterpartyAddressResponse {} +// MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc +message MsgRegisterDistributionAddress { + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + // the relayer address + string address = 1; + // the fee distribution address + string distribution_address = 2 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; + // unique port identifier + string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; + // unique channel identifier + string channel_id = 4 [(gogoproto.moretags) = "yaml:\"channel_id\""]; +} + +// MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc +message MsgRegisterDistributionAddressResponse {} + // MsgPayPacketFee defines the request type for the PayPacketFee rpc // This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be // paid for From 55e69b1235e11dfba78cf08e228ca0ce04d674bc Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Sun, 5 Jun 2022 11:29:20 +0200 Subject: [PATCH 02/12] updating tests --- modules/apps/29-fee/keeper/msg_server_test.go | 45 ++++++------ modules/apps/29-fee/types/keys_test.go | 15 ++-- modules/apps/29-fee/types/msgs_test.go | 71 +++++++++++++++++++ 3 files changed, 98 insertions(+), 33 deletions(-) diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index bbe3cd99a60..cb56c0bd404 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -71,13 +71,9 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { } } -// TODO: Rewrite this test func (suite *KeeperTestSuite) TestRegisterDistributionAddress() { var ( - sender string - counterparty string - channelID string - ctx sdk.Context + msg *types.MsgRegisterDistributionAddress ) testCases := []struct { @@ -90,44 +86,49 @@ func (suite *KeeperTestSuite) TestRegisterDistributionAddress() { true, func() {}, }, - { - "counterparty is an arbitrary string", - true, - func() { counterparty = "arbitrary-string" }, - }, { "channel does not exist", false, - func() { channelID = "channel-22" }, + func() { + msg.ChannelId = "channel-100" + }, }, { "channel is not fee enabled", false, func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(ctx, suite.path.EndpointA.ChannelConfig.PortID, channelID) + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) }, }, } for _, tc := range testCases { suite.SetupTest() - ctx = suite.chainA.GetContext() - suite.coordinator.Setup(suite.path) // setup channel + suite.coordinator.Setup(suite.path) - sender = suite.chainA.SenderAccount.GetAddress().String() - counterparty = suite.chainB.SenderAccount.GetAddress().String() - channelID = suite.path.EndpointA.ChannelID + msg = types.NewMsgRegisterDistributionAddress( + suite.path.EndpointA.ChannelConfig.PortID, + suite.path.EndpointA.ChannelID, + suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), + suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), + ) tc.malleate() - msg := types.NewMsgRegisterDistributionAddress(suite.path.EndpointA.ChannelConfig.PortID, channelID, sender, counterparty) - _, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterDistributionAddress(sdk.WrapSDKContext(ctx), msg) + res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterDistributionAddress(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) if tc.expPass { - suite.Require().NoError(err) // message committed + suite.Require().NoError(err) + suite.Require().NotNil(res) - counterpartyAddress, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(ctx, suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) - suite.Require().Equal(counterparty, counterpartyAddress) + distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccount.GetAddress().String(), + suite.path.EndpointA.ChannelID, + ) + + suite.Require().True(found) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) } else { suite.Require().Error(err) } diff --git a/modules/apps/29-fee/types/keys_test.go b/modules/apps/29-fee/types/keys_test.go index 0632c5f5e4a..ecb98bfc9e3 100644 --- a/modules/apps/29-fee/types/keys_test.go +++ b/modules/apps/29-fee/types/keys_test.go @@ -24,18 +24,11 @@ func TestKeyCounterpartyRelayer(t *testing.T) { } func TestKeyDistributionAddress(t *testing.T) { - var ( - relayerAddress = "relayer_address" - channelID = "channel-0" - ) - - key := types.KeyDistributionAddress(relayerAddress, channelID) - require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.DistributionAddressKeyPrefix, relayerAddress, channelID)) + key := types.KeyDistributionAddress("relayer-address", ibctesting.FirstChannelID) + require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.DistributionAddressKeyPrefix, "relayer-address", ibctesting.FirstChannelID)) } func TestParseKeyDistributionAddress(t *testing.T) { - relayerAddress := "relayer_address" - testCases := []struct { name string key string @@ -43,7 +36,7 @@ func TestParseKeyDistributionAddress(t *testing.T) { }{ { "success", - string(types.KeyDistributionAddress(relayerAddress, ibctesting.FirstChannelID)), + string(types.KeyDistributionAddress("relayer-address", ibctesting.FirstChannelID)), true, }, { @@ -58,7 +51,7 @@ func TestParseKeyDistributionAddress(t *testing.T) { if tc.expPass { require.NoError(t, err) - require.Equal(t, relayerAddress, address) + require.Equal(t, "relayer-address", address) require.Equal(t, ibctesting.FirstChannelID, channelID) } else { require.Error(t, err) diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index 17452a64b45..d28f99a63bd 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -83,6 +83,77 @@ func TestRegisterCountepartyAddressGetSigners(t *testing.T) { require.Equal(t, []sdk.AccAddress{sdk.AccAddress(accAddress)}, msg.GetSigners()) } +func TestMsgRegisterDistributionAddressValidation(t *testing.T) { + var msg *types.MsgRegisterDistributionAddress + + testCases := []struct { + name string + malleate func() + expPass bool + }{ + { + "success", + func() {}, + true, + }, + { + "validate with invalid relayer address", + func() { + msg.Address = "invalid-address" + }, + false, + }, + { + "invalid distribution address", + func() { + msg.DistributionAddress = "" + }, + false, + }, + { + "invalid distribution address: whitespaced empty string", + func() { + msg.DistributionAddress = " " + }, + false, + }, + { + "invalid channelID", + func() { + msg.ChannelId = "" + }, + false, + }, + { + "invalid portID", + func() { + msg.PortId = "" + }, + false, + }, + } + + for i, tc := range testCases { + msg = types.NewMsgRegisterDistributionAddress(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) + + tc.malleate() + + err := msg.ValidateBasic() + + if tc.expPass { + require.NoError(t, err, "valid test case %d failed: %s", i, tc.name) + } else { + require.Error(t, err, "invalid test case %d passed: %s", i, tc.name) + } + } +} + +func TestRegisterDistributionAddressGetSigners(t *testing.T) { + accAddress := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + msg := types.NewMsgRegisterDistributionAddress(ibctesting.MockPort, ibctesting.FirstChannelID, accAddress.String(), defaultAccAddress) + require.Equal(t, []sdk.AccAddress{sdk.AccAddress(accAddress)}, msg.GetSigners()) +} + func TestMsgPayPacketFeeValidation(t *testing.T) { var msg *types.MsgPayPacketFee From 29abd2ebaadc9ee5cc6183f99af5ba1c66585453 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Sun, 5 Jun 2022 15:27:55 +0200 Subject: [PATCH 03/12] adding registered distribution addresses to genesis state --- docs/ibc/proto-docs.md | 19 + modules/apps/29-fee/keeper/genesis.go | 13 +- modules/apps/29-fee/keeper/genesis_test.go | 50 ++- modules/apps/29-fee/keeper/keeper.go | 25 ++ modules/apps/29-fee/keeper/keeper_test.go | 25 ++ modules/apps/29-fee/types/genesis.go | 41 +- modules/apps/29-fee/types/genesis.pb.go | 419 ++++++++++++++++++-- proto/ibc/applications/fee/v1/genesis.proto | 13 + 8 files changed, 532 insertions(+), 73 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 2495830bdbd..b696bd93771 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -38,6 +38,7 @@ - [FeeEnabledChannel](#ibc.applications.fee.v1.FeeEnabledChannel) - [ForwardRelayerAddress](#ibc.applications.fee.v1.ForwardRelayerAddress) - [GenesisState](#ibc.applications.fee.v1.GenesisState) + - [RegisteredDistributionAddress](#ibc.applications.fee.v1.RegisteredDistributionAddress) - [RegisteredRelayerAddress](#ibc.applications.fee.v1.RegisteredRelayerAddress) - [ibc/applications/fee/v1/metadata.proto](#ibc/applications/fee/v1/metadata.proto) @@ -844,6 +845,24 @@ GenesisState defines the ICS29 fee middleware genesis state | `fee_enabled_channels` | [FeeEnabledChannel](#ibc.applications.fee.v1.FeeEnabledChannel) | repeated | list of fee enabled channels | | `registered_relayers` | [RegisteredRelayerAddress](#ibc.applications.fee.v1.RegisteredRelayerAddress) | repeated | list of registered relayer addresses | | `forward_relayers` | [ForwardRelayerAddress](#ibc.applications.fee.v1.ForwardRelayerAddress) | repeated | list of forward relayer addresses | +| `registered_distribution_addresses` | [RegisteredDistributionAddress](#ibc.applications.fee.v1.RegisteredDistributionAddress) | repeated | list of registered distribution addresses | + + + + + + + + +### RegisteredDistributionAddress +RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `address` | [string](#string) | | the relayer address | +| `distribution_address` | [string](#string) | | the distribution address | +| `channel_id` | [string](#string) | | unique channel identifier | diff --git a/modules/apps/29-fee/keeper/genesis.go b/modules/apps/29-fee/keeper/genesis.go index 70b6a5012a2..a402d66ebea 100644 --- a/modules/apps/29-fee/keeper/genesis.go +++ b/modules/apps/29-fee/keeper/genesis.go @@ -23,14 +23,19 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { for _, enabledChan := range state.FeeEnabledChannels { k.SetFeeEnabled(ctx, enabledChan.PortId, enabledChan.ChannelId) } + + for _, registeredDistAddr := range state.RegisteredDistributionAddresses { + k.SetDistributionAddress(ctx, registeredDistAddr.Address, registeredDistAddr.DistributionAddress, registeredDistAddr.ChannelId) + } } // ExportGenesis returns the fee middleware application exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ - IdentifiedFees: k.GetAllIdentifiedPacketFees(ctx), - FeeEnabledChannels: k.GetAllFeeEnabledChannels(ctx), - RegisteredRelayers: k.GetAllRelayerAddresses(ctx), - ForwardRelayers: k.GetAllForwardRelayerAddresses(ctx), + IdentifiedFees: k.GetAllIdentifiedPacketFees(ctx), + FeeEnabledChannels: k.GetAllFeeEnabledChannels(ctx), + RegisteredRelayers: k.GetAllRelayerAddresses(ctx), + ForwardRelayers: k.GetAllForwardRelayerAddresses(ctx), + RegisteredDistributionAddresses: k.GetAllDistributionAddresses(ctx), } } diff --git a/modules/apps/29-fee/keeper/genesis_test.go b/modules/apps/29-fee/keeper/genesis_test.go index 8aa30385e58..5ab2c65094e 100644 --- a/modules/apps/29-fee/keeper/genesis_test.go +++ b/modules/apps/29-fee/keeper/genesis_test.go @@ -7,18 +7,7 @@ import ( ) func (suite *KeeperTestSuite) TestInitGenesis() { - // build PacketId & Fee - refundAcc := suite.chainA.SenderAccount.GetAddress() packetID := channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1) - fee := types.Fee{ - RecvFee: defaultRecvFee, - AckFee: defaultAckFee, - TimeoutFee: defaultTimeoutFee, - } - - // relayer addresses - sender := suite.chainA.SenderAccount.GetAddress().String() - counterparty := suite.chainB.SenderAccount.GetAddress().String() genesisState := types.GenesisState{ IdentifiedFees: []types.IdentifiedPacketFees{ @@ -26,8 +15,8 @@ func (suite *KeeperTestSuite) TestInitGenesis() { PacketId: packetID, PacketFees: []types.PacketFee{ { - Fee: fee, - RefundAddress: refundAcc.String(), + Fee: types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee), + RefundAddress: suite.chainA.SenderAccount.GetAddress().String(), Relayers: nil, }, }, @@ -41,8 +30,15 @@ func (suite *KeeperTestSuite) TestInitGenesis() { }, RegisteredRelayers: []types.RegisteredRelayerAddress{ { - Address: sender, - CounterpartyAddress: counterparty, + Address: suite.chainA.SenderAccount.GetAddress().String(), + CounterpartyAddress: suite.chainB.SenderAccount.GetAddress().String(), + ChannelId: ibctesting.FirstChannelID, + }, + }, + RegisteredDistributionAddresses: []types.RegisteredDistributionAddress{ + { + Address: suite.chainA.SenderAccount.GetAddress().String(), + DistributionAddress: suite.chainB.SenderAccount.GetAddress().String(), ChannelId: ibctesting.FirstChannelID, }, }, @@ -60,9 +56,14 @@ func (suite *KeeperTestSuite) TestInitGenesis() { suite.Require().True(isEnabled) // check relayers - addr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainA.GetContext(), sender, ibctesting.FirstChannelID) + addr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) suite.Require().True(found) suite.Require().Equal(genesisState.RegisteredRelayers[0].CounterpartyAddress, addr) + + // check distribution addresses + distAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) + suite.Require().True(found) + suite.Require().Equal(genesisState.RegisteredDistributionAddresses[0].DistributionAddress, distAddr) } func (suite *KeeperTestSuite) TestExportGenesis() { @@ -72,11 +73,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { // setup & escrow the packet fee refundAcc := suite.chainA.SenderAccount.GetAddress() packetID := channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1) - fee := types.Fee{ - RecvFee: defaultRecvFee, - AckFee: defaultAckFee, - TimeoutFee: defaultTimeoutFee, - } + fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee) packetFee := types.NewPacketFee(fee, refundAcc.String(), []string{}) suite.chainA.GetSimApp().IBCFeeKeeper.SetFeesInEscrow(suite.chainA.GetContext(), packetID, types.NewPacketFees([]types.PacketFee{packetFee})) @@ -90,6 +87,9 @@ func (suite *KeeperTestSuite) TestExportGenesis() { // set forward relayer address suite.chainA.GetSimApp().IBCFeeKeeper.SetRelayerAddressForAsyncAck(suite.chainA.GetContext(), packetID, sender) + // set distribution address + suite.chainA.GetSimApp().IBCFeeKeeper.SetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.chainB.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) + // export genesis genesisState := suite.chainA.GetSimApp().IBCFeeKeeper.ExportGenesis(suite.chainA.GetContext()) @@ -106,8 +106,14 @@ func (suite *KeeperTestSuite) TestExportGenesis() { // check registered relayer addresses suite.Require().Equal(sender, genesisState.RegisteredRelayers[0].Address) suite.Require().Equal(counterparty, genesisState.RegisteredRelayers[0].CounterpartyAddress) + suite.Require().Equal(ibctesting.FirstChannelID, genesisState.RegisteredRelayers[0].ChannelId) - // check registered relayer addresses + // check forward relayer addresses suite.Require().Equal(sender, genesisState.ForwardRelayers[0].Address) suite.Require().Equal(packetID, genesisState.ForwardRelayers[0].PacketId) + + // check distribution addresses + suite.Require().Equal(suite.chainA.SenderAccount.GetAddress().String(), genesisState.RegisteredDistributionAddresses[0].Address) + suite.Require().Equal(suite.chainB.SenderAccount.GetAddress().String(), genesisState.RegisteredDistributionAddresses[0].DistributionAddress) + suite.Require().Equal(ibctesting.FirstChannelID, genesisState.RegisteredDistributionAddresses[0].ChannelId) } diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 2c5b9fae145..0fbeb62dabb 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -259,6 +259,31 @@ func (k Keeper) SetDistributionAddress(ctx sdk.Context, address, distributionAdd store.Set(types.KeyDistributionAddress(address, channelID), []byte(distributionAddress)) } +// GetAllDistributionAddresses returns all registered distribution addresses +func (k Keeper) GetAllDistributionAddresses(ctx sdk.Context) []types.RegisteredDistributionAddress { + store := ctx.KVStore(k.storeKey) + iterator := sdk.KVStorePrefixIterator(store, []byte(types.DistributionAddressKeyPrefix)) + defer iterator.Close() + + var distributionAddrs []types.RegisteredDistributionAddress + for ; iterator.Valid(); iterator.Next() { + addr, channelID, err := types.ParseKeyDistributionAddress(string(iterator.Key())) + if err != nil { + panic(err) + } + + distributionAddr := types.RegisteredDistributionAddress{ + Address: addr, + DistributionAddress: string(iterator.Value()), + ChannelId: channelID, + } + + distributionAddrs = append(distributionAddrs, distributionAddr) + } + + return distributionAddrs +} + // GetFeesInEscrow returns all escrowed packet fees for a given packetID func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) (types.PacketFees, bool) { store := ctx.KVStore(k.storeKey) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 985d540903f..c58597ddcf2 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -276,3 +276,28 @@ func (suite *KeeperTestSuite) TestGetAllRelayerAddresses() { suite.Require().Len(addr, len(expectedAddr)) suite.Require().Equal(addr, expectedAddr) } + +func (suite *KeeperTestSuite) TestGetAllDistributionAddresses() { + var expectedDistAddrs []types.RegisteredDistributionAddress + + for i := 0; i < 3; i++ { + suite.chainA.GetSimApp().IBCFeeKeeper.SetDistributionAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccounts[i].SenderAccount.GetAddress().String(), + suite.chainB.SenderAccounts[i].SenderAccount.GetAddress().String(), + ibctesting.FirstChannelID, + ) + + registeredDistAddr := types.RegisteredDistributionAddress{ + Address: suite.chainA.SenderAccounts[i].SenderAccount.GetAddress().String(), + DistributionAddress: suite.chainB.SenderAccounts[i].SenderAccount.GetAddress().String(), + ChannelId: ibctesting.FirstChannelID, + } + + expectedDistAddrs = append(expectedDistAddrs, registeredDistAddr) + } + + registeredDistAddrs := suite.chainA.GetSimApp().IBCFeeKeeper.GetAllDistributionAddresses(suite.chainA.GetContext()) + suite.Require().Len(registeredDistAddrs, len(expectedDistAddrs)) + suite.Require().ElementsMatch(expectedDistAddrs, registeredDistAddrs) +} diff --git a/modules/apps/29-fee/types/genesis.go b/modules/apps/29-fee/types/genesis.go index be9299fcd94..66b234c1ed7 100644 --- a/modules/apps/29-fee/types/genesis.go +++ b/modules/apps/29-fee/types/genesis.go @@ -10,22 +10,30 @@ import ( ) // NewGenesisState creates a 29-fee GenesisState instance. -func NewGenesisState(identifiedFees []IdentifiedPacketFees, feeEnabledChannels []FeeEnabledChannel, registeredRelayers []RegisteredRelayerAddress, forwardRelayers []ForwardRelayerAddress) *GenesisState { +func NewGenesisState( + identifiedFees []IdentifiedPacketFees, + feeEnabledChannels []FeeEnabledChannel, + registeredRelayers []RegisteredRelayerAddress, + forwardRelayers []ForwardRelayerAddress, + registeredDistributionAddrs []RegisteredDistributionAddress, +) *GenesisState { return &GenesisState{ - IdentifiedFees: identifiedFees, - FeeEnabledChannels: feeEnabledChannels, - RegisteredRelayers: registeredRelayers, - ForwardRelayers: forwardRelayers, + IdentifiedFees: identifiedFees, + FeeEnabledChannels: feeEnabledChannels, + RegisteredRelayers: registeredRelayers, + ForwardRelayers: forwardRelayers, + RegisteredDistributionAddresses: registeredDistributionAddrs, } } // DefaultGenesisState returns a GenesisState with "transfer" as the default PortID. func DefaultGenesisState() *GenesisState { return &GenesisState{ - IdentifiedFees: []IdentifiedPacketFees{}, - ForwardRelayers: []ForwardRelayerAddress{}, - FeeEnabledChannels: []FeeEnabledChannel{}, - RegisteredRelayers: []RegisteredRelayerAddress{}, + IdentifiedFees: []IdentifiedPacketFees{}, + ForwardRelayers: []ForwardRelayerAddress{}, + FeeEnabledChannels: []FeeEnabledChannel{}, + RegisteredRelayers: []RegisteredRelayerAddress{}, + RegisteredDistributionAddresses: []RegisteredDistributionAddress{}, } } @@ -77,5 +85,20 @@ func (gs GenesisState) Validate() error { } } + // Validate DistributionAddresses + for _, registeredDistAddr := range gs.RegisteredDistributionAddresses { + if _, err := sdk.AccAddressFromBech32(registeredDistAddr.Address); err != nil { + return sdkerrors.Wrap(err, "failed to convert source relayer address into sdk.AccAddress") + } + + if strings.TrimSpace(registeredDistAddr.DistributionAddress) == "" { + return ErrDistributionAddressEmpty + } + + if err := host.ChannelIdentifierValidator(registeredDistAddr.ChannelId); err != nil { + return sdkerrors.Wrapf(err, "invalid channel identifier: %s", registeredDistAddr.ChannelId) + } + } + return nil } diff --git a/modules/apps/29-fee/types/genesis.pb.go b/modules/apps/29-fee/types/genesis.pb.go index af78add463e..19ef17108b4 100644 --- a/modules/apps/29-fee/types/genesis.pb.go +++ b/modules/apps/29-fee/types/genesis.pb.go @@ -34,6 +34,8 @@ type GenesisState struct { RegisteredRelayers []RegisteredRelayerAddress `protobuf:"bytes,3,rep,name=registered_relayers,json=registeredRelayers,proto3" json:"registered_relayers" yaml:"registered_relayers"` // list of forward relayer addresses ForwardRelayers []ForwardRelayerAddress `protobuf:"bytes,4,rep,name=forward_relayers,json=forwardRelayers,proto3" json:"forward_relayers" yaml:"forward_relayers"` + // list of registered distribution addresses + RegisteredDistributionAddresses []RegisteredDistributionAddress `protobuf:"bytes,5,rep,name=registered_distribution_addresses,json=registeredDistributionAddresses,proto3" json:"registered_distribution_addresses" yaml:"registered_distribution_addresses"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -97,6 +99,13 @@ func (m *GenesisState) GetForwardRelayers() []ForwardRelayerAddress { return nil } +func (m *GenesisState) GetRegisteredDistributionAddresses() []RegisteredDistributionAddress { + if m != nil { + return m.RegisteredDistributionAddresses + } + return nil +} + // FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel type FeeEnabledChannel struct { // unique port identifier @@ -271,11 +280,76 @@ func (m *ForwardRelayerAddress) GetPacketId() types.PacketId { return types.PacketId{} } +// RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel +type RegisteredDistributionAddress struct { + // the relayer address + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // the distribution address + DistributionAddress string `protobuf:"bytes,2,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` + // unique channel identifier + ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *RegisteredDistributionAddress) Reset() { *m = RegisteredDistributionAddress{} } +func (m *RegisteredDistributionAddress) String() string { return proto.CompactTextString(m) } +func (*RegisteredDistributionAddress) ProtoMessage() {} +func (*RegisteredDistributionAddress) Descriptor() ([]byte, []int) { + return fileDescriptor_7191992e856dff95, []int{4} +} +func (m *RegisteredDistributionAddress) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisteredDistributionAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisteredDistributionAddress.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RegisteredDistributionAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisteredDistributionAddress.Merge(m, src) +} +func (m *RegisteredDistributionAddress) XXX_Size() int { + return m.Size() +} +func (m *RegisteredDistributionAddress) XXX_DiscardUnknown() { + xxx_messageInfo_RegisteredDistributionAddress.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisteredDistributionAddress proto.InternalMessageInfo + +func (m *RegisteredDistributionAddress) GetAddress() string { + if m != nil { + return m.Address + } + return "" +} + +func (m *RegisteredDistributionAddress) GetDistributionAddress() string { + if m != nil { + return m.DistributionAddress + } + return "" +} + +func (m *RegisteredDistributionAddress) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + func init() { proto.RegisterType((*GenesisState)(nil), "ibc.applications.fee.v1.GenesisState") proto.RegisterType((*FeeEnabledChannel)(nil), "ibc.applications.fee.v1.FeeEnabledChannel") proto.RegisterType((*RegisteredRelayerAddress)(nil), "ibc.applications.fee.v1.RegisteredRelayerAddress") proto.RegisterType((*ForwardRelayerAddress)(nil), "ibc.applications.fee.v1.ForwardRelayerAddress") + proto.RegisterType((*RegisteredDistributionAddress)(nil), "ibc.applications.fee.v1.RegisteredDistributionAddress") } func init() { @@ -283,44 +357,48 @@ func init() { } var fileDescriptor_7191992e856dff95 = []byte{ - // 579 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4d, 0x6f, 0xd4, 0x30, - 0x14, 0xdc, 0xb4, 0x55, 0x4b, 0x5d, 0xd4, 0x0f, 0xb7, 0xa5, 0x51, 0x11, 0x49, 0x31, 0x42, 0xaa, - 0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a4, 0xcf, 0xc9, 0x54, 0x4f, 0x42, 0x57, 0xc7, 0x2b, 0x25, 0x1e, - 0x7f, 0x31, 0xd0, 0x56, 0x0c, 0xe0, 0x41, 0xe6, 0x07, 0x29, 0x44, 0x5e, 0x6d, 0x53, 0x9a, 0x73, - 0x95, 0xfa, 0xa3, 0x56, 0xf5, 0x63, 0x80, 0x57, 0x9a, 0xf3, 0x52, 0x53, 0x7a, 0x0f, 0x6a, 0xe9, - 0xbb, 0x5a, 0x7a, 0x56, 0x57, 0x42, 0x71, 0x3c, 0xcd, 0x93, 0xf8, 0xab, 0x81, 0x36, 0x05, 0x24, - 0x4c, 0x2a, 0x10, 0x10, 0x79, 0x02, 0x52, 0x7f, 0x08, 0x42, 0x9a, 0xf3, 0x95, 0x85, 0x6e, 0xab, - 0x05, 0x7a, 0xcd, 0xa1, 0x9a, 0xf2, 0x22, 0x8a, 0x04, 0x48, 0xd9, 0x23, 0xb5, 0x93, 0x5d, 0xed, - 0x64, 0x46, 0x6f, 0x42, 0xb1, 0x98, 0x66, 0x4b, 0xfc, 0x19, 0xad, 0xc7, 0x5c, 0x7c, 0xf2, 0xc5, - 0x84, 0x89, 0x85, 0xca, 0x84, 0xd3, 0x9e, 0x83, 0x26, 0x4c, 0x39, 0xb0, 0x6b, 0x07, 0x3b, 0x75, - 0x16, 0x53, 0x5d, 0x09, 0x5d, 0x8b, 0x6f, 0xf0, 0x24, 0x29, 0xd0, 0xc6, 0x5f, 0x91, 0xe2, 0xc7, - 0x68, 0x29, 0xe7, 0x42, 0x79, 0x2c, 0x32, 0x8d, 0x3d, 0x63, 0x7f, 0xb9, 0x87, 0xaf, 0x46, 0xf6, - 0xaa, 0xee, 0x59, 0x6f, 0x10, 0xba, 0x58, 0x56, 0xfd, 0x08, 0x3f, 0x41, 0xa8, 0xce, 0xb9, 0xc4, - 0xcf, 0x55, 0xf8, 0xed, 0xab, 0x91, 0xbd, 0xa1, 0xf1, 0xe3, 0x3d, 0x42, 0x97, 0xe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0x00, + // 655 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0x8d, 0x5b, 0xda, 0xd2, 0x2d, 0xea, 0x87, 0xdb, 0x52, 0xab, 0xa8, 0x76, 0xbb, 0x08, 0xa9, + 0x02, 0xd5, 0x26, 0x2d, 0x20, 0xc1, 0x8d, 0x00, 0x45, 0x39, 0x81, 0x16, 0x4e, 0x5c, 0x22, 0x7f, + 0x8c, 0xd3, 0x15, 0x89, 0xd7, 0xda, 0xdd, 0x04, 0x85, 0x1b, 0x17, 0xb8, 0xf2, 0x63, 0x38, 0x73, + 0x41, 0x42, 0x3d, 0xf6, 0xc8, 0x29, 0x42, 0xed, 0x3f, 0xe8, 0x2f, 0x40, 0xf6, 0xae, 0xdb, 0x34, + 0x71, 0xa2, 0x8a, 0xdb, 0xda, 0xfb, 0xde, 0xbc, 0x37, 0xcf, 0xe3, 0x41, 0xf7, 0x68, 0x10, 0x7a, + 0x7e, 0x9a, 0xb6, 0x68, 0xe8, 0x4b, 0xca, 0x12, 0xe1, 0xc5, 0x00, 0x5e, 0xb7, 0xea, 0x35, 0x21, + 0x01, 0x41, 0x85, 0x9b, 0x72, 0x26, 0x99, 0xb9, 0x41, 0x83, 0xd0, 0x1d, 0x84, 0xb9, 0x31, 0x80, + 0xdb, 0xad, 0x6e, 0xae, 0x35, 0x59, 0x93, 0xe5, 0x18, 0x2f, 0x3b, 0x29, 0xf8, 0xe6, 0xce, 0xb8, + 0xaa, 0x19, 0x6b, 0x00, 0x12, 0x32, 0x0e, 0x5e, 0x78, 0xe4, 0x27, 0x09, 0xb4, 0xb2, 0x6b, 0x7d, + 0x54, 0x10, 0xfc, 0x7b, 0x06, 0xdd, 0x7a, 0xad, 0x6c, 0xbc, 0x93, 0xbe, 0x04, 0xb3, 0x8b, 0x96, + 0x68, 0x04, 0x89, 0xa4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4, + 0x66, 0xaa, 0x31, 0xf8, 0x97, 0x81, 0xb6, 0x26, 0xce, 0xcd, 0xe4, 0x3c, 0xcb, 0x46, 0x67, 0x34, + 0xcf, 0x32, 0x14, 0x26, 0xab, 0x51, 0x89, 0xda, 0x7f, 0xe5, 0x59, 0x7b, 0x73, 0x7c, 0x6a, 0x1b, + 0x27, 0xa7, 0xb6, 0xf1, 0xf7, 0xd4, 0x36, 0xbe, 0x9f, 0xd9, 0x95, 0x93, 0x33, 0xbb, 0xf2, 0xe7, + 0xcc, 0xae, 0x7c, 0x78, 0xdc, 0xa4, 0xf2, 0xa8, 0x13, 0xb8, 0x21, 0x6b, 0x7b, 0x21, 0x13, 0x6d, + 0x26, 0x3c, 0x1a, 0x84, 0x7b, 0x4d, 0xe6, 0x75, 0x0f, 0xbc, 0x36, 0x8b, 0x3a, 0x2d, 0x10, 0xd9, + 0x46, 0x17, 0xde, 0xfe, 0xd3, 0xbd, 0x6c, 0x99, 0xcb, 0x5e, 0x0a, 0x22, 0x98, 0xcd, 0x37, 0xf5, + 0xc1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0xe4, 0xb2, 0x8e, 0x47, 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -343,6 +421,20 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RegisteredDistributionAddresses) > 0 { + for iNdEx := len(m.RegisteredDistributionAddresses) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RegisteredDistributionAddresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } if len(m.ForwardRelayers) > 0 { for iNdEx := len(m.ForwardRelayers) - 1; iNdEx >= 0; iNdEx-- { { @@ -523,6 +615,50 @@ func (m *ForwardRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RegisteredDistributionAddress) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *RegisteredDistributionAddress) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RegisteredDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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.DistributionAddress) > 0 { + i -= len(m.DistributionAddress) + copy(dAtA[i:], m.DistributionAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.DistributionAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -564,6 +700,12 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.RegisteredDistributionAddresses) > 0 { + for _, e := range m.RegisteredDistributionAddresses { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -620,6 +762,27 @@ func (m *ForwardRelayerAddress) Size() (n int) { return n } +func (m *RegisteredDistributionAddress) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.DistributionAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -791,6 +954,40 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RegisteredDistributionAddresses", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RegisteredDistributionAddresses = append(m.RegisteredDistributionAddresses, RegisteredDistributionAddress{}) + if err := m.RegisteredDistributionAddresses[len(m.RegisteredDistributionAddresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) @@ -1187,6 +1384,152 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { } return nil } +func (m *RegisteredDistributionAddress) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: RegisteredDistributionAddress: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RegisteredDistributionAddress: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", 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.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", 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.DistributionAddress = 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:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/proto/ibc/applications/fee/v1/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto index cae132239d6..6d6e22065d8 100644 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ b/proto/ibc/applications/fee/v1/genesis.proto @@ -22,6 +22,9 @@ message GenesisState { // list of forward relayer addresses repeated ForwardRelayerAddress forward_relayers = 4 [(gogoproto.moretags) = "yaml:\"forward_relayers\"", (gogoproto.nullable) = false]; + // list of registered distribution addresses + repeated RegisteredDistributionAddress registered_distribution_addresses = 5 + [(gogoproto.moretags) = "yaml:\"registered_distribution_addresses\"", (gogoproto.nullable) = false]; } // FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel @@ -50,3 +53,13 @@ message ForwardRelayerAddress { ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; } + +// RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel +message RegisteredDistributionAddress { + // the relayer address + string address = 1; + // the distribution address + string distribution_address = 2 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; + // unique channel identifier + string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; +} From 522dd3c7a41bedc4ab42f4838090ff1896a9ecf8 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Sun, 5 Jun 2022 18:44:46 +0200 Subject: [PATCH 04/12] refactor and update validate genesis tests --- modules/apps/29-fee/types/genesis_test.go | 171 +++++++++------------- 1 file changed, 67 insertions(+), 104 deletions(-) diff --git a/modules/apps/29-fee/types/genesis_test.go b/modules/apps/29-fee/types/genesis_test.go index d574257e706..13a0c7dbf69 100644 --- a/modules/apps/29-fee/types/genesis_test.go +++ b/modules/apps/29-fee/types/genesis_test.go @@ -5,35 +5,19 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" - transfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v3/testing" ) -var ( - addr1 = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() - addr2 = sdk.AccAddress("testaddr2").String() - validCoins = sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}} - validCoins2 = sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(200)}} - validCoins3 = sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(300)}} -) +func TestValidateDefaultGenesis(t *testing.T) { + err := types.DefaultGenesisState().Validate() + require.NoError(t, err) +} func TestValidateGenesis(t *testing.T) { - var ( - packetID channeltypes.PacketId - fee types.Fee - refundAcc string - sender string - forwardAddr string - counterparty string - portID string - channelID string - packetChannelID string - seq uint64 - ) + var genState *types.GenesisState testCases := []struct { name string @@ -41,166 +25,150 @@ func TestValidateGenesis(t *testing.T) { expPass bool }{ { - "valid genesis", + "success - valid genesis", func() {}, true, }, { - "invalid packetID: invalid channel", + "invalid packetID: invalid port ID", func() { - packetID = channeltypes.NewPacketId( - portID, - "", - seq, - ) + genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketId("", ibctesting.FirstChannelID, 1) }, false, }, { - "invalid packetID: invalid port", + "invalid packetID: invalid channel ID", func() { - packetID = channeltypes.NewPacketId( - "", - channelID, - seq, - ) + genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketId(ibctesting.MockFeePort, "", 1) }, false, }, { "invalid packetID: invalid sequence", func() { - packetID = channeltypes.NewPacketId( - portID, - channelID, - 0, - ) + genState.IdentifiedFees[0].PacketId = channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 0) + }, + false, + }, + { + "invalid packet fee: invalid fee", + func() { + genState.IdentifiedFees[0].PacketFees[0].Fee = types.NewFee(sdk.Coins{}, sdk.Coins{}, sdk.Coins{}) }, false, }, { - "invalid packetID: invalid fee", + "invalid packet fee: invalid refund address", func() { - fee = types.Fee{ - sdk.Coins{}, - sdk.Coins{}, - sdk.Coins{}, - } + genState.IdentifiedFees[0].PacketFees[0].RefundAddress = "" }, false, }, { - "invalid packetID: invalid refundAcc", + "invalid fee enabled channel: invalid port ID", func() { - refundAcc = "" + genState.FeeEnabledChannels[0].PortId = "" }, false, }, { - "invalid FeeEnabledChannel: invalid ChannelID", + "invalid fee enabled channel: invalid channel ID", func() { - channelID = "" + genState.FeeEnabledChannels[0].ChannelId = "" }, false, }, { - "invalid FeeEnabledChannel: invalid PortID", + "invalid registered relayers: invalid sender", func() { - portID = "" + genState.RegisteredRelayers[0].Address = "" }, false, }, { - "invalid RegisteredRelayers: invalid sender", + "invalid registered relayers: invalid counterparty", func() { - sender = "" + genState.RegisteredRelayers[0].CounterpartyAddress = "" }, false, }, { - "invalid RegisteredRelayers: invalid counterparty", + "invalid forward relayer address: invalid forward address", func() { - counterparty = " " + genState.ForwardRelayers[0].Address = "" }, false, }, { - "invalid ForwardRelayerAddress: invalid forwardAddr", + "invalid forward relayer address: invalid packet", func() { - forwardAddr = "" + genState.ForwardRelayers[0].PacketId = channeltypes.PacketId{} }, false, }, { - "invalid ForwardRelayerAddress: invalid packet", + "invalid distribution address: invalid relayer address", func() { - packetChannelID = "1" + genState.RegisteredDistributionAddresses[0].Address = "" + }, + false, + }, + { + "invalid distribution address: invalid distribution address", + func() { + genState.RegisteredDistributionAddresses[0].DistributionAddress = "" + }, + false, + }, + { + "invalid distribution address: invalid channel ID", + func() { + genState.RegisteredDistributionAddresses[0].ChannelId = "" }, false, }, } for _, tc := range testCases { - portID = transfertypes.PortID - channelID = ibctesting.FirstChannelID - packetChannelID = ibctesting.FirstChannelID - seq = uint64(1) - - // build PacketId & Fee - packetID = channeltypes.NewPacketId( - portID, - channelID, - seq, - ) - fee = types.Fee{ - validCoins, - validCoins2, - validCoins3, - } - - refundAcc = addr1 - - // relayer addresses - sender = addr1 - counterparty = addr2 - forwardAddr = addr2 - tc.malleate() - - genState := types.GenesisState{ + genState = &types.GenesisState{ IdentifiedFees: []types.IdentifiedPacketFees{ { - PacketId: packetID, - PacketFees: []types.PacketFee{ - { - Fee: fee, - RefundAddress: refundAcc, - Relayers: nil, - }, - }, + PacketId: channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), + PacketFees: []types.PacketFee{types.NewPacketFee(types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee), defaultAccAddress, nil)}, }, }, FeeEnabledChannels: []types.FeeEnabledChannel{ { - PortId: portID, - ChannelId: channelID, + PortId: ibctesting.MockFeePort, + ChannelId: ibctesting.FirstChannelID, }, }, RegisteredRelayers: []types.RegisteredRelayerAddress{ { - Address: sender, - CounterpartyAddress: counterparty, + Address: defaultAccAddress, + CounterpartyAddress: defaultAccAddress, }, }, ForwardRelayers: []types.ForwardRelayerAddress{ { - Address: forwardAddr, - PacketId: channeltypes.NewPacketId(portID, packetChannelID, 1), + Address: defaultAccAddress, + PacketId: channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), + }, + }, + RegisteredDistributionAddresses: []types.RegisteredDistributionAddress{ + { + Address: defaultAccAddress, + DistributionAddress: defaultAccAddress, + ChannelId: ibctesting.FirstChannelID, }, }, } + tc.malleate() + err := genState.Validate() + if tc.expPass { require.NoError(t, err, tc.name) } else { @@ -208,8 +176,3 @@ func TestValidateGenesis(t *testing.T) { } } } - -func TestValidateDefaultGenesis(t *testing.T) { - err := types.DefaultGenesisState().Validate() - require.NoError(t, err) -} From e09d0d30da99c3c3f6eb20812dc7d2945250c22f Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 6 Jun 2022 12:30:47 +0200 Subject: [PATCH 05/12] adding cli for register distribution address rpc --- modules/apps/29-fee/client/cli/cli.go | 3 ++- modules/apps/29-fee/client/cli/tx.go | 29 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/apps/29-fee/client/cli/cli.go b/modules/apps/29-fee/client/cli/cli.go index a0141c20f9a..6331d77df30 100644 --- a/modules/apps/29-fee/client/cli/cli.go +++ b/modules/apps/29-fee/client/cli/cli.go @@ -41,7 +41,8 @@ func NewTxCmd() *cobra.Command { txCmd.AddCommand( NewPayPacketFeeAsyncTxCmd(), - NewRegisterCounterpartyAddress(), + NewRegisterCounterpartyAddressCmd(), + NewRegisterDistributionAddressCmd(), ) return txCmd diff --git a/modules/apps/29-fee/client/cli/tx.go b/modules/apps/29-fee/client/cli/tx.go index 9c972316d91..d445ff47d8a 100644 --- a/modules/apps/29-fee/client/cli/tx.go +++ b/modules/apps/29-fee/client/cli/tx.go @@ -98,8 +98,8 @@ func NewPayPacketFeeAsyncTxCmd() *cobra.Command { return cmd } -// NewRegisterCounterpartyAddress returns the command to create a MsgRegisterCounterpartyAddress -func NewRegisterCounterpartyAddress() *cobra.Command { +// NewRegisterCounterpartyAddressCmd returns the command to create a MsgRegisterCounterpartyAddress +func NewRegisterCounterpartyAddressCmd() *cobra.Command { cmd := &cobra.Command{ Use: "register-counterparty [port-id] [channel-id] [address] [counterparty-address] ", Short: "Register a counterparty relayer address on a given channel.", @@ -122,3 +122,28 @@ func NewRegisterCounterpartyAddress() *cobra.Command { return cmd } + +// NewRegisterDistributionAddressCmd returns the command to create a MsgRegisterDistributionAddress +func NewRegisterDistributionAddressCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "register-distribution-address [port-id] [channel-id] [address] [distribution-address] ", + Short: "Register a distribution address on a given channel.", + Long: strings.TrimSpace(`Register a distribution address on a given channel.`), + Example: fmt.Sprintf("%s tx ibc-fee register-distribution-address transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5", version.AppName), + Args: cobra.ExactArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgRegisterDistributionAddress(args[0], args[1], args[2], args[3]) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} From e4e7d014511bc7ff4e74ffa3cbe4dc630faca3e3 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 7 Jun 2022 17:36:39 +0200 Subject: [PATCH 06/12] renaming RegisterDistributionAddress rpc to RegisterPayee --- docs/ibc/proto-docs.md | 22 +- modules/apps/29-fee/client/cli/cli.go | 2 +- modules/apps/29-fee/client/cli/tx.go | 50 +- modules/apps/29-fee/keeper/msg_server.go | 36 +- modules/apps/29-fee/keeper/msg_server_test.go | 92 ++-- modules/apps/29-fee/types/msgs.go | 48 +- modules/apps/29-fee/types/msgs_test.go | 42 +- modules/apps/29-fee/types/tx.pb.go | 431 +++++++++--------- proto/ibc/applications/fee/v1/tx.proto | 46 +- 9 files changed, 385 insertions(+), 384 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 2495830bdbd..02763055263 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -72,8 +72,8 @@ - [MsgPayPacketFeeResponse](#ibc.applications.fee.v1.MsgPayPacketFeeResponse) - [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) - [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) - - [MsgRegisterDistributionAddress](#ibc.applications.fee.v1.MsgRegisterDistributionAddress) - - [MsgRegisterDistributionAddressResponse](#ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse) + - [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) + - [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) - [Msg](#ibc.applications.fee.v1.Msg) @@ -1315,28 +1315,28 @@ MsgRegisterCounterpartyAddressResponse defines the response type for the Registe - + -### MsgRegisterDistributionAddress -MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc +### MsgRegisterPayee +MsgRegisterPayee defines the request type for the RegisterPayee rpc | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | the relayer address | -| `distribution_address` | [string](#string) | | the fee distribution address | | `port_id` | [string](#string) | | unique port identifier | | `channel_id` | [string](#string) | | unique channel identifier | +| `relayer_address` | [string](#string) | | the relayer address | +| `distribution_address` | [string](#string) | | the fee distribution address | - + -### MsgRegisterDistributionAddressResponse -MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc +### MsgRegisterPayeeResponse +MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc @@ -1356,8 +1356,8 @@ Msg defines the ICS29 Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | +| `RegisterPayee` | [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) | [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) | RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional distribution address to which escrowed packet fees will be paid out. The distribution address should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest distribution address is always used. | | | `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | | -| `RegisterDistributionAddress` | [MsgRegisterDistributionAddress](#ibc.applications.fee.v1.MsgRegisterDistributionAddress) | [MsgRegisterDistributionAddressResponse](#ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse) | RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional distribution address to which escrowed packet fees will be paid out. The distribution address should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest distribution address is always used. | | | `PayPacketFee` | [MsgPayPacketFee](#ibc.applications.fee.v1.MsgPayPacketFee) | [MsgPayPacketFeeResponse](#ibc.applications.fee.v1.MsgPayPacketFeeResponse) | PayPacketFee defines a rpc handler method for MsgPayPacketFee PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of the packet at the next sequence NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows initiates the lifecycle of the incentivized packet | | | `PayPacketFeeAsync` | [MsgPayPacketFeeAsync](#ibc.applications.fee.v1.MsgPayPacketFeeAsync) | [MsgPayPacketFeeAsyncResponse](#ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse) | PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of a known packet (i.e. at a particular sequence) | | diff --git a/modules/apps/29-fee/client/cli/cli.go b/modules/apps/29-fee/client/cli/cli.go index 6331d77df30..1306efa84b9 100644 --- a/modules/apps/29-fee/client/cli/cli.go +++ b/modules/apps/29-fee/client/cli/cli.go @@ -40,9 +40,9 @@ func NewTxCmd() *cobra.Command { } txCmd.AddCommand( + NewRegisterPayeeCmd(), NewPayPacketFeeAsyncTxCmd(), NewRegisterCounterpartyAddressCmd(), - NewRegisterDistributionAddressCmd(), ) return txCmd diff --git a/modules/apps/29-fee/client/cli/tx.go b/modules/apps/29-fee/client/cli/tx.go index d445ff47d8a..a765b2391bb 100644 --- a/modules/apps/29-fee/client/cli/tx.go +++ b/modules/apps/29-fee/client/cli/tx.go @@ -22,6 +22,31 @@ const ( flagTimeoutFee = "timeout-fee" ) +// NewRegisterPayeeCmd returns the command to create a MsgRegisterPayee +func NewRegisterPayeeCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "register-payee [port-id] [channel-id] [relayer-address] [distribution-address] ", + Short: "Register a payee on a given channel.", + Long: strings.TrimSpace(`Register a payee's distribution address on a given channel.`), + Example: fmt.Sprintf("%s tx ibc-fee register-payee transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5", version.AppName), + Args: cobra.ExactArgs(4), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgRegisterPayee(args[0], args[1], args[2], args[3]) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + // NewPayPacketFeeAsyncTxCmd returns the command to create a MsgPayPacketFeeAsync func NewPayPacketFeeAsyncTxCmd() *cobra.Command { cmd := &cobra.Command{ @@ -122,28 +147,3 @@ func NewRegisterCounterpartyAddressCmd() *cobra.Command { return cmd } - -// NewRegisterDistributionAddressCmd returns the command to create a MsgRegisterDistributionAddress -func NewRegisterDistributionAddressCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "register-distribution-address [port-id] [channel-id] [address] [distribution-address] ", - Short: "Register a distribution address on a given channel.", - Long: strings.TrimSpace(`Register a distribution address on a given channel.`), - Example: fmt.Sprintf("%s tx ibc-fee register-distribution-address transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5", version.AppName), - Args: cobra.ExactArgs(4), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msg := types.NewMsgRegisterDistributionAddress(args[0], args[1], args[2], args[3]) - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index 3abb1dd46ff..abaa6116a2c 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -12,13 +12,15 @@ import ( var _ types.MsgServer = Keeper{} -// RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying -// This ensures they will be properly compensated for forward relaying on the source chain since the destination chain must send back relayer's source address (counterparty address) in acknowledgement -// This function may be called more than once by relayers, in which case, the previous counterparty address will be overwritten by the new counterparty address -func (k Keeper) RegisterCounterpartyAddress(goCtx context.Context, msg *types.MsgRegisterCounterpartyAddress) (*types.MsgRegisterCounterpartyAddressResponse, error) { +// RegisterPayee defines a rpc handler method for MsgRegisterPayee +// RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional +// distribution address to which escrowed packet fees will be paid out. The distribution address should be registered +// on the source chain from which packets originate as this is where fee distribution takes place. This function may +// be called more than once by a relayer, in which case, the latest distribution address is always used. +func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee) (*types.MsgRegisterPayeeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // only register counterparty address if the channel exists and is fee enabled + // only register distribution address if the channel exists and is fee enabled if _, found := k.channelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId); !found { return nil, channeltypes.ErrChannelNotFound } @@ -27,22 +29,20 @@ func (k Keeper) RegisterCounterpartyAddress(goCtx context.Context, msg *types.Ms return nil, types.ErrFeeNotEnabled } - k.SetCounterpartyAddress(ctx, msg.Address, msg.CounterpartyAddress, msg.ChannelId) + k.SetDistributionAddress(ctx, msg.RelayerAddress, msg.DistributionAddress, msg.ChannelId) - k.Logger(ctx).Info("registering counterparty address for relayer", "address", msg.Address, "counterparty address", msg.CounterpartyAddress, "channel", msg.ChannelId) + k.Logger(ctx).Info("registering distribution address for relayer", "address", msg.RelayerAddress, "distribution address", msg.DistributionAddress, "channel", msg.ChannelId) - return &types.MsgRegisterCounterpartyAddressResponse{}, nil + return &types.MsgRegisterPayeeResponse{}, nil } -// RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress -// RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional -// distribution address to which escrowed packet fees will be paid out. The distribution address should be registered -// on the source chain from which packets originate as this is where fee distribution takes place. This function may -// be called more than once by a relayer, in which case, the latest distribution address is always used. -func (k Keeper) RegisterDistributionAddress(goCtx context.Context, msg *types.MsgRegisterDistributionAddress) (*types.MsgRegisterDistributionAddressResponse, error) { +// RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying +// This ensures they will be properly compensated for forward relaying on the source chain since the destination chain must send back relayer's source address (counterparty address) in acknowledgement +// This function may be called more than once by relayers, in which case, the previous counterparty address will be overwritten by the new counterparty address +func (k Keeper) RegisterCounterpartyAddress(goCtx context.Context, msg *types.MsgRegisterCounterpartyAddress) (*types.MsgRegisterCounterpartyAddressResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // only register distribution address if the channel exists and is fee enabled + // only register counterparty address if the channel exists and is fee enabled if _, found := k.channelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId); !found { return nil, channeltypes.ErrChannelNotFound } @@ -51,11 +51,11 @@ func (k Keeper) RegisterDistributionAddress(goCtx context.Context, msg *types.Ms return nil, types.ErrFeeNotEnabled } - k.SetDistributionAddress(ctx, msg.Address, msg.DistributionAddress, msg.ChannelId) + k.SetCounterpartyAddress(ctx, msg.Address, msg.CounterpartyAddress, msg.ChannelId) - k.Logger(ctx).Info("registering distribution address for relayer", "address", msg.Address, "distribution address", msg.DistributionAddress, "channel", msg.ChannelId) + k.Logger(ctx).Info("registering counterparty address for relayer", "address", msg.Address, "counterparty address", msg.CounterpartyAddress, "channel", msg.ChannelId) - return &types.MsgRegisterDistributionAddressResponse{}, nil + return &types.MsgRegisterCounterpartyAddressResponse{}, nil } // PayPacketFee defines a rpc handler method for MsgPayPacketFee diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index cb56c0bd404..814755457ab 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -9,12 +9,9 @@ import ( ibctesting "github.com/cosmos/ibc-go/v3/testing" ) -func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { +func (suite *KeeperTestSuite) TestRegisterPayee() { var ( - sender string - counterparty string - channelID string - ctx sdk.Context + msg *types.MsgRegisterPayee ) testCases := []struct { @@ -27,53 +24,61 @@ func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { true, func() {}, }, - { - "counterparty is an arbitrary string", - true, - func() { counterparty = "arbitrary-string" }, - }, { "channel does not exist", false, - func() { channelID = "channel-22" }, + func() { + msg.ChannelId = "channel-100" + }, }, { "channel is not fee enabled", false, func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(ctx, suite.path.EndpointA.ChannelConfig.PortID, channelID) + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) }, }, } for _, tc := range testCases { suite.SetupTest() - ctx = suite.chainA.GetContext() - suite.coordinator.Setup(suite.path) // setup channel + suite.coordinator.Setup(suite.path) - sender = suite.chainA.SenderAccount.GetAddress().String() - counterparty = suite.chainB.SenderAccount.GetAddress().String() - channelID = suite.path.EndpointA.ChannelID + msg = types.NewMsgRegisterPayee( + suite.path.EndpointA.ChannelConfig.PortID, + suite.path.EndpointA.ChannelID, + suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), + suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), + ) tc.malleate() - msg := types.NewMsgRegisterCounterpartyAddress(suite.path.EndpointA.ChannelConfig.PortID, channelID, sender, counterparty) - _, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterCounterpartyAddress(sdk.WrapSDKContext(ctx), msg) + res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterPayee(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) if tc.expPass { - suite.Require().NoError(err) // message committed + suite.Require().NoError(err) + suite.Require().NotNil(res) - counterpartyAddress, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetCounterpartyAddress(ctx, suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) - suite.Require().Equal(counterparty, counterpartyAddress) + distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress( + suite.chainA.GetContext(), + suite.chainA.SenderAccount.GetAddress().String(), + suite.path.EndpointA.ChannelID, + ) + + suite.Require().True(found) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) } else { suite.Require().Error(err) } } } -func (suite *KeeperTestSuite) TestRegisterDistributionAddress() { +func (suite *KeeperTestSuite) TestRegisterCounterpartyAddress() { var ( - msg *types.MsgRegisterDistributionAddress + sender string + counterparty string + channelID string + ctx sdk.Context ) testCases := []struct { @@ -86,49 +91,44 @@ func (suite *KeeperTestSuite) TestRegisterDistributionAddress() { true, func() {}, }, + { + "counterparty is an arbitrary string", + true, + func() { counterparty = "arbitrary-string" }, + }, { "channel does not exist", false, - func() { - msg.ChannelId = "channel-100" - }, + func() { channelID = "channel-22" }, }, { "channel is not fee enabled", false, func() { - suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(suite.chainA.GetContext(), suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) + suite.chainA.GetSimApp().IBCFeeKeeper.DeleteFeeEnabled(ctx, suite.path.EndpointA.ChannelConfig.PortID, channelID) }, }, } for _, tc := range testCases { suite.SetupTest() - suite.coordinator.Setup(suite.path) + ctx = suite.chainA.GetContext() + suite.coordinator.Setup(suite.path) // setup channel - msg = types.NewMsgRegisterDistributionAddress( - suite.path.EndpointA.ChannelConfig.PortID, - suite.path.EndpointA.ChannelID, - suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), - suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), - ) + sender = suite.chainA.SenderAccount.GetAddress().String() + counterparty = suite.chainB.SenderAccount.GetAddress().String() + channelID = suite.path.EndpointA.ChannelID tc.malleate() - res, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterDistributionAddress(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) + msg := types.NewMsgRegisterCounterpartyAddress(suite.path.EndpointA.ChannelConfig.PortID, channelID, sender, counterparty) + _, err := suite.chainA.GetSimApp().IBCFeeKeeper.RegisterCounterpartyAddress(sdk.WrapSDKContext(ctx), msg) if tc.expPass { - suite.Require().NoError(err) - suite.Require().NotNil(res) - - distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress( - suite.chainA.GetContext(), - suite.chainA.SenderAccount.GetAddress().String(), - suite.path.EndpointA.ChannelID, - ) + suite.Require().NoError(err) // message committed - suite.Require().True(found) - suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) + 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/types/msgs.go b/modules/apps/29-fee/types/msgs.go index ead7fa72f89..8a7b43470cc 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -16,33 +16,31 @@ const ( TypeMsgPayPacketFeeAsync = "payPacketFeeAsync" ) -// NewMsgRegisterCounterpartyAddress creates a new instance of MsgRegisterCounterpartyAddress -func NewMsgRegisterCounterpartyAddress(portID, channelID, address, counterpartyAddress string) *MsgRegisterCounterpartyAddress { - return &MsgRegisterCounterpartyAddress{ - Address: address, - CounterpartyAddress: counterpartyAddress, +// NewMsgRegisterPayee creates a new instance of MsgRegisterPayee +func NewMsgRegisterPayee(portID, channelID, relayerAddr, distributionAddr string) *MsgRegisterPayee { + return &MsgRegisterPayee{ + RelayerAddress: relayerAddr, + DistributionAddress: distributionAddr, PortId: portID, ChannelId: channelID, } } -// ValidateBasic performs a basic check of the MsgRegisterCounterpartyAddress fields -func (msg MsgRegisterCounterpartyAddress) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Address) +// ValidateBasic implements sdk.Msg and performs basic stateless validation +func (msg MsgRegisterPayee) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.RelayerAddress) if err != nil { return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") } - if strings.TrimSpace(msg.CounterpartyAddress) == "" { - return ErrCounterpartyAddressEmpty + if strings.TrimSpace(msg.DistributionAddress) == "" { + return ErrDistributionAddressEmpty } - // validate portId if err := host.PortIdentifierValidator(msg.PortId); err != nil { return err } - // validate channelId if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { return err } @@ -51,39 +49,42 @@ func (msg MsgRegisterCounterpartyAddress) ValidateBasic() error { } // GetSigners implements sdk.Msg -func (msg MsgRegisterCounterpartyAddress) GetSigners() []sdk.AccAddress { - signer, err := sdk.AccAddressFromBech32(msg.Address) +func (msg MsgRegisterPayee) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(msg.RelayerAddress) if err != nil { panic(err) } + return []sdk.AccAddress{signer} } -// NewMsgRegisterDistributionAddress creates a new instance of MsgRegisterDistributionAddress -func NewMsgRegisterDistributionAddress(portID, channelID, address, distributionAddress string) *MsgRegisterDistributionAddress { - return &MsgRegisterDistributionAddress{ +// NewMsgRegisterCounterpartyAddress creates a new instance of MsgRegisterCounterpartyAddress +func NewMsgRegisterCounterpartyAddress(portID, channelID, address, counterpartyAddress string) *MsgRegisterCounterpartyAddress { + return &MsgRegisterCounterpartyAddress{ Address: address, - DistributionAddress: distributionAddress, + CounterpartyAddress: counterpartyAddress, PortId: portID, ChannelId: channelID, } } -// ValidateBasic implements sdk.Msg and performs basic stateless validation -func (msg MsgRegisterDistributionAddress) ValidateBasic() error { +// ValidateBasic performs a basic check of the MsgRegisterCounterpartyAddress fields +func (msg MsgRegisterCounterpartyAddress) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") } - if strings.TrimSpace(msg.DistributionAddress) == "" { - return ErrDistributionAddressEmpty + if strings.TrimSpace(msg.CounterpartyAddress) == "" { + return ErrCounterpartyAddressEmpty } + // validate portId if err := host.PortIdentifierValidator(msg.PortId); err != nil { return err } + // validate channelId if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { return err } @@ -92,12 +93,11 @@ func (msg MsgRegisterDistributionAddress) ValidateBasic() error { } // GetSigners implements sdk.Msg -func (msg MsgRegisterDistributionAddress) GetSigners() []sdk.AccAddress { +func (msg MsgRegisterCounterpartyAddress) GetSigners() []sdk.AccAddress { signer, err := sdk.AccAddressFromBech32(msg.Address) if err != nil { panic(err) } - return []sdk.AccAddress{signer} } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index d28f99a63bd..89fe7b58e00 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -12,8 +12,8 @@ import ( "github.com/tendermint/tendermint/crypto/secp256k1" ) -func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { - var msg *types.MsgRegisterCounterpartyAddress +func TestMsgRegisterPayeeValidation(t *testing.T) { + var msg *types.MsgRegisterPayee testCases := []struct { name string @@ -26,23 +26,23 @@ func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { true, }, { - "validate with incorrect destination relayer address", + "validate with invalid relayer address", func() { - msg.Address = "invalid-address" + msg.RelayerAddress = "invalid-address" }, false, }, { - "invalid counterparty address", + "invalid distribution address", func() { - msg.CounterpartyAddress = "" + msg.DistributionAddress = "" }, false, }, { - "invalid counterparty address: whitespaced empty string", + "invalid distribution address: whitespaced empty string", func() { - msg.CounterpartyAddress = " " + msg.DistributionAddress = " " }, false, }, @@ -63,7 +63,7 @@ func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { } for i, tc := range testCases { - msg = types.NewMsgRegisterCounterpartyAddress(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) + msg = types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) tc.malleate() @@ -77,14 +77,14 @@ func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { } } -func TestRegisterCountepartyAddressGetSigners(t *testing.T) { +func TestRegisterPayeeGetSigners(t *testing.T) { accAddress := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) - msg := types.NewMsgRegisterCounterpartyAddress(ibctesting.MockPort, ibctesting.FirstChannelID, accAddress.String(), defaultAccAddress) + msg := types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, accAddress.String(), defaultAccAddress) require.Equal(t, []sdk.AccAddress{sdk.AccAddress(accAddress)}, msg.GetSigners()) } -func TestMsgRegisterDistributionAddressValidation(t *testing.T) { - var msg *types.MsgRegisterDistributionAddress +func TestMsgRegisterCountepartyAddressValidation(t *testing.T) { + var msg *types.MsgRegisterCounterpartyAddress testCases := []struct { name string @@ -97,23 +97,23 @@ func TestMsgRegisterDistributionAddressValidation(t *testing.T) { true, }, { - "validate with invalid relayer address", + "validate with incorrect destination relayer address", func() { msg.Address = "invalid-address" }, false, }, { - "invalid distribution address", + "invalid counterparty address", func() { - msg.DistributionAddress = "" + msg.CounterpartyAddress = "" }, false, }, { - "invalid distribution address: whitespaced empty string", + "invalid counterparty address: whitespaced empty string", func() { - msg.DistributionAddress = " " + msg.CounterpartyAddress = " " }, false, }, @@ -134,7 +134,7 @@ func TestMsgRegisterDistributionAddressValidation(t *testing.T) { } for i, tc := range testCases { - msg = types.NewMsgRegisterDistributionAddress(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) + msg = types.NewMsgRegisterCounterpartyAddress(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) tc.malleate() @@ -148,9 +148,9 @@ func TestMsgRegisterDistributionAddressValidation(t *testing.T) { } } -func TestRegisterDistributionAddressGetSigners(t *testing.T) { +func TestRegisterCountepartyAddressGetSigners(t *testing.T) { accAddress := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) - msg := types.NewMsgRegisterDistributionAddress(ibctesting.MockPort, ibctesting.FirstChannelID, accAddress.String(), defaultAccAddress) + msg := types.NewMsgRegisterCounterpartyAddress(ibctesting.MockPort, ibctesting.FirstChannelID, accAddress.String(), defaultAccAddress) require.Equal(t, []sdk.AccAddress{sdk.AccAddress(accAddress)}, msg.GetSigners()) } diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index a12326a16c9..40d6133e799 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -29,30 +29,30 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgRegisterCounterpartyAddress defines the request type for the RegisterCounterpartyAddress rpc -type MsgRegisterCounterpartyAddress struct { - // the relayer address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // the counterparty relayer address - CounterpartyAddress string `protobuf:"bytes,2,opt,name=counterparty_address,json=counterpartyAddress,proto3" json:"counterparty_address,omitempty" yaml:"counterparty_address"` +// MsgRegisterPayee defines the request type for the RegisterPayee rpc +type MsgRegisterPayee struct { // unique port identifier - PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` // unique channel identifier - ChannelId string `protobuf:"bytes,4,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` + // the relayer address + RelayerAddress string `protobuf:"bytes,3,opt,name=relayer_address,json=relayerAddress,proto3" json:"relayer_address,omitempty" yaml:"relayer_address"` + // the fee distribution address + DistributionAddress string `protobuf:"bytes,4,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` } -func (m *MsgRegisterCounterpartyAddress) Reset() { *m = MsgRegisterCounterpartyAddress{} } -func (m *MsgRegisterCounterpartyAddress) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterCounterpartyAddress) ProtoMessage() {} -func (*MsgRegisterCounterpartyAddress) Descriptor() ([]byte, []int) { +func (m *MsgRegisterPayee) Reset() { *m = MsgRegisterPayee{} } +func (m *MsgRegisterPayee) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterPayee) ProtoMessage() {} +func (*MsgRegisterPayee) Descriptor() ([]byte, []int) { return fileDescriptor_05c93128649f1b96, []int{0} } -func (m *MsgRegisterCounterpartyAddress) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterPayee) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRegisterCounterpartyAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterPayee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRegisterCounterpartyAddress.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterPayee.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -62,36 +62,34 @@ func (m *MsgRegisterCounterpartyAddress) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *MsgRegisterCounterpartyAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterCounterpartyAddress.Merge(m, src) +func (m *MsgRegisterPayee) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterPayee.Merge(m, src) } -func (m *MsgRegisterCounterpartyAddress) XXX_Size() int { +func (m *MsgRegisterPayee) XXX_Size() int { return m.Size() } -func (m *MsgRegisterCounterpartyAddress) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterCounterpartyAddress.DiscardUnknown(m) +func (m *MsgRegisterPayee) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterPayee.DiscardUnknown(m) } -var xxx_messageInfo_MsgRegisterCounterpartyAddress proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterPayee proto.InternalMessageInfo -// MsgRegisterCounterpartyAddressResponse defines the response type for the RegisterCounterpartyAddress rpc -type MsgRegisterCounterpartyAddressResponse struct { +// MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc +type MsgRegisterPayeeResponse struct { } -func (m *MsgRegisterCounterpartyAddressResponse) Reset() { - *m = MsgRegisterCounterpartyAddressResponse{} -} -func (m *MsgRegisterCounterpartyAddressResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterCounterpartyAddressResponse) ProtoMessage() {} -func (*MsgRegisterCounterpartyAddressResponse) Descriptor() ([]byte, []int) { +func (m *MsgRegisterPayeeResponse) Reset() { *m = MsgRegisterPayeeResponse{} } +func (m *MsgRegisterPayeeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterPayeeResponse) ProtoMessage() {} +func (*MsgRegisterPayeeResponse) Descriptor() ([]byte, []int) { return fileDescriptor_05c93128649f1b96, []int{1} } -func (m *MsgRegisterCounterpartyAddressResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterPayeeResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRegisterCounterpartyAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterPayeeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterPayeeResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -101,42 +99,42 @@ func (m *MsgRegisterCounterpartyAddressResponse) XXX_Marshal(b []byte, determini return b[:n], nil } } -func (m *MsgRegisterCounterpartyAddressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.Merge(m, src) +func (m *MsgRegisterPayeeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterPayeeResponse.Merge(m, src) } -func (m *MsgRegisterCounterpartyAddressResponse) XXX_Size() int { +func (m *MsgRegisterPayeeResponse) XXX_Size() int { return m.Size() } -func (m *MsgRegisterCounterpartyAddressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.DiscardUnknown(m) +func (m *MsgRegisterPayeeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterPayeeResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRegisterCounterpartyAddressResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterPayeeResponse proto.InternalMessageInfo -// MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc -type MsgRegisterDistributionAddress struct { +// MsgRegisterCounterpartyAddress defines the request type for the RegisterCounterpartyAddress rpc +type MsgRegisterCounterpartyAddress struct { // the relayer address Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // the fee distribution address - DistributionAddress string `protobuf:"bytes,2,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` + // the counterparty relayer address + CounterpartyAddress string `protobuf:"bytes,2,opt,name=counterparty_address,json=counterpartyAddress,proto3" json:"counterparty_address,omitempty" yaml:"counterparty_address"` // unique port identifier PortId string `protobuf:"bytes,3,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty" yaml:"port_id"` // unique channel identifier ChannelId string `protobuf:"bytes,4,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` } -func (m *MsgRegisterDistributionAddress) Reset() { *m = MsgRegisterDistributionAddress{} } -func (m *MsgRegisterDistributionAddress) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterDistributionAddress) ProtoMessage() {} -func (*MsgRegisterDistributionAddress) Descriptor() ([]byte, []int) { +func (m *MsgRegisterCounterpartyAddress) Reset() { *m = MsgRegisterCounterpartyAddress{} } +func (m *MsgRegisterCounterpartyAddress) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCounterpartyAddress) ProtoMessage() {} +func (*MsgRegisterCounterpartyAddress) Descriptor() ([]byte, []int) { return fileDescriptor_05c93128649f1b96, []int{2} } -func (m *MsgRegisterDistributionAddress) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterCounterpartyAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRegisterDistributionAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterCounterpartyAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRegisterDistributionAddress.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterCounterpartyAddress.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -146,36 +144,36 @@ func (m *MsgRegisterDistributionAddress) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *MsgRegisterDistributionAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterDistributionAddress.Merge(m, src) +func (m *MsgRegisterCounterpartyAddress) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCounterpartyAddress.Merge(m, src) } -func (m *MsgRegisterDistributionAddress) XXX_Size() int { +func (m *MsgRegisterCounterpartyAddress) XXX_Size() int { return m.Size() } -func (m *MsgRegisterDistributionAddress) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterDistributionAddress.DiscardUnknown(m) +func (m *MsgRegisterCounterpartyAddress) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCounterpartyAddress.DiscardUnknown(m) } -var xxx_messageInfo_MsgRegisterDistributionAddress proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterCounterpartyAddress proto.InternalMessageInfo -// MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc -type MsgRegisterDistributionAddressResponse struct { +// MsgRegisterCounterpartyAddressResponse defines the response type for the RegisterCounterpartyAddress rpc +type MsgRegisterCounterpartyAddressResponse struct { } -func (m *MsgRegisterDistributionAddressResponse) Reset() { - *m = MsgRegisterDistributionAddressResponse{} +func (m *MsgRegisterCounterpartyAddressResponse) Reset() { + *m = MsgRegisterCounterpartyAddressResponse{} } -func (m *MsgRegisterDistributionAddressResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRegisterDistributionAddressResponse) ProtoMessage() {} -func (*MsgRegisterDistributionAddressResponse) Descriptor() ([]byte, []int) { +func (m *MsgRegisterCounterpartyAddressResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRegisterCounterpartyAddressResponse) ProtoMessage() {} +func (*MsgRegisterCounterpartyAddressResponse) Descriptor() ([]byte, []int) { return fileDescriptor_05c93128649f1b96, []int{3} } -func (m *MsgRegisterDistributionAddressResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRegisterCounterpartyAddressResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgRegisterDistributionAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRegisterCounterpartyAddressResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgRegisterDistributionAddressResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -185,17 +183,17 @@ func (m *MsgRegisterDistributionAddressResponse) XXX_Marshal(b []byte, determini return b[:n], nil } } -func (m *MsgRegisterDistributionAddressResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRegisterDistributionAddressResponse.Merge(m, src) +func (m *MsgRegisterCounterpartyAddressResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.Merge(m, src) } -func (m *MsgRegisterDistributionAddressResponse) XXX_Size() int { +func (m *MsgRegisterCounterpartyAddressResponse) XXX_Size() int { return m.Size() } -func (m *MsgRegisterDistributionAddressResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRegisterDistributionAddressResponse.DiscardUnknown(m) +func (m *MsgRegisterCounterpartyAddressResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRegisterCounterpartyAddressResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgRegisterDistributionAddressResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRegisterCounterpartyAddressResponse proto.InternalMessageInfo // MsgPayPacketFee defines the request type for the PayPacketFee rpc // This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be @@ -363,10 +361,10 @@ func (m *MsgPayPacketFeeAsyncResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgPayPacketFeeAsyncResponse proto.InternalMessageInfo func init() { + proto.RegisterType((*MsgRegisterPayee)(nil), "ibc.applications.fee.v1.MsgRegisterPayee") + proto.RegisterType((*MsgRegisterPayeeResponse)(nil), "ibc.applications.fee.v1.MsgRegisterPayeeResponse") proto.RegisterType((*MsgRegisterCounterpartyAddress)(nil), "ibc.applications.fee.v1.MsgRegisterCounterpartyAddress") proto.RegisterType((*MsgRegisterCounterpartyAddressResponse)(nil), "ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse") - proto.RegisterType((*MsgRegisterDistributionAddress)(nil), "ibc.applications.fee.v1.MsgRegisterDistributionAddress") - proto.RegisterType((*MsgRegisterDistributionAddressResponse)(nil), "ibc.applications.fee.v1.MsgRegisterDistributionAddressResponse") proto.RegisterType((*MsgPayPacketFee)(nil), "ibc.applications.fee.v1.MsgPayPacketFee") proto.RegisterType((*MsgPayPacketFeeResponse)(nil), "ibc.applications.fee.v1.MsgPayPacketFeeResponse") proto.RegisterType((*MsgPayPacketFeeAsync)(nil), "ibc.applications.fee.v1.MsgPayPacketFeeAsync") @@ -376,51 +374,54 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xbf, 0x4f, 0xdb, 0x40, - 0x14, 0xc7, 0x63, 0x42, 0x81, 0x5c, 0x11, 0x34, 0x06, 0x4a, 0x08, 0xd4, 0xa6, 0x1e, 0xaa, 0x48, - 0x15, 0x76, 0xf9, 0xa5, 0xaa, 0x2c, 0x88, 0x50, 0xa1, 0x32, 0xa0, 0xa2, 0x53, 0xa7, 0xaa, 0x12, - 0x72, 0xce, 0x2f, 0xc6, 0x6d, 0x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fe, 0xf3, 0x6a, 0x6e, 0x4d, 0x1a, 0x26, 0x96, 0x57, - 0xf7, 0xff, 0x4a, 0x9e, 0xa6, 0xae, 0xbf, 0xbd, 0xb9, 0x53, 0xa4, 0xdb, 0x3b, 0x45, 0xfa, 0x71, - 0xa7, 0x48, 0x57, 0xf7, 0x4a, 0xe1, 0xf6, 0x5e, 0x29, 0x7c, 0xbf, 0x57, 0x0a, 0xef, 0xf7, 0x6d, - 0x27, 0xb8, 0xec, 0x34, 0x74, 0x42, 0xdb, 0x06, 0xa1, 0xac, 0x4d, 0x99, 0xe1, 0x34, 0xc8, 0x96, - 0x4d, 0x8d, 0xee, 0xae, 0xd1, 0xa6, 0x56, 0xa7, 0x05, 0x8c, 0xbf, 0x8b, 0xcc, 0xd8, 0x79, 0xb5, - 0xc5, 0x9f, 0xc4, 0x20, 0xf4, 0x80, 0x35, 0x66, 0xe2, 0xf7, 0x6e, 0xf7, 0x77, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x23, 0xd7, 0x5e, 0xd0, 0x88, 0x07, 0x00, 0x00, + // 744 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xbf, 0x4f, 0xdb, 0x4e, + 0x14, 0x8f, 0x13, 0xbe, 0x40, 0x0e, 0xbe, 0x40, 0xcc, 0xaf, 0x60, 0xa8, 0x4d, 0x3d, 0x54, 0xa9, + 0x2a, 0xec, 0x26, 0x80, 0xaa, 0xb2, 0x20, 0x82, 0x84, 0xca, 0x80, 0x1a, 0x9d, 0x3a, 0x55, 0x95, + 0x90, 0x63, 0xbf, 0x18, 0xb7, 0x49, 0xce, 0xf2, 0x39, 0x51, 0xfd, 0x1f, 0x74, 0x64, 0x6b, 0x47, + 0xfe, 0x1c, 0x46, 0x86, 0x0e, 0x9d, 0xac, 0x0a, 0x96, 0xce, 0x96, 0x3a, 0x75, 0xa9, 0x6c, 0x9f, + 0x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c8, 0xf4, 0x1e, + 0x7b, 0xb5, 0x15, 0xf8, 0x52, 0x79, 0x80, 0x23, 0x6b, 0xc1, 0x62, 0x1c, 0x3b, 0x4e, 0xef, 0xee, + 0x1a, 0x9a, 0xa6, 0x96, 0xd9, 0x05, 0x27, 0xb6, 0x0e, 0xb3, 0x15, 0x2f, 0xa0, 0x59, 0x76, 0x41, + 0x69, 0xf9, 0xbf, 0xed, 0x42, 0xa5, 0x88, 0xd3, 0x75, 0xc6, 0xbc, 0x0d, 0xb4, 0x3e, 0xe4, 0x48, + 0xea, 0xd6, 0x57, 0x0e, 0xad, 0x0c, 0xe5, 0x8e, 0xa8, 0xd7, 0xd5, 0xf9, 0x37, 0xa8, 0x68, 0x47, + 0x91, 0x64, 0x24, 0xe7, 0x6a, 0x8f, 0x22, 0xe3, 0xc2, 0xe1, 0x56, 0x92, 0x89, 0xee, 0x57, 0x95, + 0xb8, 0xee, 0xd4, 0xa8, 0x97, 0x43, 0xe7, 0x02, 0x5f, 0x5a, 0x62, 0x57, 0x20, 0xa9, 0x96, 0xf1, + 0xac, 0xcd, 0x30, 0xfc, 0x3b, 0x84, 0x58, 0x3c, 0x3c, 0x8f, 0x7c, 0x44, 0x2b, 0x8f, 0x3d, 0x8f, + 0x54, 0x52, 0x7d, 0x83, 0x71, 0x97, 0x06, 0xb8, 0x5b, 0x00, 0x32, 0x66, 0x32, 0x4f, 0x00, 0x32, + 0x1d, 0x8b, 0x68, 0x6b, 0x54, 0x57, 0x49, 0xdb, 0xb5, 0x9f, 0x05, 0x54, 0x38, 0xa3, 0x26, 0xdf, + 0x41, 0xff, 0x0f, 0xfe, 0x87, 0x9e, 0x8e, 0x15, 0x33, 0x3c, 0x98, 0x42, 0x75, 0x62, 0x68, 0xb2, + 0x2d, 0xff, 0x99, 0x43, 0x9b, 0xf7, 0x0d, 0xf0, 0x8b, 0x49, 0x28, 0x47, 0x14, 0x0a, 0x87, 0xff, + 0x58, 0x98, 0x2a, 0x7b, 0x8f, 0xe6, 0x07, 0x26, 0xa6, 0x72, 0x1f, 0x61, 0x16, 0x29, 0x3c, 0x9f, + 0x14, 0x99, 0xee, 0xe5, 0xa1, 0xd2, 0xdf, 0xf7, 0x6d, 0x67, 0x52, 0x9a, 0x08, 0x2e, 0xec, 0x3f, + 0x08, 0x9e, 0x6c, 0x5d, 0x7f, 0x7d, 0x7d, 0x2b, 0x72, 0x37, 0xb7, 0x22, 0xf7, 0xfd, 0x56, 0xe4, + 0x2e, 0xef, 0xc4, 0xdc, 0xcd, 0x9d, 0x98, 0xfb, 0x76, 0x27, 0xe6, 0xde, 0xee, 0x9b, 0x96, 0x7b, + 0xd1, 0x6b, 0x2a, 0x3a, 0xe9, 0xa8, 0x3a, 0xa1, 0x1d, 0x42, 0x55, 0xab, 0xa9, 0xef, 0x98, 0x44, + 0xed, 0xef, 0xaa, 0x1d, 0x62, 0xf4, 0xda, 0x40, 0xc3, 0xb7, 0x8f, 0xaa, 0xb5, 0x97, 0x3b, 0xe1, + 0xb3, 0xe7, 0x7a, 0x36, 0xd0, 0xe6, 0x74, 0xf4, 0xa6, 0xed, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, + 0xf9, 0xb1, 0x24, 0xfc, 0x6c, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -435,18 +436,18 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // RegisterPayee defines a rpc handler method for MsgRegisterPayee + // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + RegisterPayee(ctx context.Context, in *MsgRegisterPayee, opts ...grpc.CallOption) (*MsgRegisterPayeeResponse, error) // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since // destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function // may be called more than once by a relayer, in which case, the latest counterparty address is always used. RegisterCounterpartyAddress(ctx context.Context, in *MsgRegisterCounterpartyAddress, opts ...grpc.CallOption) (*MsgRegisterCounterpartyAddressResponse, error) - // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress - // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. - RegisterDistributionAddress(ctx context.Context, in *MsgRegisterDistributionAddress, opts ...grpc.CallOption) (*MsgRegisterDistributionAddressResponse, error) // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -467,18 +468,18 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) RegisterCounterpartyAddress(ctx context.Context, in *MsgRegisterCounterpartyAddress, opts ...grpc.CallOption) (*MsgRegisterCounterpartyAddressResponse, error) { - out := new(MsgRegisterCounterpartyAddressResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/RegisterCounterpartyAddress", in, out, opts...) +func (c *msgClient) RegisterPayee(ctx context.Context, in *MsgRegisterPayee, opts ...grpc.CallOption) (*MsgRegisterPayeeResponse, error) { + out := new(MsgRegisterPayeeResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/RegisterPayee", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) RegisterDistributionAddress(ctx context.Context, in *MsgRegisterDistributionAddress, opts ...grpc.CallOption) (*MsgRegisterDistributionAddressResponse, error) { - out := new(MsgRegisterDistributionAddressResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/RegisterDistributionAddress", in, out, opts...) +func (c *msgClient) RegisterCounterpartyAddress(ctx context.Context, in *MsgRegisterCounterpartyAddress, opts ...grpc.CallOption) (*MsgRegisterCounterpartyAddressResponse, error) { + out := new(MsgRegisterCounterpartyAddressResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.fee.v1.Msg/RegisterCounterpartyAddress", in, out, opts...) if err != nil { return nil, err } @@ -505,18 +506,18 @@ func (c *msgClient) PayPacketFeeAsync(ctx context.Context, in *MsgPayPacketFeeAs // MsgServer is the server API for Msg service. type MsgServer interface { + // RegisterPayee defines a rpc handler method for MsgRegisterPayee + // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + RegisterPayee(context.Context, *MsgRegisterPayee) (*MsgRegisterPayeeResponse, error) // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since // destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function // may be called more than once by a relayer, in which case, the latest counterparty address is always used. RegisterCounterpartyAddress(context.Context, *MsgRegisterCounterpartyAddress) (*MsgRegisterCounterpartyAddressResponse, error) - // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress - // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. - RegisterDistributionAddress(context.Context, *MsgRegisterDistributionAddress) (*MsgRegisterDistributionAddressResponse, error) // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -533,12 +534,12 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) RegisterPayee(ctx context.Context, req *MsgRegisterPayee) (*MsgRegisterPayeeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterPayee not implemented") +} func (*UnimplementedMsgServer) RegisterCounterpartyAddress(ctx context.Context, req *MsgRegisterCounterpartyAddress) (*MsgRegisterCounterpartyAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RegisterCounterpartyAddress not implemented") } -func (*UnimplementedMsgServer) RegisterDistributionAddress(ctx context.Context, req *MsgRegisterDistributionAddress) (*MsgRegisterDistributionAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RegisterDistributionAddress not implemented") -} func (*UnimplementedMsgServer) PayPacketFee(ctx context.Context, req *MsgPayPacketFee) (*MsgPayPacketFeeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method PayPacketFee not implemented") } @@ -550,38 +551,38 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_RegisterCounterpartyAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRegisterCounterpartyAddress) +func _Msg_RegisterPayee_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterPayee) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RegisterCounterpartyAddress(ctx, in) + return srv.(MsgServer).RegisterPayee(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.fee.v1.Msg/RegisterCounterpartyAddress", + FullMethod: "/ibc.applications.fee.v1.Msg/RegisterPayee", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RegisterCounterpartyAddress(ctx, req.(*MsgRegisterCounterpartyAddress)) + return srv.(MsgServer).RegisterPayee(ctx, req.(*MsgRegisterPayee)) } return interceptor(ctx, in, info, handler) } -func _Msg_RegisterDistributionAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRegisterDistributionAddress) +func _Msg_RegisterCounterpartyAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRegisterCounterpartyAddress) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).RegisterDistributionAddress(ctx, in) + return srv.(MsgServer).RegisterCounterpartyAddress(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.fee.v1.Msg/RegisterDistributionAddress", + FullMethod: "/ibc.applications.fee.v1.Msg/RegisterCounterpartyAddress", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RegisterDistributionAddress(ctx, req.(*MsgRegisterDistributionAddress)) + return srv.(MsgServer).RegisterCounterpartyAddress(ctx, req.(*MsgRegisterCounterpartyAddress)) } return interceptor(ctx, in, info, handler) } @@ -627,12 +628,12 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "RegisterCounterpartyAddress", - Handler: _Msg_RegisterCounterpartyAddress_Handler, + MethodName: "RegisterPayee", + Handler: _Msg_RegisterPayee_Handler, }, { - MethodName: "RegisterDistributionAddress", - Handler: _Msg_RegisterDistributionAddress_Handler, + MethodName: "RegisterCounterpartyAddress", + Handler: _Msg_RegisterCounterpartyAddress_Handler, }, { MethodName: "PayPacketFee", @@ -647,7 +648,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "ibc/applications/fee/v1/tx.proto", } -func (m *MsgRegisterCounterpartyAddress) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterPayee) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -657,48 +658,48 @@ func (m *MsgRegisterCounterpartyAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRegisterCounterpartyAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterPayee) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterCounterpartyAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterPayee) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.DistributionAddress) > 0 { + i -= len(m.DistributionAddress) + copy(dAtA[i:], m.DistributionAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.DistributionAddress))) + i-- + dAtA[i] = 0x22 + } + if len(m.RelayerAddress) > 0 { + i -= len(m.RelayerAddress) + copy(dAtA[i:], m.RelayerAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.RelayerAddress))) + i-- + dAtA[i] = 0x1a + } 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] = 0x22 + dAtA[i] = 0x12 } if len(m.PortId) > 0 { i -= len(m.PortId) copy(dAtA[i:], m.PortId) i = encodeVarintTx(dAtA, i, uint64(len(m.PortId))) i-- - dAtA[i] = 0x1a - } - if len(m.CounterpartyAddress) > 0 { - i -= len(m.CounterpartyAddress) - copy(dAtA[i:], m.CounterpartyAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.CounterpartyAddress))) - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) - i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgRegisterCounterpartyAddressResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterPayeeResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -708,12 +709,12 @@ func (m *MsgRegisterCounterpartyAddressResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *MsgRegisterCounterpartyAddressResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterPayeeResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterCounterpartyAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterPayeeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -721,7 +722,7 @@ func (m *MsgRegisterCounterpartyAddressResponse) MarshalToSizedBuffer(dAtA []byt return len(dAtA) - i, nil } -func (m *MsgRegisterDistributionAddress) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterCounterpartyAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -731,12 +732,12 @@ func (m *MsgRegisterDistributionAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgRegisterDistributionAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterCounterpartyAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterCounterpartyAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -755,10 +756,10 @@ func (m *MsgRegisterDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x1a } - if len(m.DistributionAddress) > 0 { - i -= len(m.DistributionAddress) - copy(dAtA[i:], m.DistributionAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DistributionAddress))) + if len(m.CounterpartyAddress) > 0 { + i -= len(m.CounterpartyAddress) + copy(dAtA[i:], m.CounterpartyAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.CounterpartyAddress))) i-- dAtA[i] = 0x12 } @@ -772,7 +773,7 @@ func (m *MsgRegisterDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *MsgRegisterDistributionAddressResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRegisterCounterpartyAddressResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -782,12 +783,12 @@ func (m *MsgRegisterDistributionAddressResponse) Marshal() (dAtA []byte, err err return dAtA[:n], nil } -func (m *MsgRegisterDistributionAddressResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRegisterCounterpartyAddressResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgRegisterDistributionAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRegisterCounterpartyAddressResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -958,32 +959,32 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgRegisterCounterpartyAddress) Size() (n int) { +func (m *MsgRegisterPayee) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Address) + l = len(m.PortId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.CounterpartyAddress) + l = len(m.ChannelId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.PortId) + l = len(m.RelayerAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.ChannelId) + l = len(m.DistributionAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgRegisterCounterpartyAddressResponse) Size() (n int) { +func (m *MsgRegisterPayeeResponse) Size() (n int) { if m == nil { return 0 } @@ -992,7 +993,7 @@ func (m *MsgRegisterCounterpartyAddressResponse) Size() (n int) { return n } -func (m *MsgRegisterDistributionAddress) Size() (n int) { +func (m *MsgRegisterCounterpartyAddress) Size() (n int) { if m == nil { return 0 } @@ -1002,7 +1003,7 @@ func (m *MsgRegisterDistributionAddress) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.DistributionAddress) + l = len(m.CounterpartyAddress) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1017,7 +1018,7 @@ func (m *MsgRegisterDistributionAddress) Size() (n int) { return n } -func (m *MsgRegisterDistributionAddressResponse) Size() (n int) { +func (m *MsgRegisterCounterpartyAddressResponse) Size() (n int) { if m == nil { return 0 } @@ -1092,7 +1093,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterPayee) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1115,15 +1116,15 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterCounterpartyAddress: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterPayee: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCounterpartyAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterPayee: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1151,11 +1152,11 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.PortId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1183,11 +1184,11 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterpartyAddress = string(dAtA[iNdEx:postIndex]) + m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RelayerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1215,11 +1216,11 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PortId = string(dAtA[iNdEx:postIndex]) + m.RelayerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1247,7 +1248,7 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChannelId = string(dAtA[iNdEx:postIndex]) + m.DistributionAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1270,7 +1271,7 @@ func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterCounterpartyAddressResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterPayeeResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1293,10 +1294,10 @@ func (m *MsgRegisterCounterpartyAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterCounterpartyAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterPayeeResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterCounterpartyAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterPayeeResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1320,7 +1321,7 @@ func (m *MsgRegisterCounterpartyAddressResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterCounterpartyAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1343,10 +1344,10 @@ func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterDistributionAddress: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterCounterpartyAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterDistributionAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterCounterpartyAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1383,7 +1384,7 @@ func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1411,7 +1412,7 @@ func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DistributionAddress = string(dAtA[iNdEx:postIndex]) + m.CounterpartyAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1498,7 +1499,7 @@ func (m *MsgRegisterDistributionAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgRegisterDistributionAddressResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRegisterCounterpartyAddressResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1521,10 +1522,10 @@ func (m *MsgRegisterDistributionAddressResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgRegisterDistributionAddressResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRegisterCounterpartyAddressResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRegisterDistributionAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRegisterCounterpartyAddressResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index b2d6c82be0d..2f6a4e67066 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -10,6 +10,13 @@ import "ibc/core/channel/v1/channel.proto"; // Msg defines the ICS29 Msg service. service Msg { + // RegisterPayee defines a rpc handler method for MsgRegisterPayee + // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional + // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered + // on the source chain from which packets originate as this is where fee distribution takes place. This function may + // be called more than once by a relayer, in which case, the latest distribution address is always used. + rpc RegisterPayee(MsgRegisterPayee) returns (MsgRegisterPayeeResponse); + // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their // counterparty address before relaying. This ensures they will be properly compensated for forward relaying since @@ -17,13 +24,6 @@ service Msg { // may be called more than once by a relayer, in which case, the latest counterparty address is always used. rpc RegisterCounterpartyAddress(MsgRegisterCounterpartyAddress) returns (MsgRegisterCounterpartyAddressResponse); - // RegisterDistributionAddress defines a rpc handler method for MsgRegisterDistributionAddress - // RegisterDistributionAddress is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. - rpc RegisterDistributionAddress(MsgRegisterDistributionAddress) returns (MsgRegisterDistributionAddressResponse); - // PayPacketFee defines a rpc handler method for MsgPayPacketFee // PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to // incentivize the relaying of the packet at the next sequence @@ -37,41 +37,41 @@ service Msg { rpc PayPacketFeeAsync(MsgPayPacketFeeAsync) returns (MsgPayPacketFeeAsyncResponse); } -// MsgRegisterCounterpartyAddress defines the request type for the RegisterCounterpartyAddress rpc -message MsgRegisterCounterpartyAddress { +// MsgRegisterPayee defines the request type for the RegisterPayee rpc +message MsgRegisterPayee { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // the relayer address - string address = 1; - // the counterparty relayer address - string counterparty_address = 2 [(gogoproto.moretags) = "yaml:\"counterparty_address\""]; // unique port identifier - string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; + string port_id = 1 [(gogoproto.moretags) = "yaml:\"port_id\""]; // unique channel identifier - string channel_id = 4 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; + // the relayer address + string relayer_address = 3 [(gogoproto.moretags) = "yaml:\"relayer_address\""]; + // the fee distribution address + string distribution_address = 4 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; } -// MsgRegisterCounterpartyAddressResponse defines the response type for the RegisterCounterpartyAddress rpc -message MsgRegisterCounterpartyAddressResponse {} +// MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc +message MsgRegisterPayeeResponse {} -// MsgRegisterDistributionAddress defines the request type for the RegisterDistributionAddress rpc -message MsgRegisterDistributionAddress { +// MsgRegisterCounterpartyAddress defines the request type for the RegisterCounterpartyAddress rpc +message MsgRegisterCounterpartyAddress { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // the relayer address string address = 1; - // the fee distribution address - string distribution_address = 2 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; + // the counterparty relayer address + string counterparty_address = 2 [(gogoproto.moretags) = "yaml:\"counterparty_address\""]; // unique port identifier string port_id = 3 [(gogoproto.moretags) = "yaml:\"port_id\""]; // unique channel identifier string channel_id = 4 [(gogoproto.moretags) = "yaml:\"channel_id\""]; } -// MsgRegisterDistributionAddressResponse defines the response type for the RegisterDistributionAddress rpc -message MsgRegisterDistributionAddressResponse {} +// MsgRegisterCounterpartyAddressResponse defines the response type for the RegisterCounterpartyAddress rpc +message MsgRegisterCounterpartyAddressResponse {} // MsgPayPacketFee defines the request type for the PayPacketFee rpc // This Msg can be used to pay for a packet at the next sequence send & should be combined with the Msg that will be From 9f77b1dde37e0310c9f20de117c52f873bdb9bcb Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 7 Jun 2022 19:01:17 +0200 Subject: [PATCH 07/12] renaming RegisterDistributionAddress to RegisterPayee --- docs/ibc/proto-docs.md | 2 +- modules/apps/29-fee/client/cli/tx.go | 4 +- modules/apps/29-fee/keeper/keeper.go | 36 +++--- modules/apps/29-fee/keeper/keeper_test.go | 12 +- modules/apps/29-fee/keeper/msg_server.go | 4 +- modules/apps/29-fee/keeper/msg_server_test.go | 4 +- modules/apps/29-fee/types/errors.go | 1 - modules/apps/29-fee/types/keys.go | 26 ++-- modules/apps/29-fee/types/keys_test.go | 34 +++--- modules/apps/29-fee/types/msgs.go | 21 ++-- modules/apps/29-fee/types/msgs_test.go | 18 +-- modules/apps/29-fee/types/tx.pb.go | 113 +++++++++--------- proto/ibc/applications/fee/v1/tx.proto | 4 +- 13 files changed, 143 insertions(+), 136 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 02763055263..4f21f1b787c 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1326,7 +1326,7 @@ MsgRegisterPayee defines the request type for the RegisterPayee rpc | `port_id` | [string](#string) | | unique port identifier | | `channel_id` | [string](#string) | | unique channel identifier | | `relayer_address` | [string](#string) | | the relayer address | -| `distribution_address` | [string](#string) | | the fee distribution address | +| `payee` | [string](#string) | | the fee payee address | diff --git a/modules/apps/29-fee/client/cli/tx.go b/modules/apps/29-fee/client/cli/tx.go index a765b2391bb..24f84731d88 100644 --- a/modules/apps/29-fee/client/cli/tx.go +++ b/modules/apps/29-fee/client/cli/tx.go @@ -25,9 +25,9 @@ const ( // NewRegisterPayeeCmd returns the command to create a MsgRegisterPayee func NewRegisterPayeeCmd() *cobra.Command { cmd := &cobra.Command{ - Use: "register-payee [port-id] [channel-id] [relayer-address] [distribution-address] ", + Use: "register-payee [port-id] [channel-id] [relayer-address] [payee-address] ", Short: "Register a payee on a given channel.", - Long: strings.TrimSpace(`Register a payee's distribution address on a given channel.`), + Long: strings.TrimSpace(`Register a payee address on a given channel.`), Example: fmt.Sprintf("%s tx ibc-fee register-payee transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5", version.AppName), Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 2c5b9fae145..462f1221b98 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -147,6 +147,24 @@ func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChan return enabledChArr } +// GetPayeeAddress retrieves the fee payee address stored in state given the provided channel identifier and relayer address +func (k Keeper) GetPayeeAddress(ctx sdk.Context, address, channelID string) (string, bool) { + store := ctx.KVStore(k.storeKey) + key := types.KeyPayeeAddress(address, channelID) + + if !store.Has(key) { + return "", false + } + + return string(store.Get(key)), true +} + +// SetPayeeAddress stores the fee payee address in state keyed by the provided channel identifier and relayer address +func (k Keeper) SetPayeeAddress(ctx sdk.Context, relayerAddr, payeeAddr, channelID string) { + store := ctx.KVStore(k.storeKey) + store.Set(types.KeyPayeeAddress(relayerAddr, channelID), []byte(payeeAddr)) +} + // 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, channelID string) { @@ -241,24 +259,6 @@ func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltyp store.Delete(key) } -// GetDistributionAddress retrieves the fee distribution address stored in state given the provided channel identifier and relayer address -func (k Keeper) GetDistributionAddress(ctx sdk.Context, address, channelID string) (string, bool) { - store := ctx.KVStore(k.storeKey) - key := types.KeyDistributionAddress(address, channelID) - - if !store.Has(key) { - return "", false - } - - return string(store.Get(key)), true -} - -// SetDistributionAddress stores the fee distribution address in state keyed by the provided channel identifier and relayer address -func (k Keeper) SetDistributionAddress(ctx sdk.Context, address, distributionAddress, channelID string) { - store := ctx.KVStore(k.storeKey) - store.Set(types.KeyDistributionAddress(address, channelID), []byte(distributionAddress)) -} - // GetFeesInEscrow returns all escrowed packet fees for a given packetID func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) (types.PacketFees, bool) { store := ctx.KVStore(k.storeKey) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 985d540903f..d66f1284fe6 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -91,23 +91,23 @@ func (suite *KeeperTestSuite) TestEscrowAccountHasBalance() { suite.Require().False(suite.chainA.GetSimApp().IBCFeeKeeper.EscrowAccountHasBalance(suite.chainA.GetContext(), fee.Total())) } -func (suite *KeeperTestSuite) TestGetSetDistributionAddress() { +func (suite *KeeperTestSuite) TestGetSetPayeeAddress() { suite.coordinator.Setup(suite.path) - distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) suite.Require().False(found) - suite.Require().Empty(distributionAddr) + suite.Require().Empty(payeeAddr) - suite.chainA.GetSimApp().IBCFeeKeeper.SetDistributionAddress( + suite.chainA.GetSimApp().IBCFeeKeeper.SetPayeeAddress( suite.chainA.GetContext(), suite.chainA.SenderAccounts[0].SenderAccount.GetAddress().String(), suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID, ) - distributionAddr, found = suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) + payeeAddr, found = suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID) suite.Require().True(found) - suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), payeeAddr) } func (suite *KeeperTestSuite) TestFeesInEscrow() { diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index abaa6116a2c..6614be844db 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -29,9 +29,9 @@ func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee return nil, types.ErrFeeNotEnabled } - k.SetDistributionAddress(ctx, msg.RelayerAddress, msg.DistributionAddress, msg.ChannelId) + k.SetPayeeAddress(ctx, msg.RelayerAddress, msg.Payee, msg.ChannelId) - k.Logger(ctx).Info("registering distribution address for relayer", "address", msg.RelayerAddress, "distribution address", msg.DistributionAddress, "channel", msg.ChannelId) + k.Logger(ctx).Info("registering distribution address for relayer", "relayer address", msg.RelayerAddress, "payee address", msg.Payee, "channel", msg.ChannelId) return &types.MsgRegisterPayeeResponse{}, nil } diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index 814755457ab..76179514943 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -59,14 +59,14 @@ func (suite *KeeperTestSuite) TestRegisterPayee() { suite.Require().NoError(err) suite.Require().NotNil(res) - distributionAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetDistributionAddress( + payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress( suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), suite.path.EndpointA.ChannelID, ) suite.Require().True(found) - suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), distributionAddr) + suite.Require().Equal(suite.chainA.SenderAccounts[1].SenderAccount.GetAddress().String(), payeeAddr) } else { suite.Require().Error(err) } diff --git a/modules/apps/29-fee/types/errors.go b/modules/apps/29-fee/types/errors.go index b8db4ca7b02..812db0a43a4 100644 --- a/modules/apps/29-fee/types/errors.go +++ b/modules/apps/29-fee/types/errors.go @@ -16,5 +16,4 @@ var ( ErrFeeNotEnabled = sdkerrors.Register(ModuleName, 9, "fee module is not enabled for this channel. If this error occurs after channel setup, fee module may not be enabled") ErrRelayerNotFoundForAsyncAck = sdkerrors.Register(ModuleName, 10, "relayer address must be stored for async WriteAcknowledgement") ErrFeeModuleLocked = sdkerrors.Register(ModuleName, 11, "the fee module is currently locked, a severe bug has been detected") - ErrDistributionAddressEmpty = sdkerrors.Register(ModuleName, 12, "distribution address must not be empty") ) diff --git a/modules/apps/29-fee/types/keys.go b/modules/apps/29-fee/types/keys.go index 5d64ef19718..6cb6f53551c 100644 --- a/modules/apps/29-fee/types/keys.go +++ b/modules/apps/29-fee/types/keys.go @@ -28,12 +28,12 @@ const ( // FeeEnabledPrefix is the key prefix for storing fee enabled flag FeeEnabledKeyPrefix = "feeEnabled" + // PayeeAddressKeyPrefix is the key prefix for the fee payee address stored in state + PayeeAddressKeyPrefix = "payeeAddress" + // CounterpartyRelayerAddressKeyPrefix is the key prefix for relayer address mapping CounterpartyRelayerAddressKeyPrefix = "relayerAddress" - // DistributionAddressKeyPrefix is the key prefix for the fee distribution address stored in state - DistributionAddressKeyPrefix = "distributionAddress" - // FeesInEscrowPrefix is the key prefix for fee in escrow mapping FeesInEscrowPrefix = "feesInEscrow" @@ -73,13 +73,13 @@ func ParseKeyFeeEnabled(key string) (portID, channelID string, err error) { return portID, channelID, nil } -// KeyCounterpartyRelayer returns the key for relayer address -> counterparty address mapping -func KeyCounterpartyRelayer(address, channelID string) []byte { - return []byte(fmt.Sprintf("%s/%s/%s", CounterpartyRelayerAddressKeyPrefix, address, channelID)) +// KeyPayeeAddress returns the key for relayer address -> payee address mapping +func KeyPayeeAddress(relayerAddr, channelID string) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", PayeeAddressKeyPrefix, relayerAddr, channelID)) } -// ParseKeyCounterpartyRelayer returns the registered relayer address and channelID used to store the counterpartyrelayer address -func ParseKeyCounterpartyRelayer(key string) (address string, channelID string, error error) { +// ParseKeyPayeeAddress returns the registered relayer addresss and channelID used to the store the fee payee address +func ParseKeyPayeeAddress(key string) (relayerAddr, channelID string, err error) { keySplit := strings.Split(key, "/") if len(keySplit) != 3 { return "", "", sdkerrors.Wrapf( @@ -90,13 +90,13 @@ func ParseKeyCounterpartyRelayer(key string) (address string, channelID string, return keySplit[1], keySplit[2], nil } -// KeyDistributionAddress returns the key for relayer address -> distribution address mapping -func KeyDistributionAddress(address, channelID string) []byte { - return []byte(fmt.Sprintf("%s/%s/%s", DistributionAddressKeyPrefix, address, channelID)) +// KeyCounterpartyRelayer returns the key for relayer address -> counterparty address mapping +func KeyCounterpartyRelayer(address, channelID string) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", CounterpartyRelayerAddressKeyPrefix, address, channelID)) } -// ParseKeyDistributionAddress returns the registered relayer addresss and channelID used to the store the fee distribution address -func ParseKeyDistributionAddress(key string) (address, channelID string, err error) { +// ParseKeyCounterpartyRelayer returns the registered relayer address and channelID used to store the counterpartyrelayer address +func ParseKeyCounterpartyRelayer(key string) (address string, channelID string, error error) { keySplit := strings.Split(key, "/") if len(keySplit) != 3 { return "", "", sdkerrors.Wrapf( diff --git a/modules/apps/29-fee/types/keys_test.go b/modules/apps/29-fee/types/keys_test.go index ecb98bfc9e3..442c4a47634 100644 --- a/modules/apps/29-fee/types/keys_test.go +++ b/modules/apps/29-fee/types/keys_test.go @@ -13,22 +13,12 @@ import ( var validPacketID = channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1) -func TestKeyCounterpartyRelayer(t *testing.T) { - var ( - relayerAddress = "relayer_address" - channelID = "channel-0" - ) - - key := types.KeyCounterpartyRelayer(relayerAddress, channelID) - require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.CounterpartyRelayerAddressKeyPrefix, relayerAddress, channelID)) -} - -func TestKeyDistributionAddress(t *testing.T) { - key := types.KeyDistributionAddress("relayer-address", ibctesting.FirstChannelID) - require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.DistributionAddressKeyPrefix, "relayer-address", ibctesting.FirstChannelID)) +func TestKeyPayeeAddress(t *testing.T) { + key := types.KeyPayeeAddress("relayer-address", ibctesting.FirstChannelID) + require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.PayeeAddressKeyPrefix, "relayer-address", ibctesting.FirstChannelID)) } -func TestParseKeyDistributionAddress(t *testing.T) { +func TestParseKeyPayeeAddress(t *testing.T) { testCases := []struct { name string key string @@ -36,18 +26,18 @@ func TestParseKeyDistributionAddress(t *testing.T) { }{ { "success", - string(types.KeyDistributionAddress("relayer-address", ibctesting.FirstChannelID)), + string(types.KeyPayeeAddress("relayer-address", ibctesting.FirstChannelID)), true, }, { "incorrect key - key split has incorrect length", - "distributionAddress/relayer_address/transfer/channel-0", + "payeeAddress/relayer_address/transfer/channel-0", false, }, } for _, tc := range testCases { - address, channelID, err := types.ParseKeyDistributionAddress(tc.key) + address, channelID, err := types.ParseKeyPayeeAddress(tc.key) if tc.expPass { require.NoError(t, err) @@ -59,6 +49,16 @@ func TestParseKeyDistributionAddress(t *testing.T) { } } +func TestKeyCounterpartyRelayer(t *testing.T) { + var ( + relayerAddress = "relayer_address" + channelID = "channel-0" + ) + + key := types.KeyCounterpartyRelayer(relayerAddress, channelID) + require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s", types.CounterpartyRelayerAddressKeyPrefix, relayerAddress, channelID)) +} + func TestKeyFeesInEscrow(t *testing.T) { key := types.KeyFeesInEscrow(validPacketID) require.Equal(t, string(key), fmt.Sprintf("%s/%s/%s/%d", types.FeesInEscrowPrefix, ibctesting.MockFeePort, ibctesting.FirstChannelID, 1)) diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 8a7b43470cc..e7362472824 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -17,24 +17,29 @@ const ( ) // NewMsgRegisterPayee creates a new instance of MsgRegisterPayee -func NewMsgRegisterPayee(portID, channelID, relayerAddr, distributionAddr string) *MsgRegisterPayee { +func NewMsgRegisterPayee(portID, channelID, relayerAddr, payeeAddr string) *MsgRegisterPayee { return &MsgRegisterPayee{ - RelayerAddress: relayerAddr, - DistributionAddress: distributionAddr, - PortId: portID, - ChannelId: channelID, + RelayerAddress: relayerAddr, + Payee: payeeAddr, + PortId: portID, + ChannelId: channelID, } } // ValidateBasic implements sdk.Msg and performs basic stateless validation func (msg MsgRegisterPayee) ValidateBasic() error { + if msg.RelayerAddress == msg.Payee { + return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "relayer address and payee must not be equal") + } + _, err := sdk.AccAddressFromBech32(msg.RelayerAddress) if err != nil { - return sdkerrors.Wrap(err, "failed to convert msg.Address into sdk.AccAddress") + return sdkerrors.Wrap(err, "failed to create sdk.AccAddress from relayer address") } - if strings.TrimSpace(msg.DistributionAddress) == "" { - return ErrDistributionAddressEmpty + _, err = sdk.AccAddressFromBech32(msg.Payee) + if err != nil { + return sdkerrors.Wrap(err, "failed to create sdk.AccAddress from payee address") } if err := host.PortIdentifierValidator(msg.PortId); err != nil { diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index 89fe7b58e00..13f92fb7c53 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -26,23 +26,24 @@ func TestMsgRegisterPayeeValidation(t *testing.T) { true, }, { - "validate with invalid relayer address", + "invalid request relayer and payee are equal", func() { - msg.RelayerAddress = "invalid-address" + msg.RelayerAddress = defaultAccAddress + msg.Payee = defaultAccAddress }, false, }, { - "invalid distribution address", + "invalid relayer address", func() { - msg.DistributionAddress = "" + msg.RelayerAddress = "invalid-address" }, false, }, { - "invalid distribution address: whitespaced empty string", + "invalid payee address", func() { - msg.DistributionAddress = " " + msg.Payee = "invalid-address" }, false, }, @@ -63,7 +64,10 @@ func TestMsgRegisterPayeeValidation(t *testing.T) { } for i, tc := range testCases { - msg = types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, defaultAccAddress, defaultAccAddress) + relayerAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + payeeAddr := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) + + msg = types.NewMsgRegisterPayee(ibctesting.MockPort, ibctesting.FirstChannelID, relayerAddr.String(), payeeAddr.String()) tc.malleate() diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index 40d6133e799..e3c36110a4d 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -37,8 +37,8 @@ type MsgRegisterPayee struct { ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` // the relayer address RelayerAddress string `protobuf:"bytes,3,opt,name=relayer_address,json=relayerAddress,proto3" json:"relayer_address,omitempty" yaml:"relayer_address"` - // the fee distribution address - DistributionAddress string `protobuf:"bytes,4,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` + // the fee payee address + Payee string `protobuf:"bytes,4,opt,name=payee,proto3" json:"payee,omitempty"` } func (m *MsgRegisterPayee) Reset() { *m = MsgRegisterPayee{} } @@ -374,54 +374,53 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 744 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xbf, 0x4f, 0xdb, 0x4e, - 0x14, 0x8f, 0x13, 0xbe, 0x40, 0x0e, 0xbe, 0x40, 0xcc, 0xaf, 0x60, 0xa8, 0x4d, 0x3d, 0x54, 0xa9, - 0x2a, 0xec, 0x26, 0x80, 0xaa, 0xb2, 0x20, 0x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x38, 0xa3, 0x26, 0xdf, - 0x41, 0xff, 0x0f, 0xfe, 0x87, 0x9e, 0x8e, 0x15, 0x33, 0x3c, 0x98, 0x42, 0x75, 0x62, 0x68, 0xb2, - 0x2d, 0xff, 0x99, 0x43, 0x9b, 0xf7, 0x0d, 0xf0, 0x8b, 0x49, 0x28, 0x47, 0x14, 0x0a, 0x87, 0xff, - 0x58, 0x98, 0x2a, 0x7b, 0x8f, 0xe6, 0x07, 0x26, 0xa6, 0x72, 0x1f, 0x61, 0x16, 0x29, 0x3c, 0x9f, - 0x14, 0x99, 0xee, 0xe5, 0xa1, 0xd2, 0xdf, 0xf7, 0x6d, 0x67, 0x52, 0x9a, 0x08, 0x2e, 0xec, 0x3f, - 0x08, 0x9e, 0x6c, 0x5d, 0x7f, 0x7d, 0x7d, 0x2b, 0x72, 0x37, 0xb7, 0x22, 0xf7, 0xfd, 0x56, 0xe4, - 0x2e, 0xef, 0xc4, 0xdc, 0xcd, 0x9d, 0x98, 0xfb, 0x76, 0x27, 0xe6, 0xde, 0xee, 0x9b, 0x96, 0x7b, - 0xd1, 0x6b, 0x2a, 0x3a, 0xe9, 0xa8, 0x3a, 0xa1, 0x1d, 0x42, 0x55, 0xab, 0xa9, 0xef, 0x98, 0x44, - 0xed, 0xef, 0xaa, 0x1d, 0x62, 0xf4, 0xda, 0x40, 0xc3, 0xb7, 0x8f, 0xaa, 0xb5, 0x97, 0x3b, 0xe1, - 0xb3, 0xe7, 0x7a, 0x36, 0xd0, 0xe6, 0x74, 0xf4, 0xa6, 0xed, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, - 0xf9, 0xb1, 0x24, 0xfc, 0x6c, 0x07, 0x00, 0x00, + // 732 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xcf, 0x4f, 0xdb, 0x58, + 0x10, 0x8e, 0x09, 0xbf, 0x32, 0xb0, 0x40, 0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0x68, 0x57, 0xbf, 0xe6, 0x21, 0x7f, + 0x41, 0x2d, 0xbe, 0x03, 0xbf, 0x0d, 0xff, 0x49, 0xfe, 0x9e, 0xd8, 0xcc, 0xe8, 0x62, 0x8a, 0x95, + 0xa9, 0xa1, 0xc9, 0xb5, 0xfc, 0x7b, 0x0e, 0xb6, 0x1f, 0x5b, 0xe0, 0xff, 0xa6, 0x29, 0x39, 0x26, + 0x51, 0x3c, 0xfe, 0xc5, 0xc4, 0xb4, 0xb3, 0xd7, 0xb0, 0x3c, 0xb4, 0x31, 0xe5, 0xc7, 0x0a, 0x66, + 0x91, 0xe2, 0xbf, 0xd3, 0x22, 0xd3, 0xbb, 0x7c, 0x28, 0xfe, 0x3c, 0x6f, 0x7b, 0xd3, 0x96, 0x89, + 0xe0, 0xe2, 0xe1, 0x93, 0xe0, 0xc9, 0xd5, 0xb5, 0xe7, 0xb7, 0xf7, 0x12, 0x77, 0x77, 0x2f, 0x71, + 0x9f, 0xef, 0x25, 0xee, 0xfa, 0x41, 0xca, 0xdd, 0x3d, 0x48, 0xb9, 0x8f, 0x0f, 0x52, 0xee, 0xe5, + 0xa1, 0x65, 0x7b, 0x57, 0xbd, 0x86, 0x6a, 0x92, 0x8e, 0x66, 0x12, 0xda, 0x21, 0x54, 0xb3, 0x1b, + 0xe6, 0x9e, 0x45, 0xb4, 0xfe, 0xbe, 0xd6, 0x21, 0xcd, 0x5e, 0x1b, 0x69, 0xf8, 0x7a, 0x51, 0xad, + 0xfa, 0xff, 0x5e, 0xf8, 0x70, 0x79, 0xbe, 0x83, 0xb4, 0x31, 0x1f, 0xbd, 0x4a, 0xfb, 0xdf, 0x03, + 0x00, 0x00, 0xff, 0xff, 0x8c, 0x56, 0x8c, 0xfd, 0x2e, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -668,10 +667,10 @@ func (m *MsgRegisterPayee) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.DistributionAddress) > 0 { - i -= len(m.DistributionAddress) - copy(dAtA[i:], m.DistributionAddress) - i = encodeVarintTx(dAtA, i, uint64(len(m.DistributionAddress))) + if len(m.Payee) > 0 { + i -= len(m.Payee) + copy(dAtA[i:], m.Payee) + i = encodeVarintTx(dAtA, i, uint64(len(m.Payee))) i-- dAtA[i] = 0x22 } @@ -977,7 +976,7 @@ func (m *MsgRegisterPayee) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.DistributionAddress) + l = len(m.Payee) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -1220,7 +1219,7 @@ func (m *MsgRegisterPayee) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Payee", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1248,7 +1247,7 @@ func (m *MsgRegisterPayee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.DistributionAddress = string(dAtA[iNdEx:postIndex]) + m.Payee = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index 2f6a4e67066..a28a9494fc0 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -48,8 +48,8 @@ message MsgRegisterPayee { string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; // the relayer address string relayer_address = 3 [(gogoproto.moretags) = "yaml:\"relayer_address\""]; - // the fee distribution address - string distribution_address = 4 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; + // the fee payee address + string payee = 4; } // MsgRegisterPayeeResponse defines the response type for the RegisterPayee rpc From b53d8afe2e602ea7e720203a62e85fac1f3279d2 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 7 Jun 2022 19:18:42 +0200 Subject: [PATCH 08/12] updating godocs and field ordering --- docs/ibc/proto-docs.md | 2 +- modules/apps/29-fee/keeper/keeper.go | 4 ++-- modules/apps/29-fee/keeper/msg_server.go | 8 ++++---- modules/apps/29-fee/types/msgs.go | 20 ++++++++++---------- modules/apps/29-fee/types/msgs_test.go | 22 +++++++++++----------- modules/apps/29-fee/types/tx.pb.go | 12 ++++++------ proto/ibc/applications/fee/v1/tx.proto | 6 +++--- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 4f21f1b787c..92fa264fbad 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -1356,7 +1356,7 @@ Msg defines the ICS29 Msg service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `RegisterPayee` | [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) | [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) | RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional distribution address to which escrowed packet fees will be paid out. The distribution address should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest distribution address is always used. | | +| `RegisterPayee` | [MsgRegisterPayee](#ibc.applications.fee.v1.MsgRegisterPayee) | [MsgRegisterPayeeResponse](#ibc.applications.fee.v1.MsgRegisterPayeeResponse) | RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest payee is always used. | | | `RegisterCounterpartyAddress` | [MsgRegisterCounterpartyAddress](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddress) | [MsgRegisterCounterpartyAddressResponse](#ibc.applications.fee.v1.MsgRegisterCounterpartyAddressResponse) | RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their counterparty address before relaying. This ensures they will be properly compensated for forward relaying since destination chain must send back relayer's source address (counterparty address) in acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty address is always used. | | | `PayPacketFee` | [MsgPayPacketFee](#ibc.applications.fee.v1.MsgPayPacketFee) | [MsgPayPacketFeeResponse](#ibc.applications.fee.v1.MsgPayPacketFeeResponse) | PayPacketFee defines a rpc handler method for MsgPayPacketFee PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of the packet at the next sequence NOTE: This method is intended to be used within a multi msg transaction, where the subsequent msg that follows initiates the lifecycle of the incentivized packet | | | `PayPacketFeeAsync` | [MsgPayPacketFeeAsync](#ibc.applications.fee.v1.MsgPayPacketFeeAsync) | [MsgPayPacketFeeAsyncResponse](#ibc.applications.fee.v1.MsgPayPacketFeeAsyncResponse) | PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of a known packet (i.e. at a particular sequence) | | diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 462f1221b98..15e9eb86f82 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -148,9 +148,9 @@ func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChan } // GetPayeeAddress retrieves the fee payee address stored in state given the provided channel identifier and relayer address -func (k Keeper) GetPayeeAddress(ctx sdk.Context, address, channelID string) (string, bool) { +func (k Keeper) GetPayeeAddress(ctx sdk.Context, relayerAddr, channelID string) (string, bool) { store := ctx.KVStore(k.storeKey) - key := types.KeyPayeeAddress(address, channelID) + key := types.KeyPayeeAddress(relayerAddr, channelID) if !store.Has(key) { return "", false diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index 6614be844db..87a1dd8cd69 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -14,9 +14,9 @@ var _ types.MsgServer = Keeper{} // RegisterPayee defines a rpc handler method for MsgRegisterPayee // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional -// distribution address to which escrowed packet fees will be paid out. The distribution address should be registered -// on the source chain from which packets originate as this is where fee distribution takes place. This function may -// be called more than once by a relayer, in which case, the latest distribution address is always used. +// payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which +// packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, +// in which case, the latest payee is always used. func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee) (*types.MsgRegisterPayeeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -31,7 +31,7 @@ func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee k.SetPayeeAddress(ctx, msg.RelayerAddress, msg.Payee, msg.ChannelId) - k.Logger(ctx).Info("registering distribution address for relayer", "relayer address", msg.RelayerAddress, "payee address", msg.Payee, "channel", msg.ChannelId) + k.Logger(ctx).Info("registering payee address for relayer", "relayer address", msg.RelayerAddress, "payee address", msg.Payee, "channel", msg.ChannelId) return &types.MsgRegisterPayeeResponse{}, nil } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index e7362472824..3d5520f3ff2 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -19,15 +19,23 @@ const ( // NewMsgRegisterPayee creates a new instance of MsgRegisterPayee func NewMsgRegisterPayee(portID, channelID, relayerAddr, payeeAddr string) *MsgRegisterPayee { return &MsgRegisterPayee{ - RelayerAddress: relayerAddr, - Payee: payeeAddr, PortId: portID, ChannelId: channelID, + RelayerAddress: relayerAddr, + Payee: payeeAddr, } } // ValidateBasic implements sdk.Msg and performs basic stateless validation func (msg MsgRegisterPayee) ValidateBasic() error { + if err := host.PortIdentifierValidator(msg.PortId); err != nil { + return err + } + + if err := host.ChannelIdentifierValidator(msg.ChannelId); err != nil { + return err + } + if msg.RelayerAddress == msg.Payee { return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "relayer address and payee must not be equal") } @@ -42,14 +50,6 @@ func (msg MsgRegisterPayee) ValidateBasic() error { return sdkerrors.Wrap(err, "failed to create sdk.AccAddress from payee address") } - if err := host.PortIdentifierValidator(msg.PortId); err != nil { - return err - } - - 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 13f92fb7c53..4ca23fea458 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -26,38 +26,38 @@ func TestMsgRegisterPayeeValidation(t *testing.T) { true, }, { - "invalid request relayer and payee are equal", + "invalid portID", func() { - msg.RelayerAddress = defaultAccAddress - msg.Payee = defaultAccAddress + msg.PortId = "" }, false, }, { - "invalid relayer address", + "invalid channelID", func() { - msg.RelayerAddress = "invalid-address" + msg.ChannelId = "" }, false, }, { - "invalid payee address", + "invalid request relayer and payee are equal", func() { - msg.Payee = "invalid-address" + msg.RelayerAddress = defaultAccAddress + msg.Payee = defaultAccAddress }, false, }, { - "invalid channelID", + "invalid relayer address", func() { - msg.ChannelId = "" + msg.RelayerAddress = "invalid-address" }, false, }, { - "invalid portID", + "invalid payee address", func() { - msg.PortId = "" + msg.Payee = "invalid-address" }, false, }, diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index e3c36110a4d..7c941f44c9c 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -437,9 +437,9 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // RegisterPayee defines a rpc handler method for MsgRegisterPayee // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. + // payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which + // packets originate as this is where fee distribution takes place. This function may be called more than once by a + // relayer, in which case, the latest payee is always used. RegisterPayee(ctx context.Context, in *MsgRegisterPayee, opts ...grpc.CallOption) (*MsgRegisterPayeeResponse, error) // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their @@ -507,9 +507,9 @@ func (c *msgClient) PayPacketFeeAsync(ctx context.Context, in *MsgPayPacketFeeAs type MsgServer interface { // RegisterPayee defines a rpc handler method for MsgRegisterPayee // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. + // payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which + // packets originate as this is where fee distribution takes place. This function may be called more than once by a + // relayer, in which case, the latest payee is always used. RegisterPayee(context.Context, *MsgRegisterPayee) (*MsgRegisterPayeeResponse, error) // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress // RegisterCounterpartyAddress is called by the relayer on each channelEnd and allows them to specify their diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index a28a9494fc0..f7c4618f54c 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -12,9 +12,9 @@ import "ibc/core/channel/v1/channel.proto"; service Msg { // RegisterPayee defines a rpc handler method for MsgRegisterPayee // RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional - // distribution address to which escrowed packet fees will be paid out. The distribution address should be registered - // on the source chain from which packets originate as this is where fee distribution takes place. This function may - // be called more than once by a relayer, in which case, the latest distribution address is always used. + // payee to which escrowed packet fees will be paid out. The payee should be registered on the source chain from which + // packets originate as this is where fee distribution takes place. This function may be called more than once by a + // relayer, in which case, the latest payee is always used. rpc RegisterPayee(MsgRegisterPayee) returns (MsgRegisterPayeeResponse); // RegisterCounterpartyAddress defines a rpc handler method for MsgRegisterCounterpartyAddress From 3b2ccdacf87636036e8dba5d5a4a90877edde181 Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 7 Jun 2022 19:23:09 +0200 Subject: [PATCH 09/12] updating inline comment --- modules/apps/29-fee/keeper/msg_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index 87a1dd8cd69..0dfc8cb9a10 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -20,7 +20,7 @@ var _ types.MsgServer = Keeper{} func (k Keeper) RegisterPayee(goCtx context.Context, msg *types.MsgRegisterPayee) (*types.MsgRegisterPayeeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // only register distribution address if the channel exists and is fee enabled + // only register payee address if the channel exists and is fee enabled if _, found := k.channelKeeper.GetChannel(ctx, msg.PortId, msg.ChannelId); !found { return nil, channeltypes.ErrChannelNotFound } From d302509a99b8644ad612a0434b18e421a979645a Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 8 Jun 2022 12:25:04 +0200 Subject: [PATCH 10/12] renaming to regsitered payees and propagating changes in genesis --- docs/ibc/proto-docs.md | 14 +- modules/apps/29-fee/keeper/genesis.go | 14 +- modules/apps/29-fee/keeper/genesis_test.go | 16 +- modules/apps/29-fee/keeper/keeper.go | 16 +- modules/apps/29-fee/keeper/keeper_test.go | 18 +- modules/apps/29-fee/types/genesis.go | 56 ++- modules/apps/29-fee/types/genesis.pb.go | 510 ++++++++++---------- modules/apps/29-fee/types/genesis_test.go | 38 +- proto/ibc/applications/fee/v1/genesis.proto | 30 +- 9 files changed, 358 insertions(+), 354 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 9abbd721759..318abd29c31 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -38,7 +38,7 @@ - [FeeEnabledChannel](#ibc.applications.fee.v1.FeeEnabledChannel) - [ForwardRelayerAddress](#ibc.applications.fee.v1.ForwardRelayerAddress) - [GenesisState](#ibc.applications.fee.v1.GenesisState) - - [RegisteredDistributionAddress](#ibc.applications.fee.v1.RegisteredDistributionAddress) + - [RegisteredPayee](#ibc.applications.fee.v1.RegisteredPayee) - [RegisteredRelayerAddress](#ibc.applications.fee.v1.RegisteredRelayerAddress) - [ibc/applications/fee/v1/metadata.proto](#ibc/applications/fee/v1/metadata.proto) @@ -843,25 +843,25 @@ GenesisState defines the ICS29 fee middleware genesis state | ----- | ---- | ----- | ----------- | | `identified_fees` | [IdentifiedPacketFees](#ibc.applications.fee.v1.IdentifiedPacketFees) | repeated | list of identified packet fees | | `fee_enabled_channels` | [FeeEnabledChannel](#ibc.applications.fee.v1.FeeEnabledChannel) | repeated | list of fee enabled channels | +| `registered_payees` | [RegisteredPayee](#ibc.applications.fee.v1.RegisteredPayee) | repeated | list of registered payees | | `registered_relayers` | [RegisteredRelayerAddress](#ibc.applications.fee.v1.RegisteredRelayerAddress) | repeated | list of registered relayer addresses | | `forward_relayers` | [ForwardRelayerAddress](#ibc.applications.fee.v1.ForwardRelayerAddress) | repeated | list of forward relayer addresses | -| `registered_distribution_addresses` | [RegisteredDistributionAddress](#ibc.applications.fee.v1.RegisteredDistributionAddress) | repeated | list of registered distribution addresses | - + -### RegisteredDistributionAddress -RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel +### RegisteredPayee +RegisteredPayee contains the relayer address and payee address for a specific channel | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `address` | [string](#string) | | the relayer address | -| `distribution_address` | [string](#string) | | the distribution address | +| `relayer_address` | [string](#string) | | the relayer address | +| `payee` | [string](#string) | | the payee address | | `channel_id` | [string](#string) | | unique channel identifier | diff --git a/modules/apps/29-fee/keeper/genesis.go b/modules/apps/29-fee/keeper/genesis.go index 46fb5d65781..c4be3a9d027 100644 --- a/modules/apps/29-fee/keeper/genesis.go +++ b/modules/apps/29-fee/keeper/genesis.go @@ -24,18 +24,18 @@ func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState) { k.SetFeeEnabled(ctx, enabledChan.PortId, enabledChan.ChannelId) } - for _, registeredDistAddr := range state.RegisteredDistributionAddresses { - k.SetPayeeAddress(ctx, registeredDistAddr.Address, registeredDistAddr.DistributionAddress, registeredDistAddr.ChannelId) + for _, registeredPayee := range state.RegisteredPayees { + k.SetPayeeAddress(ctx, registeredPayee.RelayerAddress, registeredPayee.Payee, registeredPayee.ChannelId) } } // ExportGenesis returns the fee middleware application exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { return &types.GenesisState{ - IdentifiedFees: k.GetAllIdentifiedPacketFees(ctx), - FeeEnabledChannels: k.GetAllFeeEnabledChannels(ctx), - RegisteredRelayers: k.GetAllRelayerAddresses(ctx), - ForwardRelayers: k.GetAllForwardRelayerAddresses(ctx), - RegisteredDistributionAddresses: k.GetAllPayeeAddresses(ctx), + IdentifiedFees: k.GetAllIdentifiedPacketFees(ctx), + FeeEnabledChannels: k.GetAllFeeEnabledChannels(ctx), + RegisteredRelayers: k.GetAllRelayerAddresses(ctx), + ForwardRelayers: k.GetAllForwardRelayerAddresses(ctx), + RegisteredPayees: k.GetAllPayeeAddresses(ctx), } } diff --git a/modules/apps/29-fee/keeper/genesis_test.go b/modules/apps/29-fee/keeper/genesis_test.go index 12bf5c6b0b1..7cd2e5bd1a6 100644 --- a/modules/apps/29-fee/keeper/genesis_test.go +++ b/modules/apps/29-fee/keeper/genesis_test.go @@ -35,11 +35,11 @@ func (suite *KeeperTestSuite) TestInitGenesis() { ChannelId: ibctesting.FirstChannelID, }, }, - RegisteredDistributionAddresses: []types.RegisteredDistributionAddress{ + RegisteredPayees: []types.RegisteredPayee{ { - Address: suite.chainA.SenderAccount.GetAddress().String(), - DistributionAddress: suite.chainB.SenderAccount.GetAddress().String(), - ChannelId: ibctesting.FirstChannelID, + RelayerAddress: suite.chainA.SenderAccount.GetAddress().String(), + Payee: suite.chainB.SenderAccount.GetAddress().String(), + ChannelId: ibctesting.FirstChannelID, }, }, } @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { // check payee addresses payeeAddr, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetPayeeAddress(suite.chainA.GetContext(), suite.chainA.SenderAccount.GetAddress().String(), ibctesting.FirstChannelID) suite.Require().True(found) - suite.Require().Equal(genesisState.RegisteredDistributionAddresses[0].DistributionAddress, payeeAddr) + suite.Require().Equal(genesisState.RegisteredPayees[0].Payee, payeeAddr) } func (suite *KeeperTestSuite) TestExportGenesis() { @@ -113,7 +113,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { suite.Require().Equal(packetID, genesisState.ForwardRelayers[0].PacketId) // check payee addresses - suite.Require().Equal(suite.chainA.SenderAccount.GetAddress().String(), genesisState.RegisteredDistributionAddresses[0].Address) - suite.Require().Equal(suite.chainB.SenderAccount.GetAddress().String(), genesisState.RegisteredDistributionAddresses[0].DistributionAddress) - suite.Require().Equal(ibctesting.FirstChannelID, genesisState.RegisteredDistributionAddresses[0].ChannelId) + suite.Require().Equal(suite.chainA.SenderAccount.GetAddress().String(), genesisState.RegisteredPayees[0].RelayerAddress) + suite.Require().Equal(suite.chainB.SenderAccount.GetAddress().String(), genesisState.RegisteredPayees[0].Payee) + suite.Require().Equal(ibctesting.FirstChannelID, genesisState.RegisteredPayees[0].ChannelId) } diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 23bbed50a70..3453d87b99c 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -166,28 +166,28 @@ func (k Keeper) SetPayeeAddress(ctx sdk.Context, relayerAddr, payeeAddr, channel } // GetAllPayeeAddresses returns all registered distribution addresses -func (k Keeper) GetAllPayeeAddresses(ctx sdk.Context) []types.RegisteredDistributionAddress { +func (k Keeper) GetAllPayeeAddresses(ctx sdk.Context) []types.RegisteredPayee { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte(types.PayeeAddressKeyPrefix)) defer iterator.Close() - var distributionAddrs []types.RegisteredDistributionAddress + var registeredPayees []types.RegisteredPayee for ; iterator.Valid(); iterator.Next() { addr, channelID, err := types.ParseKeyPayeeAddress(string(iterator.Key())) if err != nil { panic(err) } - distributionAddr := types.RegisteredDistributionAddress{ - Address: addr, - DistributionAddress: string(iterator.Value()), - ChannelId: channelID, + payee := types.RegisteredPayee{ + RelayerAddress: addr, + Payee: string(iterator.Value()), + ChannelId: channelID, } - distributionAddrs = append(distributionAddrs, distributionAddr) + registeredPayees = append(registeredPayees, payee) } - return distributionAddrs + return registeredPayees } // SetCounterpartyAddress maps the destination chain relayer address to the source relayer address diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 50d339b0ce9..ed36418ad87 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -278,7 +278,7 @@ func (suite *KeeperTestSuite) TestGetAllRelayerAddresses() { } func (suite *KeeperTestSuite) TestGetAllDistributionAddresses() { - var expectedDistAddrs []types.RegisteredDistributionAddress + var expectedPayees []types.RegisteredPayee for i := 0; i < 3; i++ { suite.chainA.GetSimApp().IBCFeeKeeper.SetPayeeAddress( @@ -288,16 +288,16 @@ func (suite *KeeperTestSuite) TestGetAllDistributionAddresses() { ibctesting.FirstChannelID, ) - registeredDistAddr := types.RegisteredDistributionAddress{ - Address: suite.chainA.SenderAccounts[i].SenderAccount.GetAddress().String(), - DistributionAddress: suite.chainB.SenderAccounts[i].SenderAccount.GetAddress().String(), - ChannelId: ibctesting.FirstChannelID, + registeredPayee := types.RegisteredPayee{ + RelayerAddress: suite.chainA.SenderAccounts[i].SenderAccount.GetAddress().String(), + Payee: suite.chainB.SenderAccounts[i].SenderAccount.GetAddress().String(), + ChannelId: ibctesting.FirstChannelID, } - expectedDistAddrs = append(expectedDistAddrs, registeredDistAddr) + expectedPayees = append(expectedPayees, registeredPayee) } - registeredDistAddrs := suite.chainA.GetSimApp().IBCFeeKeeper.GetAllPayeeAddresses(suite.chainA.GetContext()) - suite.Require().Len(registeredDistAddrs, len(expectedDistAddrs)) - suite.Require().ElementsMatch(expectedDistAddrs, registeredDistAddrs) + registeredPayees := suite.chainA.GetSimApp().IBCFeeKeeper.GetAllPayeeAddresses(suite.chainA.GetContext()) + suite.Require().Len(registeredPayees, len(expectedPayees)) + suite.Require().ElementsMatch(expectedPayees, registeredPayees) } diff --git a/modules/apps/29-fee/types/genesis.go b/modules/apps/29-fee/types/genesis.go index 14a291bec6d..db406c3fefb 100644 --- a/modules/apps/29-fee/types/genesis.go +++ b/modules/apps/29-fee/types/genesis.go @@ -15,25 +15,25 @@ func NewGenesisState( feeEnabledChannels []FeeEnabledChannel, registeredRelayers []RegisteredRelayerAddress, forwardRelayers []ForwardRelayerAddress, - registeredDistributionAddrs []RegisteredDistributionAddress, + registeredPayees []RegisteredPayee, ) *GenesisState { return &GenesisState{ - IdentifiedFees: identifiedFees, - FeeEnabledChannels: feeEnabledChannels, - RegisteredRelayers: registeredRelayers, - ForwardRelayers: forwardRelayers, - RegisteredDistributionAddresses: registeredDistributionAddrs, + IdentifiedFees: identifiedFees, + FeeEnabledChannels: feeEnabledChannels, + RegisteredRelayers: registeredRelayers, + ForwardRelayers: forwardRelayers, + RegisteredPayees: registeredPayees, } } // DefaultGenesisState returns a GenesisState with "transfer" as the default PortID. func DefaultGenesisState() *GenesisState { return &GenesisState{ - IdentifiedFees: []IdentifiedPacketFees{}, - ForwardRelayers: []ForwardRelayerAddress{}, - FeeEnabledChannels: []FeeEnabledChannel{}, - RegisteredRelayers: []RegisteredRelayerAddress{}, - RegisteredDistributionAddresses: []RegisteredDistributionAddress{}, + IdentifiedFees: []IdentifiedPacketFees{}, + ForwardRelayers: []ForwardRelayerAddress{}, + FeeEnabledChannels: []FeeEnabledChannel{}, + RegisteredRelayers: []RegisteredRelayerAddress{}, + RegisteredPayees: []RegisteredPayee{}, } } @@ -63,6 +63,25 @@ func (gs GenesisState) Validate() error { } } + // Validate RegisteredPayees + for _, registeredPayee := range gs.RegisteredPayees { + if registeredPayee.RelayerAddress == registeredPayee.Payee { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "relayer address and payee address must not be equal") + } + + if _, err := sdk.AccAddressFromBech32(registeredPayee.RelayerAddress); err != nil { + return sdkerrors.Wrap(err, "failed to convert relayer address into sdk.AccAddress") + } + + if _, err := sdk.AccAddressFromBech32(registeredPayee.Payee); err != nil { + return sdkerrors.Wrap(err, "failed to convert payee address into sdk.AccAddress") + } + + if err := host.ChannelIdentifierValidator(registeredPayee.ChannelId); err != nil { + return sdkerrors.Wrapf(err, "invalid channel identifier: %s", registeredPayee.ChannelId) + } + } + // Validate RegisteredRelayers for _, rel := range gs.RegisteredRelayers { if _, err := sdk.AccAddressFromBech32(rel.Address); err != nil { @@ -85,20 +104,5 @@ func (gs GenesisState) Validate() error { } } - // Validate DistributionAddresses - for _, registeredDistAddr := range gs.RegisteredDistributionAddresses { - if _, err := sdk.AccAddressFromBech32(registeredDistAddr.Address); err != nil { - return sdkerrors.Wrap(err, "failed to convert source relayer address into sdk.AccAddress") - } - - if _, err := sdk.AccAddressFromBech32(registeredDistAddr.DistributionAddress); err != nil { - return sdkerrors.Wrap(err, "failed to convert source relayer address into sdk.AccAddress") - } - - if err := host.ChannelIdentifierValidator(registeredDistAddr.ChannelId); err != nil { - return sdkerrors.Wrapf(err, "invalid channel identifier: %s", registeredDistAddr.ChannelId) - } - } - return nil } diff --git a/modules/apps/29-fee/types/genesis.pb.go b/modules/apps/29-fee/types/genesis.pb.go index 19ef17108b4..bd2fd2083f0 100644 --- a/modules/apps/29-fee/types/genesis.pb.go +++ b/modules/apps/29-fee/types/genesis.pb.go @@ -30,12 +30,12 @@ type GenesisState struct { IdentifiedFees []IdentifiedPacketFees `protobuf:"bytes,1,rep,name=identified_fees,json=identifiedFees,proto3" json:"identified_fees" yaml:"identified_fees"` // list of fee enabled channels FeeEnabledChannels []FeeEnabledChannel `protobuf:"bytes,2,rep,name=fee_enabled_channels,json=feeEnabledChannels,proto3" json:"fee_enabled_channels" yaml:"fee_enabled_channels"` + // list of registered payees + RegisteredPayees []RegisteredPayee `protobuf:"bytes,3,rep,name=registered_payees,json=registeredPayees,proto3" json:"registered_payees" yaml:"registered_payees"` // list of registered relayer addresses - RegisteredRelayers []RegisteredRelayerAddress `protobuf:"bytes,3,rep,name=registered_relayers,json=registeredRelayers,proto3" json:"registered_relayers" yaml:"registered_relayers"` + RegisteredRelayers []RegisteredRelayerAddress `protobuf:"bytes,4,rep,name=registered_relayers,json=registeredRelayers,proto3" json:"registered_relayers" yaml:"registered_relayers"` // list of forward relayer addresses - ForwardRelayers []ForwardRelayerAddress `protobuf:"bytes,4,rep,name=forward_relayers,json=forwardRelayers,proto3" json:"forward_relayers" yaml:"forward_relayers"` - // list of registered distribution addresses - RegisteredDistributionAddresses []RegisteredDistributionAddress `protobuf:"bytes,5,rep,name=registered_distribution_addresses,json=registeredDistributionAddresses,proto3" json:"registered_distribution_addresses" yaml:"registered_distribution_addresses"` + ForwardRelayers []ForwardRelayerAddress `protobuf:"bytes,5,rep,name=forward_relayers,json=forwardRelayers,proto3" json:"forward_relayers" yaml:"forward_relayers"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -85,23 +85,23 @@ func (m *GenesisState) GetFeeEnabledChannels() []FeeEnabledChannel { return nil } -func (m *GenesisState) GetRegisteredRelayers() []RegisteredRelayerAddress { +func (m *GenesisState) GetRegisteredPayees() []RegisteredPayee { if m != nil { - return m.RegisteredRelayers + return m.RegisteredPayees } return nil } -func (m *GenesisState) GetForwardRelayers() []ForwardRelayerAddress { +func (m *GenesisState) GetRegisteredRelayers() []RegisteredRelayerAddress { if m != nil { - return m.ForwardRelayers + return m.RegisteredRelayers } return nil } -func (m *GenesisState) GetRegisteredDistributionAddresses() []RegisteredDistributionAddress { +func (m *GenesisState) GetForwardRelayers() []ForwardRelayerAddress { if m != nil { - return m.RegisteredDistributionAddresses + return m.ForwardRelayers } return nil } @@ -161,6 +161,70 @@ func (m *FeeEnabledChannel) GetChannelId() string { return "" } +// RegisteredPayee contains the relayer address and payee address for a specific channel +type RegisteredPayee struct { + // the relayer address + RelayerAddress string `protobuf:"bytes,1,opt,name=relayer_address,json=relayerAddress,proto3" json:"relayer_address,omitempty" yaml:"relayer_address"` + // the payee address + Payee string `protobuf:"bytes,2,opt,name=payee,proto3" json:"payee,omitempty"` + // unique channel identifier + ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` +} + +func (m *RegisteredPayee) Reset() { *m = RegisteredPayee{} } +func (m *RegisteredPayee) String() string { return proto.CompactTextString(m) } +func (*RegisteredPayee) ProtoMessage() {} +func (*RegisteredPayee) Descriptor() ([]byte, []int) { + return fileDescriptor_7191992e856dff95, []int{2} +} +func (m *RegisteredPayee) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RegisteredPayee) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RegisteredPayee.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *RegisteredPayee) XXX_Merge(src proto.Message) { + xxx_messageInfo_RegisteredPayee.Merge(m, src) +} +func (m *RegisteredPayee) XXX_Size() int { + return m.Size() +} +func (m *RegisteredPayee) XXX_DiscardUnknown() { + xxx_messageInfo_RegisteredPayee.DiscardUnknown(m) +} + +var xxx_messageInfo_RegisteredPayee proto.InternalMessageInfo + +func (m *RegisteredPayee) GetRelayerAddress() string { + if m != nil { + return m.RelayerAddress + } + return "" +} + +func (m *RegisteredPayee) GetPayee() string { + if m != nil { + return m.Payee + } + return "" +} + +func (m *RegisteredPayee) GetChannelId() string { + if m != nil { + return m.ChannelId + } + return "" +} + // RegisteredRelayerAddress contains the address and counterparty address for a specific relayer (for distributing fees) type RegisteredRelayerAddress struct { // the relayer address @@ -175,7 +239,7 @@ func (m *RegisteredRelayerAddress) Reset() { *m = RegisteredRelayerAddre func (m *RegisteredRelayerAddress) String() string { return proto.CompactTextString(m) } func (*RegisteredRelayerAddress) ProtoMessage() {} func (*RegisteredRelayerAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_7191992e856dff95, []int{2} + return fileDescriptor_7191992e856dff95, []int{3} } func (m *RegisteredRelayerAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -237,7 +301,7 @@ func (m *ForwardRelayerAddress) Reset() { *m = ForwardRelayerAddress{} } func (m *ForwardRelayerAddress) String() string { return proto.CompactTextString(m) } func (*ForwardRelayerAddress) ProtoMessage() {} func (*ForwardRelayerAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_7191992e856dff95, []int{3} + return fileDescriptor_7191992e856dff95, []int{4} } func (m *ForwardRelayerAddress) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,76 +344,12 @@ func (m *ForwardRelayerAddress) GetPacketId() types.PacketId { return types.PacketId{} } -// RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel -type RegisteredDistributionAddress struct { - // the relayer address - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // the distribution address - DistributionAddress string `protobuf:"bytes,2,opt,name=distribution_address,json=distributionAddress,proto3" json:"distribution_address,omitempty" yaml:"distribution_address"` - // unique channel identifier - ChannelId string `protobuf:"bytes,3,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty" yaml:"channel_id"` -} - -func (m *RegisteredDistributionAddress) Reset() { *m = RegisteredDistributionAddress{} } -func (m *RegisteredDistributionAddress) String() string { return proto.CompactTextString(m) } -func (*RegisteredDistributionAddress) ProtoMessage() {} -func (*RegisteredDistributionAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_7191992e856dff95, []int{4} -} -func (m *RegisteredDistributionAddress) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RegisteredDistributionAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RegisteredDistributionAddress.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *RegisteredDistributionAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_RegisteredDistributionAddress.Merge(m, src) -} -func (m *RegisteredDistributionAddress) XXX_Size() int { - return m.Size() -} -func (m *RegisteredDistributionAddress) XXX_DiscardUnknown() { - xxx_messageInfo_RegisteredDistributionAddress.DiscardUnknown(m) -} - -var xxx_messageInfo_RegisteredDistributionAddress proto.InternalMessageInfo - -func (m *RegisteredDistributionAddress) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func (m *RegisteredDistributionAddress) GetDistributionAddress() string { - if m != nil { - return m.DistributionAddress - } - return "" -} - -func (m *RegisteredDistributionAddress) GetChannelId() string { - if m != nil { - return m.ChannelId - } - return "" -} - func init() { proto.RegisterType((*GenesisState)(nil), "ibc.applications.fee.v1.GenesisState") proto.RegisterType((*FeeEnabledChannel)(nil), "ibc.applications.fee.v1.FeeEnabledChannel") + proto.RegisterType((*RegisteredPayee)(nil), "ibc.applications.fee.v1.RegisteredPayee") proto.RegisterType((*RegisteredRelayerAddress)(nil), "ibc.applications.fee.v1.RegisteredRelayerAddress") proto.RegisterType((*ForwardRelayerAddress)(nil), "ibc.applications.fee.v1.ForwardRelayerAddress") - proto.RegisterType((*RegisteredDistributionAddress)(nil), "ibc.applications.fee.v1.RegisteredDistributionAddress") } func init() { @@ -357,48 +357,48 @@ func init() { } var fileDescriptor_7191992e856dff95 = []byte{ - // 655 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0x8d, 0x5b, 0xda, 0xd2, 0x2d, 0xea, 0x87, 0xdb, 0x52, 0xab, 0xa8, 0x76, 0xbb, 0x08, 0xa9, - 0x02, 0xd5, 0x26, 0x2d, 0x20, 0xc1, 0x8d, 0x00, 0x45, 0x39, 0x81, 0x16, 0x4e, 0x5c, 0x22, 0x7f, - 0x8c, 0xd3, 0x15, 0x89, 0xd7, 0xda, 0xdd, 0x04, 0x85, 0x1b, 0x17, 0xb8, 0xf2, 0x63, 0x38, 0x73, - 0x41, 0x42, 0x3d, 0xf6, 0xc8, 0x29, 0x42, 0xed, 0x3f, 0xe8, 0x2f, 0x40, 0xf6, 0xae, 0xdb, 0x34, - 0x71, 0xa2, 0x8a, 0xdb, 0xda, 0xfb, 0xde, 0xbc, 0x37, 0xcf, 0xe3, 0x41, 0xf7, 0x68, 0x10, 0x7a, - 0x7e, 0x9a, 0xb6, 0x68, 0xe8, 0x4b, 0xca, 0x12, 0xe1, 0xc5, 0x00, 0x5e, 0xb7, 0xea, 0x35, 0x21, - 0x01, 0x41, 0x85, 0x9b, 0x72, 0x26, 0x99, 0xb9, 0x41, 0x83, 0xd0, 0x1d, 0x84, 0xb9, 0x31, 0x80, - 0xdb, 0xad, 0x6e, 0xae, 0x35, 0x59, 0x93, 0xe5, 0x18, 0x2f, 0x3b, 0x29, 0xf8, 0xe6, 0xce, 0xb8, - 0xaa, 0x19, 0x6b, 0x00, 0x12, 0x32, 0x0e, 0x5e, 0x78, 0xe4, 0x27, 0x09, 0xb4, 0xb2, 0x6b, 0x7d,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xe3, 0x16, 0x1b, 0xa6, - 0x5b, 0x75, 0xd5, 0x42, 0xa8, 0x47, 0x35, 0x4b, 0x7f, 0xf1, 0x65, 0x1d, 0x7e, 0xc1, 0xc6, 0xe4, - 0x66, 0xaa, 0x31, 0xf8, 0x97, 0x81, 0xb6, 0x26, 0xce, 0xcd, 0xe4, 0x3c, 0xcb, 0x46, 0x67, 0x34, - 0xcf, 0x32, 0x14, 0x26, 0xab, 0x51, 0x89, 0xda, 0x7f, 0xe5, 0x59, 0x7b, 0x73, 0x7c, 0x6a, 0x1b, - 0x27, 0xa7, 0xb6, 0xf1, 0xf7, 0xd4, 0x36, 0xbe, 0x9f, 0xd9, 0x95, 0x93, 0x33, 0xbb, 0xf2, 0xe7, - 0xcc, 0xae, 0x7c, 0x78, 0xdc, 0xa4, 0xf2, 0xa8, 0x13, 0xb8, 0x21, 0x6b, 0x7b, 0x21, 0x13, 0x6d, - 0x26, 0x3c, 0x1a, 0x84, 0x7b, 0x4d, 0xe6, 0x75, 0x0f, 0xbc, 0x36, 0x8b, 0x3a, 0x2d, 0x10, 0xd9, - 0x46, 0x17, 0xde, 0xfe, 0xd3, 0xbd, 0x6c, 0x99, 0xcb, 0x5e, 0x0a, 0x22, 0x98, 0xcd, 0x37, 0xf5, - 0xc1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x83, 0xe4, 0xb2, 0x8e, 0x47, 0x06, 0x00, 0x00, + // 652 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6f, 0xd3, 0x30, + 0x18, 0x6d, 0x36, 0xb6, 0x31, 0x0f, 0xad, 0x9b, 0xd7, 0xb1, 0xa8, 0x88, 0x74, 0x18, 0x21, 0x4d, + 0xa0, 0x25, 0xea, 0x06, 0x07, 0xb8, 0xd1, 0x89, 0xa1, 0x9e, 0x98, 0x0c, 0x27, 0x2e, 0x55, 0x9a, + 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 0x53, 0xc7, 0x27, 0x6d, 0x37, 0xe0, 0x3d, 0x2f, 0xe0, 0xb2, 0xc7, 0xa5, 0xc7, 0xda, + 0xc1, 0x6e, 0x87, 0x7b, 0xfd, 0x7d, 0xaf, 0xc7, 0xc3, 0x93, 0x2e, 0xc8, 0x74, 0xe4, 0x4a, 0x6f, + 0xef, 0xe5, 0x6e, 0x3a, 0x6d, 0xd5, 0x20, 0x01, 0xd9, 0x5e, 0xcc, 0x46, 0xe9, 0xfe, 0xdf, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xb6, 0xf7, 0x84, 0x44, 0xe8, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -421,10 +421,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.RegisteredDistributionAddresses) > 0 { - for iNdEx := len(m.RegisteredDistributionAddresses) - 1; iNdEx >= 0; iNdEx-- { + if len(m.ForwardRelayers) > 0 { + for iNdEx := len(m.ForwardRelayers) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.RegisteredDistributionAddresses[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.ForwardRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -435,10 +435,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x2a } } - if len(m.ForwardRelayers) > 0 { - for iNdEx := len(m.ForwardRelayers) - 1; iNdEx >= 0; iNdEx-- { + if len(m.RegisteredRelayers) > 0 { + for iNdEx := len(m.RegisteredRelayers) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ForwardRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RegisteredRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -449,10 +449,10 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if len(m.RegisteredRelayers) > 0 { - for iNdEx := len(m.RegisteredRelayers) - 1; iNdEx >= 0; iNdEx-- { + if len(m.RegisteredPayees) > 0 { + for iNdEx := len(m.RegisteredPayees) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.RegisteredRelayers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RegisteredPayees[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -531,7 +531,7 @@ func (m *FeeEnabledChannel) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RegisteredRelayerAddress) Marshal() (dAtA []byte, err error) { +func (m *RegisteredPayee) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -541,12 +541,12 @@ func (m *RegisteredRelayerAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RegisteredRelayerAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *RegisteredPayee) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RegisteredRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RegisteredPayee) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -558,24 +558,24 @@ func (m *RegisteredRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error i-- dAtA[i] = 0x1a } - if len(m.CounterpartyAddress) > 0 { - i -= len(m.CounterpartyAddress) - copy(dAtA[i:], m.CounterpartyAddress) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.CounterpartyAddress))) + if len(m.Payee) > 0 { + i -= len(m.Payee) + copy(dAtA[i:], m.Payee) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.Payee))) i-- dAtA[i] = 0x12 } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.Address))) + if len(m.RelayerAddress) > 0 { + i -= len(m.RelayerAddress) + copy(dAtA[i:], m.RelayerAddress) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.RelayerAddress))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ForwardRelayerAddress) Marshal() (dAtA []byte, err error) { +func (m *RegisteredRelayerAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -585,26 +585,30 @@ func (m *ForwardRelayerAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ForwardRelayerAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *RegisteredRelayerAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ForwardRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RegisteredRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + 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) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.CounterpartyAddress))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x12 if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -615,7 +619,7 @@ func (m *ForwardRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *RegisteredDistributionAddress) Marshal() (dAtA []byte, err error) { +func (m *ForwardRelayerAddress) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -625,30 +629,26 @@ func (m *RegisteredDistributionAddress) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RegisteredDistributionAddress) MarshalTo(dAtA []byte) (int, error) { +func (m *ForwardRelayerAddress) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RegisteredDistributionAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ForwardRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = 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.DistributionAddress) > 0 { - i -= len(m.DistributionAddress) - copy(dAtA[i:], m.DistributionAddress) - i = encodeVarintGenesis(dAtA, i, uint64(len(m.DistributionAddress))) - i-- - dAtA[i] = 0x12 + { + size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Address) > 0 { i -= len(m.Address) copy(dAtA[i:], m.Address) @@ -688,20 +688,20 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.RegisteredRelayers) > 0 { - for _, e := range m.RegisteredRelayers { + if len(m.RegisteredPayees) > 0 { + for _, e := range m.RegisteredPayees { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.ForwardRelayers) > 0 { - for _, e := range m.ForwardRelayers { + if len(m.RegisteredRelayers) > 0 { + for _, e := range m.RegisteredRelayers { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.RegisteredDistributionAddresses) > 0 { - for _, e := range m.RegisteredDistributionAddresses { + if len(m.ForwardRelayers) > 0 { + for _, e := range m.ForwardRelayers { l = e.Size() n += 1 + l + sovGenesis(uint64(l)) } @@ -726,17 +726,17 @@ func (m *FeeEnabledChannel) Size() (n int) { return n } -func (m *RegisteredRelayerAddress) Size() (n int) { +func (m *RegisteredPayee) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Address) + l = len(m.RelayerAddress) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - l = len(m.CounterpartyAddress) + l = len(m.Payee) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } @@ -747,7 +747,7 @@ func (m *RegisteredRelayerAddress) Size() (n int) { return n } -func (m *ForwardRelayerAddress) Size() (n int) { +func (m *RegisteredRelayerAddress) Size() (n int) { if m == nil { return 0 } @@ -757,12 +757,18 @@ func (m *ForwardRelayerAddress) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - l = m.PacketId.Size() - n += 1 + l + sovGenesis(uint64(l)) + l = len(m.CounterpartyAddress) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + sovGenesis(uint64(l)) + } return n } -func (m *RegisteredDistributionAddress) Size() (n int) { +func (m *ForwardRelayerAddress) Size() (n int) { if m == nil { return 0 } @@ -772,14 +778,8 @@ func (m *RegisteredDistributionAddress) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - l = len(m.DistributionAddress) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + sovGenesis(uint64(l)) - } + l = m.PacketId.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -888,7 +888,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegisteredRelayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RegisteredPayees", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -915,14 +915,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RegisteredRelayers = append(m.RegisteredRelayers, RegisteredRelayerAddress{}) - if err := m.RegisteredRelayers[len(m.RegisteredRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RegisteredPayees = append(m.RegisteredPayees, RegisteredPayee{}) + if err := m.RegisteredPayees[len(m.RegisteredPayees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ForwardRelayers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RegisteredRelayers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -949,14 +949,14 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ForwardRelayers = append(m.ForwardRelayers, ForwardRelayerAddress{}) - if err := m.ForwardRelayers[len(m.ForwardRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RegisteredRelayers = append(m.RegisteredRelayers, RegisteredRelayerAddress{}) + if err := m.RegisteredRelayers[len(m.RegisteredRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegisteredDistributionAddresses", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ForwardRelayers", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -983,8 +983,8 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.RegisteredDistributionAddresses = append(m.RegisteredDistributionAddresses, RegisteredDistributionAddress{}) - if err := m.RegisteredDistributionAddresses[len(m.RegisteredDistributionAddresses)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ForwardRelayers = append(m.ForwardRelayers, ForwardRelayerAddress{}) + if err := m.ForwardRelayers[len(m.ForwardRelayers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1123,7 +1123,7 @@ func (m *FeeEnabledChannel) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { +func (m *RegisteredPayee) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1146,15 +1146,15 @@ func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisteredRelayerAddress: wiretype end group for non-group") + return fmt.Errorf("proto: RegisteredPayee: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisteredRelayerAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisteredPayee: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RelayerAddress", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1182,11 +1182,11 @@ func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Address = string(dAtA[iNdEx:postIndex]) + m.RelayerAddress = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Payee", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1214,7 +1214,7 @@ func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CounterpartyAddress = string(dAtA[iNdEx:postIndex]) + m.Payee = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -1269,7 +1269,7 @@ func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { +func (m *RegisteredRelayerAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1292,10 +1292,10 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ForwardRelayerAddress: wiretype end group for non-group") + return fmt.Errorf("proto: RegisteredRelayerAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ForwardRelayerAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RegisteredRelayerAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1332,9 +1332,9 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CounterpartyAddress", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -1344,24 +1344,55 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + 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 @@ -1384,7 +1415,7 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { } return nil } -func (m *RegisteredDistributionAddress) Unmarshal(dAtA []byte) error { +func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1407,10 +1438,10 @@ func (m *RegisteredDistributionAddress) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RegisteredDistributionAddress: wiretype end group for non-group") + return fmt.Errorf("proto: ForwardRelayerAddress: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RegisteredDistributionAddress: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ForwardRelayerAddress: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1447,9 +1478,9 @@ func (m *RegisteredDistributionAddress) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DistributionAddress", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field PacketId", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -1459,55 +1490,24 @@ func (m *RegisteredDistributionAddress) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthGenesis } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthGenesis } if postIndex > l { return io.ErrUnexpectedEOF } - m.DistributionAddress = 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 + if err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - m.ChannelId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/modules/apps/29-fee/types/genesis_test.go b/modules/apps/29-fee/types/genesis_test.go index 13a0c7dbf69..fa6ca6d1dd2 100644 --- a/modules/apps/29-fee/types/genesis_test.go +++ b/modules/apps/29-fee/types/genesis_test.go @@ -5,6 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types" channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" @@ -79,58 +80,57 @@ func TestValidateGenesis(t *testing.T) { false, }, { - "invalid registered relayers: invalid sender", + "invalid registered payee: invalid relayer address", func() { - genState.RegisteredRelayers[0].Address = "" + genState.RegisteredPayees[0].RelayerAddress = "" }, false, }, { - "invalid registered relayers: invalid counterparty", + "invalid registered payee: invalid payee address", func() { - genState.RegisteredRelayers[0].CounterpartyAddress = "" + genState.RegisteredPayees[0].Payee = "" }, false, }, { - "invalid forward relayer address: invalid forward address", + "invalid registered payee: invalid channel ID", func() { - genState.ForwardRelayers[0].Address = "" + genState.RegisteredPayees[0].ChannelId = "" }, false, }, { - "invalid forward relayer address: invalid packet", + "invalid registered relayers: invalid sender", func() { - genState.ForwardRelayers[0].PacketId = channeltypes.PacketId{} + genState.RegisteredRelayers[0].Address = "" }, false, }, { - "invalid distribution address: invalid relayer address", + "invalid registered relayers: invalid counterparty", func() { - genState.RegisteredDistributionAddresses[0].Address = "" + genState.RegisteredRelayers[0].CounterpartyAddress = "" }, false, }, { - "invalid distribution address: invalid distribution address", + "invalid forward relayer address: invalid forward address", func() { - genState.RegisteredDistributionAddresses[0].DistributionAddress = "" + genState.ForwardRelayers[0].Address = "" }, false, }, { - "invalid distribution address: invalid channel ID", + "invalid forward relayer address: invalid packet", func() { - genState.RegisteredDistributionAddresses[0].ChannelId = "" + genState.ForwardRelayers[0].PacketId = channeltypes.PacketId{} }, false, }, } for _, tc := range testCases { - genState = &types.GenesisState{ IdentifiedFees: []types.IdentifiedPacketFees{ { @@ -156,11 +156,11 @@ func TestValidateGenesis(t *testing.T) { PacketId: channeltypes.NewPacketId(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1), }, }, - RegisteredDistributionAddresses: []types.RegisteredDistributionAddress{ + RegisteredPayees: []types.RegisteredPayee{ { - Address: defaultAccAddress, - DistributionAddress: defaultAccAddress, - ChannelId: ibctesting.FirstChannelID, + RelayerAddress: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + Payee: sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String(), + ChannelId: ibctesting.FirstChannelID, }, }, } diff --git a/proto/ibc/applications/fee/v1/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto index 6d6e22065d8..57af52f32d9 100644 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ b/proto/ibc/applications/fee/v1/genesis.proto @@ -16,15 +16,15 @@ message GenesisState { // list of fee enabled channels repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\"", (gogoproto.nullable) = false]; + // list of registered payees + repeated RegisteredPayee registered_payees = 3 + [(gogoproto.moretags) = "yaml:\"registered_payees\"", (gogoproto.nullable) = false]; // list of registered relayer addresses - repeated RegisteredRelayerAddress registered_relayers = 3 + repeated RegisteredRelayerAddress registered_relayers = 4 [(gogoproto.moretags) = "yaml:\"registered_relayers\"", (gogoproto.nullable) = false]; // list of forward relayer addresses - repeated ForwardRelayerAddress forward_relayers = 4 + repeated ForwardRelayerAddress forward_relayers = 5 [(gogoproto.moretags) = "yaml:\"forward_relayers\"", (gogoproto.nullable) = false]; - // list of registered distribution addresses - repeated RegisteredDistributionAddress registered_distribution_addresses = 5 - [(gogoproto.moretags) = "yaml:\"registered_distribution_addresses\"", (gogoproto.nullable) = false]; } // FeeEnabledChannel contains the PortID & ChannelID for a fee enabled channel @@ -35,6 +35,16 @@ message FeeEnabledChannel { string channel_id = 2 [(gogoproto.moretags) = "yaml:\"channel_id\""]; } +// RegisteredPayee contains the relayer address and payee address for a specific channel +message RegisteredPayee { + // the relayer address + string relayer_address = 1 [(gogoproto.moretags) = "yaml:\"relayer_address\""]; + // the payee address + string payee = 2; + // unique channel identifier + string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; +} + // RegisteredRelayerAddress contains the address and counterparty address for a specific relayer (for distributing fees) message RegisteredRelayerAddress { // the relayer address @@ -53,13 +63,3 @@ message ForwardRelayerAddress { ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; } - -// RegisteredDistributionAddress contains the relayer address and distribution address for a specific channel -message RegisteredDistributionAddress { - // the relayer address - string address = 1; - // the distribution address - string distribution_address = 2 [(gogoproto.moretags) = "yaml:\"distribution_address\""]; - // unique channel identifier - string channel_id = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""]; -} From fde1732a22741de00604925364f0e9d3d4f1262b Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 8 Jun 2022 14:35:22 +0200 Subject: [PATCH 11/12] updating godoc in keeper.go --- modules/apps/29-fee/keeper/keeper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 3453d87b99c..311bee5eb69 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -165,7 +165,7 @@ func (k Keeper) SetPayeeAddress(ctx sdk.Context, relayerAddr, payeeAddr, channel store.Set(types.KeyPayeeAddress(relayerAddr, channelID), []byte(payeeAddr)) } -// GetAllPayeeAddresses returns all registered distribution addresses +// GetAllPayeeAddresses returns all registered payees func (k Keeper) GetAllPayeeAddresses(ctx sdk.Context) []types.RegisteredPayee { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte(types.PayeeAddressKeyPrefix)) From 9e0cc4394c3b3bceaa95a032f8d313246b5d604c Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Wed, 8 Jun 2022 15:18:22 +0200 Subject: [PATCH 12/12] Update modules/apps/29-fee/keeper/keeper_test.go Co-authored-by: Aditya --- modules/apps/29-fee/keeper/keeper_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index ed36418ad87..1b26fe6ac5e 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -277,7 +277,7 @@ func (suite *KeeperTestSuite) TestGetAllRelayerAddresses() { suite.Require().Equal(addr, expectedAddr) } -func (suite *KeeperTestSuite) TestGetAllDistributionAddresses() { +func (suite *KeeperTestSuite) TestGetAllPayeeAddresses() { var expectedPayees []types.RegisteredPayee for i := 0; i < 3; i++ {