Skip to content

Commit

Permalink
lint legacy-ibc-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Jun 23, 2023
1 parent b17e3ab commit 6a0e6f7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ run:
sort-results: true
allow-parallel-runners: true
skip-dirs:
- 'legacy_ibc_testing'
- 'testutil'

linters:
Expand Down
4 changes: 2 additions & 2 deletions legacy_ibc_testing/core/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ These files will be deprecated once ICS is able to upgrade to ibc-go v5.
func ReconstructPacketFromEvent(event abci.Event) (packet types.Packet, err error) {
attrMap := make(map[string][]byte)
for _, attr := range event.Attributes {
attrMap[string(attr.Key)] = []byte(attr.Value)
attrMap[attr.Key] = []byte(attr.Value)
}

sequence, err := strconv.Atoi(string(attrMap[string(types.AttributeKeySequence)]))
Expand All @@ -36,7 +36,7 @@ func ReconstructPacketFromEvent(event abci.Event) (packet types.Packet, err erro
return packet, err
}
return types.NewPacket(
attrMap[string(types.AttributeKeyData)], // data
attrMap[string(types.AttributeKeyDataHex)], // data
uint64(sequence),
string(attrMap[string(types.AttributeKeySrcPort)]), // sourcePort,
string(attrMap[string(types.AttributeKeySrcChannel)]), // sourceChannel,
Expand Down
5 changes: 3 additions & 2 deletions legacy_ibc_testing/simapp/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"
"time"

errorsmod "cosmossdk.io/errors"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
bam "github.com/cosmos/cosmos-sdk/baseapp"
Expand Down Expand Up @@ -60,7 +61,7 @@ func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress {
return valAddrs
}

func TestAddr(addr string, bech string) (sdk.AccAddress, error) {
func TestAddr(addr, bech string) (sdk.AccAddress, error) {
res, err := sdk.AccAddressFromHexUnsafe(addr)
if err != nil {
return nil, err
Expand Down Expand Up @@ -140,7 +141,7 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) {
panic(err)
}
if len(pkBytes) != ed25519.PubKeySize {
panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
panic(errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size"))
}
return &ed25519.PubKey{Key: pkBytes}
}
Expand Down
14 changes: 7 additions & 7 deletions legacy_ibc_testing/testing/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ func ParseClientIDFromEvents(events sdk.Events) (string, error) {
for _, ev := range events {
if ev.Type == clienttypes.EventTypeCreateClient {
for _, attr := range ev.Attributes {
if string(attr.Key) == clienttypes.AttributeKeyClientID {
return string(attr.Value), nil
if attr.Key == clienttypes.AttributeKeyClientID {
return attr.Value, nil
}
}
}
Expand All @@ -39,8 +39,8 @@ func ParseConnectionIDFromEvents(events sdk.Events) (string, error) {
if ev.Type == connectiontypes.EventTypeConnectionOpenInit ||
ev.Type == connectiontypes.EventTypeConnectionOpenTry {
for _, attr := range ev.Attributes {
if string(attr.Key) == connectiontypes.AttributeKeyConnectionID {
return string(attr.Value), nil
if attr.Key == connectiontypes.AttributeKeyConnectionID {
return attr.Value, nil
}
}
}
Expand All @@ -54,8 +54,8 @@ func ParseChannelIDFromEvents(events sdk.Events) (string, error) {
for _, ev := range events {
if ev.Type == channeltypes.EventTypeChannelOpenInit || ev.Type == channeltypes.EventTypeChannelOpenTry {
for _, attr := range ev.Attributes {
if string(attr.Key) == channeltypes.AttributeKeyChannelID {
return string(attr.Value), nil
if attr.Key == channeltypes.AttributeKeyChannelID {
return attr.Value, nil
}
}
}
Expand All @@ -69,7 +69,7 @@ func ParseAckFromEvents(events sdk.Events) ([]byte, error) {
for _, ev := range events {
if ev.Type == channeltypes.EventTypeWriteAck {
for _, attr := range ev.Attributes {
if string(attr.Key) == channeltypes.AttributeKeyAck {
if attr.Key == channeltypes.AttributeKeyAckHex {
return []byte(attr.Value), nil
}
}
Expand Down

0 comments on commit 6a0e6f7

Please sign in to comment.