Skip to content

Commit 832d58c

Browse files
committed
chore: remove mainnet prefix
1 parent b219064 commit 832d58c

File tree

10 files changed

+95
-95
lines changed

10 files changed

+95
-95
lines changed

calculation/src/main/java/org/cardanofoundation/rewards/calculation/EpochCalculation.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static EpochCalculationResult calculateEpochRewardPots(final int epoch,
3535
final NetworkConfig networkConfig) {
3636
final EpochCalculationResult epochCalculationResult = EpochCalculationResult.builder().epoch(epoch).build();
3737

38-
if (epoch < networkConfig.getMainnetShelleyStartEpoch()) {
38+
if (epoch < networkConfig.getShelleyStartEpoch()) {
3939
log.warn("Epoch " + epoch + " is before the start of the Shelley era. No rewards were calculated in this epoch.");
4040
epochCalculationResult.setReserves(BigInteger.ZERO);
4141
epochCalculationResult.setTreasury(BigInteger.ZERO);
@@ -44,13 +44,13 @@ public static EpochCalculationResult calculateEpochRewardPots(final int epoch,
4444
epochCalculationResult.setTotalPoolRewardsPot(BigInteger.ZERO);
4545
epochCalculationResult.setTotalAdaInCirculation(BigInteger.ZERO);
4646
return epochCalculationResult;
47-
} else if (epoch == networkConfig.getMainnetShelleyStartEpoch()) {
48-
epochCalculationResult.setReserves(networkConfig.getMainnetShelleyInitialReserves());
49-
epochCalculationResult.setTreasury(networkConfig.getMainnetShelleyInitialTreasury());
47+
} else if (epoch == networkConfig.getShelleyStartEpoch()) {
48+
epochCalculationResult.setReserves(networkConfig.getShelleyInitialReserves());
49+
epochCalculationResult.setTreasury(networkConfig.getShelleyInitialTreasury());
5050
epochCalculationResult.setTotalDistributedRewards(BigInteger.ZERO);
5151
epochCalculationResult.setTotalRewardsPot(BigInteger.ZERO);
5252
epochCalculationResult.setTotalPoolRewardsPot(BigInteger.ZERO);
53-
epochCalculationResult.setTotalAdaInCirculation(networkConfig.getMainnetShelleyInitialUtxo());
53+
epochCalculationResult.setTotalAdaInCirculation(networkConfig.getShelleyInitialUtxo());
5454
return epochCalculationResult;
5555
}
5656

@@ -147,7 +147,7 @@ public static EpochCalculationResult calculateEpochRewardPots(final int epoch,
147147
// This is not the case anymore and the stake account receives the reward for all pools
148148
// Until the Allegra hard fork, this method will be used to emulate the old behavior
149149
boolean ignoreLeaderReward = false;
150-
if (epoch - 2 < networkConfig.getMainnetAllegraHardforkEpoch()) {
150+
if (epoch - 2 < networkConfig.getAllegraHardforkEpoch()) {
151151
ignoreLeaderReward = sharedPoolRewardAddressesWithoutReward.contains(poolId);
152152
}
153153

@@ -168,15 +168,15 @@ public static EpochCalculationResult calculateEpochRewardPots(final int epoch,
168168
calculatedReserve = add(calculatedReserve, undistributedRewards);
169169
calculatedReserve = subtract(calculatedReserve, unspendableEarnedRewards);
170170

171-
if (epoch == networkConfig.getMainnetAllegraHardforkEpoch()) {
171+
if (epoch == networkConfig.getAllegraHardforkEpoch()) {
172172
/*
173173
"The bootstrap addresses from Figure 6 were not intended to include the Byron era redeem
174174
addresses (those with addrtype 2, see the Byron CDDL spec). These addresses were, however,
175175
not spendable in the Shelley era. At the Allegra hard fork they were removed from the UTxO
176176
and the Ada contained in them was returned to the reserves."
177177
- shelley-spec-ledger.pdf 17.5 p.115
178178
*/
179-
calculatedReserve = calculatedReserve.add(networkConfig.getMainnetBootstrapAddressAmount());
179+
calculatedReserve = calculatedReserve.add(networkConfig.getBootstrapAddressAmount());
180180
}
181181

182182
log.debug("Unspendable earned rewards: " + unspendableEarnedRewards.longValue() + " Lovelace");

calculation/src/main/java/org/cardanofoundation/rewards/calculation/PoolRewardsCalculation.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static PoolRewardCalculationResult calculatePoolRewardInEpoch(final Strin
149149
a reward update. As in the Shelley era, though, they are still filtered on the epoch boundary
150150
when the reward update is applied
151151
*/
152-
if (earnedEpoch >= networkConfig.getMainnetVasilHardforkEpoch()) {
152+
if (earnedEpoch >= networkConfig.getVasilHardforkEpoch()) {
153153
lateDeregisteredAccounts.addAll(deregisteredAccounts);
154154
deregisteredAccounts.clear();
155155
}
@@ -212,7 +212,7 @@ public static PoolRewardCalculationResult calculatePoolRewardInEpoch(final Strin
212212

213213
if (!accountsRegisteredInThePast.contains(rewardAddress)) {
214214
log.info(poolRewardCalculationResult.getRewardAddress() + " has never been registered. Operator would have received " + poolOperatorReward + " but will not receive any rewards.");
215-
if (earnedEpoch >= networkConfig.getMainnetVasilHardforkEpoch()) {
215+
if (earnedEpoch >= networkConfig.getVasilHardforkEpoch()) {
216216
unspendableEarnedRewards = poolOperatorReward;
217217
}
218218
poolOperatorReward = BigInteger.ZERO;
@@ -244,7 +244,7 @@ public static PoolRewardCalculationResult calculatePoolRewardInEpoch(final Strin
244244
shelley-ledger.pdf | 17.4 Reward aggregation | p. 114
245245
*/
246246
if (stakeAddress.equals(poolStateCurrentEpoch.getRewardAddress())
247-
&& earnedEpoch < networkConfig.getMainnetAllegraHardforkEpoch()) {
247+
&& earnedEpoch < networkConfig.getAllegraHardforkEpoch()) {
248248
continue;
249249
}
250250

calculation/src/main/java/org/cardanofoundation/rewards/calculation/TreasuryCalculation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static TreasuryCalculationResult calculateTreasuryInEpoch(int epoch, Prot
2525
NetworkConfig networkConfig) {
2626
// The Shelley era and the ada pot system started on mainnet in epoch 208.
2727
// Fee and treasury values are 0 for epoch 208.
28-
if (epoch <= networkConfig.getMainnetShelleyStartEpoch()) {
28+
if (epoch <= networkConfig.getShelleyStartEpoch()) {
2929
return TreasuryCalculationResult.builder()
3030
.treasury(BigInteger.ZERO)
3131
.epoch(epoch)

calculation/src/main/java/org/cardanofoundation/rewards/calculation/config/NetworkConfig.java

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ public class NetworkConfig {
1515
private BigInteger totalLovelace;
1616
private BigInteger poolDepositInLovelace;
1717
private long expectedSlotsPerEpoch;
18-
private BigInteger mainnetShelleyInitialReserves;
19-
private BigInteger mainnetShelleyInitialTreasury;
20-
private BigInteger mainnetShelleyInitialUtxo;
18+
private BigInteger shelleyInitialReserves;
19+
private BigInteger shelleyInitialTreasury;
20+
private BigInteger shelleyInitialUtxo;
2121
private int genesisConfigSecurityParameter;
22-
private int mainnetShelleyStartEpoch;
23-
private int mainnetAllegraHardforkEpoch;
24-
private int mainnetVasilHardforkEpoch;
25-
private BigInteger mainnetBootstrapAddressAmount;
22+
private int shelleyStartEpoch;
23+
private int allegraHardforkEpoch;
24+
private int vasilHardforkEpoch;
25+
private BigInteger bootstrapAddressAmount;
2626
private double activeSlotCoefficient;
2727
private long randomnessStabilisationWindow;
28-
private BigDecimal mainnetShelleyStartDecentralisation;
29-
private BigDecimal mainnetShelleyStartTreasuryGrowRate;
30-
private BigDecimal mainnetShelleyStartMonetaryExpandRate;
31-
private int mainnetShelleyStartOptimalPoolCount;
32-
private BigDecimal mainnetShelleyStartPoolOwnerInfluence;
28+
private BigDecimal shelleyStartDecentralisation;
29+
private BigDecimal shelleyStartTreasuryGrowRate;
30+
private BigDecimal shelleyStartMonetaryExpandRate;
31+
private int shelleyStartOptimalPoolCount;
32+
private BigDecimal shelleyStartPoolOwnerInfluence;
3333

3434
public static final int MAINNET_NETWORK_MAGIC = 764824073;
3535
public static final int PREPROD_NETWORK_MAGIC = 1;
@@ -42,21 +42,21 @@ public static NetworkConfig getMainnetConfig() {
4242
.totalLovelace(new BigInteger("45000000000000000"))
4343
.poolDepositInLovelace(BigInteger.valueOf(500000000))
4444
.expectedSlotsPerEpoch(432000)
45-
.mainnetShelleyInitialReserves(new BigInteger("13888022852926644"))
46-
.mainnetShelleyInitialTreasury(new BigInteger("0"))
47-
.mainnetShelleyInitialUtxo(new BigInteger("31111977147073356"))
45+
.shelleyInitialReserves(new BigInteger("13888022852926644"))
46+
.shelleyInitialTreasury(new BigInteger("0"))
47+
.shelleyInitialUtxo(new BigInteger("31111977147073356"))
4848
.genesisConfigSecurityParameter(2160)
49-
.mainnetShelleyStartEpoch(208)
50-
.mainnetAllegraHardforkEpoch(236)
51-
.mainnetVasilHardforkEpoch(365)
52-
.mainnetBootstrapAddressAmount(new BigInteger("318200635000000"))
49+
.shelleyStartEpoch(208)
50+
.allegraHardforkEpoch(236)
51+
.vasilHardforkEpoch(365)
52+
.bootstrapAddressAmount(new BigInteger("318200635000000"))
5353
.activeSlotCoefficient(0.05)
5454
.randomnessStabilisationWindow(172800)
55-
.mainnetShelleyStartDecentralisation(BigDecimal.valueOf(1.0))
56-
.mainnetShelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
57-
.mainnetShelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
58-
.mainnetShelleyStartOptimalPoolCount(150)
59-
.mainnetShelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
55+
.shelleyStartDecentralisation(BigDecimal.valueOf(1.0))
56+
.shelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
57+
.shelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
58+
.shelleyStartOptimalPoolCount(150)
59+
.shelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
6060
.build();
6161
}
6262

@@ -66,21 +66,21 @@ public static NetworkConfig getPreprodConfig() {
6666
.totalLovelace(new BigInteger("45000000000000000"))
6767
.poolDepositInLovelace(BigInteger.valueOf(500000000))
6868
.expectedSlotsPerEpoch(432000)
69-
.mainnetShelleyInitialReserves(new BigInteger("14991000000000000"))
70-
.mainnetShelleyInitialTreasury(new BigInteger("9000000000000"))
71-
.mainnetShelleyInitialUtxo(new BigInteger("30009000000000000"))
69+
.shelleyInitialReserves(new BigInteger("14991000000000000"))
70+
.shelleyInitialTreasury(new BigInteger("9000000000000"))
71+
.shelleyInitialUtxo(new BigInteger("30009000000000000"))
7272
.genesisConfigSecurityParameter(2160)
73-
.mainnetShelleyStartEpoch(4)
74-
.mainnetAllegraHardforkEpoch(5)
75-
.mainnetVasilHardforkEpoch(12)
76-
.mainnetBootstrapAddressAmount(new BigInteger("0"))
73+
.shelleyStartEpoch(4)
74+
.allegraHardforkEpoch(5)
75+
.vasilHardforkEpoch(12)
76+
.bootstrapAddressAmount(new BigInteger("0"))
7777
.activeSlotCoefficient(0.05)
7878
.randomnessStabilisationWindow(172800) // (4 * GENESIS_CONFIG_SECURITY_PARAMETER) / ACTIVE_SLOT_COEFFICIENT
79-
.mainnetShelleyStartDecentralisation(BigDecimal.valueOf(1.0))
80-
.mainnetShelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
81-
.mainnetShelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
82-
.mainnetShelleyStartOptimalPoolCount(150)
83-
.mainnetShelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
79+
.shelleyStartDecentralisation(BigDecimal.valueOf(1.0))
80+
.shelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
81+
.shelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
82+
.shelleyStartOptimalPoolCount(150)
83+
.shelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
8484
.build();
8585
}
8686

@@ -90,21 +90,21 @@ public static NetworkConfig getPreviewConfig() {
9090
.totalLovelace(new BigInteger("45000000000000000"))
9191
.poolDepositInLovelace(BigInteger.valueOf(500000000))
9292
.expectedSlotsPerEpoch(86400)
93-
.mainnetShelleyInitialReserves(new BigInteger("14991000000000000"))
94-
.mainnetShelleyInitialTreasury(new BigInteger("9000000000000"))
95-
.mainnetShelleyInitialUtxo(new BigInteger("30009000000000000"))
93+
.shelleyInitialReserves(new BigInteger("14991000000000000"))
94+
.shelleyInitialTreasury(new BigInteger("9000000000000"))
95+
.shelleyInitialUtxo(new BigInteger("30009000000000000"))
9696
.genesisConfigSecurityParameter(432)
97-
.mainnetShelleyStartEpoch(1)
98-
.mainnetAllegraHardforkEpoch(1)
99-
.mainnetVasilHardforkEpoch(3)
100-
.mainnetBootstrapAddressAmount(new BigInteger("0"))
97+
.shelleyStartEpoch(1)
98+
.allegraHardforkEpoch(1)
99+
.vasilHardforkEpoch(3)
100+
.bootstrapAddressAmount(new BigInteger("0"))
101101
.activeSlotCoefficient(0.05)
102102
.randomnessStabilisationWindow(34560) // (4 * GENESIS_CONFIG_SECURITY_PARAMETER) / ACTIVE_SLOT_COEFFICIENT
103-
.mainnetShelleyStartDecentralisation(BigDecimal.valueOf(1.0))
104-
.mainnetShelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
105-
.mainnetShelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
106-
.mainnetShelleyStartOptimalPoolCount(150)
107-
.mainnetShelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
103+
.shelleyStartDecentralisation(BigDecimal.valueOf(1.0))
104+
.shelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
105+
.shelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
106+
.shelleyStartOptimalPoolCount(150)
107+
.shelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
108108
.build();
109109
}
110110

@@ -114,21 +114,21 @@ public static NetworkConfig getSanchonetConfig() {
114114
.totalLovelace(new BigInteger("45000000000000000"))
115115
.poolDepositInLovelace(BigInteger.valueOf(500000000))
116116
.expectedSlotsPerEpoch(86400)
117-
.mainnetShelleyInitialReserves(new BigInteger("14991000000000000"))
118-
.mainnetShelleyInitialTreasury(new BigInteger("9000000000000"))
119-
.mainnetShelleyInitialUtxo(new BigInteger("30009000000000000"))
117+
.shelleyInitialReserves(new BigInteger("14991000000000000"))
118+
.shelleyInitialTreasury(new BigInteger("9000000000000"))
119+
.shelleyInitialUtxo(new BigInteger("30009000000000000"))
120120
.genesisConfigSecurityParameter(432)
121-
.mainnetShelleyStartEpoch(1)
122-
.mainnetAllegraHardforkEpoch(1)
123-
.mainnetVasilHardforkEpoch(3)
124-
.mainnetBootstrapAddressAmount(new BigInteger("0"))
121+
.shelleyStartEpoch(1)
122+
.allegraHardforkEpoch(1)
123+
.vasilHardforkEpoch(3)
124+
.bootstrapAddressAmount(new BigInteger("0"))
125125
.activeSlotCoefficient(0.05)
126126
.randomnessStabilisationWindow(34560) // (4 * GENESIS_CONFIG_SECURITY_PARAMETER) / ACTIVE_SLOT_COEFFICIENT
127-
.mainnetShelleyStartDecentralisation(BigDecimal.valueOf(1.0))
128-
.mainnetShelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
129-
.mainnetShelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
130-
.mainnetShelleyStartOptimalPoolCount(150)
131-
.mainnetShelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
127+
.shelleyStartDecentralisation(BigDecimal.valueOf(1.0))
128+
.shelleyStartTreasuryGrowRate(BigDecimal.valueOf(0.2))
129+
.shelleyStartMonetaryExpandRate(BigDecimal.valueOf(0.003))
130+
.shelleyStartOptimalPoolCount(150)
131+
.shelleyStartPoolOwnerInfluence(BigDecimal.valueOf(0.03))
132132
.build();
133133
}
134134

validation/src/main/java/org/cardanofoundation/rewards/validation/EpochValidation.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
2121
}
2222

2323
public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataProvider dataProvider, boolean detailedValidation, NetworkConfig networkConfig) {
24-
if (epoch < networkConfig.getMainnetShelleyStartEpoch()) {
24+
if (epoch < networkConfig.getShelleyStartEpoch()) {
2525
log.warn("Epoch " + epoch + " is before the start of the Shelley era. No rewards were calculated in this epoch.");
2626
return EpochCalculationResult.builder()
2727
.totalRewardsPot(BigInteger.ZERO)
@@ -36,7 +36,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
3636
.totalDistributedRewards(BigInteger.ZERO)
3737
.epoch(epoch)
3838
.build();
39-
} else if (epoch == networkConfig.getMainnetShelleyStartEpoch()) {
39+
} else if (epoch == networkConfig.getShelleyStartEpoch()) {
4040
return EpochCalculationResult.builder()
4141
.totalRewardsPot(BigInteger.ZERO)
4242
.treasury(BigInteger.ZERO)
@@ -46,7 +46,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
4646
.treasuryWithdrawals(BigInteger.ZERO)
4747
.unspendableEarnedRewards(BigInteger.ZERO)
4848
.epoch(epoch).build())
49-
.reserves(networkConfig.getMainnetShelleyInitialReserves())
49+
.reserves(networkConfig.getShelleyInitialReserves())
5050
.totalDistributedRewards(BigInteger.ZERO)
5151
.epoch(epoch)
5252
.build();
@@ -130,7 +130,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
130130
HashSet<String> deregisteredAccounts;
131131
HashSet<String> deregisteredAccountsOnEpochBoundary;
132132
HashSet<String> lateDeregisteredAccounts = new HashSet<>();
133-
if (epoch - 2 < networkConfig.getMainnetVasilHardforkEpoch()) {
133+
if (epoch - 2 < networkConfig.getVasilHardforkEpoch()) {
134134
deregisteredAccounts = dataProvider.getDeregisteredAccountsInEpoch(epoch - 1, networkConfig.getRandomnessStabilisationWindow());
135135
deregisteredAccountsOnEpochBoundary = dataProvider.getDeregisteredAccountsInEpoch(epoch - 1, networkConfig.getExpectedSlotsPerEpoch());
136136
lateDeregisteredAccounts = deregisteredAccountsOnEpochBoundary.stream().filter(account -> !deregisteredAccounts.contains(account)).collect(Collectors.toCollection(HashSet::new));
@@ -140,7 +140,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
140140
}
141141

142142
HashSet<String> sharedPoolRewardAddressesWithoutReward = new HashSet<>();
143-
if (epoch - 2 < networkConfig.getMainnetAllegraHardforkEpoch()) {
143+
if (epoch - 2 < networkConfig.getAllegraHardforkEpoch()) {
144144
sharedPoolRewardAddressesWithoutReward = dataProvider.findSharedPoolRewardAddressWithoutReward(epoch - 2);
145145
}
146146
HashSet<String> poolRewardAddresses = poolStates.stream().map(PoolState::getRewardAddress).collect(Collectors.toCollection(HashSet::new));
@@ -150,7 +150,7 @@ public static EpochCalculationResult calculateEpochRewardPots(int epoch, DataPro
150150
// Since the Vasil hard fork, the unregistered accounts will not filter out before the
151151
// rewards calculation starts (at the stability window). They will be filtered out on the
152152
// epoch boundary when the reward update will be applied.
153-
if (epoch - 2 >= networkConfig.getMainnetVasilHardforkEpoch()) {
153+
if (epoch - 2 >= networkConfig.getVasilHardforkEpoch()) {
154154
stabilityWindow = networkConfig.getExpectedSlotsPerEpoch();
155155
}
156156

0 commit comments

Comments
 (0)