Skip to content

Commit

Permalink
chore: remove deprecated network parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Letang <[email protected]>
  • Loading branch information
jeremyletang committed Aug 23, 2024
1 parent 7156f91 commit 48618f1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 65 deletions.
5 changes: 0 additions & 5 deletions cmd/vega/commands/verify/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,6 @@ func verifyNetworkParameters(r *reporter, nps map[string]string, overwriteParame
continue
}

if _, ok := netparams.Deprecated[k]; ok {
r.Err("appstate.network_parameters deprecated parameter `%v`", k)
continue
}

err := netp.Validate(k, v)
if err != nil {
r.Err("appstate.network_parameters invalid parameter `%v`, %v", k, err)
Expand Down
36 changes: 15 additions & 21 deletions core/netparams/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,21 @@ func defaultNetParams() map[string]value {
MarketAMMMaxCalculationLevels: NewUint(gteU1).Mutable(true).MustUpdate("100"),

// markets
MarketAggressiveOrderBlockDelay: NewUint(gteU0).Mutable(true).MustUpdate("1"),
MarketMarginScalingFactors: NewJSON(&proto.ScalingFactors{}, checks.MarginScalingFactor(), checks.MarginScalingFactorRange(num.DecimalOne(), num.DecimalFromInt64(100))).Mutable(true).MustUpdate(`{"search_level": 1.1, "initial_margin": 1.2, "collateral_release": 1.4}`),
MarketFeeFactorsMakerFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0.00025"),
MarketFeeFactorsInfrastructureFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0.0005"),
MarketFeeFactorsBuyBackFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0"),
MarketFeeFactorsTreasuryFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0"),
MarketAuctionMinimumDuration: NewDuration(gte1s, lte1d).Mutable(true).MustUpdate("30m0s"),
MarketAuctionMaximumDuration: NewDuration(gte1s, lte1mo).Mutable(true).MustUpdate(week),
MarketLiquidityTargetStakeTriggeringRatio: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0"),
MarketProbabilityOfTradingTauScaling: NewDecimal(DecimalGTE(num.MustDecimalFromString("0.0001")), lteD1000).Mutable(true).MustUpdate("1"),
MarketMinProbabilityOfTradingForLPOrders: NewDecimal(DecimalGTE(num.MustDecimalFromString("1e-12")), DecimalLTE(num.MustDecimalFromString("0.1"))).Mutable(true).MustUpdate("1e-8"),
MarketTargetStakeTimeWindow: NewDuration(gte1s, lte1mo).Mutable(true).MustUpdate("1h0m0s"),
MarketTargetStakeScalingFactor: NewDecimal(gtD0, lteD100).Mutable(true).MustUpdate("10"),
MarketValueWindowLength: NewDuration(gte1m, lte1mo).Mutable(true).MustUpdate(week),
MarketPriceMonitoringDefaultParameters: NewJSON(&proto.PriceMonitoringParameters{}, checks.PriceMonitoringParametersAuctionExtension(5*time.Second, 30*24*time.Hour), checks.PriceMonitoringParametersHorizon(5*time.Second, 30*24*time.Hour), checks.PriceMonitoringParametersProbability(num.DecimalFromFloat(0.9), num.DecimalOne())).Mutable(true).MustUpdate(`{"triggers": []}`),
MarketLiquidityProvisionShapesMaxSize: NewInt(gteI1, lteI1000).Mutable(true).MustUpdate("5"),
MarketMinLpStakeQuantumMultiple: NewDecimal(gtD0, DecimalLT(num.MustDecimalFromString("1e10"))).Mutable(true).MustUpdate("1"),
RewardMarketCreationQuantumMultiple: NewDecimal(gteD1, DecimalLT(num.MustDecimalFromString("1e20"))).Mutable(true).MustUpdate("10000000"),
MarketAggressiveOrderBlockDelay: NewUint(gteU0).Mutable(true).MustUpdate("1"),
MarketMarginScalingFactors: NewJSON(&proto.ScalingFactors{}, checks.MarginScalingFactor(), checks.MarginScalingFactorRange(num.DecimalOne(), num.DecimalFromInt64(100))).Mutable(true).MustUpdate(`{"search_level": 1.1, "initial_margin": 1.2, "collateral_release": 1.4}`),
MarketFeeFactorsMakerFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0.00025"),
MarketFeeFactorsInfrastructureFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0.0005"),
MarketFeeFactorsBuyBackFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0"),
MarketFeeFactorsTreasuryFee: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0"),
MarketAuctionMinimumDuration: NewDuration(gte1s, lte1d).Mutable(true).MustUpdate("30m0s"),
MarketAuctionMaximumDuration: NewDuration(gte1s, lte1mo).Mutable(true).MustUpdate(week),
MarketProbabilityOfTradingTauScaling: NewDecimal(DecimalGTE(num.MustDecimalFromString("0.0001")), lteD1000).Mutable(true).MustUpdate("1"),
MarketMinProbabilityOfTradingForLPOrders: NewDecimal(DecimalGTE(num.MustDecimalFromString("1e-12")), DecimalLTE(num.MustDecimalFromString("0.1"))).Mutable(true).MustUpdate("1e-8"),
MarketValueWindowLength: NewDuration(gte1m, lte1mo).Mutable(true).MustUpdate(week),
MarketPriceMonitoringDefaultParameters: NewJSON(&proto.PriceMonitoringParameters{}, checks.PriceMonitoringParametersAuctionExtension(5*time.Second, 30*24*time.Hour), checks.PriceMonitoringParametersHorizon(5*time.Second, 30*24*time.Hour), checks.PriceMonitoringParametersProbability(num.DecimalFromFloat(0.9), num.DecimalOne())).Mutable(true).MustUpdate(`{"triggers": []}`),
MarketLiquidityProvisionShapesMaxSize: NewInt(gteI1, lteI1000).Mutable(true).MustUpdate("5"),
MarketMinLpStakeQuantumMultiple: NewDecimal(gtD0, DecimalLT(num.MustDecimalFromString("1e10"))).Mutable(true).MustUpdate("1"),
RewardMarketCreationQuantumMultiple: NewDecimal(gteD1, DecimalLT(num.MustDecimalFromString("1e20"))).Mutable(true).MustUpdate("10000000"),

MarketLiquidityBondPenaltyParameter: NewDecimal(gteD0, lteD1000).Mutable(true).MustUpdate("0.1"),
MarketLiquidityEarlyExitPenalty: NewDecimal(gteD0, lteD1000).Mutable(true).MustUpdate("0.05"),
Expand Down Expand Up @@ -220,13 +217,10 @@ func defaultNetParams() map[string]value {
DelegationMinAmount: NewDecimal(gtD0).Mutable(true).MustUpdate("1"),

// staking and delegation
StakingAndDelegationRewardPayoutFraction: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("1.0"),
StakingAndDelegationRewardPayoutDelay: NewDuration(DurationGTE(0 * time.Second)).Mutable(true).MustUpdate("24h0m0s"),
StakingAndDelegationRewardMaxPayoutPerParticipant: NewDecimal(gteD0).Mutable(true).MustUpdate("0"),
StakingAndDelegationRewardDelegatorShare: NewDecimal(gteD0, lteD1).Mutable(true).MustUpdate("0.883"),
StakingAndDelegationRewardMinimumValidatorStake: NewDecimal(gteD0).Mutable(true).MustUpdate("0"),
StakingAndDelegationRewardCompetitionLevel: NewDecimal(gteD1).Mutable(true).MustUpdate("1.1"),
StakingAndDelegationRewardMaxPayoutPerEpoch: NewDecimal(gteD0).Mutable(true).MustUpdate("7000000000000000000000"),
StakingAndDelegationRewardsMinValidators: NewInt(gteI1, lteI500).Mutable(true).MustUpdate("5"),
StakingAndDelegationRewardOptimalStakeMultiplier: NewDecimal(gteD1).Mutable(true).MustUpdate("3.0"),

Expand Down
3 changes: 0 additions & 3 deletions core/netparams/genesis_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ func DefaultGenesisState() GenesisState {
netp := defaultNetParams()

for k, v := range netp {
if _, ok := Deprecated[k]; ok {
continue
}
state[k] = v.String()
}

Expand Down
25 changes: 2 additions & 23 deletions core/netparams/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ const (
MinimumMarginQuantumMultiple = "spam.order.minimumMarginQuantumMultiple"
MinimumHoldingQuantumMultiple = "spam.order.minimumHoldingQuantumMultiple"

MarketTargetStakeTimeWindow = "market.stake.target.timeWindow"
MarketTargetStakeScalingFactor = "market.stake.target.scalingFactor"
MarketLiquidityTargetStakeTriggeringRatio = "market.liquidity.targetstake.triggering.ratio"
MarketValueWindowLength = "market.value.windowLength"
MarketPriceMonitoringDefaultParameters = "market.monitor.price.defaultParameters"
MarketValueWindowLength = "market.value.windowLength"
MarketPriceMonitoringDefaultParameters = "market.monitor.price.defaultParameters"

MarketMinLpStakeQuantumMultiple = "market.liquidityProvision.minLpStakeQuantumMultiple"
MarketProbabilityOfTradingTauScaling = "market.liquidity.probabilityOfTrading.tau.scaling"
Expand Down Expand Up @@ -165,13 +162,10 @@ const (
GovernanceProposalVolumeRebateProgramMinVoterBalance = "governance.proposal.VolumeRebateProgram.minVoterBalance"

// staking and delegation reward network params.
StakingAndDelegationRewardPayoutFraction = "reward.staking.delegation.payoutFraction"
StakingAndDelegationRewardMaxPayoutPerParticipant = "reward.staking.delegation.maxPayoutPerParticipant"
StakingAndDelegationRewardPayoutDelay = "reward.staking.delegation.payoutDelay"
StakingAndDelegationRewardDelegatorShare = "reward.staking.delegation.delegatorShare"
StakingAndDelegationRewardMinimumValidatorStake = "reward.staking.delegation.minimumValidatorStake"
StakingAndDelegationRewardCompetitionLevel = "reward.staking.delegation.competitionLevel"
StakingAndDelegationRewardMaxPayoutPerEpoch = "reward.staking.delegation.maxPayoutPerEpoch"
StakingAndDelegationRewardsMinValidators = "reward.staking.delegation.minValidators"
StakingAndDelegationRewardOptimalStakeMultiplier = "reward.staking.delegation.optimalStakeMultiplier"

Expand Down Expand Up @@ -289,15 +283,6 @@ const (
MarketAMMMaxCalculationLevels = "market.liquidity.maxAmmCalculationLevels"
)

var Deprecated = map[string]struct{}{
StakingAndDelegationRewardPayoutFraction: {},
StakingAndDelegationRewardPayoutDelay: {},
StakingAndDelegationRewardMaxPayoutPerEpoch: {},
MarketLiquidityTargetStakeTriggeringRatio: {},
MarketTargetStakeTimeWindow: {},
MarketTargetStakeScalingFactor: {},
}

var AllKeys = map[string]struct{}{
NetworkWideAuctionDuration: {},
RewardsUpdateFrequency: {},
Expand Down Expand Up @@ -341,15 +326,12 @@ var AllKeys = map[string]struct{}{
MarketAuctionMaximumDuration: {},
MarketLiquidityBondPenaltyParameter: {},
MarketLiquidityMaximumLiquidityFeeFactorLevel: {},
MarketLiquidityTargetStakeTriggeringRatio: {},
MarketLiquidityEarlyExitPenalty: {},
MarketLiquiditySLANonPerformanceBondPenaltySlope: {},
MarketLiquiditySLANonPerformanceBondPenaltyMax: {},
MarketLiquidityStakeToCCYVolume: {},
MarketLiquidityProvidersFeeCalculationTimeStep: {},
MarketLiquidityEquityLikeShareFeeFraction: {},
MarketTargetStakeTimeWindow: {},
MarketTargetStakeScalingFactor: {},
MarketPriceMonitoringDefaultParameters: {},
MarketMinLpStakeQuantumMultiple: {},
RewardAsset: {},
Expand Down Expand Up @@ -427,15 +409,12 @@ var AllKeys = map[string]struct{}{
MarketMinProbabilityOfTradingForLPOrders: {},
ValidatorsEpochLength: {},
DelegationMinAmount: {},
StakingAndDelegationRewardPayoutFraction: {},
StakingAndDelegationRewardMaxPayoutPerParticipant: {},
StakingAndDelegationRewardPayoutDelay: {},
StakingAndDelegationRewardDelegatorShare: {},
StakingAndDelegationRewardMinimumValidatorStake: {},
ValidatorsVoteRequired: {},
NetworkCheckpointTimeElapsedBetweenCheckpoints: {},
MarketValueWindowLength: {},
StakingAndDelegationRewardMaxPayoutPerEpoch: {},
SpamProtectionMinTokensForProposal: {},
SpamProtectionMaxVotes: {},
SpamProtectionMaxProposals: {},
Expand Down
4 changes: 0 additions & 4 deletions core/netparams/netparams.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,6 @@ func (s *Store) IsUpdateAllowed(key string) error {
return ErrUnknownKey
}

if _, ok := Deprecated[key]; ok {
return ErrNetworkParameterDeprecated(key)
}

for _, v := range updateDisallowed {
if v == key {
return ErrNetworkParameterUpdateDisabledFor(key)
Expand Down
9 changes: 0 additions & 9 deletions core/netparams/netparams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,12 +456,3 @@ func TestCrossNetParamUpdatesInGenesis(t *testing.T) {
require.NoError(t, err)
require.NoError(t, netp.UponGenesis(context.Background(), buf))
}

func TestDefaultStateHidesDeprecated(t *testing.T) {
st := netparams.DefaultGenesisState()

for v := range st {
_, ok := netparams.Deprecated[v]
assert.False(t, ok)
}
}

0 comments on commit 48618f1

Please sign in to comment.