From 56a6516671287adb07dc230f0121b28f34248261 Mon Sep 17 00:00:00 2001 From: David Edey Date: Mon, 27 Jun 2022 12:45:44 +0100 Subject: [PATCH 1/2] Add fork olympia-rpf-001 --- .../forks/modules/MainnetForksModule.java | 43 +++++++++++++++++++ .../forks/modules/ReleasenetForksModule.java | 43 +++++++++++++++++++ .../radixdlt/application/tokens/Amount.java | 5 +++ 3 files changed, 91 insertions(+) diff --git a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java index 6a7e4fd1e2..5542a61491 100644 --- a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java +++ b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java @@ -66,6 +66,7 @@ import static com.radixdlt.constraintmachine.REInstruction.REMicroOp.MSG; +import com.google.common.collect.ImmutableSet; import com.google.inject.AbstractModule; import com.google.inject.multibindings.ProvidesIntoSet; import com.radixdlt.application.system.FeeTable; @@ -78,6 +79,7 @@ import com.radixdlt.application.validators.state.ValidatorMetaData; import com.radixdlt.application.validators.state.ValidatorOwnerCopy; import com.radixdlt.application.validators.state.ValidatorRegisteredCopy; +import com.radixdlt.statecomputer.forks.CandidateForkConfig; import com.radixdlt.statecomputer.forks.ForkBuilder; import com.radixdlt.statecomputer.forks.RERulesConfig; import com.radixdlt.statecomputer.forks.RERulesVersion; @@ -155,4 +157,45 @@ ForkBuilder olympia() { 100, // 100 max validators MSG.maxLength())); } + + @ProvidesIntoSet + ForkBuilder olympiaRadixProtocolFork1() { + return new ForkBuilder( + "olympia-rpf-001", + ImmutableSet.of(new CandidateForkConfig.Threshold((short) 8500, 320)), + 14493, + 15224, + RERulesVersion.OLYMPIA_V1, + new RERulesConfig( + RESERVED_SYMBOLS, + Pattern.compile("[a-z0-9]+"), // Token symbol pattern + FeeTable.create( + Amount.ofNanoTokens(116400), // 0.0001164XRD per byte fee + Map.of( + TokenResource.class, Amount.ofMilliTokens(58220), // 58.22XRD per resource + ValidatorRegisteredCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per validator update + ValidatorFeeCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + ValidatorOwnerCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + ValidatorMetaData.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + AllowDelegationFlag.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + PreparedStake.class, Amount.ofMicroTokens(291100), // 0.2911XRD per stake + PreparedUnstakeOwnership.class, + Amount.ofMicroTokens(291100) // 0.2911XRD per unstake + )), + (long) 1024 * 1024, // 1MB max user transaction size + OptionalInt.of(50), // 50 Txns per round + 10_000, // Rounds per epoch + 500, // Two weeks worth of epochs + Amount.ofTokens(90), // 90XRD Minimum stake + 500, // Two weeks worth of epochs + Amount.ofMilliTokens(1797), // 1.797XRD Rewards per proposal + 9800, // 98.00% threshold for completed proposals to get any rewards + 100, // 100 max validators + MSG.maxLength())); + } } diff --git a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java index 96b794e0bb..9f6bd7dbaf 100644 --- a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java +++ b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java @@ -66,6 +66,7 @@ import static com.radixdlt.constraintmachine.REInstruction.REMicroOp.MSG; +import com.google.common.collect.ImmutableSet; import com.google.inject.AbstractModule; import com.google.inject.multibindings.ProvidesIntoSet; import com.radixdlt.application.system.FeeTable; @@ -78,6 +79,7 @@ import com.radixdlt.application.validators.state.ValidatorMetaData; import com.radixdlt.application.validators.state.ValidatorOwnerCopy; import com.radixdlt.application.validators.state.ValidatorRegisteredCopy; +import com.radixdlt.statecomputer.forks.CandidateForkConfig; import com.radixdlt.statecomputer.forks.ForkBuilder; import com.radixdlt.statecomputer.forks.RERulesConfig; import com.radixdlt.statecomputer.forks.RERulesVersion; @@ -155,4 +157,45 @@ ForkBuilder releasenetV2() { 100, // 100 max validators MSG.maxLength())); } + + @ProvidesIntoSet + ForkBuilder olympiaRadixProtocolFork1() { + return new ForkBuilder( + "rlsnet-rpf-001", + ImmutableSet.of(new CandidateForkConfig.Threshold((short) 8500, 2)), + 11420, + 15000, + RERulesVersion.OLYMPIA_V1, + new RERulesConfig( + RESERVED_SYMBOLS, + Pattern.compile("[a-z0-9]+"), // Token symbol pattern + FeeTable.create( + Amount.ofNanoTokens(116400), // 0.0001164XRD per byte fee + Map.of( + TokenResource.class, Amount.ofMilliTokens(58220), // 58.22XRD per resource + ValidatorRegisteredCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per validator update + ValidatorFeeCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + ValidatorOwnerCopy.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + ValidatorMetaData.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + AllowDelegationFlag.class, + Amount.ofMilliTokens(2911), // 2.911XRD per register update + PreparedStake.class, Amount.ofMicroTokens(291100), // 0.2911XRD per stake + PreparedUnstakeOwnership.class, + Amount.ofMicroTokens(291100) // 0.2911XRD per unstake + )), + (long) 1024 * 1024, // 1MB max user transaction size + OptionalInt.of(50), // 50 Txns per round + 10_000, // Rounds per epoch + 500, // Two weeks worth of epochs + Amount.ofTokens(90), // 90XRD Minimum stake + 500, // Two weeks worth of epochs + Amount.ofMilliTokens(1797), // 1.797XRD Rewards per proposal + 9800, // 98.00% threshold for completed proposals to get any rewards + 100, // 100 max validators + MSG.maxLength())); + } } diff --git a/radixdlt-engine/src/main/java/com/radixdlt/application/tokens/Amount.java b/radixdlt-engine/src/main/java/com/radixdlt/application/tokens/Amount.java index 68b2eb5b5f..a0754fe793 100644 --- a/radixdlt-engine/src/main/java/com/radixdlt/application/tokens/Amount.java +++ b/radixdlt-engine/src/main/java/com/radixdlt/application/tokens/Amount.java @@ -90,6 +90,11 @@ public static Amount ofMicroTokens(long units) { UInt256.from(units).multiply(UInt256.TEN.pow(TokenUtils.SUB_UNITS_POW_10 - 6))); } + public static Amount ofNanoTokens(long units) { + return new Amount( + UInt256.from(units).multiply(UInt256.TEN.pow(TokenUtils.SUB_UNITS_POW_10 - 9))); + } + public static Amount ofTokens(long units) { return new Amount(UInt256.from(units).multiply(TokenUtils.SUB_UNITS)); } From 7c7c3e07e70b177a9b66476985657e446a3e627d Mon Sep 17 00:00:00 2001 From: David Edey Date: Mon, 27 Jun 2022 13:08:31 +0100 Subject: [PATCH 2/2] Improves comments in fee table --- .../statecomputer/forks/modules/MainnetForksModule.java | 4 ++-- .../statecomputer/forks/modules/ReleasenetForksModule.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java index 5542a61491..581dfbf3eb 100644 --- a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java +++ b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/MainnetForksModule.java @@ -190,9 +190,9 @@ ForkBuilder olympiaRadixProtocolFork1() { (long) 1024 * 1024, // 1MB max user transaction size OptionalInt.of(50), // 50 Txns per round 10_000, // Rounds per epoch - 500, // Two weeks worth of epochs + 500, // Validator fee increases take effect after 500 epochs (roughly two weeks) Amount.ofTokens(90), // 90XRD Minimum stake - 500, // Two weeks worth of epochs + 500, // Unstakes are unlocked after 500 epochs without changes (roughly two weeks) Amount.ofMilliTokens(1797), // 1.797XRD Rewards per proposal 9800, // 98.00% threshold for completed proposals to get any rewards 100, // 100 max validators diff --git a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java index 9f6bd7dbaf..69a4347f01 100644 --- a/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java +++ b/radixdlt-core/radixdlt/src/main/java/com/radixdlt/statecomputer/forks/modules/ReleasenetForksModule.java @@ -190,9 +190,9 @@ ForkBuilder olympiaRadixProtocolFork1() { (long) 1024 * 1024, // 1MB max user transaction size OptionalInt.of(50), // 50 Txns per round 10_000, // Rounds per epoch - 500, // Two weeks worth of epochs + 500, // Validator fee increases take effect after 500 epochs (roughly two weeks) Amount.ofTokens(90), // 90XRD Minimum stake - 500, // Two weeks worth of epochs + 500, // Unstakes are unlocked after 500 epochs without changes (roughly two weeks) Amount.ofMilliTokens(1797), // 1.797XRD Rewards per proposal 9800, // 98.00% threshold for completed proposals to get any rewards 100, // 100 max validators