Skip to content

Commit

Permalink
Merge commit 'a418ee2' into faddat/integrated-branch
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Sep 9, 2023
2 parents b2b6029 + a418ee2 commit 9e530e6
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 241 deletions.
4 changes: 2 additions & 2 deletions modules/apps/29-fee/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ func (k Keeper) PayPacketFee(goCtx context.Context, msg *types.MsgPayPacketFee)
return &types.MsgPayPacketFeeResponse{}, nil
}

// PayPacketFee defines a rpc handler method for MsgPayPacketFee
// PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to
// PayPacketFeeAsync defines a rpc handler method for MsgPayPacketFeeAsync
// PayPacketFeeAsync is an open callback that may be called by any module/user that wishes to escrow funds in order to
// incentivize the relaying of a known packet. Only packets which have been sent and have not gone through the
// packet life cycle may be incentivized.
func (k Keeper) PayPacketFeeAsync(goCtx context.Context, msg *types.MsgPayPacketFeeAsync) (*types.MsgPayPacketFeeAsyncResponse, error) {
Expand Down
67 changes: 35 additions & 32 deletions modules/apps/29-fee/types/fee.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 4 additions & 43 deletions modules/apps/29-fee/types/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,17 @@ import (
errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
legacytx "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"

channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors"
)

// msg types
const (
TypeMsgPayPacketFee = "payPacketFee"
TypeMsgPayPacketFeeAsync = "payPacketFeeAsync"
)

var (
_ sdk.Msg = (*MsgRegisterPayee)(nil)
_ sdk.Msg = (*MsgRegisterCounterpartyPayee)(nil)
_ sdk.Msg = (*MsgPayPacketFee)(nil)
_ sdk.Msg = (*MsgPayPacketFeeAsync)(nil)
_ legacytx.LegacyMsg = (*MsgPayPacketFee)(nil)
_ legacytx.LegacyMsg = (*MsgPayPacketFeeAsync)(nil)
_ sdk.Msg = (*MsgRegisterPayee)(nil)
_ sdk.Msg = (*MsgRegisterCounterpartyPayee)(nil)
_ sdk.Msg = (*MsgPayPacketFee)(nil)
_ sdk.Msg = (*MsgPayPacketFeeAsync)(nil)
)

// NewMsgRegisterPayee creates a new instance of MsgRegisterPayee
Expand Down Expand Up @@ -162,21 +153,6 @@ func (msg MsgPayPacketFee) GetSigners() []sdk.AccAddress {
return []sdk.AccAddress{signer}
}

// Type implements legacytx.LegacyMsg
func (MsgPayPacketFee) Type() string {
return TypeMsgPayPacketFee
}

// Route implements legacytx.LegacyMsg
func (MsgPayPacketFee) Route() string {
return RouterKey
}

// GetSignBytes implements legacytx.LegacyMsg
func (msg MsgPayPacketFee) GetSignBytes() []byte {
return sdk.MustSortJSON(amino.MustMarshalJSON(&msg))
}

// NewMsgPayPacketAsync creates a new instance of MsgPayPacketFee
func NewMsgPayPacketFeeAsync(packetID channeltypes.PacketId, packetFee PacketFee) *MsgPayPacketFeeAsync {
return &MsgPayPacketFeeAsync{
Expand All @@ -203,18 +179,3 @@ func (msg MsgPayPacketFeeAsync) GetSigners() []sdk.AccAddress {
}
return []sdk.AccAddress{signer}
}

// Type implements legacytx.LegacyMsg
func (MsgPayPacketFeeAsync) Type() string {
return TypeMsgPayPacketFeeAsync
}

// Route implements legacytx.LegacyMsg
func (MsgPayPacketFeeAsync) Route() string {
return RouterKey
}

// GetSignBytes implements legacytx.LegacyMsg
func (msg MsgPayPacketFeeAsync) GetSignBytes() []byte {
return sdk.MustSortJSON(amino.MustMarshalJSON(&msg))
}
31 changes: 0 additions & 31 deletions modules/apps/29-fee/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,20 +234,6 @@ func TestPayPacketFeeGetSigners(t *testing.T) {
require.Equal(t, []sdk.AccAddress{refundAddr}, msg.GetSigners())
}

func TestMsgPayPacketFeeRoute(t *testing.T) {
var msg types.MsgPayPacketFee
require.Equal(t, types.RouterKey, msg.Route())
}

func TestMsgPayPacketFeeGetSignBytes(t *testing.T) {
fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
msg := types.NewMsgPayPacketFee(fee, ibctesting.MockFeePort, ibctesting.FirstChannelID, defaultAccAddress, nil)

require.NotPanics(t, func() {
_ = msg.GetSignBytes()
})
}

func TestMsgPayPacketFeeAsyncValidation(t *testing.T) {
var msg *types.MsgPayPacketFeeAsync

Expand Down Expand Up @@ -382,20 +368,3 @@ func TestPayPacketFeeAsyncGetSigners(t *testing.T) {

require.Equal(t, []sdk.AccAddress{refundAddr}, msg.GetSigners())
}

func TestMsgPayPacketFeeAsyncRoute(t *testing.T) {
var msg types.MsgPayPacketFeeAsync
require.Equal(t, types.RouterKey, msg.Route())
}

func TestMsgPayPacketFeeAsyncGetSignBytes(t *testing.T) {
packetID := channeltypes.NewPacketID(ibctesting.MockFeePort, ibctesting.FirstChannelID, 1)
fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
packetFee := types.NewPacketFee(fee, defaultAccAddress, nil)

msg := types.NewMsgPayPacketFeeAsync(packetID, packetFee)

require.NotPanics(t, func() {
_ = msg.GetSignBytes()
})
}
88 changes: 46 additions & 42 deletions modules/apps/29-fee/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9e530e6

Please sign in to comment.