Skip to content

Commit

Permalink
Deprecate lb sunset level constant
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed Dec 11, 2022
1 parent 6dd5023 commit 561c518
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 32 deletions.
10 changes: 5 additions & 5 deletions Tzkt.Api/Models/ProtocolConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@ public class ProtocolConstants
/// </summary>
public int LBSubsidy { get; set; }

/// <summary>
/// Level after protocol activation when liquidity baking shuts off
/// </summary>
public int LBSunsetLevel { get; set; }

/// <summary>
/// 1/2 window size of 2000 blocks with precision of 1000000 for integer computation
/// </summary>
Expand Down Expand Up @@ -195,6 +190,11 @@ public class ProtocolConstants
/// [DEPRECATED]
/// </summary>
public int LBEscapeThreshold => LBToggleThreshold;

/// <summary>
/// [DEPRECATED]
/// </summary>
public int LBSunsetLevel => 3_063_809;
#endregion
}
}
4 changes: 0 additions & 4 deletions Tzkt.Api/Repositories/ProtocolRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ ORDER BY ""FirstLevel"" DESC
BallotQuorumMin = row.BallotQuorumMin / 100.0,
BallotQuorumMax = row.BallotQuorumMax / 100.0,
LBSubsidy = row.LBSubsidy,
LBSunsetLevel = row.LBSunsetLevel,
LBToggleThreshold = row.LBToggleThreshold,
ConsensusThreshold = row.ConsensusThreshold,
DoubleBakingPunishment = row.DoubleBakingPunishment,
Expand Down Expand Up @@ -140,7 +139,6 @@ public async Task<Protocol> Get(int code)
BallotQuorumMin = row.BallotQuorumMin / 100.0,
BallotQuorumMax = row.BallotQuorumMax / 100.0,
LBSubsidy = row.LBSubsidy,
LBSunsetLevel = row.LBSunsetLevel,
LBToggleThreshold = row.LBToggleThreshold,
ConsensusThreshold = row.ConsensusThreshold,
DoubleBakingPunishment = row.DoubleBakingPunishment,
Expand Down Expand Up @@ -208,7 +206,6 @@ public async Task<Protocol> Get(string hash)
BallotQuorumMin = row.BallotQuorumMin / 100.0,
BallotQuorumMax = row.BallotQuorumMax / 100.0,
LBSubsidy = row.LBSubsidy,
LBSunsetLevel = row.LBSunsetLevel,
LBToggleThreshold = row.LBToggleThreshold,
ConsensusThreshold = row.ConsensusThreshold,
DoubleBakingPunishment = row.DoubleBakingPunishment,
Expand Down Expand Up @@ -277,7 +274,6 @@ public async Task<IEnumerable<Protocol>> Get(SortParameter sort, OffsetParameter
BallotQuorumMin = row.BallotQuorumMin / 100.0,
BallotQuorumMax = row.BallotQuorumMax / 100.0,
LBSubsidy = row.LBSubsidy,
LBSunsetLevel = row.LBSunsetLevel,
LBToggleThreshold = row.LBToggleThreshold,
ConsensusThreshold = row.ConsensusThreshold,
DoubleBakingPunishment = row.DoubleBakingPunishment,
Expand Down
4 changes: 0 additions & 4 deletions Tzkt.Data/Models/Blocks/Protocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ public class Protocol
/// </summary>
public int LBSubsidy { get; set; }
/// <summary>
/// Level after protocol activation when liquidity baking shuts off
/// </summary>
public int LBSunsetLevel { get; set; }
/// <summary>
/// 1/2 window size of 2000 blocks with precision of 1000000 for integer computation
/// </summary>
public int LBToggleThreshold { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ public async Task UpgradeProtocol(AppState state)
BallotQuorumMax = prev.BallotQuorumMax,
ProposalQuorum = prev.ProposalQuorum,
LBSubsidy = prev.LBSubsidy,
LBSunsetLevel = prev.LBSunsetLevel,
LBToggleThreshold = prev.LBToggleThreshold,
ConsensusThreshold = prev.ConsensusThreshold,
DoubleBakingPunishment = prev.DoubleBakingPunishment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ protected override void SetParameters(Protocol protocol, JToken parameters)
protocol.TimeBetweenBlocks = parameters["minimal_block_delay"]?.Value<int>() ?? 30;

protocol.LBSubsidy = parameters["liquidity_baking_subsidy"]?.Value<int>() ?? 2_500_000;
protocol.LBSunsetLevel = parameters["liquidity_baking_sunset_level"]?.Value<int>() ?? 2_032_928;
protocol.LBToggleThreshold = (parameters["liquidity_baking_escape_ema_threshold"]?.Value<int>() ?? 1_000_000) * 1000;
}

Expand All @@ -81,7 +80,6 @@ protected override void UpgradeParameters(Protocol protocol, Protocol prev)
protocol.TimeBetweenBlocks /= 2;

protocol.LBSubsidy = 2_500_000;
protocol.LBSunsetLevel = 2_032_928;
protocol.LBToggleThreshold = 1_000_000_000;
}

Expand Down
13 changes: 0 additions & 13 deletions Tzkt.Sync/Protocols/Handlers/Proto11/Activation/ProtoActivator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using Tzkt.Data.Models;

namespace Tzkt.Sync.Protocols.Proto11
Expand All @@ -8,18 +7,6 @@ class ProtoActivator : Proto10.ProtoActivator
{
public ProtoActivator(ProtocolHandler proto) : base(proto) { }

protected override void SetParameters(Protocol protocol, JToken parameters)
{
base.SetParameters(protocol, parameters);
protocol.LBSunsetLevel = parameters["liquidity_baking_sunset_level"]?.Value<int>() ?? 2_244_609;
}

protected override void UpgradeParameters(Protocol protocol, Protocol prev)
{
if (protocol.LBSunsetLevel == 2_032_928)
protocol.LBSunsetLevel = 2_244_609;
}

protected override Task MigrateContext(AppState state) => Task.CompletedTask;
protected override Task RevertContext(AppState state) => Task.CompletedTask;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ protected override void SetParameters(Protocol protocol, JToken parameters)
protocol.EndorsementReward0 = parameters["endorsing_reward_per_slot"]?.Value<long>() ?? (totalReward / 2 / protocol.EndorsersPerBlock);
protocol.EndorsementReward1 = 0;

protocol.LBSunsetLevel = parameters["liquidity_baking_sunset_level"]?.Value<int>() ?? 3_063_809;
protocol.LBToggleThreshold = (parameters["liquidity_baking_escape_ema_threshold"]?.Value<int>() ?? 666_667) * 1000;

protocol.ConsensusThreshold = parameters["consensus_threshold"]?.Value<int>() ?? 4667;
Expand Down Expand Up @@ -59,8 +58,6 @@ protected override void UpgradeParameters(Protocol protocol, Protocol prev)
protocol.EndorsementReward0 = totalReward / 2 / protocol.EndorsersPerBlock;
protocol.EndorsementReward1 = 0;

if (protocol.LBSunsetLevel == 2_244_609)
protocol.LBSunsetLevel = 3_063_809;
protocol.LBToggleThreshold = 666_667_000;

protocol.ConsensusThreshold = 4667;
Expand Down

0 comments on commit 561c518

Please sign in to comment.