From e514f1a31d5afbefde3d470b815ea50067f3a6d6 Mon Sep 17 00:00:00 2001 From: Aditya Sripal Date: Wed, 17 Nov 2021 15:27:23 +0100 Subject: [PATCH] store refund address in IdentifiedPacketFee --- docs/ibc/proto-docs.md | 76 +---------- modules/apps/29-fee/keeper/escrow.go | 6 +- modules/apps/29-fee/keeper/escrow_test.go | 12 +- modules/apps/29-fee/keeper/grpc_query_test.go | 14 +- modules/apps/29-fee/keeper/msg_server.go | 16 +-- modules/apps/29-fee/keeper/msg_server_test.go | 4 +- modules/apps/29-fee/types/fee.pb.go | 126 +++++++++++++----- modules/apps/29-fee/types/msgs.go | 17 +-- modules/apps/29-fee/types/msgs_test.go | 8 +- modules/apps/29-fee/types/tx.pb.go | 124 ++++++----------- proto/ibc/applications/fee/v1/fee.proto | 15 ++- proto/ibc/applications/fee/v1/tx.proto | 5 +- 12 files changed, 187 insertions(+), 236 deletions(-) diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 562bb7f718d..11f3ab0479b 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -617,7 +617,7 @@ CLOSED, INIT, TRYOPEN, OPEN or UNINITIALIZED. ### Fee -Fee interface +Fee implements the ics29 Fee interface See Fee Payment Middleware spec: https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middleware-contract @@ -636,13 +636,17 @@ https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middl ### IdentifiedPacketFee -Fee associated with a packet_id +IdentifiedPacketFee contains the relayer fee along with the associated metadata needed to process it. +This includes the PacketId identifying the packet the fee is paying for, +the refund address to which any unused funds are refunded, +and an optional list of relayers that are permitted to receive the fee. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `packet_id` | [ibc.core.channel.v1.PacketId](#ibc.core.channel.v1.PacketId) | | | | `fee` | [Fee](#ibc.applications.fee.v1.Fee) | | | +| `refund_address` | [string](#string) | | | | `relayers` | [string](#string) | repeated | | @@ -781,71 +785,6 @@ Query provides defines the gRPC querier service. - - -### MsgPayPacketFee -MsgPayPacketFee defines the request type EscrowPacketFee 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 - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `fee` | [Fee](#ibc.applications.fee.v1.Fee) | | | -| `source_port_id` | [string](#string) | | source channel port identifier | -| `source_channel_id` | [string](#string) | | source channel unique identifier | -| `signer` | [string](#string) | | account address to refund fee if necessary | -| `relayers` | [string](#string) | repeated | | - - - - - - - - -### MsgPayPacketFeeAsync -MsgPayPacketFeeAsync defines the request type PayPacketFeeAsync RPC -This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `identified_packet_fee` | [IdentifiedPacketFee](#ibc.applications.fee.v1.IdentifiedPacketFee) | | packet to pay fee for | -| `signer` | [string](#string) | | account address to refund fee if necessary | - - - - - - - - - - - -### Query -Query provides defines the gRPC querier service. - -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `ReceiveFee` | [QueryReceiveFeeRequest](#ibc.applications.fee.v1.QueryReceiveFeeRequest) | [QueryReceiveFeeResponse](#ibc.applications.fee.v1.QueryReceiveFeeResponse) | Gets the fee expected for submitting ReceivePacket msg for the given packet | GET|/ibc/apps/fee/v1/receive_fee/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `AckFee` | [QueryAckFeeRequest](#ibc.applications.fee.v1.QueryAckFeeRequest) | [QueryAckFeeResponse](#ibc.applications.fee.v1.QueryAckFeeResponse) | Gets the fee expected for submitting AcknowledgePacket msg for the given packet | GET|/ibc/apps/fee/v1/ack_fee/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `TimeoutFee` | [QueryTimeoutFeeRequest](#ibc.applications.fee.v1.QueryTimeoutFeeRequest) | [QueryTimeoutFeeResponse](#ibc.applications.fee.v1.QueryTimeoutFeeResponse) | Gets the fee expected for submitting TimeoutPacket msg for the given packet | GET|/ibc/apps/fee/v1/timeout_fee/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| -| `IncentivizedPackets` | [QueryIncentivizedPacketsRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketsRequest) | [QueryIncentivizedPacketsResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketsResponse) | Gets all incentivized packets | GET|/ibc/apps/fee/v1/incentivized_packets| -| `IncentivizedPacket` | [QueryIncentivizedPacketRequest](#ibc.applications.fee.v1.QueryIncentivizedPacketRequest) | [QueryIncentivizedPacketResponse](#ibc.applications.fee.v1.QueryIncentivizedPacketResponse) | Gets the specified incentivized packet | GET|/ibc/apps/fee/v1/incentivized_packet/port/{packet_id.port_id}/channel/{packet_id.channel_id}/sequence/{packet_id.sequence}| - - - - - - -

Top

- -## ibc/applications/fee/v1/tx.proto - - - ### MsgPayPacketFee @@ -876,8 +815,7 @@ This Msg can be used to pay for a packet at a specified sequence (instead of the | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `identified_packet_fee` | [IdentifiedPacketFee](#ibc.applications.fee.v1.IdentifiedPacketFee) | | packet to pay fee for | -| `signer` | [string](#string) | | account address to refund fee if necessary | +| `identified_packet_fee` | [IdentifiedPacketFee](#ibc.applications.fee.v1.IdentifiedPacketFee) | | identified packet to pay fee for identified fee must contain the refund address which is also signer of this message | diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index cddb3be047a..1f46d16bbf9 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -12,8 +12,12 @@ import ( ) // EscrowPacketFee sends the packet fee to the 29-fee module account to hold in escrow -func (k Keeper) EscrowPacketFee(ctx sdk.Context, refundAcc sdk.AccAddress, identifiedFee *types.IdentifiedPacketFee) error { +func (k Keeper) EscrowPacketFee(ctx sdk.Context, identifiedFee *types.IdentifiedPacketFee) error { // check if the refund account exists + refundAcc, err := sdk.AccAddressFromBech32(identifiedFee.RefundAddress) + if err != nil { + return err + } hasRefundAcc := k.authKeeper.GetAccount(ctx, refundAcc) if hasRefundAcc == nil { return sdkerrors.Wrap(types.ErrRefundAccNotFound, fmt.Sprintf("Account with address: %s not found", refundAcc)) diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index d5600c964e3..91cd66a2a14 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -74,13 +74,13 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() { tc.malleate() fee := types.Fee{ackFee, receiveFee, timeoutFee} - identifiedPacketFee := &types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: []string{}} + identifiedPacketFee := &types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} // refundAcc balance before escrow originalBal := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAcc, sdk.DefaultBondDenom) // escrow the packet fee - err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), refundAcc, identifiedPacketFee) + err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) if tc.expPass { feeInEscrow, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeInEscrow(suite.chainA.GetContext(), packetId) @@ -153,9 +153,9 @@ func (suite *KeeperTestSuite) TestDistributeFee() { fee := types.Fee{receiveFee, ackFee, timeoutFee} // escrow the packet fee & store the fee in state - identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: []string{}} + identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} - err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), refundAcc, &identifiedPacketFee) + err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) suite.Require().NoError(err) tc.malleate() @@ -244,8 +244,8 @@ func (suite *KeeperTestSuite) TestDistributeTimeoutFee() { fee := types.Fee{receiveFee, ackFee, timeoutFee} // escrow the packet fee & store the fee in state - identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: []string{}} - err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), refundAcc, &identifiedPacketFee) + identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) suite.Require().NoError(err) tc.malleate() diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index c1eb27f2fcc..899df77d5bd 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -26,6 +26,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { ReceiveFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))), TimeoutFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))), }, + "", // leave empty here and then populate on each testcase since suite resets []string(nil), ) @@ -61,10 +62,12 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacket() { suite.SetupTest() // reset refundAcc := suite.chainA.SenderAccount.GetAddress() + // populate RefundAddress field + identifiedPacketFee.RefundAddress = refundAcc.String() tc.malleate() ctx := sdk.WrapSDKContext(suite.chainA.GetContext()) - suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), refundAcc, identifiedPacketFee) + suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) res, err := suite.queryClient.IncentivizedPacket(ctx, req) if tc.expPass { @@ -107,15 +110,15 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { func() { refundAcc := suite.chainA.SenderAccount.GetAddress() - fee1 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 1), fee, []string(nil)) - fee2 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 2), fee, []string(nil)) - fee3 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 3), fee, []string(nil)) + fee1 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 1), fee, refundAcc.String(), []string(nil)) + fee2 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 2), fee, refundAcc.String(), []string(nil)) + fee3 := types.NewIdentifiedPacketFee(types.NewPacketId(ibctesting.FirstChannelID, 3), fee, refundAcc.String(), []string(nil)) expPackets = []*types.IdentifiedPacketFee{} expPackets = append(expPackets, fee1, fee2, fee3) for _, p := range expPackets { - suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), refundAcc, p) + suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), p) } req = &types.QueryIncentivizedPacketsRequest{ @@ -141,7 +144,6 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) - fmt.Println(expPackets) suite.Require().Equal(expPackets, res.IncentivizedPackets) } else { suite.Require().Error(err) diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index 4b81a870eea..e3687b9d215 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -43,13 +43,8 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) Sequence: sequence, } - refundAccAddr, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - return nil, err - } - - identifiedPacket := types.NewIdentifiedPacketFee(packetId, msg.Fee, msg.Relayers) - err = k.EscrowPacketFee(ctx, refundAccAddr, identifiedPacket) + identifiedPacket := types.NewIdentifiedPacketFee(packetId, msg.Fee, msg.Signer, msg.Relayers) + err := k.EscrowPacketFee(ctx, identifiedPacket) if err != nil { return nil, err } @@ -63,12 +58,7 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) func (k Keeper) PayPacketFeeAsync(goCtx context.Context, msg *types.MsgPayPacketFeeAsync) (*types.MsgPayPacketFeeAsyncResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - refundAccAddr, err := sdk.AccAddressFromBech32(msg.Signer) - if err != nil { - return nil, err - } - - err = k.EscrowPacketFee(ctx, refundAccAddr, &msg.IdentifiedPacketFee) + err := k.EscrowPacketFee(ctx, &msg.IdentifiedPacketFee) if err != nil { return nil, err } diff --git a/modules/apps/29-fee/keeper/msg_server_test.go b/modules/apps/29-fee/keeper/msg_server_test.go index face4c4c905..c93f02bd97c 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -115,11 +115,11 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { // build fee packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: suite.path.EndpointA.ChannelConfig.PortID, Sequence: seq} - identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: []string{}} + identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} tc.malleate() - msg := types.NewMsgPayPacketFeeAsync(identifiedPacketFee, refundAcc.String()) + msg := types.NewMsgPayPacketFeeAsync(identifiedPacketFee) _, err = suite.chainA.SendMsgs(msg) if tc.expPass { diff --git a/modules/apps/29-fee/types/fee.pb.go b/modules/apps/29-fee/types/fee.pb.go index 23c7abecd4d..038368c7ce8 100644 --- a/modules/apps/29-fee/types/fee.pb.go +++ b/modules/apps/29-fee/types/fee.pb.go @@ -26,7 +26,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Fee interface +// Fee implements the ics29 Fee interface // See Fee Payment Middleware spec: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middleware-contract type Fee struct { @@ -89,11 +89,15 @@ func (m *Fee) GetTimeoutFee() github_com_cosmos_cosmos_sdk_types.Coins { return nil } -// Fee associated with a packet_id +// IdentifiedPacketFee contains the relayer fee along with the associated metadata needed to process it. +// This includes the PacketId identifying the packet the fee is paying for, +// the refund address to which any unused funds are refunded, +// and an optional list of relayers that are permitted to receive the fee. type IdentifiedPacketFee struct { - PacketId *types1.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id,omitempty" yaml:"packet_id"` - Fee Fee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee"` - Relayers []string `protobuf:"bytes,3,rep,name=relayers,proto3" json:"relayers,omitempty"` + PacketId *types1.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id,omitempty" yaml:"packet_id"` + Fee Fee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee"` + RefundAddress string `protobuf:"bytes,3,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty" yaml:"refund_address"` + Relayers []string `protobuf:"bytes,4,rep,name=relayers,proto3" json:"relayers,omitempty"` } func (m *IdentifiedPacketFee) Reset() { *m = IdentifiedPacketFee{} } @@ -143,6 +147,13 @@ func (m *IdentifiedPacketFee) GetFee() Fee { return Fee{} } +func (m *IdentifiedPacketFee) GetRefundAddress() string { + if m != nil { + return m.RefundAddress + } + return "" +} + func (m *IdentifiedPacketFee) GetRelayers() []string { if m != nil { return m.Relayers @@ -158,35 +169,37 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/fee.proto", fileDescriptor_cb3319f1af2a53e5) } var fileDescriptor_cb3319f1af2a53e5 = []byte{ - // 443 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xcd, 0x6e, 0x13, 0x31, - 0x10, 0xc7, 0x63, 0x16, 0x95, 0xd6, 0x91, 0x10, 0x5a, 0x2a, 0x51, 0x22, 0xd8, 0x94, 0x3d, 0xe5, - 0x12, 0x5b, 0x09, 0x5c, 0xe0, 0xb8, 0x48, 0x91, 0x2a, 0x71, 0xa8, 0xf6, 0xc8, 0xa5, 0xf2, 0x7a, - 0x27, 0x5b, 0x6b, 0x3f, 0xbc, 0x5a, 0x3b, 0x2b, 0xe5, 0xca, 0x85, 0x2b, 0xcf, 0xc1, 0x1b, 0xf0, - 0x06, 0x3d, 0xf6, 0xc8, 0x29, 0xa0, 0xe4, 0x0d, 0xfa, 0x04, 0xc8, 0x1f, 0xad, 0x22, 0x21, 0x84, - 0x72, 0xf2, 0xd8, 0x9e, 0xbf, 0x7f, 0x33, 0xe3, 0x19, 0xfc, 0x46, 0x64, 0x9c, 0xb2, 0xb6, 0xad, - 0x04, 0x67, 0x5a, 0xc8, 0x46, 0xd1, 0x25, 0x00, 0xed, 0x67, 0x66, 0x21, 0x6d, 0x27, 0xb5, 0x0c, - 0x5f, 0x88, 0x8c, 0x93, 0x7d, 0x17, 0x62, 0xee, 0xfa, 0xd9, 0x28, 0xe2, 0x52, 0xd5, 0x52, 0xd1, - 0x8c, 0x29, 0x23, 0xc9, 0x40, 0xb3, 0x19, 0xe5, 0x52, 0x34, 0x4e, 0x38, 0x3a, 0x2d, 0x64, 0x21, - 0xad, 0x49, 0x8d, 0xe5, 0x4f, 0x2d, 0x91, 0xcb, 0x0e, 0x28, 0xbf, 0x66, 0x4d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x32, 0x4e, 0x8f, 0x5b, 0x7f, 0x1f, 0xbe, 0xc3, 0x81, 0x2b, 0xb1, 0x79, 0xeb, 0x15, 0xf9, - 0x47, 0xcf, 0x91, 0x05, 0x40, 0xf2, 0xd8, 0x24, 0x9a, 0x1a, 0xf7, 0x70, 0x84, 0x8f, 0x3b, 0xa8, - 0xd8, 0x1a, 0x3a, 0x65, 0x0b, 0x74, 0x92, 0x3e, 0xec, 0x93, 0x4f, 0x37, 0xdb, 0x08, 0xdd, 0x6e, - 0x23, 0xf4, 0x7b, 0x1b, 0xa1, 0x6f, 0xbb, 0x68, 0x70, 0xbb, 0x8b, 0x06, 0x3f, 0x77, 0xd1, 0xe0, - 0xf3, 0xfc, 0xef, 0x5a, 0x88, 0x8c, 0x4f, 0x0b, 0x49, 0x6b, 0x99, 0xaf, 0x2a, 0x50, 0x66, 0x22, - 0x14, 0x9d, 0xbf, 0x9f, 0x9a, 0x61, 0xb0, 0xb5, 0xc9, 0x8e, 0x6c, 0x6b, 0xbe, 0xfd, 0x13, 0x00, - 0x00, 0xff, 0xff, 0x80, 0x3a, 0xb6, 0x74, 0x31, 0x03, 0x00, 0x00, + // 480 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x31, 0x8f, 0xd3, 0x30, + 0x14, 0xc7, 0x1b, 0x72, 0x3a, 0xae, 0xae, 0x38, 0xa1, 0x70, 0x88, 0x5e, 0x05, 0x69, 0xc9, 0x94, + 0xa5, 0xb6, 0x5a, 0x58, 0x60, 0x82, 0x20, 0x55, 0x3a, 0x89, 0xe1, 0x94, 0x91, 0xa5, 0x72, 0xec, + 0xd7, 0x9e, 0xd5, 0x24, 0x8e, 0xe2, 0x34, 0x52, 0x57, 0x16, 0x56, 0x3e, 0x07, 0x9f, 0xe4, 0xc6, + 0x1b, 0x99, 0x0a, 0x6a, 0xbf, 0x41, 0x57, 0x16, 0xe4, 0xd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, 0x76, 0x53, 0x24, 0x6c, 0x38, 0x97, 0x24, 0x93, 0x7c, + 0x99, 0x82, 0xd2, 0x7f, 0x4a, 0x91, 0xf1, 0xbb, 0xa1, 0xfe, 0x4e, 0x4d, 0x77, 0x93, 0xd3, 0x66, + 0xb8, 0xdf, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xbf, 0x7c, 0x4e, 0x14, 0x73, 0x03, 0x00, 0x00, } func (m *Fee) Marshal() (dAtA []byte, err error) { @@ -280,9 +293,16 @@ func (m *IdentifiedPacketFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.Relayers[iNdEx]) i = encodeVarintFee(dAtA, i, uint64(len(m.Relayers[iNdEx]))) i-- - dAtA[i] = 0x1a + dAtA[i] = 0x22 } } + if len(m.RefundAddress) > 0 { + i -= len(m.RefundAddress) + copy(dAtA[i:], m.RefundAddress) + i = encodeVarintFee(dAtA, i, uint64(len(m.RefundAddress))) + i-- + dAtA[i] = 0x1a + } { size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -358,6 +378,10 @@ func (m *IdentifiedPacketFee) Size() (n int) { } l = m.Fee.Size() n += 1 + l + sovFee(uint64(l)) + l = len(m.RefundAddress) + if l > 0 { + n += 1 + l + sovFee(uint64(l)) + } if len(m.Relayers) > 0 { for _, s := range m.Relayers { l = len(s) @@ -624,6 +648,38 @@ func (m *IdentifiedPacketFee) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RefundAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowFee + } + 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 ErrInvalidLengthFee + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthFee + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RefundAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Relayers", wireType) } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 2c212da21bc..53bcc0b5b74 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -103,10 +103,9 @@ func (msg MsgPayPacketFee) GetSigners() []sdk.AccAddress { } // NewMsgPayPacketAsync creates a new instance of MsgPayPacketFee -func NewMsgPayPacketFeeAsync(identifiedPacketFee IdentifiedPacketFee, signer string) *MsgPayPacketFeeAsync { +func NewMsgPayPacketFeeAsync(identifiedPacketFee IdentifiedPacketFee) *MsgPayPacketFeeAsync { return &MsgPayPacketFeeAsync{ IdentifiedPacketFee: identifiedPacketFee, - Signer: signer, } } @@ -125,7 +124,7 @@ func (msg MsgPayPacketFeeAsync) ValidateBasic() error { } // signer check - _, err = sdk.AccAddressFromBech32(msg.Signer) + _, err = sdk.AccAddressFromBech32(msg.IdentifiedPacketFee.RefundAddress) if err != nil { return sdkerrors.Wrap(err, "failed to convert msg.Signer into sdk.AccAddress") } @@ -154,19 +153,21 @@ func (msg MsgPayPacketFeeAsync) ValidateBasic() error { } // GetSigners implements sdk.Msg +// The signer of the fee message must be the refund address func (msg MsgPayPacketFeeAsync) GetSigners() []sdk.AccAddress { - signer, err := sdk.AccAddressFromBech32(msg.Signer) + signer, err := sdk.AccAddressFromBech32(msg.IdentifiedPacketFee.RefundAddress) if err != nil { panic(err) } return []sdk.AccAddress{signer} } -func NewIdentifiedPacketFee(packetId *channeltypes.PacketId, fee Fee, relayers []string) *IdentifiedPacketFee { +func NewIdentifiedPacketFee(packetId *channeltypes.PacketId, fee Fee, refundAddr string, relayers []string) *IdentifiedPacketFee { return &IdentifiedPacketFee{ - PacketId: packetId, - Fee: fee, - Relayers: relayers, + PacketId: packetId, + Fee: fee, + RefundAddress: refundAddr, + Relayers: relayers, } } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index 480eedcc403..16172969776 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -320,8 +320,8 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { fee = Fee{receiveFee, ackFee, timeoutFee} packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: portID, Sequence: seq} - identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: relayers} - msg := NewMsgPayPacketFeeAsync(identifiedPacketFee, signer) + identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: signer, Relayers: relayers} + msg := NewMsgPayPacketFeeAsync(identifiedPacketFee) err := msg.ValidateBasic() @@ -342,8 +342,8 @@ func TestPayPacketFeeAsyncGetSigners(t *testing.T) { fee := Fee{validCoins, validCoins, validCoins} seq := uint64(1) packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: portID, Sequence: seq} - identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, Relayers: nil} - msg := NewMsgPayPacketFeeAsync(identifiedPacketFee, addr.String()) + identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: addr.String(), Relayers: nil} + msg := NewMsgPayPacketFeeAsync(identifiedPacketFee) // GetSigners res := msg.GetSigners() diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index 7e27acc666a..8602f2996c8 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -194,10 +194,9 @@ var xxx_messageInfo_MsgPayPacketFeeResponse proto.InternalMessageInfo // MsgPayPacketFeeAsync defines the request type PayPacketFeeAsync RPC // This Msg can be used to pay for a packet at a specified sequence (instead of the next sequence send) type MsgPayPacketFeeAsync struct { - // packet to pay fee for + // identified packet to pay fee for + // identified fee must contain the refund address which is also signer of this message IdentifiedPacketFee IdentifiedPacketFee `protobuf:"bytes,1,opt,name=identified_packet_fee,json=identifiedPacketFee,proto3" json:"identified_packet_fee" yaml:"identified_packet_fee"` - // account address to refund fee if necessary - Signer string `protobuf:"bytes,2,opt,name=signer,proto3" json:"signer,omitempty"` } func (m *MsgPayPacketFeeAsync) Reset() { *m = MsgPayPacketFeeAsync{} } @@ -282,44 +281,44 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/tx.proto", fileDescriptor_05c93128649f1b96) } var fileDescriptor_05c93128649f1b96 = []byte{ - // 589 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, - 0x18, 0xc7, 0x93, 0x75, 0xbf, 0xfd, 0x36, 0x33, 0x31, 0x2d, 0xeb, 0x58, 0x97, 0x55, 0x49, 0x89, - 0x10, 0xea, 0x81, 0x26, 0xac, 0x80, 0x10, 0xbb, 0x4c, 0xeb, 0xa4, 0x89, 0x4a, 0x54, 0xaa, 0x72, - 0xe4, 0x52, 0xa5, 0xce, 0xd3, 0xcc, 0xd0, 0xc6, 0x91, 0xed, 0x4e, 0xe4, 0x0d, 0x4c, 0x1c, 0x77, - 0x83, 0xe3, 0xde, 0x0a, 0xb7, 0x1d, 0x77, 0xe4, 0x54, 0xa1, 0xf6, 0xc2, 0xb9, 0xaf, 0x00, 0x25, - 0x69, 0xbb, 0x74, 0xfd, 0xa3, 0xc1, 0xcd, 0xf6, 0xf3, 0x79, 0xbe, 0xf6, 0xf7, 0x6b, 0xcb, 0xa8, - 0x40, 0x9a, 0xd8, 0x72, 0x82, 0xa0, 0x4d, 0xb0, 0x23, 0x08, 0xf5, 0xb9, 0xd5, 0x02, 0xb0, 0x2e, - 0x0e, 0x2d, 0xf1, 0xc5, 0x0c, 0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, 0x6b, 0x71, 0x99, 0x60, 0x9a, 0x54, 0x5f, 0x3e, 0x94, 0x9c, 0xec, 0x15, 0xa2, 0xed, - 0xd9, 0xdb, 0x2e, 0x3d, 0x54, 0x26, 0xc6, 0xd5, 0x37, 0x7f, 0x85, 0x8f, 0xb7, 0xae, 0x7c, 0xb8, - 0xe9, 0x6b, 0xf2, 0x6d, 0x5f, 0x93, 0x7f, 0xf5, 0x35, 0xf9, 0x6a, 0xa0, 0x49, 0xb7, 0x03, 0x4d, - 0xfa, 0x39, 0xd0, 0xa4, 0x8f, 0x65, 0x8f, 0x88, 0xf3, 0x6e, 0xd3, 0xc4, 0xb4, 0x63, 0x61, 0xca, - 0x3b, 0x94, 0x5b, 0xa4, 0x89, 0x4b, 0x1e, 0xb5, 0x3a, 0xd4, 0xed, 0xb6, 0x81, 0x47, 0x9f, 0x1b, - 0xb7, 0xca, 0xef, 0x4a, 0xd1, 0xbf, 0x26, 0xc2, 0x00, 0x78, 0x73, 0x2d, 0xfe, 0xb4, 0x5e, 0xfd, - 0x09, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xcb, 0x98, 0x2b, 0x4d, 0x05, 0x00, 0x00, + // 585 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0x4f, 0x6f, 0xd3, 0x4c, + 0x10, 0xc6, 0xed, 0xa6, 0x6f, 0xdf, 0x76, 0xa9, 0xa8, 0xea, 0xa6, 0x34, 0x75, 0x23, 0x3b, 0x58, + 0x08, 0xe5, 0x40, 0x6c, 0x1a, 0x40, 0x88, 0x5e, 0xaa, 0xa6, 0x52, 0x45, 0x24, 0x22, 0x45, 0x3e, + 0x72, 0x89, 0x9c, 0xf5, 0xc4, 0x5d, 0x48, 0xbc, 0xd6, 0xee, 0xa6, 0xc2, 0x5f, 0xa0, 0xe2, 0xd8, + 0x1b, 0x1c, 0x7b, 0xe5, 0x9b, 0xf4,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x4d, 0xb5, 0xa1, 0xa1, 0xfc, 0xbc, 0x52, 0xc7, 0xbd, 0x94, 0x2f, + 0x33, 0x28, 0x53, 0xe3, 0x9e, 0xf2, 0x4d, 0x46, 0x07, 0xcb, 0xfe, 0xf0, 0xdb, 0x85, 0xa5, 0x2f, + 0xff, 0x62, 0xea, 0xf1, 0x3f, 0x26, 0x8e, 0x2b, 0x54, 0x3e, 0xa1, 0xcd, 0xa9, 0x7f, 0x59, 0x5c, + 0x26, 0x98, 0x26, 0xd5, 0x97, 0x0f, 0x25, 0x27, 0x77, 0x85, 0x68, 0x7b, 0xf6, 0x55, 0x4b, 0x0f, + 0x95, 0x89, 0x71, 0xf5, 0xcd, 0x5f, 0xe1, 0xe3, 0xab, 0x2b, 0x1f, 0x6e, 0xfa, 0x9a, 0x7c, 0xdb, + 0xd7, 0xe4, 0x5f, 0x7d, 0x4d, 0xbe, 0x1a, 0x68, 0xd2, 0xed, 0x40, 0x93, 0x7e, 0x0e, 0x34, 0xe9, + 0x63, 0xd9, 0x23, 0xe2, 0xbc, 0xdb, 0x34, 0x31, 0xed, 0x58, 0x98, 0xf2, 0x0e, 0xe5, 0x16, 0x69, + 0xe2, 0x92, 0x47, 0xad, 0x0e, 0x75, 0xbb, 0x6d, 0xe0, 0xd1, 0x10, 0xe3, 0x56, 0xf9, 0x5d, 0x29, + 0x9a, 0x5f, 0x22, 0x0c, 0x80, 0x37, 0xd7, 0xe2, 0xe1, 0xf4, 0xea, 0x4f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x20, 0xf7, 0x8a, 0xce, 0x35, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -662,13 +661,6 @@ func (m *MsgPayPacketFeeAsync) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) - i-- - dAtA[i] = 0x12 - } { size, err := m.IdentifiedPacketFee.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -788,10 +780,6 @@ func (m *MsgPayPacketFeeAsync) Size() (n int) { _ = l l = m.IdentifiedPacketFee.Size() n += 1 + l + sovTx(uint64(l)) - l = len(m.Signer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } return n } @@ -1297,38 +1285,6 @@ func (m *MsgPayPacketFeeAsync) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", 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.Signer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) diff --git a/proto/ibc/applications/fee/v1/fee.proto b/proto/ibc/applications/fee/v1/fee.proto index 121eae2dca4..eb21f44caec 100644 --- a/proto/ibc/applications/fee/v1/fee.proto +++ b/proto/ibc/applications/fee/v1/fee.proto @@ -6,7 +6,7 @@ import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; option go_package = "github.com/cosmos/ibc-go/modules/apps/29-fee/types"; -// Fee interface +// Fee implements the ics29 Fee interface // See Fee Payment Middleware spec: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middleware-contract message Fee { @@ -26,9 +26,14 @@ message Fee { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } -// Fee associated with a packet_id + +// IdentifiedPacketFee contains the relayer fee along with the associated metadata needed to process it. +// This includes the PacketId identifying the packet the fee is paying for, +// the refund address to which any unused funds are refunded, +// and an optional list of relayers that are permitted to receive the fee. message IdentifiedPacketFee { - ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.moretags) = "yaml:\"packet_id\""]; - Fee fee = 2 [(gogoproto.nullable) = false]; - repeated string relayers = 3; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.moretags) = "yaml:\"packet_id\""]; + Fee fee = 2 [(gogoproto.nullable) = false]; + string refund_address = 3 [(gogoproto.moretags) = "yaml:\"refund_address\""]; + repeated string relayers = 4; } diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index 31163483d4d..6313e94d0ef 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -63,11 +63,10 @@ message MsgPayPacketFeeAsync { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // packet to pay fee for + // identified packet to pay fee for + // identified fee must contain the refund address which is also signer of this message ibc.applications.fee.v1.IdentifiedPacketFee identified_packet_fee = 1 [(gogoproto.moretags) = "yaml:\"identified_packet_fee\"", (gogoproto.nullable) = false]; - // account address to refund fee if necessary - string signer = 2; } // MsgPayPacketFeeAsyncResponse defines the response type for Msg/PayPacketFeeAsync