Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package controller_test

import (
"fmt"
"strconv"
"testing"

testifysuite "github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -584,7 +585,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
icatypes.EventTypePacket,
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", false)),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(false)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace fmt.Sprintf with strconv.FormatBool for boolean conversion.

- sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success()))
+ sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success()))
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(false)),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(false)),

sdk.NewAttribute(icatypes.AttributeKeyAckError, "cannot receive packet on controller chain: invalid message sent to channel end"),
),
}.ToABCIEvents()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keeper

import (
"fmt"
"strconv"

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

Expand All @@ -16,7 +16,7 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e
attributes := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyControllerChannelID, packet.GetDestChannel()),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
Comment thread
MukulKolpe marked this conversation as resolved.
Outdated
}

if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package host_test

import (
"fmt"
"strconv"
"testing"

"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -507,7 +508,7 @@ func (suite *InterchainAccountsTestSuite) TestOnRecvPacket() {
expectedAttributes := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
}

if tc.expAckSuccess {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/27-interchain-accounts/host/keeper/events.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package keeper

import (
"fmt"
"strconv"

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

Expand All @@ -17,7 +17,7 @@ func EmitAcknowledgementEvent(ctx sdk.Context, packet channeltypes.Packet, ack e
attributes := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyModule, icatypes.ModuleName),
sdk.NewAttribute(icatypes.AttributeKeyHostChannelID, packet.GetDestChannel()),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
sdk.NewAttribute(icatypes.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
Comment thread
MukulKolpe marked this conversation as resolved.
Outdated
}

if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/transfer/internal/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package events

import (
"encoding/json"
"fmt"
"strconv"

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

Expand Down Expand Up @@ -38,7 +38,7 @@ func EmitOnRecvPacketEvent(ctx sdk.Context, packetData types.FungibleTokenPacket
sdk.NewAttribute(types.AttributeKeyReceiver, packetData.Receiver),
sdk.NewAttribute(types.AttributeKeyTokens, jsonTokens),
sdk.NewAttribute(types.AttributeKeyMemo, packetData.Memo),
sdk.NewAttribute(types.AttributeKeyAckSuccess, fmt.Sprintf("%t", ack.Success())),
sdk.NewAttribute(types.AttributeKeyAckSuccess, strconv.FormatBool(ack.Success())),
Comment thread
MukulKolpe marked this conversation as resolved.
Outdated
}

if ackErr != nil {
Expand Down