From cb95019d7092c07478c40f9541c4c027be9f89a6 Mon Sep 17 00:00:00 2001 From: "James C. Owens" Date: Sat, 28 Dec 2024 17:09:20 -0500 Subject: [PATCH] Add MaxMagnitudeUnit to chain parameters This establishes an upper clamp on the magnitude unit. Currently set at 5. --- src/chainparams.cpp | 2 ++ src/consensus/params.h | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 3f85659aa4..1b2d13774b 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -79,6 +79,7 @@ class CMainParams : public CChainParams { consensus.MRCZeroPaymentInterval = 14 * 24 * 60 * 60; consensus.MaxMandatorySideStakeTotalAlloc = Fraction(1, 4); consensus.DefaultMagnitudeUnit = Fraction(1, 4); + consensus.MaxMagnitudeUnit = Fraction(5, 1); consensus.DefaultMagnitudeWeightFactor = Fraction(100, 567); consensus.StandardContractReplayLookback = 180 * 24 * 60 * 60; consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); @@ -195,6 +196,7 @@ class CTestNetParams : public CChainParams { consensus.MRCZeroPaymentInterval = 10 * 60; consensus.MaxMandatorySideStakeTotalAlloc = Fraction(1, 4); consensus.DefaultMagnitudeUnit = Fraction(1, 4); + consensus.MaxMagnitudeUnit = Fraction(5, 1); consensus.DefaultMagnitudeWeightFactor = Fraction(100, 567); consensus.StandardContractReplayLookback = 180 * 24 * 60 * 60; consensus.powLimit = uint256S("0000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); diff --git a/src/consensus/params.h b/src/consensus/params.h index 4563defd8d..1a768d7e1b 100644 --- a/src/consensus/params.h +++ b/src/consensus/params.h @@ -46,6 +46,9 @@ struct Params { int SuperblockV3Height; /** * @brief The default GRC paid for a constant block reward. + * + * Note that the GRC paid for CBR can be specified by an administrative protocol entry with the key name "blockreward1" for + * V13+ blocks. The value is specified in HALFORDS. */ int64_t DefaultConstantBlockReward; /** @@ -72,11 +75,21 @@ struct Params { Fraction MaxMandatorySideStakeTotalAlloc; /** * @brief The multiplier applied to network magnitude to determine the rate of accrual. Nominally 1/4 from Fern onwards. + * + * Note that the magnitude unit can be set by an administrative protocol entry with the key name "magnitudeunit" for + * V13+ blocks. The value is specified as a whole number or fraction. For example, 0.25 would be "1/4", 5 would be "5". */ Fraction DefaultMagnitudeUnit; + /** + * @brief The maximum magnitude unit allowed to be specified. This is an upper clamp that is set at 5. + */ + Fraction MaxMagnitudeUnit; /** * @brief The multiplier applied to (money supply / network magnitude) to scale the network magnitude into equivalent GRC * for purposes of computing voting weight. Nominally 1 / 5.67 from Fern onwards. + * + * The magnitude weight factor can be set by an administrative protocol entry with the key name "magnitudeweightfactor" for + * V13+ blocks. The value is specified as a whole number or fraction. For example, 1 / 5.67 would be "100/567", 2 would be "2". */ Fraction DefaultMagnitudeWeightFactor; /** The "standard" contract replay lookback for those contract types that do not have a registry db.