From fdcca888a0369df0057476017351476542b92a6e Mon Sep 17 00:00:00 2001 From: insumity Date: Thu, 13 Jun 2024 16:04:04 +0200 Subject: [PATCH] Set soft_opt_out_threshold to 0 instead of empty --- app/consumer/genesis.go | 4 ++-- app/consumer/genesis_test.go | 8 ++++---- tests/e2e/actions.go | 4 ++-- x/ccv/provider/keeper/proposal_test.go | 2 +- x/ccv/types/params.go | 8 +++++--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/app/consumer/genesis.go b/app/consumer/genesis.go index e8cd96e600..176d9d2d0e 100644 --- a/app/consumer/genesis.go +++ b/app/consumer/genesis.go @@ -81,8 +81,8 @@ func transformToNew(jsonRaw []byte, ctx client.Context) (json.RawMessage, error) oldConsumerGenesis.Params.RetryDelayPeriod = types.DefaultRetryDelayPeriod } - // `SoftOptThreshold` is deprecated in the current consumer implementation, so set to empty - oldConsumerGenesis.Params.SoftOptOutThreshold = "" + // `SoftOptOutThreshold` is deprecated in the current consumer implementation, so set to zero + oldConsumerGenesis.Params.SoftOptOutThreshold = "0" // Versions before v3.3.x of provider genesis data fills up deprecated fields // ProviderClientState, ConsensusState and InitialValSet in type GenesisState diff --git a/app/consumer/genesis_test.go b/app/consumer/genesis_test.go index 7fa37c7d20..16cdf94e25 100644 --- a/app/consumer/genesis_test.go +++ b/app/consumer/genesis_test.go @@ -495,8 +495,8 @@ func TestConsumerGenesisTransformationFromV2ToCurrent(t *testing.T) { require.EqualValues(t, srcGenesis.Params.HistoricalEntries, resultGenesis.Params.HistoricalEntries) require.EqualValues(t, srcGenesis.Params.UnbondingPeriod, resultGenesis.Params.UnbondingPeriod) - // `SoftOptOutThreshold` is deprecated, so it should not be set in the current version - require.EqualValues(t, "", resultGenesis.Params.SoftOptOutThreshold) + // `SoftOptOutThreshold` is deprecated, so it should be set to zero the current version + require.EqualValues(t, "0", resultGenesis.Params.SoftOptOutThreshold) require.EqualValues(t, srcGenesis.Params.RewardDenoms, resultGenesis.Params.RewardDenoms) require.EqualValues(t, srcGenesis.Params.ProviderRewardDenoms, resultGenesis.Params.ProviderRewardDenoms) @@ -568,8 +568,8 @@ func TestConsumerGenesisTransformationV330ToCurrent(t *testing.T) { require.Equal(t, srcGenesis.Params.HistoricalEntries, resultGenesis.Params.HistoricalEntries) require.Equal(t, srcGenesis.Params.UnbondingPeriod, resultGenesis.Params.UnbondingPeriod) - // `SoftOptOutThreshold` is deprecated, so it should not be set in the current version - require.Equal(t, "", resultGenesis.Params.SoftOptOutThreshold) + // `SoftOptOutThreshold` is deprecated, so it should be set to zero the current version + require.Equal(t, "0", resultGenesis.Params.SoftOptOutThreshold) require.Equal(t, srcGenesis.Params.RewardDenoms, resultGenesis.Params.RewardDenoms) require.Equal(t, srcGenesis.Params.ProviderRewardDenoms, resultGenesis.Params.ProviderRewardDenoms) diff --git a/tests/e2e/actions.go b/tests/e2e/actions.go index 918653cfc2..3bab10cb94 100644 --- a/tests/e2e/actions.go +++ b/tests/e2e/actions.go @@ -608,7 +608,7 @@ func (tr *TestConfig) startConsumerChain( // Note that Soft Opt-Out has been deprecated. Nevertheless, the parameter still exists and is expected to be set // because the SDK requires that all params are set to valid values in the genesis file. - action.GenesisChanges = action.GenesisChanges + ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"\"" + action.GenesisChanges = action.GenesisChanges + ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0\"" consumerGenesis := ".app_state.ccvconsumer = " + tr.getConsumerGenesis(action.ProviderChain, action.ConsumerChain, target) consumerGenesisChanges := tr.chainConfigs[action.ConsumerChain].GenesisChanges @@ -844,7 +844,7 @@ func (tr TestConfig) changeoverChain( // Note that Soft Opt-Out has been deprecated. Nevertheless, the parameter still exists and is expected to be set // because the SDK requires that all params are set to valid values in the genesis file. - action.GenesisChanges = action.GenesisChanges + ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"\"" + action.GenesisChanges = action.GenesisChanges + ".app_state.ccvconsumer.params.soft_opt_out_threshold = \"0\"" consumerGenesis := ".app_state.ccvconsumer = " + string(bz) consumerGenesisChanges := tr.chainConfigs[action.SovereignChain].GenesisChanges diff --git a/x/ccv/provider/keeper/proposal_test.go b/x/ccv/provider/keeper/proposal_test.go index d20bc75842..5ea2080348 100644 --- a/x/ccv/provider/keeper/proposal_test.go +++ b/x/ccv/provider/keeper/proposal_test.go @@ -876,7 +876,7 @@ func TestMakeConsumerGenesis(t *testing.T) { "consumer_redistribution_fraction": "0.75", "historical_entries": 10000, "unbonding_period": 1728000000000000, - "soft_opt_out_threshold": "", + "soft_opt_out_threshold": "0", "reward_denoms": [], "provider_reward_denoms": [], "retry_delay_period": 3600000000000 diff --git a/x/ccv/types/params.go b/x/ccv/types/params.go index be3fe7f533..5759ce28f9 100644 --- a/x/ccv/types/params.go +++ b/x/ccv/types/params.go @@ -79,9 +79,11 @@ func NewParams(enabled bool, blocksPerDistributionTransmission int64, ConsumerRedistributionFraction: consumerRedistributionFraction, HistoricalEntries: historicalEntries, UnbondingPeriod: consumerUnbondingPeriod, - RewardDenoms: rewardDenoms, - ProviderRewardDenoms: providerRewardDenoms, - RetryDelayPeriod: retryDelayPeriod, + // DEPRECATED but setting here to 0 (i.e., disabled) for older versions of interchain-security + SoftOptOutThreshold: "0", + RewardDenoms: rewardDenoms, + ProviderRewardDenoms: providerRewardDenoms, + RetryDelayPeriod: retryDelayPeriod, } }