Skip to content

Commit

Permalink
complete merge
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat committed Jan 1, 2024
1 parent b378536 commit 838fb50
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 137 deletions.
132 changes: 15 additions & 117 deletions tests/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,23 +161,14 @@ func SlashThrottleTestConfig() TestConfig {
Now: time.Now(),
},
validatorConfigs: getDefaultValidators(),
<<<<<<< HEAD
chainConfigs: map[chainID]ChainConfig{
chainID("provi"): {
chainId: chainID("provi"),
binaryName: "providerd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======

chainConfigs: map[ChainID]ChainConfig{
ChainID("provi"): {
ChainId: ChainID("provi"),
BinaryName: "interchain-security-pd",
BinaryName: "providerd",
IpPrefix: "7.7.7",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
Expand All @@ -187,21 +178,13 @@ func SlashThrottleTestConfig() TestConfig {
".app_state.provider.params.slash_meter_replenish_fraction = \"0.10\" | " +
".app_state.provider.params.slash_meter_replenish_period = \"20s\"",
},
<<<<<<< HEAD
chainID("consu"): {
chainId: chainID("consu"),
binaryName: "consumerd",
ipPrefix: "7.7.8",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======

ChainID("consu"): {
ChainId: ChainID("consu"),
BinaryName: "interchain-security-cd",
BinaryName: "consumerd",
IpPrefix: "7.7.8",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
".app_state.slashing.params.signed_blocks_window = \"15\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
Expand All @@ -226,23 +209,13 @@ func DefaultTestConfig() TestConfig {
Now: time.Now(),
},
validatorConfigs: getDefaultValidators(),
<<<<<<< HEAD
chainConfigs: map[chainID]ChainConfig{
chainID("provi"): {
chainId: chainID("provi"),
binaryName: "providerd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
chainConfigs: map[ChainID]ChainConfig{
ChainID("provi"): {
ChainId: ChainID("provi"),
BinaryName: "interchain-security-pd",
BinaryName: "providerd",
IpPrefix: "7.7.7",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
Expand All @@ -252,21 +225,12 @@ func DefaultTestConfig() TestConfig {
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling
".app_state.provider.params.slash_meter_replenish_period = \"3s\"",
},
<<<<<<< HEAD
chainID("consu"): {
chainId: chainID("consu"),
binaryName: "consumerd",
ipPrefix: "7.7.8",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
ChainID("consu"): {
ChainId: ChainID("consu"),
BinaryName: "interchain-security-cd",
BinaryName: "consumerd",
IpPrefix: "7.7.8",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
".app_state.slashing.params.signed_blocks_window = \"15\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
Expand Down Expand Up @@ -303,23 +267,13 @@ func DemocracyTestConfig(allowReward bool) TestConfig {
Now: time.Now(),
},
validatorConfigs: getDefaultValidators(),
<<<<<<< HEAD
chainConfigs: map[chainID]ChainConfig{
chainID("provi"): {
chainId: chainID("provi"),
binaryName: "providerd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
chainConfigs: map[ChainID]ChainConfig{
ChainID("provi"): {
ChainId: ChainID("provi"),
BinaryName: "interchain-security-pd",
BinaryName: "providerd",
IpPrefix: "7.7.7",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
Expand All @@ -328,21 +282,12 @@ func DemocracyTestConfig(allowReward bool) TestConfig {
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
<<<<<<< HEAD
chainID("democ"): {
chainId: chainID("democ"),
binaryName: "democracyd",
ipPrefix: "7.7.9",
votingWaitTime: 20,
genesisChanges: consumerGenChanges,
=======
ChainID("democ"): {
ChainId: ChainID("democ"),
BinaryName: "interchain-security-cdd",
BinaryName: "democracyd",
IpPrefix: "7.7.9",
VotingWaitTime: 20,
GenesisChanges: consumerGenChanges,
>>>>>>> origin/main
},
},
tendermintConfigOverride: `s/timeout_commit = "5s"/timeout_commit = "1s"/;` +
Expand All @@ -362,23 +307,13 @@ func MultiConsumerTestConfig() TestConfig {
Now: time.Now(),
},
validatorConfigs: getDefaultValidators(),
<<<<<<< HEAD
chainConfigs: map[chainID]ChainConfig{
chainID("provi"): {
chainId: chainID("provi"),
binaryName: "providerd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"30s\" | " +
=======
chainConfigs: map[ChainID]ChainConfig{
ChainID("provi"): {
ChainId: ChainID("provi"),
BinaryName: "interchain-security-pd",
BinaryName: "providerd",
IpPrefix: "7.7.7",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"30s\" | " +
>>>>>>> origin/main
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
Expand All @@ -387,41 +322,24 @@ func MultiConsumerTestConfig() TestConfig {
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\" | " +
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\"", // This disables slash packet throttling
},
<<<<<<< HEAD
chainID("consu"): {
chainId: chainID("consu"),
binaryName: "consumerd",
ipPrefix: "7.7.8",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
ChainID("consu"): {
ChainId: ChainID("consu"),
BinaryName: "interchain-security-cd",
BinaryName: "consumerd",
IpPrefix: "7.7.8",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
".app_state.slashing.params.slash_fraction_downtime = \"0.010000000000000000\"",
},
<<<<<<< HEAD
chainID("densu"): {
chainId: chainID("densu"),
binaryName: "consumerd",
ipPrefix: "7.7.9",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======

ChainID("densu"): {
ChainId: ChainID("densu"),
BinaryName: "interchain-security-cd",
BinaryName: "consumerd",
IpPrefix: "7.7.9",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
Expand All @@ -445,23 +363,13 @@ func ChangeoverTestConfig() TestConfig {
Now: time.Now(),
},
validatorConfigs: getDefaultValidators(),
<<<<<<< HEAD
chainConfigs: map[chainID]ChainConfig{
chainID("provi"): {
chainId: chainID("provi"),
binaryName: "providerd",
ipPrefix: "7.7.7",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
chainConfigs: map[ChainID]ChainConfig{
ChainID("provi"): {
ChainId: ChainID("provi"),
BinaryName: "interchain-security-pd",
BinaryName: "providerd",
IpPrefix: "7.7.7",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
// Custom slashing parameters for testing validator downtime functionality
// See https://docs.cosmos.network/main/modules/slashing/04_begin_block.html#uptime-tracking
".app_state.slashing.params.signed_blocks_window = \"10\" | " +
Expand All @@ -471,23 +379,13 @@ func ChangeoverTestConfig() TestConfig {
".app_state.provider.params.slash_meter_replenish_fraction = \"1.0\" | " + // This disables slash packet throttling
".app_state.provider.params.slash_meter_replenish_period = \"3s\"",
},
<<<<<<< HEAD
chainID("sover"): {
chainId: chainID("sover"),
binaryName: "sovereignd",
upgradeBinary: "consumerd",
ipPrefix: "7.7.8",
votingWaitTime: 20,
genesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
=======
ChainID("sover"): {
ChainId: ChainID("sover"),
BinaryName: "interchain-security-sd",
UpgradeBinary: "interchain-security-cdd",
BinaryName: "sovereignd",
UpgradeBinary: "consumerd",
IpPrefix: "7.7.8",
VotingWaitTime: 20,
GenesisChanges: ".app_state.gov.params.voting_period = \"20s\" | " +
>>>>>>> origin/main
".app_state.slashing.params.signed_blocks_window = \"15\" | " +
".app_state.slashing.params.min_signed_per_window = \"0.500000000000000000\" | " +
".app_state.slashing.params.downtime_jail_duration = \"60s\" | " +
Expand Down
1 change: 1 addition & 0 deletions x/ccv/consumer/migrations/v2/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

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

testutil "github.com/cosmos/interchain-security/v3/testutil/keeper"
v2 "github.com/cosmos/interchain-security/v3/x/ccv/consumer/migrations/v2"
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
Expand Down
32 changes: 16 additions & 16 deletions x/ccv/provider/migrations/v3/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,41 @@ func TestMigrate2To3(t *testing.T) {
providerKeeper.SetConsumerClientId(ctx, "chain-3", "client-3")

// Queue some data for chain-1
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-1", 66, testutil.GetNewSlashPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-1", 67, testutil.GetNewVSCMaturedPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-1", 68, testutil.GetNewSlashPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-1", 69, testutil.GetNewVSCMaturedPacketData())

// Queue some data for chain-2
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-2", 789, testutil.GetNewVSCMaturedPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-2", 790, testutil.GetNewSlashPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-2", 791, testutil.GetNewVSCMaturedPacketData())

// Queue some data for chain-3
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-3", 123, testutil.GetNewSlashPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-3", 124, testutil.GetNewVSCMaturedPacketData())
providerKeeper.LegacyQueueThrottledPacketData( //nolint:staticcheck // SA1019: used in migration tests
providerKeeper.LegacyQueueThrottledPacketData(
ctx, "chain-3", 125, testutil.GetNewVSCMaturedPacketData())

// Confirm getter methods return expected values
slash1, vscm1 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") //nolint:staticcheck // SA1019: used in migration tests
slash1, vscm1 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1")
require.Len(t, slash1, 2)
require.Len(t, vscm1, 2)

slash2, vscm2 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") //nolint:staticcheck // SA1019: used in migration tests
slash2, vscm2 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2")
require.Len(t, slash2, 1)
require.Len(t, vscm2, 2)

slash3, vscm3 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") //nolint:staticcheck // SA1019: used in migration tests
slash3, vscm3 := providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3")
require.Len(t, slash3, 1)
require.Len(t, vscm3, 2)

Expand Down Expand Up @@ -91,13 +91,13 @@ func TestMigrate2To3(t *testing.T) {
require.NoError(t, err)

// Confirm throttled data is now deleted
slash1, vscm1 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1") //nolint:staticcheck // SA1019: used in migration tests
slash1, vscm1 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-1")
require.Empty(t, slash1)
require.Empty(t, vscm1)
slash2, vscm2 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2") //nolint:staticcheck // SA1019: used in migration tests
slash2, vscm2 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-2")
require.Empty(t, slash2)
require.Empty(t, vscm2)
slash3, vscm3 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3") //nolint:staticcheck // SA1019: used in migration tests
slash3, vscm3 = providerKeeper.LegacyGetAllThrottledPacketData(ctx, "chain-3")
require.Empty(t, slash3)
require.Empty(t, vscm3)

Expand Down
4 changes: 2 additions & 2 deletions x/ccv/provider/migrations/v3/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import (
// on the provider in the v2 consensus version (jail throttling v1).
func MigrateQueuedPackets(ctx sdk.Context, k providerkeeper.Keeper) error {
for _, consumer := range k.GetAllConsumerChains(ctx) {
slashData, vscmData := k.LegacyGetAllThrottledPacketData(ctx, consumer.ChainId) //nolint:staticcheck // SA1019: function used for migration
slashData, vscmData := k.LegacyGetAllThrottledPacketData(ctx, consumer.ChainId)
if len(slashData) > 0 {
k.Logger(ctx).Error(fmt.Sprintf("slash data being dropped: %v", slashData))
}
for _, data := range vscmData {
k.HandleVSCMaturedPacket(ctx, consumer.ChainId, data)
}
k.LegacyDeleteThrottledPacketDataForConsumer(ctx, consumer.ChainId) //nolint:staticcheck // SA1019: function used for migration
k.LegacyDeleteThrottledPacketDataForConsumer(ctx, consumer.ChainId)
}
return nil
}
5 changes: 3 additions & 2 deletions x/ccv/provider/types/codec.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package types

import (
"github.com/cosmos/ibc-go/v7/modules/core/exported"
tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"

"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/cosmos/ibc-go/v7/modules/core/exported"
tendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
)

// RegisterLegacyAminoCodec registers the necessary x/ibc transfer interfaces and concrete types
Expand Down

0 comments on commit 838fb50

Please sign in to comment.