Revert "feat(consensus): consolidate UNL report amendment"

This reverts commit 0cdd7164f4.
This commit is contained in:
Nicholas Dudfield
2026-07-13 05:56:15 +07:00
parent a3084b2843
commit fa71bb62c2
3 changed files with 22 additions and 20 deletions

View File

@@ -65,7 +65,7 @@ XRPL_FEATURE(AMM, Supported::no, VoteBehavior::DefaultNo
XRPL_FIX (ReducedOffersV1, Supported::yes, VoteBehavior::DefaultYes)
XRPL_FEATURE(HooksUpdate2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(HookOnV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(UNLReportV2, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(NegativeUNLActiveViewCap, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(Export, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FEATURE(ConsensusEntropy, Supported::yes, VoteBehavior::DefaultNo)
XRPL_FIX (HookAPI20251128, Supported::yes, VoteBehavior::DefaultYes)

View File

@@ -1127,9 +1127,9 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
}
void
testFindAllCandidatesWithUNLReportV2()
testFindAllCandidatesWithActiveViewCap()
{
testcase("Find All Candidates with UNLReportV2 denominator");
testcase("Find All Candidates with active-view cap denominator");
jtx::Env env(*this);
NegativeUNLVote vote(NodeID(0xA0), env.journal, env.app());
@@ -1155,10 +1155,10 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
BEAST_EXPECT(legacyCandidates.toDisableCandidates.size() == 17);
BEAST_EXPECT(legacyCandidates.toReEnableCandidates.empty());
auto const unlReportV2Candidates =
auto const activeViewCandidates =
vote.findAllCandidates(unl, negUnl, scoreTable, 10);
BEAST_EXPECT(unlReportV2Candidates.toDisableCandidates.empty());
BEAST_EXPECT(unlReportV2Candidates.toReEnableCandidates.empty());
BEAST_EXPECT(activeViewCandidates.toDisableCandidates.empty());
BEAST_EXPECT(activeViewCandidates.toReEnableCandidates.empty());
}
void
@@ -1416,7 +1416,7 @@ class NegativeUNLVoteInternal_test : public beast::unit_test::suite
testPickOneCandidate();
testBuildScoreTableSpecialCases();
testFindAllCandidates();
testFindAllCandidatesWithUNLReportV2();
testFindAllCandidatesWithActiveViewCap();
testFindAllCandidatesCombination();
testNewValidators();
}
@@ -1755,16 +1755,16 @@ class NegativeUNLVoteMaxListed_test : public beast::unit_test::suite
{
// The same reliability state produces a fourth disable vote under
// the legacy trusted-UNL denominator, but not when UNLReportV2
// the legacy trusted-UNL denominator, but not when the amended cap
// uses the parent-ledger UNLReport active denominator.
auto const legacyFeatures =
(jtx::supported_amendments() - featureUNLReportV2) |
auto const legacyFeatures = (jtx::supported_amendments() -
featureNegativeUNLActiveViewCap) |
featureNegativeUNL;
BEAST_EXPECT(voteCountWithUNLReport(legacyFeatures) == 1);
auto const unlReportV2Features = jtx::supported_amendments() |
featureUNLReportV2 | featureNegativeUNL;
BEAST_EXPECT(voteCountWithUNLReport(unlReportV2Features) == 0);
auto const activeViewCapFeatures = jtx::supported_amendments() |
featureNegativeUNLActiveViewCap | featureNegativeUNL;
BEAST_EXPECT(voteCountWithUNLReport(activeViewCapFeatures) == 0);
}
}

View File

@@ -28,11 +28,13 @@ namespace ripple {
namespace {
//@@start negative-unl-report-v2-denominator
//@@start negative-unl-active-view-cap-denominator
std::optional<std::size_t>
negativeUNLReportV2Denominator(std::shared_ptr<Ledger const> const& prevLedger)
negativeUNLActiveViewCapDenominator(
std::shared_ptr<Ledger const> const& prevLedger)
{
if (!prevLedger || !prevLedger->rules().enabled(featureUNLReportV2))
if (!prevLedger ||
!prevLedger->rules().enabled(featureNegativeUNLActiveViewCap))
{
return std::nullopt;
}
@@ -56,7 +58,7 @@ negativeUNLReportV2Denominator(std::shared_ptr<Ledger const> const& prevLedger)
return activeKeys.size();
}
//@@end negative-unl-report-v2-denominator
//@@end negative-unl-active-view-cap-denominator
} // namespace
@@ -120,13 +122,13 @@ NegativeUNLVote::doVoting(
purgeNewValidators(seq);
// Process the table and find all candidates to disable or to re-enable
//@@start negative-unl-vote-unl-report-v2-use
//@@start negative-unl-vote-active-view-cap-use
auto const candidates = findAllCandidates(
unlNodeIDs,
negUnlNodeIDs,
*scoreTable,
negativeUNLReportV2Denominator(prevLedger));
//@@end negative-unl-vote-unl-report-v2-use
negativeUNLActiveViewCapDenominator(prevLedger));
//@@end negative-unl-vote-active-view-cap-use
// Pick one to disable and one to re-enable if any, add ttUNL_MODIFY Tx
if (!candidates.toDisableCandidates.empty())