Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nit: packetID var name #1214

Merged
merged 1 commit into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/apps/29-fee/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,10 @@ func (suite *FeeTestSuite) TestOnRecvPacket() {

case tc.forwardRelayer && result == nil:
suite.Require().Equal(nil, result)
packetId := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence())
packetID := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence())

// retrieve the forward relayer that was stored in `onRecvPacket`
relayer, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), packetId)
relayer, _ := suite.chainB.GetSimApp().IBCFeeKeeper.GetRelayerAddressForAsyncAck(suite.chainB.GetContext(), packetID)
suite.Require().Equal(relayer, suite.chainA.SenderAccount.GetAddress().String())

case !tc.forwardRelayer:
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/keeper/escrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (k Keeper) EscrowPacketFee(ctx sdk.Context, packetID channeltypes.PacketId,
return nil
}

// DistributePacketFees pays the acknowledgement fee & receive fee for a given packetId while refunding the timeout fee to the refund account associated with the Fee.
// DistributePacketFees pays the acknowledgement fee & receive fee for a given packetID while refunding the timeout fee to the refund account associated with the Fee.
func (k Keeper) DistributePacketFees(ctx sdk.Context, forwardRelayer string, reverseRelayer sdk.AccAddress, feesInEscrow []types.PacketFee) {
forwardAddr, _ := sdk.AccAddressFromBech32(forwardRelayer)

Expand All @@ -72,7 +72,7 @@ func (k Keeper) DistributePacketFees(ctx sdk.Context, forwardRelayer string, rev
}
}

// DistributePacketsFeesTimeout pays the timeout fee for a given packetId while refunding the acknowledgement fee & receive fee to the refund account associated with the Fee
// DistributePacketsFeesTimeout pays the timeout fee for a given packetID while refunding the acknowledgement fee & receive fee to the refund account associated with the Fee
func (k Keeper) DistributePacketFeesOnTimeout(ctx sdk.Context, timeoutRelayer sdk.AccAddress, feesInEscrow []types.PacketFee) {
for _, feeInEscrow := range feesInEscrow {
// check if refundAcc address works
Expand Down
2 changes: 1 addition & 1 deletion modules/apps/29-fee/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (suite *KeeperTestSuite) TestPayPacketFeeAsync() {

refundAcc := suite.chainA.SenderAccount.GetAddress()

// build packetId
// build packetID
channelID := suite.path.EndpointA.ChannelID
fee := types.Fee{
RecvFee: defaultReceiveFee,
Expand Down
8 changes: 4 additions & 4 deletions modules/apps/29-fee/keeper/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C
return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, acknowledgement)
}

packetId := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence())
packetID := channeltypes.NewPacketId(packet.GetDestChannel(), packet.GetDestPort(), packet.GetSequence())

// retrieve the forward relayer that was stored in `onRecvPacket`
relayer, found := k.GetRelayerAddressForAsyncAck(ctx, packetId)
relayer, found := k.GetRelayerAddressForAsyncAck(ctx, packetID)
if !found {
return sdkerrors.Wrapf(types.ErrRelayerNotFoundForAsyncAck, "no relayer address stored for async acknowledgement for packet with portID: %s, channelID: %s, sequence: %d", packetId.PortId, packetId.ChannelId, packetId.Sequence)
return sdkerrors.Wrapf(types.ErrRelayerNotFoundForAsyncAck, "no relayer address stored for async acknowledgement for packet with portID: %s, channelID: %s, sequence: %d", packetID.PortId, packetID.ChannelId, packetID.Sequence)
}

// it is possible that a relayer has not registered a counterparty address.
Expand All @@ -37,7 +37,7 @@ func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.C

ack := types.NewIncentivizedAcknowledgement(forwardRelayer, acknowledgement.Acknowledgement(), acknowledgement.Success())

k.DeleteForwardRelayerAddress(ctx, packetId)
k.DeleteForwardRelayerAddress(ctx, packetID)

// ics4Wrapper may be core IBC or higher-level middleware
return k.ics4Wrapper.WriteAcknowledgement(ctx, chanCap, packet, ack)
Expand Down
22 changes: 11 additions & 11 deletions modules/apps/29-fee/types/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (

func TestValidateGenesis(t *testing.T) {
var (
packetId channeltypes.PacketId
packetID channeltypes.PacketId
fee types.Fee
refundAcc string
sender string
Expand All @@ -46,9 +46,9 @@ func TestValidateGenesis(t *testing.T) {
true,
},
{
"invalid packetId: invalid channel",
"invalid packetID: invalid channel",
func() {
packetId = channeltypes.NewPacketId(
packetID = channeltypes.NewPacketId(
"",
portID,
seq,
Expand All @@ -57,9 +57,9 @@ func TestValidateGenesis(t *testing.T) {
false,
},
{
"invalid packetId: invalid port",
"invalid packetID: invalid port",
func() {
packetId = channeltypes.NewPacketId(
packetID = channeltypes.NewPacketId(
channelID,
"",
seq,
Expand All @@ -68,9 +68,9 @@ func TestValidateGenesis(t *testing.T) {
false,
},
{
"invalid packetId: invalid sequence",
"invalid packetID: invalid sequence",
func() {
packetId = channeltypes.NewPacketId(
packetID = channeltypes.NewPacketId(
channelID,
portID,
0,
Expand All @@ -79,7 +79,7 @@ func TestValidateGenesis(t *testing.T) {
false,
},
{
"invalid packetId: invalid fee",
"invalid packetID: invalid fee",
func() {
fee = types.Fee{
sdk.Coins{},
Expand All @@ -90,7 +90,7 @@ func TestValidateGenesis(t *testing.T) {
false,
},
{
"invalid packetId: invalid refundAcc",
"invalid packetID: invalid refundAcc",
func() {
refundAcc = ""
},
Expand Down Expand Up @@ -147,7 +147,7 @@ func TestValidateGenesis(t *testing.T) {
seq = uint64(1)

// build PacketId & Fee
packetId = channeltypes.NewPacketId(
packetID = channeltypes.NewPacketId(
portID,
channelID,
seq,
Expand All @@ -170,7 +170,7 @@ func TestValidateGenesis(t *testing.T) {
genState := types.GenesisState{
IdentifiedFees: []types.IdentifiedPacketFees{
{
PacketId: packetId,
PacketId: packetID,
PacketFees: []types.PacketFee{
{
Fee: fee,
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/29-fee/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func ParseKeyCounterpartyRelayer(key string) (address string, channelID string,
}

// KeyForwardRelayerAddress returns the key for packetID -> forwardAddress mapping
func KeyForwardRelayerAddress(packetId channeltypes.PacketId) []byte {
return []byte(fmt.Sprintf("%s/%s/%s/%d", ForwardRelayerPrefix, packetId.PortId, packetId.ChannelId, packetId.Sequence))
func KeyForwardRelayerAddress(packetID channeltypes.PacketId) []byte {
return []byte(fmt.Sprintf("%s/%s/%s/%d", ForwardRelayerPrefix, packetID.PortId, packetID.ChannelId, packetID.Sequence))
}

// ParseKeyForwardRelayerAddress parses the key used to store the forward relayer address and returns the packetID
Expand Down