Skip to content

Commit

Permalink
fix from review
Browse files Browse the repository at this point in the history
  • Loading branch information
satawatnack committed Nov 25, 2024
1 parent 47d575b commit 758014a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion x/tunnel/keeper/keeper_packet_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ func (k Keeper) SendIBCPacket(
return nil, err
}

return types.NewIBCPacketReceipt(route.ChannelID, sequence), nil
return types.NewIBCPacketReceipt(sequence), nil
}
11 changes: 4 additions & 7 deletions x/tunnel/types/route_ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ package types

import (
"fmt"
"regexp"

channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"

sdk "github.com/cosmos/cosmos-sdk/types"

Expand All @@ -12,10 +13,6 @@ import (
// IBCRoute defines the IBC route for the tunnel module
var _ RouteI = &IBCRoute{}

// IsChannelIDFormat checks if a channelID is in the format required on the SDK for
// parsing channel identifiers. The channel identifier must be in the form: `channel-{N}
var IsChannelIDFormat = regexp.MustCompile(`^channel-[0-9]{1,20}$`).MatchString

// NewIBCRoute creates a new IBCRoute instance.
func NewIBCRoute(channelID string) *IBCRoute {
return &IBCRoute{
Expand All @@ -26,14 +23,14 @@ func NewIBCRoute(channelID string) *IBCRoute {
// Route defines the IBC route for the tunnel module
func (r *IBCRoute) ValidateBasic() error {
// Validate the ChannelID format
if !IsChannelIDFormat(r.ChannelID) {
if !channeltypes.IsChannelIDFormat(r.ChannelID) {
return fmt.Errorf("channel identifier is not in the format: `channel-{N}`")
}
return nil
}

// NewIBCPacketReceipt creates a new IBCPacketReceipt instance.
func NewIBCPacketReceipt(channelID string, sequence uint64) *IBCPacketReceipt {
func NewIBCPacketReceipt(sequence uint64) *IBCPacketReceipt {
return &IBCPacketReceipt{
Sequence: sequence,
}
Expand Down

0 comments on commit 758014a

Please sign in to comment.