diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 662081f9459..284a8718f00 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -701,7 +701,7 @@ https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middl | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `receive_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `recv_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | | `ack_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | | `timeout_fee` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | @@ -978,7 +978,7 @@ MsgPayPacketFeeResponse defines the response type for Msg/PayPacketFee ### MsgRegisterCounterpartyAddress -MsgRegisterCounterpartyAddress is the request type for registering the counter party address +MsgRegisterCounterpartyAddress is the request type for registering the counterparty address | Field | Type | Label | Description | diff --git a/go.mod b/go.mod index 2a8ed9f82c6..3e5f606755d 100644 --- a/go.mod +++ b/go.mod @@ -27,12 +27,6 @@ require ( gopkg.in/yaml.v2 v2.4.0 ) -require ( - github.com/gin-gonic/gin v1.7.0 // indirect - github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.0.3 // indirect -) - require ( filippo.io/edwards25519 v1.0.0-beta.2 // indirect github.com/99designs/keyring v1.1.6 // indirect @@ -60,6 +54,7 @@ require ( github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b // indirect github.com/felixge/httpsnoop v1.0.1 // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect + github.com/gin-gonic/gin v1.7.0 // indirect github.com/go-kit/kit v0.10.0 // indirect github.com/go-logfmt/logfmt v0.5.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect @@ -92,6 +87,8 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect + github.com/opencontainers/runc v1.0.3 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect diff --git a/modules/apps/29-fee/ibc_module_test.go b/modules/apps/29-fee/ibc_module_test.go index 41234d7468a..715a2509344 100644 --- a/modules/apps/29-fee/ibc_module_test.go +++ b/modules/apps/29-fee/ibc_module_test.go @@ -271,13 +271,13 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { { "success", func(suite *FeeTestSuite) { - packetId := channeltypes.PacketId{ - PortId: suite.path.EndpointA.ChannelConfig.PortID, - ChannelId: suite.path.EndpointA.ChannelID, - Sequence: 1, - } + packetId := channeltypes.NewPacketId( + suite.path.EndpointA.ChannelID, + suite.path.EndpointA.ChannelConfig.PortID, + 1, + ) refundAcc := suite.chainA.SenderAccount.GetAddress() - identifiedFee := types.NewIdentifiedPacketFee(&packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) + identifiedFee := types.NewIdentifiedPacketFee(packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedFee) suite.Require().NoError(err) }, @@ -292,7 +292,7 @@ func (suite *FeeTestSuite) TestOnChanCloseInit() { Sequence: 1, } refundAcc := suite.chainA.SenderAccount.GetAddress() - identifiedFee := types.NewIdentifiedPacketFee(&packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) + identifiedFee := types.NewIdentifiedPacketFee(packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedFee) suite.Require().NoError(err) @@ -357,7 +357,7 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { Sequence: 1, } refundAcc := suite.chainA.SenderAccount.GetAddress() - identifiedFee := types.NewIdentifiedPacketFee(&packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) + identifiedFee := types.NewIdentifiedPacketFee(packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedFee) suite.Require().NoError(err) }, @@ -372,7 +372,7 @@ func (suite *FeeTestSuite) TestOnChanCloseConfirm() { Sequence: 1, } refundAcc := suite.chainA.SenderAccount.GetAddress() - identifiedFee := types.NewIdentifiedPacketFee(&packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) + identifiedFee := types.NewIdentifiedPacketFee(packetId, types.Fee{validCoins, validCoins2, validCoins3}, refundAcc.String(), []string{}) err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedFee) suite.Require().NoError(err) @@ -510,7 +510,7 @@ func (suite *FeeTestSuite) TestOnRecvPacket() { func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { var ( ack []byte - identifiedFee *types.IdentifiedPacketFee + identifiedFee types.IdentifiedPacketFee originalBalance sdk.Coins expectedBalance sdk.Coins expectedRelayerBalance sdk.Coins @@ -524,7 +524,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { { "success", func() { - expectedRelayerBalance = identifiedFee.Fee.ReceiveFee.Add(identifiedFee.Fee.AckFee[0]) + expectedRelayerBalance = identifiedFee.Fee.RecvFee.Add(identifiedFee.Fee.AckFee[0]) }, true, }, @@ -603,7 +603,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { identifiedFee = types.NewIdentifiedPacketFee( packetId, types.Fee{ - ReceiveFee: validCoins, + RecvFee: validCoins, AckFee: validCoins2, TimeoutFee: validCoins3, }, @@ -658,7 +658,7 @@ func (suite *FeeTestSuite) TestOnAcknowledgementPacket() { func (suite *FeeTestSuite) TestOnTimeoutPacket() { var ( relayerAddr sdk.AccAddress - identifiedFee *types.IdentifiedPacketFee + identifiedFee types.IdentifiedPacketFee originalBalance sdk.Coins expectedBalance sdk.Coins ) @@ -698,7 +698,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { relayerAddr = suite.chainA.GetSimApp().AccountKeeper.GetModuleAccount(suite.chainA.GetContext(), transfertypes.ModuleName).GetAddress() expectedBalance = originalBalance. - Add(identifiedFee.Fee.ReceiveFee[0]). + Add(identifiedFee.Fee.RecvFee[0]). Add(identifiedFee.Fee.AckFee[0]). Add(ibctesting.TestCoin) // timeout refund for ics20 transfer }, @@ -737,7 +737,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { identifiedFee = types.NewIdentifiedPacketFee( packetId, types.Fee{ - ReceiveFee: validCoins, + RecvFee: validCoins, AckFee: validCoins2, TimeoutFee: validCoins3, }, @@ -754,7 +754,7 @@ func (suite *FeeTestSuite) TestOnTimeoutPacket() { // default to success case expectedBalance = originalBalance. - Add(identifiedFee.Fee.ReceiveFee[0]). + Add(identifiedFee.Fee.RecvFee[0]). Add(identifiedFee.Fee.AckFee[0]). Add(coin) // timeout refund from ics20 transfer diff --git a/modules/apps/29-fee/keeper/escrow.go b/modules/apps/29-fee/keeper/escrow.go index 2574843d9b7..1e19c127ed0 100644 --- a/modules/apps/29-fee/keeper/escrow.go +++ b/modules/apps/29-fee/keeper/escrow.go @@ -10,7 +10,7 @@ import ( ) // EscrowPacketFee sends the packet fee to the 29-fee module account to hold in escrow -func (k Keeper) EscrowPacketFee(ctx sdk.Context, identifiedFee *types.IdentifiedPacketFee) error { +func (k Keeper) EscrowPacketFee(ctx sdk.Context, identifiedFee types.IdentifiedPacketFee) error { if !k.IsFeeEnabled(ctx, identifiedFee.PacketId.PortId, identifiedFee.PacketId.ChannelId) { // users may not escrow fees on this channel. Must send packets without a fee message return sdkerrors.Wrap(types.ErrFeeNotEnabled, "cannot escrow fee for packet") @@ -26,7 +26,7 @@ func (k Keeper) EscrowPacketFee(ctx sdk.Context, identifiedFee *types.Identified return sdkerrors.Wrap(types.ErrRefundAccNotFound, fmt.Sprintf("Account with address: %s not found", refundAcc)) } - coins := identifiedFee.Fee.ReceiveFee + coins := identifiedFee.Fee.RecvFee coins = coins.Add(identifiedFee.Fee.AckFee...) coins = coins.Add(identifiedFee.Fee.TimeoutFee...) @@ -46,7 +46,7 @@ func (k Keeper) DistributePacketFees(ctx sdk.Context, refundAcc, forwardRelayer // distribute fee for forward relaying forward, err := sdk.AccAddressFromBech32(forwardRelayer) if err == nil { - k.distributeFee(ctx, forward, feeInEscrow.Fee.ReceiveFee) + k.distributeFee(ctx, forward, feeInEscrow.Fee.RecvFee) } // distribute fee for reverse relaying @@ -74,7 +74,7 @@ func (k Keeper) DistributePacketFeesOnTimeout(ctx sdk.Context, refundAcc string, } // refund receive fee for unused forward relaying - k.distributeFee(ctx, refundAddr, feeInEscrow.Fee.ReceiveFee) + k.distributeFee(ctx, refundAddr, feeInEscrow.Fee.RecvFee) // refund ack fee for unused reverse relaying k.distributeFee(ctx, refundAddr, feeInEscrow.Fee.AckFee) @@ -117,7 +117,7 @@ func (k Keeper) RefundFeesOnChannel(ctx sdk.Context, portID, channelID string) e // refund all fees to refund address // Use SendCoins rather than the module account send functions since refund address may be a user account or module address. // if any `SendCoins` call returns an error, we return error and stop iteration - if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, refundAccAddr, identifiedFee.Fee.ReceiveFee); err != nil { + if err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, refundAccAddr, identifiedFee.Fee.RecvFee); err != nil { refundErr = err return true } diff --git a/modules/apps/29-fee/keeper/escrow_test.go b/modules/apps/29-fee/keeper/escrow_test.go index 3b25f03d101..8642cca14d9 100644 --- a/modules/apps/29-fee/keeper/escrow_test.go +++ b/modules/apps/29-fee/keeper/escrow_test.go @@ -16,7 +16,7 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() { ackFee sdk.Coins receiveFee sdk.Coins timeoutFee sdk.Coins - packetId *channeltypes.PacketId + packetId channeltypes.PacketId ) testCases := []struct { @@ -67,15 +67,15 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() { receiveFee = defaultReceiveFee ackFee = defaultAckFee timeoutFee = defaultTimeoutFee - packetId = &channeltypes.PacketId{ChannelId: suite.path.EndpointA.ChannelID, PortId: transfertypes.PortID, Sequence: uint64(1)} + packetId = channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, transfertypes.PortID, uint64(1)) tc.malleate() fee := types.Fee{ - ReceiveFee: receiveFee, + RecvFee: receiveFee, AckFee: ackFee, TimeoutFee: timeoutFee, } - identifiedPacketFee := &types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + identifiedPacketFee := types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) // refundAcc balance before escrow originalBal := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAcc, sdk.DefaultBondDenom) @@ -87,7 +87,7 @@ func (suite *KeeperTestSuite) TestEscrowPacketFee() { feeInEscrow, _ := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeInEscrow(suite.chainA.GetContext(), packetId) // check if the escrowed fee is set in state suite.Require().True(feeInEscrow.Fee.AckFee.IsEqual(fee.AckFee)) - suite.Require().True(feeInEscrow.Fee.ReceiveFee.IsEqual(fee.ReceiveFee)) + suite.Require().True(feeInEscrow.Fee.RecvFee.IsEqual(fee.RecvFee)) suite.Require().True(feeInEscrow.Fee.TimeoutFee.IsEqual(fee.TimeoutFee)) // check if the fee is escrowed correctly hasBalance := suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(600)}) @@ -140,9 +140,9 @@ func (suite *KeeperTestSuite) TestDistributeFee() { reverseRelayer = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) forwardRelayer = sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()).String() - packetId := &channeltypes.PacketId{ChannelId: suite.path.EndpointA.ChannelID, PortId: transfertypes.PortID, Sequence: validSeq} + packetId := channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, transfertypes.PortID, validSeq) fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } @@ -158,7 +158,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { // refundAcc balance after escrow refundAccBal := suite.chainA.GetSimApp().BankKeeper.GetBalance(suite.chainA.GetContext(), refundAcc, sdk.DefaultBondDenom) - suite.chainA.GetSimApp().IBCFeeKeeper.DistributePacketFees(suite.chainA.GetContext(), refundAcc.String(), forwardRelayer, reverseRelayer, *identifiedPacketFee) + suite.chainA.GetSimApp().IBCFeeKeeper.DistributePacketFees(suite.chainA.GetContext(), refundAcc.String(), forwardRelayer, reverseRelayer, identifiedPacketFee) if tc.expPass { // there should no longer be a fee in escrow for this packet @@ -172,7 +172,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { // check if the forward relayer is paid forward, err := sdk.AccAddressFromBech32(forwardRelayer) suite.Require().NoError(err) - hasBalance = suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), forward, fee.ReceiveFee[0]) + hasBalance = suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), forward, fee.RecvFee[0]) suite.Require().True(hasBalance) // check if the refund acc has been refunded the timeoutFee @@ -185,7 +185,7 @@ func (suite *KeeperTestSuite) TestDistributeFee() { suite.Require().True(hasBalance) } else { // check the module acc wallet still has forward relaying balance - hasBalance := suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), fee.ReceiveFee[0]) + hasBalance := suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeModuleAddress(), fee.RecvFee[0]) suite.Require().True(hasBalance) } }) @@ -199,27 +199,27 @@ func (suite *KeeperTestSuite) TestDistributeTimeoutFee() { refundAcc := suite.chainA.SenderAccount.GetAddress() timeoutRelayer := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address()) - packetId := &channeltypes.PacketId{ - ChannelId: suite.path.EndpointA.ChannelID, - PortId: transfertypes.PortID, - Sequence: 1, - } + packetId := channeltypes.NewPacketId( + suite.path.EndpointA.ChannelID, + transfertypes.PortID, + 1, + ) fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } // escrow the packet fee & store the fee in state - identifiedPacketFee := types.IdentifiedPacketFee{ - PacketId: packetId, - Fee: fee, - RefundAddress: refundAcc.String(), - Relayers: []string{}, - } + identifiedPacketFee := types.NewIdentifiedPacketFee( + packetId, + fee, + refundAcc.String(), + []string{}, + ) - err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) + err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) // refundAcc balance after escrow @@ -237,7 +237,7 @@ func (suite *KeeperTestSuite) TestDistributeTimeoutFee() { // check if the refund acc has been refunded the recv & ack fees expectedRefundAccBal := refundAccBal.Add(fee.AckFee[0]) - expectedRefundAccBal = refundAccBal.Add(fee.ReceiveFee[0]) + expectedRefundAccBal = refundAccBal.Add(fee.RecvFee[0]) hasBalance = suite.chainA.GetSimApp().BankKeeper.HasBalance(suite.chainA.GetContext(), refundAcc, expectedRefundAccBal) suite.Require().True(hasBalance) @@ -254,30 +254,30 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannel() { prevBal := suite.chainA.GetSimApp().BankKeeper.GetAllBalances(suite.chainA.GetContext(), refundAcc) for i := 0; i < 5; i++ { - packetId := &channeltypes.PacketId{ChannelId: "channel-0", PortId: transfertypes.PortID, Sequence: uint64(i)} + packetId := channeltypes.NewPacketId("channel-0", transfertypes.PortID, uint64(i)) fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } - identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + identifiedPacketFee := types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), transfertypes.PortID, "channel-0") - err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) + err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) } // send a packet over a different channel to ensure this fee is not refunded - packetId := &channeltypes.PacketId{ChannelId: "channel-1", PortId: transfertypes.PortID, Sequence: 1} + packetId := channeltypes.NewPacketId("channel-1", transfertypes.PortID, 1) fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } - identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + identifiedPacketFee := types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), transfertypes.PortID, "channel-1") - err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) + err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) // check that refunding all fees on channel-0 refunds all fees except for fee on channel-1 @@ -286,13 +286,13 @@ func (suite *KeeperTestSuite) TestRefundFeesOnChannel() { // add fee sent to channel-1 to after balance to recover original balance afterBal := suite.chainA.GetSimApp().BankKeeper.GetAllBalances(suite.chainA.GetContext(), refundAcc) - suite.Require().Equal(prevBal, afterBal.Add(fee.ReceiveFee...).Add(fee.AckFee...).Add(fee.TimeoutFee...), "refund account not back to original balance after refunding all tokens") + suite.Require().Equal(prevBal, afterBal.Add(fee.RecvFee...).Add(fee.AckFee...).Add(fee.TimeoutFee...), "refund account not back to original balance after refunding all tokens") // create escrow and then change module account balance to cause error on refund - packetId = &channeltypes.PacketId{ChannelId: "channel-0", PortId: transfertypes.PortID, Sequence: uint64(6)} + packetId = channeltypes.NewPacketId("channel-0", transfertypes.PortID, uint64(6)) - identifiedPacketFee = types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} - err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), &identifiedPacketFee) + identifiedPacketFee = types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) + err = suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) suite.chainA.GetSimApp().BankKeeper.SendCoinsFromModuleToAccount(suite.chainA.GetContext(), types.ModuleName, refundAcc, fee.TimeoutFee) diff --git a/modules/apps/29-fee/keeper/genesis_test.go b/modules/apps/29-fee/keeper/genesis_test.go index 58e772ac66c..568335daed1 100644 --- a/modules/apps/29-fee/keeper/genesis_test.go +++ b/modules/apps/29-fee/keeper/genesis_test.go @@ -28,7 +28,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { counterparty := suite.chainB.SenderAccount.GetAddress().String() genesisState := types.GenesisState{ - IdentifiedFees: []*types.IdentifiedPacketFee{ + IdentifiedFees: []types.IdentifiedPacketFee{ { PacketId: packetId, Fee: fee, @@ -55,7 +55,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() { // check fee identifiedFee, found := suite.chainA.GetSimApp().IBCFeeKeeper.GetFeeInEscrow(suite.chainA.GetContext(), packetId) suite.Require().True(found) - suite.Require().Equal(genesisState.IdentifiedFees[0], &identifiedFee) + suite.Require().Equal(genesisState.IdentifiedFees[0], identifiedFee) // check fee is enabled isEnabled := suite.chainA.GetSimApp().IBCFeeKeeper.IsFeeEnabled(suite.chainA.GetContext(), transfertypes.PortID, ibctesting.FirstChannelID) @@ -84,7 +84,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() { defaultAckFee, defaultTimeoutFee, } - identifiedPacketFee := &types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + identifiedPacketFee := types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) diff --git a/modules/apps/29-fee/keeper/grpc_query_test.go b/modules/apps/29-fee/keeper/grpc_query_test.go index bef02669b04..2c41da93d1e 100644 --- a/modules/apps/29-fee/keeper/grpc_query_test.go +++ b/modules/apps/29-fee/keeper/grpc_query_test.go @@ -26,7 +26,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketI() { validPacketId, types.Fee{ AckFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))), - ReceiveFee: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100))), + RecvFee: 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 @@ -78,7 +78,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPacketI() { if tc.expPass { suite.Require().NoError(err) suite.Require().NotNil(res) - suite.Require().Equal(identifiedPacketFee, res.IncentivizedPacket) + suite.Require().Equal(&identifiedPacketFee, res.IncentivizedPacket) } else { suite.Require().Error(err) } @@ -94,7 +94,7 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { fee := types.Fee{ AckFee: sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}}, - ReceiveFee: sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}}, + RecvFee: sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}}, TimeoutFee: sdk.Coins{sdk.Coin{Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(100)}}, } @@ -120,11 +120,11 @@ func (suite *KeeperTestSuite) TestQueryIncentivizedPackets() { fee3 := types.NewIdentifiedPacketFee(channeltypes.NewPacketId(ibctesting.FirstChannelID, transfertypes.PortID, 3), fee, refundAcc.String(), []string(nil)) expPackets = []*types.IdentifiedPacketFee{} - expPackets = append(expPackets, fee1, fee2, fee3) + expPackets = append(expPackets, &fee1, &fee2, &fee3) suite.chainA.GetSimApp().IBCFeeKeeper.SetFeeEnabled(suite.chainA.GetContext(), transfertypes.PortID, ibctesting.FirstChannelID) for _, p := range expPackets { - suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), p) + suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), *p) } req = &types.QueryIncentivizedPacketsRequest{ diff --git a/modules/apps/29-fee/keeper/keeper.go b/modules/apps/29-fee/keeper/keeper.go index 53f9c9c091b..441aaf57a2c 100644 --- a/modules/apps/29-fee/keeper/keeper.go +++ b/modules/apps/29-fee/keeper/keeper.go @@ -175,13 +175,13 @@ func (k Keeper) GetAllRelayerAddresses(ctx sdk.Context) []*types.RegisteredRelay } // SetForwardRelayerAddress sets the forward relayer address during OnRecvPacket in case of async acknowledgement -func (k Keeper) SetForwardRelayerAddress(ctx sdk.Context, packetId *channeltypes.PacketId, address string) { +func (k Keeper) SetForwardRelayerAddress(ctx sdk.Context, packetId channeltypes.PacketId, address string) { store := ctx.KVStore(k.storeKey) store.Set(types.KeyForwardRelayerAddress(packetId), []byte(address)) } // GetForwardRelayerAddress gets forward relayer address for a particular packet -func (k Keeper) GetForwardRelayerAddress(ctx sdk.Context, packetId *channeltypes.PacketId) (string, bool) { +func (k Keeper) GetForwardRelayerAddress(ctx sdk.Context, packetId channeltypes.PacketId) (string, bool) { store := ctx.KVStore(k.storeKey) key := types.KeyForwardRelayerAddress(packetId) if !store.Has(key) { @@ -221,21 +221,21 @@ func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []*types.ForwardR } // Deletes the forwardRelayerAddr associated with the packetId -func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetId *channeltypes.PacketId) { +func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetId channeltypes.PacketId) { store := ctx.KVStore(k.storeKey) key := types.KeyForwardRelayerAddress(packetId) store.Delete(key) } // Stores a Fee for a given packet in state -func (k Keeper) SetFeeInEscrow(ctx sdk.Context, fee *types.IdentifiedPacketFee) { +func (k Keeper) SetFeeInEscrow(ctx sdk.Context, fee types.IdentifiedPacketFee) { store := ctx.KVStore(k.storeKey) - bz := k.MustMarshalFee(fee) + bz := k.MustMarshalFee(&fee) store.Set(types.KeyFeeInEscrow(fee.PacketId), bz) } // Gets a Fee for a given packet -func (k Keeper) GetFeeInEscrow(ctx sdk.Context, packetId *channeltypes.PacketId) (types.IdentifiedPacketFee, bool) { +func (k Keeper) GetFeeInEscrow(ctx sdk.Context, packetId channeltypes.PacketId) (types.IdentifiedPacketFee, bool) { store := ctx.KVStore(k.storeKey) key := types.KeyFeeInEscrow(packetId) bz := store.Get(key) @@ -263,14 +263,14 @@ func (k Keeper) IterateChannelFeesInEscrow(ctx sdk.Context, portID, channelID st } // Deletes the fee associated with the given packetId -func (k Keeper) DeleteFeeInEscrow(ctx sdk.Context, packetId *channeltypes.PacketId) { +func (k Keeper) DeleteFeeInEscrow(ctx sdk.Context, packetId channeltypes.PacketId) { store := ctx.KVStore(k.storeKey) key := types.KeyFeeInEscrow(packetId) store.Delete(key) } // HasFeeInEscrow returns true if there is a Fee still to be escrowed for a given packet -func (k Keeper) HasFeeInEscrow(ctx sdk.Context, packetId *channeltypes.PacketId) bool { +func (k Keeper) HasFeeInEscrow(ctx sdk.Context, packetId channeltypes.PacketId) bool { store := ctx.KVStore(k.storeKey) key := types.KeyFeeInEscrow(packetId) @@ -278,15 +278,15 @@ func (k Keeper) HasFeeInEscrow(ctx sdk.Context, packetId *channeltypes.PacketId) } // GetAllIdentifiedPacketFees returns a list of all IdentifiedPacketFees that are stored in state -func (k Keeper) GetAllIdentifiedPacketFees(ctx sdk.Context) []*types.IdentifiedPacketFee { +func (k Keeper) GetAllIdentifiedPacketFees(ctx sdk.Context) []types.IdentifiedPacketFee { store := ctx.KVStore(k.storeKey) iterator := sdk.KVStorePrefixIterator(store, []byte(types.FeeInEscrowPrefix)) defer iterator.Close() - var identifiedFees []*types.IdentifiedPacketFee + var identifiedFees []types.IdentifiedPacketFee for ; iterator.Valid(); iterator.Next() { fee := k.MustUnmarshalFee(iterator.Value()) - identifiedFees = append(identifiedFees, &fee) + identifiedFees = append(identifiedFees, fee) } return identifiedFees diff --git a/modules/apps/29-fee/keeper/keeper_test.go b/modules/apps/29-fee/keeper/keeper_test.go index 267190fa080..bfea0dabcd9 100644 --- a/modules/apps/29-fee/keeper/keeper_test.go +++ b/modules/apps/29-fee/keeper/keeper_test.go @@ -57,7 +57,7 @@ func TestKeeperTestSuite(t *testing.T) { } func (suite *KeeperTestSuite) TestFeeInEscrow() { - fee := types.Fee{ReceiveFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee} + fee := types.Fee{RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee} // set some fees for i := 1; i < 6; i++ { @@ -101,15 +101,15 @@ func (suite *KeeperTestSuite) TestGetAllIdentifiedPacketFees() { // escrow a fee refundAcc := suite.chainA.SenderAccount.GetAddress() - packetId := &channeltypes.PacketId{ChannelId: suite.path.EndpointA.ChannelID, PortId: transfertypes.PortID, Sequence: uint64(1)} + packetId := channeltypes.NewPacketId(suite.path.EndpointA.ChannelID, transfertypes.PortID, uint64(1)) fee := types.Fee{defaultAckFee, defaultReceiveFee, defaultTimeoutFee} - identifiedPacketFee := &types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} + identifiedPacketFee := types.NewIdentifiedPacketFee(packetId, fee, refundAcc.String(), []string{}) // escrow the packet fee err := suite.chainA.GetSimApp().IBCFeeKeeper.EscrowPacketFee(suite.chainA.GetContext(), identifiedPacketFee) suite.Require().NoError(err) - expectedFees := []*types.IdentifiedPacketFee{ + expectedFees := []types.IdentifiedPacketFee{ { PacketId: packetId, Fee: fee, diff --git a/modules/apps/29-fee/keeper/msg_server.go b/modules/apps/29-fee/keeper/msg_server.go index cc60036e190..3ef24d2c443 100644 --- a/modules/apps/29-fee/keeper/msg_server.go +++ b/modules/apps/29-fee/keeper/msg_server.go @@ -37,11 +37,11 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee) return nil, channeltypes.ErrSequenceSendNotFound } - packetId := &channeltypes.PacketId{ - PortId: msg.SourcePortId, - ChannelId: msg.SourceChannelId, - Sequence: sequence, - } + packetId := channeltypes.NewPacketId( + msg.SourceChannelId, + msg.SourcePortId, + sequence, + ) identifiedPacket := types.NewIdentifiedPacketFee(packetId, msg.Fee, msg.Signer, msg.Relayers) if err := k.EscrowPacketFee(ctx, identifiedPacket); err != nil { @@ -57,7 +57,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) - if err := k.EscrowPacketFee(ctx, &msg.IdentifiedPacketFee); err != nil { + if err := k.EscrowPacketFee(ctx, msg.IdentifiedPacketFee); 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 0664b4e7fd9..f541dd3fd36 100644 --- a/modules/apps/29-fee/keeper/msg_server_test.go +++ b/modules/apps/29-fee/keeper/msg_server_test.go @@ -70,7 +70,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() { refundAcc := suite.chainA.SenderAccount.GetAddress() channelID := suite.path.EndpointA.ChannelID fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } @@ -111,14 +111,14 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() { // build packetId channelID := suite.path.EndpointA.ChannelID fee := types.Fee{ - ReceiveFee: defaultReceiveFee, + RecvFee: defaultReceiveFee, AckFee: defaultAckFee, TimeoutFee: defaultTimeoutFee, } seq, _ := suite.chainA.App.GetIBCKeeper().ChannelKeeper.GetNextSequenceSend(ctxA, suite.path.EndpointA.ChannelConfig.PortID, suite.path.EndpointA.ChannelID) // build fee - packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: suite.path.EndpointA.ChannelConfig.PortID, Sequence: seq} + packetId := channeltypes.NewPacketId(channelID, suite.path.EndpointA.ChannelConfig.PortID, seq) identifiedPacketFee := types.IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: refundAcc.String(), Relayers: []string{}} tc.malleate() diff --git a/modules/apps/29-fee/types/fee.pb.go b/modules/apps/29-fee/types/fee.pb.go index 0f50271f0f0..4fa6f240abb 100644 --- a/modules/apps/29-fee/types/fee.pb.go +++ b/modules/apps/29-fee/types/fee.pb.go @@ -30,7 +30,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // See Fee Payment Middleware spec: // https://github.com/cosmos/ibc/tree/master/spec/app/ics-029-fee-payment#fee-middleware-contract type Fee struct { - ReceiveFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=receive_fee,json=receiveFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"receive_fee" yaml:"receive_fee"` + RecvFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,1,rep,name=recv_fee,json=recvFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"recv_fee" yaml:"receive_fee"` AckFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=ack_fee,json=ackFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"ack_fee" yaml:"ack_fee"` TimeoutFee github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=timeout_fee,json=timeoutFee,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"timeout_fee" yaml:"timeout_fee"` } @@ -68,9 +68,9 @@ func (m *Fee) XXX_DiscardUnknown() { var xxx_messageInfo_Fee proto.InternalMessageInfo -func (m *Fee) GetReceiveFee() github_com_cosmos_cosmos_sdk_types.Coins { +func (m *Fee) GetRecvFee() github_com_cosmos_cosmos_sdk_types.Coins { if m != nil { - return m.ReceiveFee + return m.RecvFee } return nil } @@ -94,10 +94,10 @@ func (m *Fee) GetTimeoutFee() github_com_cosmos_cosmos_sdk_types.Coins { // 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"` - 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"` + PacketId types1.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id" 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{} } @@ -133,11 +133,11 @@ func (m *IdentifiedPacketFee) XXX_DiscardUnknown() { var xxx_messageInfo_IdentifiedPacketFee proto.InternalMessageInfo -func (m *IdentifiedPacketFee) GetPacketId() *types1.PacketId { +func (m *IdentifiedPacketFee) GetPacketId() types1.PacketId { if m != nil { return m.PacketId } - return nil + return types1.PacketId{} } func (m *IdentifiedPacketFee) GetFee() Fee { @@ -169,38 +169,38 @@ func init() { func init() { proto.RegisterFile("ibc/applications/fee/v1/fee.proto", fileDescriptor_cb3319f1af2a53e5) } var fileDescriptor_cb3319f1af2a53e5 = []byte{ - // 483 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, 0x49, 0xc9, 0x94, - 0xa5, 0xb6, 0xda, 0x83, 0x01, 0x26, 0x08, 0x52, 0xa5, 0x9b, 0x38, 0x65, 0x64, 0xa9, 0x1c, 0xe7, - 0xb5, 0x67, 0x35, 0x89, 0xa3, 0x38, 0x8d, 0xd4, 0x95, 0x85, 0x95, 0xcf, 0xc1, 0x27, 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0x37, 0x6e, 0xeb, 0x7e, 0xe3, 0xb6, - 0x7e, 0x6e, 0xdc, 0xd6, 0x97, 0xb7, 0xff, 0x76, 0x93, 0xc7, 0x6c, 0x30, 0x13, 0xa4, 0xbe, 0x22, - 0x99, 0x48, 0x16, 0x29, 0x48, 0xf5, 0xad, 0x24, 0x19, 0xbd, 0x1b, 0xa8, 0x1f, 0xd5, 0x34, 0x38, - 0x3e, 0x6d, 0xe6, 0xfb, 0xea, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0b, 0xc2, 0x60, 0x3e, 0x76, - 0x03, 0x00, 0x00, + // 488 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0xbd, 0x8e, 0xd3, 0x40, + 0x10, 0xc7, 0x63, 0x7c, 0xba, 0x8f, 0x8d, 0x38, 0x21, 0x03, 0xc2, 0x17, 0x81, 0x13, 0x5c, 0xb9, + 0xc9, 0xae, 0x92, 0x83, 0x02, 0x2a, 0x30, 0x52, 0xa4, 0xab, 0x40, 0x16, 0x15, 0x4d, 0xb4, 0x5e, + 0x4f, 0x72, 0xab, 0xd8, 0x5e, 0xcb, 0xeb, 0x58, 0x8a, 0x44, 0x81, 0x78, 0x02, 0x9e, 0x83, 0x27, + 0xb9, 0xf2, 0x4a, 0xaa, 0x80, 0x92, 0x37, 0xb8, 0x17, 0x00, 0x8d, 0xd7, 0x77, 0x8a, 0x84, 0x10, + 0x4a, 0xe5, 0x99, 0xd9, 0xf9, 0xcf, 0x6f, 0x3c, 0x3b, 0x4b, 0x9e, 0xcb, 0x58, 0x30, 0x5e, 0x14, + 0xa9, 0x14, 0xbc, 0x92, 0x2a, 0xd7, 0x6c, 0x06, 0xc0, 0xea, 0x11, 0x7e, 0x68, 0x51, 0xaa, 0x4a, + 0x39, 0x4f, 0x64, 0x2c, 0xe8, 0x6e, 0x0a, 0xc5, 0xb3, 0x7a, 0xd4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, 0x00, } func (m *Fee) Marshal() (dAtA []byte, err error) { @@ -251,10 +251,10 @@ func (m *Fee) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if len(m.ReceiveFee) > 0 { - for iNdEx := len(m.ReceiveFee) - 1; iNdEx >= 0; iNdEx-- { + if len(m.RecvFee) > 0 { + for iNdEx := len(m.RecvFee) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.ReceiveFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RecvFee[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -314,18 +314,16 @@ func (m *IdentifiedPacketFee) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if m.PacketId != nil { - { - size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintFee(dAtA, i, uint64(size)) + { + size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintFee(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -346,8 +344,8 @@ func (m *Fee) Size() (n int) { } var l int _ = l - if len(m.ReceiveFee) > 0 { - for _, e := range m.ReceiveFee { + if len(m.RecvFee) > 0 { + for _, e := range m.RecvFee { l = e.Size() n += 1 + l + sovFee(uint64(l)) } @@ -373,10 +371,8 @@ func (m *IdentifiedPacketFee) Size() (n int) { } var l int _ = l - if m.PacketId != nil { - l = m.PacketId.Size() - n += 1 + l + sovFee(uint64(l)) - } + l = m.PacketId.Size() + n += 1 + l + sovFee(uint64(l)) l = m.Fee.Size() n += 1 + l + sovFee(uint64(l)) l = len(m.RefundAddress) @@ -429,7 +425,7 @@ func (m *Fee) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiveFee", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RecvFee", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -456,8 +452,8 @@ func (m *Fee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ReceiveFee = append(m.ReceiveFee, types.Coin{}) - if err := m.ReceiveFee[len(m.ReceiveFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RecvFee = append(m.RecvFee, types.Coin{}) + if err := m.RecvFee[len(m.RecvFee)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -608,9 +604,6 @@ func (m *IdentifiedPacketFee) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PacketId == nil { - m.PacketId = &types1.PacketId{} - } if err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/modules/apps/29-fee/types/genesis.go b/modules/apps/29-fee/types/genesis.go index e1eea3b7fac..c0a84516291 100644 --- a/modules/apps/29-fee/types/genesis.go +++ b/modules/apps/29-fee/types/genesis.go @@ -8,7 +8,7 @@ import ( ) // NewGenesisState creates a 29-fee GenesisState instance. -func NewGenesisState(identifiedFees []*IdentifiedPacketFee, feeEnabledChannels []*FeeEnabledChannel, registeredRelayers []*RegisteredRelayerAddress) *GenesisState { +func NewGenesisState(identifiedFees []IdentifiedPacketFee, feeEnabledChannels []*FeeEnabledChannel, registeredRelayers []*RegisteredRelayerAddress) *GenesisState { return &GenesisState{ IdentifiedFees: identifiedFees, FeeEnabledChannels: feeEnabledChannels, @@ -19,7 +19,7 @@ func NewGenesisState(identifiedFees []*IdentifiedPacketFee, feeEnabledChannels [ // DefaultGenesisState returns a GenesisState with "transfer" as the default PortID. func DefaultGenesisState() *GenesisState { return &GenesisState{ - IdentifiedFees: []*IdentifiedPacketFee{}, + IdentifiedFees: []IdentifiedPacketFee{}, FeeEnabledChannels: []*FeeEnabledChannel{}, RegisteredRelayers: []*RegisteredRelayerAddress{}, } diff --git a/modules/apps/29-fee/types/genesis.pb.go b/modules/apps/29-fee/types/genesis.pb.go index c1c6750597f..6bcc498ac87 100644 --- a/modules/apps/29-fee/types/genesis.pb.go +++ b/modules/apps/29-fee/types/genesis.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the fee middleware genesis state type GenesisState struct { - IdentifiedFees []*IdentifiedPacketFee `protobuf:"bytes,1,rep,name=identified_fees,json=identifiedFees,proto3" json:"identified_fees,omitempty" yaml:"identified_fees"` + IdentifiedFees []IdentifiedPacketFee `protobuf:"bytes,1,rep,name=identified_fees,json=identifiedFees,proto3" json:"identified_fees" yaml:"identified_fees"` FeeEnabledChannels []*FeeEnabledChannel `protobuf:"bytes,2,rep,name=fee_enabled_channels,json=feeEnabledChannels,proto3" json:"fee_enabled_channels,omitempty" yaml:"fee_enabled_channels"` RegisteredRelayers []*RegisteredRelayerAddress `protobuf:"bytes,3,rep,name=registered_relayers,json=registeredRelayers,proto3" json:"registered_relayers,omitempty" yaml:"registered_relayers"` ForwardRelayers []*ForwardRelayerAddress `protobuf:"bytes,4,rep,name=forward_relayers,json=forwardRelayers,proto3" json:"forward_relayers,omitempty" yaml:"forward_relayers"` @@ -65,7 +65,7 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetIdentifiedFees() []*IdentifiedPacketFee { +func (m *GenesisState) GetIdentifiedFees() []IdentifiedPacketFee { if m != nil { return m.IdentifiedFees } @@ -201,8 +201,8 @@ func (m *RegisteredRelayerAddress) GetCounterpartyAddress() string { // ForwardRelayerAddress contains the forward relayer address and packetId used for async acknowledgements type ForwardRelayerAddress struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - PacketId *types.PacketId `protobuf:"bytes,2,opt,name=packet_id,json=packetId,proto3" json:"packet_id,omitempty" yaml:"packet_id"` + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + PacketId types.PacketId `protobuf:"bytes,2,opt,name=packet_id,json=packetId,proto3" json:"packet_id" yaml:"packet_id"` } func (m *ForwardRelayerAddress) Reset() { *m = ForwardRelayerAddress{} } @@ -245,11 +245,11 @@ func (m *ForwardRelayerAddress) GetAddress() string { return "" } -func (m *ForwardRelayerAddress) GetPacketId() *types.PacketId { +func (m *ForwardRelayerAddress) GetPacketId() types.PacketId { if m != nil { return m.PacketId } - return nil + return types.PacketId{} } func init() { @@ -264,43 +264,43 @@ func init() { } var fileDescriptor_7191992e856dff95 = []byte{ - // 570 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x4f, 0x6f, 0xd4, 0x3e, - 0x10, 0x6d, 0xda, 0x9f, 0xda, 0x5f, 0x5d, 0xd4, 0x3f, 0xee, 0x96, 0xae, 0xb6, 0x22, 0x29, 0x96, - 0x90, 0x2a, 0xa0, 0x89, 0xb6, 0x85, 0x03, 0xdc, 0x58, 0x44, 0xd1, 0x9e, 0xa8, 0xcc, 0x8d, 0xcb, - 0x2a, 0x7f, 0x26, 0xa9, 0x45, 0x36, 0x0e, 0xb6, 0x1b, 0xb4, 0x07, 0x2e, 0x70, 0xe1, 0xc8, 0xc7, - 0xe2, 0xd8, 0x23, 0xa7, 0x08, 0x75, 0xbf, 0x41, 0xee, 0x48, 0x28, 0x71, 0xd2, 0x2e, 0xcb, 0x86, - 0xdb, 0xd8, 0xf3, 0xde, 0xbc, 0xe7, 0xb1, 0xc7, 0xe8, 0x01, 0xf3, 0x7c, 0xc7, 0x4d, 0xd3, 0x98, - 0xf9, 0xae, 0x62, 0x3c, 0x91, 0x4e, 0x08, 0xe0, 0x64, 0x7d, 0x27, 0x82, 0x04, 0x24, 0x93, 0x76, - 0x2a, 0xb8, 0xe2, 0x78, 0x9f, 0x79, 0xbe, 0x3d, 0x0b, 0xb3, 0x43, 0x00, 0x3b, 0xeb, 0xf7, 0x3a, - 0x11, 0x8f, 0x78, 0x85, 0x71, 0xca, 0x48, 0xc3, 0x7b, 0xf7, 0xdb, 0xaa, 0x96, 0xac, 0x19, 0x88, - 0xcf, 0x05, 0x38, 0xfe, 0x85, 0x9b, 0x24, 0x10, 0x97, 0xe9, 0x3a, 0xd4, 0x10, 0xf2, 0x6b, 0x05, - 0xdd, 0x79, 0xad, 0x6d, 0xbc, 0x55, 0xae, 0x02, 0xfc, 0x01, 0x6d, 0xb1, 0x00, 0x12, 0xc5, 0x42, - 0x06, 0xc1, 0x28, 0x04, 0x90, 0x5d, 0xe3, 0x70, 0xe5, 0x68, 0xe3, 0xe4, 0xb1, 0xdd, 0xe2, 0xcf, - 0x1e, 0xde, 0xe0, 0xcf, 0x5d, 0xff, 0x3d, 0xa8, 0x33, 0x80, 0x41, 0xaf, 0xc8, 0xad, 0xbb, 0x13, - 0x77, 0x1c, 0x3f, 0x27, 0x73, 0xe5, 0x08, 0xdd, 0xbc, 0xdd, 0x39, 0x03, 0x90, 0xf8, 0x13, 0xea, - 0x84, 0x00, 0x23, 0x48, 0x5c, 0x2f, 0x86, 0x60, 0x54, 0x1b, 0x94, 0xdd, 0xe5, 0x4a, 0xf7, 0x61, - 0xab, 0xee, 0x19, 0xc0, 0x2b, 0xcd, 0x79, 0xa9, 0x29, 0x03, 0xab, 0xc8, 0xad, 0x03, 0xad, 0xba, - 0xa8, 0x22, 0xa1, 0x38, 0x9c, 0xe7, 0x48, 0xfc, 0xd9, 0x40, 0xbb, 0x02, 0x22, 0x26, 0x15, 0x08, - 0x08, 0x46, 0x02, 0x62, 0x77, 0x02, 0x42, 0x76, 0x57, 0x2a, 0xf9, 0x7e, 0xab, 0x3c, 0xbd, 0xe1, - 0x50, 0x4d, 0x79, 0x11, 0x04, 0x02, 0xa4, 0x1c, 0x98, 0x45, 0x6e, 0xf5, 0xb4, 0x8b, 0x05, 0x75, - 0x09, 0xc5, 0x62, 0x9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6, 0x71, 0x75, 0x6d, 0x1a, 0x3f, - 0xaf, 0x4d, 0xe3, 0xdb, 0xd4, 0x5c, 0xba, 0x9a, 0x9a, 0x4b, 0x3f, 0xa6, 0xe6, 0xd2, 0xbb, 0xa7, - 0x11, 0x53, 0x17, 0x97, 0x9e, 0xed, 0xf3, 0xb1, 0xe3, 0x73, 0x39, 0xe6, 0xd2, 0x61, 0x9e, 0x7f, - 0x1c, 0x71, 0x27, 0x3b, 0x75, 0xc6, 0x3c, 0xb8, 0x8c, 0x41, 0x96, 0x1f, 0x81, 0x74, 0x4e, 0x9e, - 0x1d, 0x97, 0x7f, 0x80, 0x9a, 0xa4, 0x20, 0xbd, 0xd5, 0x6a, 0xc0, 0x4f, 0x7f, 0x07, 0x00, 0x00, - 0xff, 0xff, 0x3f, 0xe2, 0x1d, 0x20, 0x7e, 0x04, 0x00, 0x00, + // 572 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xbf, 0x6f, 0xd4, 0x30, + 0x18, 0xbd, 0xb4, 0x55, 0x4b, 0x5d, 0xd4, 0x1f, 0x6e, 0x4b, 0xa3, 0x56, 0x24, 0xc5, 0x12, 0x52, + 0x05, 0x34, 0xd1, 0xb5, 0x30, 0xc0, 0xc6, 0x21, 0x8a, 0x6e, 0x02, 0x19, 0x26, 0x96, 0x53, 0x2e, + 0xf9, 0x92, 0x5a, 0xe4, 0xe2, 0xc8, 0xf6, 0x05, 0xdd, 0xc0, 0x00, 0x0b, 0x8c, 0xfc, 0x59, 0x1d, + 0x3b, 0x32, 0x45, 0xa8, 0xfd, 0x0f, 0xf2, 0x17, 0xa0, 0xc4, 0x49, 0x7b, 0x1c, 0x17, 0xb6, 0x2f, + 0xf6, 0x7b, 0xdf, 0x7b, 0x7e, 0xce, 0x67, 0xf4, 0x90, 0x0d, 0x7d, 0xd7, 0x4b, 0xd3, 0x98, 0xf9, + 0x9e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4f, + 0xe5, 0xc4, 0x39, 0xcd, 0x98, 0x65, 0x5d, 0x47, 0x4f, 0x45, 0x3f, 0xe8, 0x99, 0xf5, 0x50, 0x6c, + 0xd6, 0x31, 0x36, 0x6c, 0x42, 0xef, 0xa4, 0x0d, 0xe6, 0xed, 0xc5, 0x95, 0x65, 0x5c, 0x5e, 0x59, + 0xc6, 0xef, 0x2b, 0xcb, 0xf8, 0x79, 0x6d, 0x75, 0x2e, 0xaf, 0xad, 0xce, 0xaf, 0x6b, 0xab, 0xf3, + 0xf1, 0x59, 0xc4, 0xd4, 0xf9, 0x78, 0xe8, 0xf8, 0x7c, 0xe4, 0xfa, 0x5c, 0x8e, 0xb8, 0x74, 0xd9, + 0xd0, 0x3f, 0x8e, 0xb8, 0x9b, 0x9d, 0xba, 0x23, 0x1e, 0x8c, 0x63, 0x90, 0xe5, 0x83, 0x20, 0xdd, + 0x93, 0xe7, 0xc7, 0xe5, 0x5b, 0xa0, 0x26, 0x29, 0xc8, 0xe1, 0x72, 0x35, 0xe8, 0xa7, 0x7f, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x8b, 0x17, 0xa1, 0x66, 0x86, 0x04, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -476,18 +476,16 @@ func (m *ForwardRelayerAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PacketId != nil { - { - size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + { + size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + 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) @@ -586,10 +584,8 @@ func (m *ForwardRelayerAddress) Size() (n int) { if l > 0 { n += 1 + l + sovGenesis(uint64(l)) } - if m.PacketId != nil { - l = m.PacketId.Size() - n += 1 + l + sovGenesis(uint64(l)) - } + l = m.PacketId.Size() + n += 1 + l + sovGenesis(uint64(l)) return n } @@ -657,7 +653,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.IdentifiedFees = append(m.IdentifiedFees, &IdentifiedPacketFee{}) + m.IdentifiedFees = append(m.IdentifiedFees, IdentifiedPacketFee{}) if err := m.IdentifiedFees[len(m.IdentifiedFees)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1103,9 +1099,6 @@ func (m *ForwardRelayerAddress) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PacketId == nil { - m.PacketId = &types.PacketId{} - } if err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/modules/apps/29-fee/types/genesis_test.go b/modules/apps/29-fee/types/genesis_test.go index 190edaab220..c41fd8f7469 100644 --- a/modules/apps/29-fee/types/genesis_test.go +++ b/modules/apps/29-fee/types/genesis_test.go @@ -23,7 +23,7 @@ var ( func TestValidateGenesis(t *testing.T) { var ( - packetId *channeltypes.PacketId + packetId channeltypes.PacketId fee types.Fee refundAcc string sender string @@ -150,7 +150,7 @@ func TestValidateGenesis(t *testing.T) { tc.malleate() genState := types.GenesisState{ - IdentifiedFees: []*types.IdentifiedPacketFee{ + IdentifiedFees: []types.IdentifiedPacketFee{ { PacketId: packetId, Fee: fee, diff --git a/modules/apps/29-fee/types/keys.go b/modules/apps/29-fee/types/keys.go index 15b33f67a33..2f26b859afc 100644 --- a/modules/apps/29-fee/types/keys.go +++ b/modules/apps/29-fee/types/keys.go @@ -46,12 +46,12 @@ func KeyRelayerAddress(address string) []byte { } // KeyForwardRelayerAddress returns the key for packetID -> forwardAddress mapping -func KeyForwardRelayerAddress(packetId *channeltypes.PacketId) []byte { +func KeyForwardRelayerAddress(packetId channeltypes.PacketId) []byte { return []byte(fmt.Sprintf("%s/%s/%s/%d/", ForwardRelayerPrefix, packetId.PortId, packetId.ChannelId, packetId.Sequence)) } // KeyFeeInEscrow returns the key for escrowed fees -func KeyFeeInEscrow(packetID *channeltypes.PacketId) []byte { +func KeyFeeInEscrow(packetID channeltypes.PacketId) []byte { return []byte(fmt.Sprintf("%s/%d", KeyFeeInEscrowChannelPrefix(packetID.PortId, packetID.ChannelId), packetID.Sequence)) } diff --git a/modules/apps/29-fee/types/msgs.go b/modules/apps/29-fee/types/msgs.go index 1c79733d5d1..e88d89e2b59 100644 --- a/modules/apps/29-fee/types/msgs.go +++ b/modules/apps/29-fee/types/msgs.go @@ -78,12 +78,12 @@ func (msg MsgPayPacketFee) ValidateBasic() error { } // if any of the fee's are invalid return an error - if !msg.Fee.AckFee.IsValid() || !msg.Fee.ReceiveFee.IsValid() || !msg.Fee.TimeoutFee.IsValid() { + if !msg.Fee.AckFee.IsValid() || !msg.Fee.RecvFee.IsValid() || !msg.Fee.TimeoutFee.IsValid() { return sdkerrors.ErrInvalidCoins } // if all three fee's are zero or empty return an error - if msg.Fee.AckFee.IsZero() && msg.Fee.ReceiveFee.IsZero() && msg.Fee.TimeoutFee.IsZero() { + if msg.Fee.AckFee.IsZero() && msg.Fee.RecvFee.IsZero() && msg.Fee.TimeoutFee.IsZero() { return sdkerrors.ErrInvalidCoins } @@ -131,8 +131,8 @@ func (msg MsgPayPacketFeeAsync) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{signer} } -func NewIdentifiedPacketFee(packetId *channeltypes.PacketId, fee Fee, refundAddr string, relayers []string) *IdentifiedPacketFee { - return &IdentifiedPacketFee{ +func NewIdentifiedPacketFee(packetId channeltypes.PacketId, fee Fee, refundAddr string, relayers []string) IdentifiedPacketFee { + return IdentifiedPacketFee{ PacketId: packetId, Fee: fee, RefundAddress: refundAddr, @@ -152,12 +152,12 @@ func (fee IdentifiedPacketFee) Validate() error { } // if any of the fee's are invalid return an error - if !fee.Fee.AckFee.IsValid() || !fee.Fee.ReceiveFee.IsValid() || !fee.Fee.TimeoutFee.IsValid() { + if !fee.Fee.AckFee.IsValid() || !fee.Fee.RecvFee.IsValid() || !fee.Fee.TimeoutFee.IsValid() { return sdkerrors.ErrInvalidCoins } // if all three fee's are zero or empty return an error - if fee.Fee.AckFee.IsZero() && fee.Fee.ReceiveFee.IsZero() && fee.Fee.TimeoutFee.IsZero() { + if fee.Fee.AckFee.IsZero() && fee.Fee.RecvFee.IsZero() && fee.Fee.TimeoutFee.IsZero() { return sdkerrors.ErrInvalidCoins } diff --git a/modules/apps/29-fee/types/msgs_test.go b/modules/apps/29-fee/types/msgs_test.go index e6386dc91d4..8671694bca0 100644 --- a/modules/apps/29-fee/types/msgs_test.go +++ b/modules/apps/29-fee/types/msgs_test.go @@ -319,7 +319,7 @@ func TestMsgPayPacketFeeAsyncValidation(t *testing.T) { tc.malleate() fee = Fee{receiveFee, ackFee, timeoutFee} - packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: portID, Sequence: seq} + packetId := channeltypes.NewPacketId(channelID, portID, seq) identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: signer, Relayers: relayers} msg := NewMsgPayPacketFeeAsync(identifiedPacketFee) @@ -341,7 +341,7 @@ func TestPayPacketFeeAsyncGetSigners(t *testing.T) { portID := validPortID fee := Fee{validCoins, validCoins, validCoins} seq := uint64(1) - packetId := &channeltypes.PacketId{ChannelId: channelID, PortId: portID, Sequence: seq} + packetId := channeltypes.NewPacketId(channelID, portID, seq) identifiedPacketFee := IdentifiedPacketFee{PacketId: packetId, Fee: fee, RefundAddress: addr.String(), Relayers: nil} msg := NewMsgPayPacketFeeAsync(identifiedPacketFee) diff --git a/modules/apps/29-fee/types/query.pb.go b/modules/apps/29-fee/types/query.pb.go index 421dec212f8..3bbbbee7b17 100644 --- a/modules/apps/29-fee/types/query.pb.go +++ b/modules/apps/29-fee/types/query.pb.go @@ -135,7 +135,7 @@ func (m *QueryIncentivizedPacketsResponse) GetIncentivizedPackets() []*Identifie // QueryIncentivizedPacketRequest is the request type for querying for all incentivized packets type QueryIncentivizedPacketRequest struct { // PacketID - PacketId *types.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id,omitempty"` + PacketId types.PacketId `protobuf:"bytes,1,opt,name=packet_id,json=packetId,proto3" json:"packet_id"` // Height to query at QueryHeight uint64 `protobuf:"varint,2,opt,name=query_height,json=queryHeight,proto3" json:"query_height,omitempty"` } @@ -173,11 +173,11 @@ func (m *QueryIncentivizedPacketRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryIncentivizedPacketRequest proto.InternalMessageInfo -func (m *QueryIncentivizedPacketRequest) GetPacketId() *types.PacketId { +func (m *QueryIncentivizedPacketRequest) GetPacketId() types.PacketId { if m != nil { return m.PacketId } - return nil + return types.PacketId{} } func (m *QueryIncentivizedPacketRequest) GetQueryHeight() uint64 { @@ -245,41 +245,42 @@ func init() { } var fileDescriptor_0638a8a78ca2503c = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6f, 0x12, 0x41, - 0x14, 0x66, 0xa8, 0x1a, 0x1d, 0x3c, 0x0d, 0x4d, 0x24, 0x44, 0x57, 0x8a, 0x51, 0x89, 0x91, 0x99, - 0x40, 0x63, 0x6c, 0x3d, 0x7a, 0x68, 0xe4, 0x64, 0xe5, 0x68, 0x62, 0xc8, 0xee, 0xec, 0x63, 0x99, - 0x08, 0x3b, 0x5b, 0x66, 0xd8, 0xa4, 0xd5, 0x46, 0x53, 0xaf, 0x3d, 0x98, 0xf8, 0x6b, 0xfc, 0x07, - 0x1e, 0x1b, 0xbd, 0x78, 0x34, 0xe0, 0x0f, 0x31, 0xb3, 0x3b, 0x8b, 0x9b, 0xc0, 0xc6, 0xe2, 0x6d, - 0x78, 0xef, 0xfb, 0xde, 0xf7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 0xba, 0x7c, 0xf5, 0xb9, 0x9e, 0x2d, 0x25, 0x6d, 0x65, 0x8c, 0x86, 0x1c, 0xf2, 0xfd, - 0xac, 0x76, 0xfa, 0xfc, 0xe5, 0xb7, 0xb9, 0x83, 0x2e, 0xe6, 0x0e, 0xfa, 0x35, 0x77, 0xd0, 0xe7, - 0x85, 0x53, 0xba, 0x58, 0x38, 0xa5, 0x9f, 0x0b, 0xa7, 0xf4, 0xfa, 0x49, 0x20, 0xf4, 0x68, 0xe6, - 0x51, 0x2e, 0x27, 0xcc, 0x7e, 0x3e, 0x84, 0xc7, 0xdb, 0x81, 0x64, 0xf1, 0x2e, 0x9b, 0x48, 0x7f, - 0x36, 0x06, 0x95, 0x9a, 0xee, 0xee, 0xb7, 0x8d, 0x6f, 0x7d, 0x1c, 0x81, 0xf2, 0xae, 0x25, 0x5f, - 0x91, 0xdd, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xd8, 0x1b, 0x4b, 0x2b, 0x05, 0x00, 0x00, + // 554 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xc1, 0x6b, 0x13, 0x4f, + 0x14, 0xce, 0xa4, 0xfd, 0xfd, 0xd0, 0x89, 0xa7, 0x49, 0xc1, 0x10, 0x74, 0x9b, 0x46, 0xd4, 0x20, + 0x66, 0x86, 0xa4, 0x88, 0xed, 0x4d, 0x7a, 0x28, 0xe6, 0x64, 0xcd, 0x51, 0x90, 0xb0, 0x3b, 0xfb, + 0xb2, 0x19, 0x4c, 0x76, 0xb6, 0x99, 0xc9, 0x42, 0xab, 0x05, 0xa9, 0x78, 0xeb, 0x41, 0xf0, 0xaf, + 0xf1, 0x3f, 0xe8, 0xb1, 0xe8, 0xc5, 0x93, 0x48, 0xe2, 0x1f, 0x22, 0xb3, 0x3b, 0x89, 0x0b, 0xc9, + 0x62, 0xe3, 0x6d, 0xf7, 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 0xc9, 0xb1, 0x66, 0x6f, 0x17, 0x27, 0x8d, 0x9a, 0xf7, 0x9e, 0xf0, 0xcf, 0x16, 0x97, 0x3f, + 0xd3, 0xb3, 0xa5, 0xa4, 0xad, 0x8c, 0xd1, 0x90, 0x43, 0xb6, 0x3f, 0xaf, 0x9d, 0x1d, 0xbc, 0xb8, + 0x9c, 0x3a, 0xe8, 0x6a, 0xea, 0xa0, 0x9f, 0x53, 0x07, 0x7d, 0x9a, 0x39, 0x85, 0xab, 0x99, 0x53, + 0xf8, 0x3e, 0x73, 0x0a, 0xaf, 0x9e, 0x04, 0x42, 0x0f, 0x26, 0x1e, 0xe5, 0x72, 0xc4, 0xec, 0x5f, + 0x44, 0x78, 0xbc, 0x19, 0x48, 0x16, 0xef, 0xb2, 0x91, 0xf4, 0x27, 0x43, 0x50, 0xa9, 0xe9, 0xf6, + 0x7e, 0xd3, 0xf8, 0xd6, 0x27, 0x11, 0x28, 0xef, 0xff, 0xe4, 0x67, 0xb2, 0xfb, 0x3b, 0x00, 0x00, + 0xff, 0xff, 0xd3, 0xea, 0xdd, 0xe2, 0x32, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -506,18 +507,16 @@ func (m *QueryIncentivizedPacketRequest) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x10 } - if m.PacketId != nil { - { - size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + { + size, err := m.PacketId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0xa + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -604,10 +603,8 @@ func (m *QueryIncentivizedPacketRequest) Size() (n int) { } var l int _ = l - if m.PacketId != nil { - l = m.PacketId.Size() - n += 1 + l + sovQuery(uint64(l)) - } + l = m.PacketId.Size() + n += 1 + l + sovQuery(uint64(l)) if m.QueryHeight != 0 { n += 1 + sovQuery(uint64(m.QueryHeight)) } @@ -880,9 +877,6 @@ func (m *QueryIncentivizedPacketRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PacketId == nil { - m.PacketId = &types.PacketId{} - } if err := m.PacketId.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/modules/apps/29-fee/types/tx.pb.go b/modules/apps/29-fee/types/tx.pb.go index 2c36575ecb0..46f20f29783 100644 --- a/modules/apps/29-fee/types/tx.pb.go +++ b/modules/apps/29-fee/types/tx.pb.go @@ -29,7 +29,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgRegisterCounterpartyAddress is the request type for registering the counter party address +// MsgRegisterCounterpartyAddress is the request type for registering the counterparty address type MsgRegisterCounterpartyAddress struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` CounterpartyAddress string `protobuf:"bytes,2,opt,name=counterparty_address,json=counterpartyAddress,proto3" json:"counterparty_address,omitempty" yaml:"counterparty_address"` diff --git a/modules/core/04-channel/types/packet.go b/modules/core/04-channel/types/packet.go index 32f6b343fb3..1b69dafa758 100644 --- a/modules/core/04-channel/types/packet.go +++ b/modules/core/04-channel/types/packet.go @@ -13,8 +13,8 @@ import ( ) // NewPacketId returns a new instance of PacketId -func NewPacketId(channelId, portId string, seq uint64) *PacketId { - return &PacketId{ChannelId: channelId, PortId: portId, Sequence: seq} +func NewPacketId(channelId, portId string, seq uint64) PacketId { + return PacketId{ChannelId: channelId, PortId: portId, Sequence: seq} } // CommitPacket returns the packet commitment bytes. The commitment consists of: diff --git a/proto/ibc/applications/fee/v1/ack.proto b/proto/ibc/applications/fee/v1/ack.proto index 626b4518f18..b978454892d 100644 --- a/proto/ibc/applications/fee/v1/ack.proto +++ b/proto/ibc/applications/fee/v1/ack.proto @@ -1,9 +1,11 @@ syntax = "proto3"; package ibc.applications.fee.v1; -import "gogoproto/gogo.proto"; + option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; +import "gogoproto/gogo.proto"; + // IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware // It contains the raw acknowledgement bytes, as well as the forward relayer address message IncentivizedAcknowledgement { diff --git a/proto/ibc/applications/fee/v1/fee.proto b/proto/ibc/applications/fee/v1/fee.proto index 1f5d9c0d05c..b57cc2cc03c 100644 --- a/proto/ibc/applications/fee/v1/fee.proto +++ b/proto/ibc/applications/fee/v1/fee.proto @@ -1,16 +1,18 @@ syntax = "proto3"; package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; + import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "ibc/core/channel/v1/channel.proto"; -option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; // 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 { - repeated cosmos.base.v1beta1.Coin receive_fee = 1 [ + repeated cosmos.base.v1beta1.Coin recv_fee = 1 [ (gogoproto.moretags) = "yaml:\"receive_fee\"", (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" @@ -32,7 +34,7 @@ message Fee { // 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\""]; + ibc.core.channel.v1.PacketId packet_id = 1 [(gogoproto.nullable) = false, (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/genesis.proto b/proto/ibc/applications/fee/v1/genesis.proto index 632693e808c..cf88fc6602a 100644 --- a/proto/ibc/applications/fee/v1/genesis.proto +++ b/proto/ibc/applications/fee/v1/genesis.proto @@ -1,15 +1,16 @@ syntax = "proto3"; package ibc.applications.fee.v1; + +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; + import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; import "ibc/core/channel/v1/channel.proto"; -option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; - // GenesisState defines the fee middleware genesis state message GenesisState { - repeated IdentifiedPacketFee identified_fees = 1 [(gogoproto.moretags) = "yaml:\"identified_fees\""]; + repeated IdentifiedPacketFee identified_fees = 1 [(gogoproto.moretags) = "yaml:\"identified_fees\"", (gogoproto.nullable) = false]; repeated FeeEnabledChannel fee_enabled_channels = 2 [(gogoproto.moretags) = "yaml:\"fee_enabled_channels\""]; repeated RegisteredRelayerAddress registered_relayers = 3 [(gogoproto.moretags) = "yaml:\"registered_relayers\""]; repeated ForwardRelayerAddress forward_relayers = 4 [(gogoproto.moretags) = "yaml:\"forward_relayers\""]; @@ -30,5 +31,5 @@ message RegisteredRelayerAddress { // ForwardRelayerAddress contains the forward relayer address and packetId used for async acknowledgements message ForwardRelayerAddress { string address = 1; - ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.moretags) = "yaml:\"packet_id\""]; + ibc.core.channel.v1.PacketId packet_id = 2 [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"packet_id\""]; } diff --git a/proto/ibc/applications/fee/v1/query.proto b/proto/ibc/applications/fee/v1/query.proto index 75a7d3c0491..1a41c3091c4 100644 --- a/proto/ibc/applications/fee/v1/query.proto +++ b/proto/ibc/applications/fee/v1/query.proto @@ -2,14 +2,14 @@ syntax = "proto3"; package ibc.applications.fee.v1; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; + import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; import "google/api/annotations.proto"; import "ibc/core/channel/v1/channel.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; - // Query provides defines the gRPC querier service. service Query { // Gets all incentivized packets @@ -43,7 +43,7 @@ message QueryIncentivizedPacketsResponse { // QueryIncentivizedPacketRequest is the request type for querying for all incentivized packets message QueryIncentivizedPacketRequest { // PacketID - ibc.core.channel.v1.PacketId packet_id = 1; + ibc.core.channel.v1.PacketId packet_id = 1[(gogoproto.nullable) = false]; // Height to query at uint64 query_height = 2; } diff --git a/proto/ibc/applications/fee/v1/tx.proto b/proto/ibc/applications/fee/v1/tx.proto index 07517f52a80..4540c28967e 100644 --- a/proto/ibc/applications/fee/v1/tx.proto +++ b/proto/ibc/applications/fee/v1/tx.proto @@ -2,10 +2,11 @@ syntax = "proto3"; package ibc.applications.fee.v1; +option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; + import "gogoproto/gogo.proto"; import "ibc/applications/fee/v1/fee.proto"; import "ibc/core/channel/v1/channel.proto"; -option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"; // Msg defines the ibc/fee Msg service. service Msg { @@ -25,7 +26,7 @@ service Msg { rpc PayPacketFeeAsync(MsgPayPacketFeeAsync) returns (MsgPayPacketFeeAsyncResponse); } -// MsgRegisterCounterpartyAddress is the request type for registering the counter party address +// MsgRegisterCounterpartyAddress is the request type for registering the counterparty address message MsgRegisterCounterpartyAddress { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false;