Skip to content

Commit

Permalink
feat: Conway era support for pre-prod and initial one for mainnet (ne…
Browse files Browse the repository at this point in the history
…eds some update after Chang HFC first block is minted.
  • Loading branch information
Mateusz Czeladka committed Aug 29, 2024
1 parent d7f553f commit 3068d3b
Show file tree
Hide file tree
Showing 11 changed files with 370 additions and 254 deletions.
10 changes: 8 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
<lombok.version>1.18.26</lombok.version>
<jackson.version>2.16.0</jackson.version>
<assertj.version>3.24.2</assertj.version>
Expand Down Expand Up @@ -92,6 +92,12 @@
<name>Mateusz Czeladka</name>
<email>mateusz.czeladka@cardanofoundation.org</email>
</developer>
<developer>
<id>giovanni</id>
<name>Giovanni Gargiulo</name>
<email>giovanni.gargiulo@cardanofoundation.org</email>
</developer>

</developers>

<profiles>
Expand Down Expand Up @@ -215,7 +221,7 @@
<plugin>
<groupId>com.spotify.fmt</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>2.18</version>
<version>2.24</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
package org.cardanofoundation.conversions;

import static org.cardanofoundation.conversions.domain.Consensus.*;
import static org.cardanofoundation.conversions.domain.EraType.Byron;
import static org.cardanofoundation.conversions.domain.EraType.Shelley;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.Praos;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.TPraos;
import static org.cardanofoundation.conversions.domain.ProtocolVersion.*;

import java.util.List;
import java.util.Optional;
import org.cardanofoundation.conversions.domain.*;

public class MainNetEraHistoryFactory {

public static List<EraHistoryItem> eraHistoryItems(GenesisPaths genesisPaths) {
return List.of(
new EraHistoryItem(
Phase.Byron,
new Era(Byron, Optional.of(genesisPaths.byronLink())),
0L,
Optional.empty(),
0L,
Optional.of(3_801_600L - 1L),
0,
Optional.of(175),
VER_0_0,
Optional.empty(),
Ouroboros_Classic,
false),
new EraHistoryItem(
Phase.Byron,
new Era(Byron, Optional.of(genesisPaths.byronLink())),
3801600L,
Optional.of(4_492_799L),
3_801_600L,
Optional.of(4_492_800L - 1L),
176,
Optional.of(207),
ProtocolVersion.VER_1_0,
Optional.empty(),
Ouroboros_BFT,
false),
new EraHistoryItem(
Phase.Shelley,
new Era(Shelley, Optional.of(genesisPaths.shelleyLink())),
4_492_800L,
Optional.of(16_588_737L),
4_492_800L,
Optional.of(16_588_800L - 1L),
208,
Optional.of(235),
ProtocolVersion.VER_2_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Allegra),
16_588_800L,
Optional.of(23_068_793L),
16_588_800L,
Optional.of(23_068_800L - 1L),
236,
Optional.of(250),
ProtocolVersion.VER_3_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Mary),
23_068_800L,
Optional.of(399_167_96L),
23_068_800L,
Optional.of(39_916_800L),
251,
Optional.of(289),
ProtocolVersion.VER_4_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Alonzo),
39_916_975L,
Optional.empty(), // TODO: find out this value based on some explorer data
39_916_800L,
Optional.of(43_372_800L - 1L),
290,
Optional.of(297),
ProtocolVersion.VER_5_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Alonzo),
43_372_972L,
Optional.of(72_316_796L),
43_372_800L,
Optional.of(72_316_800L - 1L),
298,
Optional.of(364),
VER_6_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Babbage),
72_316_896L,
Optional.empty(), // TODO: find out this value based on some explorer data
72_316_800L,
Optional.empty(),
365,
Optional.of(393),
ProtocolVersion.VER_7_0,
Optional.of(Praos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Babbage),
84_844_885L,
Optional.empty(), // TODO we don't know this value yet, update when Conway starts
84_844_800L,
Optional.of(108_172_800L - 1L),
394,
Optional.of(507 - 1),
VER_8_0,
Optional.of(Praos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Voltaire,
Era.noGenesis(EraType.Conway),
68_774_413L, // TODO we don't know this value yet
Optional
.empty(), // Conway era is an active era soon, and we don't know when it ends yet
133_660_800L,
Optional
.empty(), // Conway era is an active era soon, and we don't know when it ends yet
507,
Optional.empty(),
VER_9_1,
Optional.of(Praos),
Ouroboros_Praos,
true));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
package org.cardanofoundation.conversions;

import static org.cardanofoundation.conversions.domain.Consensus.Ouroboros_BFT;
import static org.cardanofoundation.conversions.domain.Consensus.Ouroboros_Praos;
import static org.cardanofoundation.conversions.domain.EraType.Byron;
import static org.cardanofoundation.conversions.domain.EraType.Shelley;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.Praos;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.TPraos;
import static org.cardanofoundation.conversions.domain.ProtocolVersion.*;

import java.util.List;
import java.util.Optional;
import org.cardanofoundation.conversions.domain.*;

public class PreProdEraHistoryFactory {

// TODO fill out real first and last slot block values for pre-prod (not only theoretical ones)
public static List<EraHistoryItem> eraHistoryItems(GenesisPaths genesisPaths) {
return List.of(
new EraHistoryItem(
Phase.Byron,
new Era(Byron, Optional.of(genesisPaths.byronLink())),
0,
Optional.of(84_242L),
0,
Optional.of(86_400L - 1L),
0,
Optional.of(3),
ProtocolVersion.VER_1_0,
Optional.empty(),
Ouroboros_BFT,
false),
new EraHistoryItem(
Phase.Shelley,
new Era(Shelley, Optional.of(genesisPaths.shelleyLink())),
-1L, // TODO find out this value based on some explorer data
Optional.of(518_360L),
86_400L,
Optional.of(518_400L - 1L),
4,
Optional.of(4),
ProtocolVersion.VER_2_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Allegra),
-1L, // TODO find out this value based on some explorer data
Optional.of(950_340L),
518_400L,
Optional.of(950_400L - 1L),
5,
Optional.of(5),
ProtocolVersion.VER_3_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Mary),
-1L, // TODO find out this value based on some explorer data
Optional.of(1_382_348L),
950_400L,
Optional.of(1_382_400L - 1L),
6,
Optional.of(6),
ProtocolVersion.VER_4_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Alonzo),
-1L, // TODO find out this value based on some explorer data
Optional.of(3_542_390L),
1_382_400L,
Optional.of(3_974_400L - 1L),
7,
Optional.of(12),
VER_6_0,
Optional.of(TPraos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Gougen,
Era.noGenesis(EraType.Babbage),
-1L, // TODO find out this value based on some explorer data
Optional.empty(),
3_974_400L,
Optional.of(68_774_413L - 1L),
13,
Optional.of(163 - 1),
VER_8_0,
Optional.of(Praos),
Ouroboros_Praos,
false),
new EraHistoryItem(
Phase.Voltaire,
Era.noGenesis(EraType.Conway),
68_774_413L,
Optional.empty(),
68_774_400L,
Optional.empty(),
163,
Optional.empty(),
VER_9_1,
Optional.of(Praos),
Ouroboros_Praos,
true));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.cardanofoundation.conversions;

import static org.cardanofoundation.conversions.domain.Consensus.Ouroboros_Praos;
import static org.cardanofoundation.conversions.domain.EraType.Shelley;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.Praos;
import static org.cardanofoundation.conversions.domain.ProtocolVersion.VER_6_0;

import java.util.List;
import java.util.Optional;
import org.cardanofoundation.conversions.domain.Era;
import org.cardanofoundation.conversions.domain.EraHistoryItem;
import org.cardanofoundation.conversions.domain.GenesisPaths;
import org.cardanofoundation.conversions.domain.Phase;

public class PreviewEraHistoryFactory {

public static List<EraHistoryItem> eraHistoryItems(GenesisPaths genesisPaths) {
return List.of(
new EraHistoryItem(
Phase.Shelley,
new Era(Shelley, Optional.of(genesisPaths.shelleyLink())),
0L, // TODO find out this value based on some explorer data
Optional.empty(),
0L,
Optional.empty(),
0,
Optional.empty(),
VER_6_0,
Optional.of(Praos),
Ouroboros_Praos,
false));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.cardanofoundation.conversions;

import static org.cardanofoundation.conversions.domain.Consensus.Ouroboros_Praos;
import static org.cardanofoundation.conversions.domain.EraType.Shelley;
import static org.cardanofoundation.conversions.domain.LedgerProtocol.Praos;
import static org.cardanofoundation.conversions.domain.ProtocolVersion.VER_6_0;

import java.util.List;
import java.util.Optional;
import org.cardanofoundation.conversions.domain.Era;
import org.cardanofoundation.conversions.domain.EraHistoryItem;
import org.cardanofoundation.conversions.domain.GenesisPaths;
import org.cardanofoundation.conversions.domain.Phase;

public class SanchoNetEraHistoryFactory {

public static List<EraHistoryItem> eraHistoryItems(GenesisPaths genesisPaths) {
return List.of(
new EraHistoryItem(
Phase.Shelley,
new Era(Shelley, Optional.of(genesisPaths.shelleyLink())),
0L, // TODO find out this value based on some explorer data
Optional.empty(),
0L,
Optional.empty(),
0,
Optional.empty(),
VER_6_0,
Optional.of(Praos),
Ouroboros_Praos,
false));
}
}
Loading

0 comments on commit 3068d3b

Please sign in to comment.