Skip to content

Commit

Permalink
Add version to the protocol API model, update sr constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
Groxan committed May 31, 2024
1 parent 9f46ff2 commit f03b15f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Tzkt.Api/Models/Protocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ public class Protocol
/// </summary>
public string Hash { get; set; }

/// <summary>
/// Global version number
/// </summary>
public int Version { get; set; }

/// <summary>
/// Block height where the protocol was applied
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions Tzkt.Api/Repositories/ProtocolRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ORDER BY ""FirstLevel"" DESC
{
Code = row.Code,
Hash = row.Hash,
Version = row.Version,
FirstLevel = row.FirstLevel,
FirstCycle = row.FirstCycle,
FirstCycleLevel = row.FirstCycleLevel,
Expand Down Expand Up @@ -105,6 +106,7 @@ public async Task<Protocol> Get(int code)
{
Code = code,
Hash = row.Hash,
Version = row.Version,
FirstLevel = row.FirstLevel,
FirstCycle = row.FirstCycle,
FirstCycleLevel = row.FirstCycleLevel,
Expand Down Expand Up @@ -173,6 +175,7 @@ public async Task<Protocol> Get(string hash)
{
Code = row.Code,
Hash = hash,
Version = row.Version,
FirstLevel = row.FirstLevel,
FirstCycle = row.FirstCycle,
FirstCycleLevel = row.FirstCycleLevel,
Expand Down Expand Up @@ -242,6 +245,7 @@ public async Task<IEnumerable<Protocol>> Get(SortParameter sort, OffsetParameter
{
Code = row.Code,
Hash = row.Hash,
Version = row.Version,
FirstLevel = row.FirstLevel,
FirstCycle = row.FirstCycle,
FirstCycleLevel = row.FirstCycleLevel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ protected override void UpgradeParameters(Protocol protocol, Protocol prev)
protocol.BlocksPerVoting = protocol.BlocksPerVoting * 3 / 2;
protocol.TimeBetweenBlocks = protocol.TimeBetweenBlocks * 2 / 3;
protocol.HardBlockGasLimit = prev.HardBlockGasLimit * 2 / 3;
protocol.SmartRollupCommitmentPeriod = 15 * 60 / protocol.TimeBetweenBlocks;
protocol.SmartRollupChallengeWindow = 14 * 24 * 60 * 60 / protocol.TimeBetweenBlocks;
protocol.SmartRollupTimeoutPeriod = 7 * 24 * 60 * 60 / protocol.TimeBetweenBlocks;
}

protected override async Task MigrateContext(AppState state)
Expand Down

0 comments on commit f03b15f

Please sign in to comment.