Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
tbruyelle committed Aug 30, 2023
1 parent e1240db commit a4c4858
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
18 changes: 15 additions & 3 deletions tests/integration/throttle_retry.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types"

stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
Expand Down Expand Up @@ -52,8 +53,15 @@ func (s *CCVTestSuite) TestSlashRetries() {

// Construct a mock slash packet from consumer
tmval1 := s.providerChain.Vals.Validators[1]
packet1 := s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval1, stakingtypes.Infraction_INFRACTION_DOWNTIME, 1)

packetData1 := s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval1, stakingtypes.Infraction_INFRACTION_DOWNTIME)
var (
timeoutHeight = clienttypes.Height{}
timeoutTimestamp = uint64(s.getFirstBundle().GetCtx().BlockTime().Add(ccvtypes.DefaultCCVTimeoutPeriod).UnixNano())
)
packet1 := channeltypes.NewPacket(packetData1, 1,
s.getFirstBundle().Path.EndpointA.ChannelConfig.PortID, s.getFirstBundle().Path.EndpointA.ChannelID,
s.getFirstBundle().Path.EndpointB.ChannelConfig.PortID, s.getFirstBundle().Path.EndpointB.ChannelID,
timeoutHeight, timeoutTimestamp)
// Mock the sending of the packet on consumer
consumerKeeper.AppendPendingPacket(s.consumerCtx(), ccvtypes.SlashPacket,
&ccvtypes.ConsumerPacketData_SlashPacketData{
Expand Down Expand Up @@ -105,7 +113,11 @@ func (s *CCVTestSuite) TestSlashRetries() {

// Construct and mock the sending of a second packet on consumer
tmval2 := s.providerChain.Vals.Validators[2]
packet2 := s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval2, stakingtypes.Infraction_INFRACTION_DOWNTIME, 1)
packetData2 := s.constructSlashPacketFromConsumer(s.getFirstBundle(), *tmval2, stakingtypes.Infraction_INFRACTION_DOWNTIME)
packet2 := channeltypes.NewPacket(packetData2, 1,
s.getFirstBundle().Path.EndpointA.ChannelConfig.PortID, s.getFirstBundle().Path.EndpointA.ChannelID,
s.getFirstBundle().Path.EndpointB.ChannelConfig.PortID, s.getFirstBundle().Path.EndpointB.ChannelID,
timeoutHeight, timeoutTimestamp)

consumerKeeper.AppendPendingPacket(s.consumerCtx(), ccvtypes.SlashPacket,
&ccvtypes.ConsumerPacketData_SlashPacketData{
Expand Down
5 changes: 3 additions & 2 deletions testutil/ibc_testing/specific_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
appConsumerDemocracy "github.com/cosmos/interchain-security/v3/app/consumer-democracy"
appProvider "github.com/cosmos/interchain-security/v3/app/provider"
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
)

var (
Expand Down Expand Up @@ -50,7 +51,7 @@ func ConsumerAppIniter(initValPowers []types.ValidatorUpdate) AppIniter {
},
)
// Feed consumer genesis with provider validators
var consumerGenesis consumertypes.GenesisState
var consumerGenesis ccvtypes.GenesisState
encoding.Codec.MustUnmarshalJSON(genesisState[consumertypes.ModuleName], &consumerGenesis)
consumerGenesis.InitialValSet = initValPowers
consumerGenesis.Params.Enabled = true
Expand All @@ -68,7 +69,7 @@ func DemocracyConsumerAppIniter(initValPowers []types.ValidatorUpdate) AppIniter
genesisState := appConsumerDemocracy.NewDefaultGenesisState(encoding.Codec)
// Feed consumer genesis with provider validators
// TODO See if useful for democracy
var consumerGenesis consumertypes.GenesisState
var consumerGenesis ccvtypes.GenesisState
encoding.Codec.MustUnmarshalJSON(genesisState[consumertypes.ModuleName], &consumerGenesis)
consumerGenesis.InitialValSet = initValPowers
consumerGenesis.Params.Enabled = true
Expand Down
3 changes: 2 additions & 1 deletion testutil/integration/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

ibctesting "github.com/cosmos/ibc-go/v7/testing"

"cosmossdk.io/api/tendermint/abci"
"cosmossdk.io/math"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
Expand All @@ -19,6 +18,8 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"

abci "github.com/cometbft/cometbft/abci/types"

consumerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper"
providerkeeper "github.com/cosmos/interchain-security/v3/x/ccv/provider/keeper"
ccvtypes "github.com/cosmos/interchain-security/v3/x/ccv/types"
Expand Down

0 comments on commit a4c4858

Please sign in to comment.