Skip to content

Commit

Permalink
Update testnet validation period duration and activation age
Browse files Browse the repository at this point in the history
  • Loading branch information
julia-zack committed Dec 23, 2024
1 parent 34a0910 commit 163b160
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,24 @@ public Instant getGenesisFederationCreationTime() {
public long getValidationPeriodDurationInBlocks() { return validationPeriodDurationInBlocks; }

public long getFederationActivationAge(ActivationConfig.ForBlock activations) {
return activations.isActive(ConsensusRule.RSKIP383) ? federationActivationAge : federationActivationAgeLegacy;
if (!activations.isActive(ConsensusRule.RSKIP383)) {
return federationActivationAgeLegacy;
}

if (btcParams.equals(NetworkParameters.fromID(NetworkParameters.ID_TESTNET))) {
return getTestnetFederationActivationAge(activations);
}
return federationActivationAge;
}

private long getTestnetFederationActivationAge(ActivationConfig.ForBlock activations) {
if (!activations.isActive(ConsensusRule.RSKIP419)) {
return federationActivationAge;
}

// after lovell, we have to consider the activation age
// has to be at least the validation period duration
return validationPeriodDurationInBlocks;
}

public long getFundsMigrationAgeSinceActivationBegin() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ private FederationTestNetConstants() {
).map(hex -> ECKey.fromPublicOnly(Hex.decode(hex))).collect(Collectors.toList()));
federationChangeAuthorizer = new AddressBasedAuthorizer(federationChangeAuthorizedKeys, AddressBasedAuthorizer.MinimumRequiredCalculation.MAJORITY);

validationPeriodDurationInBlocks = 80L;
validationPeriodDurationInBlocks = 2000L;

federationActivationAgeLegacy = 60L;
federationActivationAge = 120L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void getValidationPeriodDuration(FederationConstants constants, long expectedDur
private static Stream<Arguments> validationPeriodDurationArgs() {
return Stream.of(
Arguments.of(MAINNET, 16000L),
Arguments.of(TESTNET, 80L),
Arguments.of(TESTNET, 2000L),
Arguments.of(REGTEST, 125L)
);
}
Expand Down

0 comments on commit 163b160

Please sign in to comment.