mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Improve amendment processing and activation logic:
* The amendment ballot counting code contained a minor technical flaw, caused by the use of integer arithmetic and rounding semantics, that could allow amendments to reach majority with slightly less than 80% support. This commit introduces an amendment which, if enabled, will ensure that activation requires at least 80% support. * This commit also introduces a configuration option to adjust the amendment activation hysteresis. This option is useful on test networks, but should not be used on the main network as is a network-wide consensus parameter that should not be changed on a per-server basis; doing so can result in a hard-fork. Fixes #3396
This commit is contained in:
committed by
Nik Bougalis
parent
fe9922d654
commit
df29e98ea5
@@ -111,7 +111,8 @@ class FeatureCollections
|
||||
"RequireFullyCanonicalSig",
|
||||
"fix1781", // XRPEndpointSteps should be included in the circular
|
||||
// payment check
|
||||
"HardenedValidations"};
|
||||
"HardenedValidations",
|
||||
"fixAmendmentMajorityCalc"}; // Fix Amendment majority calculation
|
||||
|
||||
std::vector<uint256> features;
|
||||
boost::container::flat_map<uint256, std::size_t> featureToIndex;
|
||||
@@ -367,6 +368,7 @@ extern uint256 const fixQualityUpperBound;
|
||||
extern uint256 const featureRequireFullyCanonicalSig;
|
||||
extern uint256 const fix1781;
|
||||
extern uint256 const featureHardenedValidations;
|
||||
extern uint256 const fixAmendmentMajorityCalc;
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define RIPPLE_PROTOCOL_SYSTEMPARAMETERS_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/XRPAmount.h>
|
||||
#include <ripple/basics/chrono.h>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@@ -59,6 +60,18 @@ systemCurrencyCode()
|
||||
/** The XRP ledger network's earliest allowed sequence */
|
||||
static std::uint32_t constexpr XRP_LEDGER_EARLIEST_SEQ{32570};
|
||||
|
||||
/** The minimum amount of support an amendment should have.
|
||||
|
||||
@note This value is used by legacy code and will become obsolete
|
||||
once the fixAmendmentMajorityCalc amendment activates.
|
||||
*/
|
||||
constexpr std::ratio<204, 256> preFixAmendmentMajorityCalcThreshold;
|
||||
|
||||
constexpr std::ratio<80, 100> postFixAmendmentMajorityCalcThreshold;
|
||||
|
||||
/** The minimum amount of time an amendment must hold a majority */
|
||||
constexpr std::chrono::seconds const defaultAmendmentMajorityTime = weeks{2};
|
||||
|
||||
} // namespace ripple
|
||||
|
||||
/** Default peer port (IANA registered) */
|
||||
|
||||
@@ -130,7 +130,8 @@ detail::supportedAmendments()
|
||||
"fixQualityUpperBound",
|
||||
"RequireFullyCanonicalSig",
|
||||
"fix1781",
|
||||
"HardenedValidations"};
|
||||
"HardenedValidations",
|
||||
"fixAmendmentMajorityCalc"};
|
||||
return supported;
|
||||
}
|
||||
|
||||
@@ -181,7 +182,8 @@ uint256 const
|
||||
fixQualityUpperBound = *getRegisteredFeature("fixQualityUpperBound"),
|
||||
featureRequireFullyCanonicalSig = *getRegisteredFeature("RequireFullyCanonicalSig"),
|
||||
fix1781 = *getRegisteredFeature("fix1781"),
|
||||
featureHardenedValidations = *getRegisteredFeature("HardenedValidations");
|
||||
featureHardenedValidations = *getRegisteredFeature("HardenedValidations"),
|
||||
fixAmendmentMajorityCalc = *getRegisteredFeature("fixAmendmentMajorityCalc");
|
||||
|
||||
// The following amendments have been active for at least two years. Their
|
||||
// pre-amendment code has been removed and the identifiers are deprecated.
|
||||
|
||||
Reference in New Issue
Block a user