Skip to content

Commit

Permalink
fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Nov 30, 2023
1 parent 6ca0ebc commit 72bc1f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions tests/integration/slashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdktypes "github.com/cosmos/cosmos-sdk/types"
sdkaddress "github.com/cosmos/cosmos-sdk/types/address"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
Expand Down Expand Up @@ -406,13 +405,13 @@ func (suite *CCVTestSuite) TestOnRecvSlashPacketErrors() {
slashPacketData.Infraction = stakingtypes.Infraction_INFRACTION_DOWNTIME

// Expect the packet to bounce if the slash meter is negative
providerKeeper.SetSlashMeter(ctx, sdktypes.NewInt(-1))
providerKeeper.SetSlashMeter(ctx, sdk.NewInt(-1))
ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData)
suite.Require().NoError(err, "no error expected")
suite.Require().Equal(ccv.SlashPacketBouncedResult, ackResult, "expected successful ack")

// Expect the packet to be handled if the slash meter is positive
providerKeeper.SetSlashMeter(ctx, sdktypes.NewInt(0))
providerKeeper.SetSlashMeter(ctx, sdk.NewInt(0))
ackResult, err = providerKeeper.OnRecvSlashPacket(ctx, packet, *slashPacketData)
suite.Require().NoError(err, "no error expected")
suite.Require().Equal(ccv.SlashPacketHandledResult, ackResult, "expected successful ack")
Expand Down
7 changes: 3 additions & 4 deletions x/ccv/provider/ibc_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/cosmos/interchain-security/v3/x/ccv/provider/keeper"
providertypes "github.com/cosmos/interchain-security/v3/x/ccv/provider/types"
"github.com/cosmos/interchain-security/v3/x/ccv/types"
ccv "github.com/cosmos/interchain-security/v3/x/ccv/types"
)

Expand Down Expand Up @@ -195,15 +194,15 @@ func (am AppModule) OnRecvPacket(
// only attempt the application logic if the packet data
// was successfully decoded
if ack.Success() {
var err error = nil
var err error
switch consumerPacket.Type {
case ccv.VscMaturedPacket:
// handle VSCMaturedPacket
data := *consumerPacket.GetVscMaturedPacketData()
err = am.keeper.OnRecvVSCMaturedPacket(ctx, packet, data)
if err == nil {
logger.Info("successfully handled VSCMaturedPacket sequence: %d", packet.Sequence)
eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId))))
eventAttributes = append(eventAttributes, sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId))))
}
case ccv.SlashPacket:
// handle SlashPacket
Expand All @@ -213,7 +212,7 @@ func (am AppModule) OnRecvPacket(
if err == nil {
ack = channeltypes.NewResultAcknowledgement(ackResult)
logger.Info("successfully handled SlashPacket sequence: %d", packet.Sequence)
eventAttributes = append(eventAttributes, sdk.NewAttribute(types.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId))))
eventAttributes = append(eventAttributes, sdk.NewAttribute(ccv.AttributeValSetUpdateID, strconv.Itoa(int(data.ValsetUpdateId))))
}
default:
err = fmt.Errorf("invalid consumer packet type: %q", consumerPacket.Type)
Expand Down

0 comments on commit 72bc1f2

Please sign in to comment.