Skip to content

Commit

Permalink
Set soft_opt_out_threshold to 0 instead of empty
Browse files Browse the repository at this point in the history
  • Loading branch information
insumity committed Jun 13, 2024
1 parent 69fff54 commit fdcca88
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions app/consumer/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions app/consumer/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/ccv/provider/keeper/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions x/ccv/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down

0 comments on commit fdcca88

Please sign in to comment.