Compare commits

...

3 Commits

Author SHA1 Message Date
Nicholas Dudfield
3754109e4b test(server_definitions): adapt amendment tests to ledger_enabled/cfg_forced split
jtx's Env enables amendments by inserting them into config.features (the
same presets mechanism as the [features] stanza), so:

- testNoParams / testSomeEnabled assert on `ledger_enabled` (the canonical
  on-ledger flag) instead of `enabled`, which is now the effective value
  (ledger_enabled || cfg_forced).
- testConfigForced uses a single-feature bitset so exactly one amendment is
  config-forced, and verifies it reports enabled:true, ledger_enabled:false,
  cfg_forced:true while the rest report cfg_forced:false and
  enabled == ledger_enabled.

ripple.rpc.ServerDefinitions: 6 cases, 3435 tests, 0 failures.
2026-06-26 14:20:03 +07:00
Nicholas Dudfield
9d125f4d19 feat(server_definitions): distinguish config-forced from ledger-enabled amendments
`server_definitions` sourced each amendment's `enabled` straight from the
on-ledger Amendments object, so amendments force-activated via the
`[features]` config stanza (live in the Rules / tx processing, but never
voted on-ledger) were reported as not-enabled. That makes the output
misleading on any node that uses `[features]` (notably testnets).

Split per-amendment activation into its two real sources and make
`enabled` reflect what the server actually applies:

    enabled        = ledger_enabled || cfg_forced
    ledger_enabled = recorded in the on-ledger Amendments object (canonical)
    cfg_forced     = forced via the [features] config stanza (node-local)

Additive JSON fields. Adds jss::ledger_enabled, jss::cfg_forced and a
ServerDefinitions test covering the config-forced case.
2026-06-26 13:55:48 +07:00
Richard Holland
bb244ef772 put release builds into a candidate folder to prevent auto-update scripts running before smoke tests (#761) 2026-06-21 12:12:43 +10:00
4 changed files with 123 additions and 8 deletions

View File

@@ -95,8 +95,16 @@ if [[ "$4" == "" ]]; then
echo "Non GH, local building, no Action runner magic"
else
# GH Action, runner
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
if [[ "$(git rev-parse --abbrev-ref HEAD)" == "release" ]]; then
echo "building on the release branch... placing it in builds/candidate"
mkdir /data/builds/candidate
cp /io/release-build/xahaud /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/candidate/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
else
echo "building non-release branch, placing it in builds root"
cp /io/release-build/xahaud /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
cp /io/release-build/release.info /data/builds/$(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4.releaseinfo
fi
echo "Published build to: http://build.xahau.tech/"
echo $(date +%Y).$(date +%-m).$(date +%-d)-$(git rev-parse --abbrev-ref HEAD)+$4
fi

View File

@@ -293,6 +293,8 @@ JSS(effective); // out: ValidatorList
// in: UNL
JSS(elapsed_seconds);
JSS(enabled); // out: AmendmentTable
JSS(ledger_enabled); // out: ServerDefinitions (amendment on-ledger)
JSS(cfg_forced); // out: ServerDefinitions ([features] config stanza)
JSS(engine_result); // out: NetworkOPs, TransactionSign, Submit
JSS(engine_result_code); // out: NetworkOPs, TransactionSign, Submit
JSS(engine_result_message); // out: NetworkOPs, TransactionSign, Submit

View File

@@ -186,10 +186,13 @@ public:
bool expectObsolete =
(votes.at(feature[jss::name].asString()) ==
VoteBehavior::Obsolete);
// "enabled" is now the effective value (ledger_voted || forced);
// this default env votes nothing onto the ledger, so assert on the
// canonical on-ledger flag.
BEAST_EXPECTS(
feature.isMember(jss::enabled) &&
!feature[jss::enabled].asBool(),
feature[jss::name].asString() + " enabled");
feature.isMember(jss::ledger_enabled) &&
!feature[jss::ledger_enabled].asBool(),
feature[jss::name].asString() + " ledger_enabled");
BEAST_EXPECTS(
feature.isMember(jss::vetoed) &&
feature[jss::vetoed].isBool() == !expectObsolete &&
@@ -237,10 +240,12 @@ public:
bool expectObsolete =
(votes.at((*it)[jss::name].asString()) ==
VoteBehavior::Obsolete);
// expectEnabled reflects the on-ledger amendment table, so compare
// against ledger_enabled (enabled is now ledger_voted || forced).
BEAST_EXPECTS(
(*it).isMember(jss::enabled) &&
(*it)[jss::enabled].asBool() == expectEnabled,
(*it)[jss::name].asString() + " enabled");
(*it).isMember(jss::ledger_enabled) &&
(*it)[jss::ledger_enabled].asBool() == expectEnabled,
(*it)[jss::name].asString() + " ledger_enabled");
if (expectEnabled)
BEAST_EXPECTS(
!(*it).isMember(jss::vetoed),
@@ -360,12 +365,78 @@ public:
}
}
void
testConfigForced(FeatureBitset features)
{
testcase("Config-forced features ([features] stanza)");
using namespace test::jtx;
// jtx enables amendments by inserting them into config.features (the
// same presets mechanism as the [features] config stanza), so passing
// a single-feature bitset gives us exactly one config-forced amendment
// and votes nothing onto the ledger. server_definitions must then
// report that one as effectively enabled, distinguishing the source:
// enabled = ledger_enabled || cfg_forced
// ledger_enabled = false (never voted onto the ledger)
// cfg_forced = true (forced via config) for the one feature only
auto const forced = featurePriceOracle;
auto const forcedHex = to_string(forced);
Env env{*this, FeatureBitset(forced)};
auto jrr = env.rpc("server_definitions")[jss::result];
if (!BEAST_EXPECT(jrr.isMember(jss::features)))
return;
bool sawForced = false;
for (auto it = jrr[jss::features].begin();
it != jrr[jss::features].end();
++it)
{
auto const& f = *it;
auto const name = f[jss::name].asString();
// every entry now carries the split flags
if (!BEAST_EXPECTS(
f.isMember(jss::enabled) &&
f.isMember(jss::ledger_enabled) &&
f.isMember(jss::cfg_forced),
name + " split flags"))
return;
// nothing is enabled on-ledger in a fresh env
BEAST_EXPECTS(
!f[jss::ledger_enabled].asBool(), name + " ledger_enabled");
if (it.key().asString() == forcedHex)
{
sawForced = true;
BEAST_EXPECTS(
f[jss::cfg_forced].asBool(), name + " cfg_forced");
// ledger_enabled(false) || cfg_forced(true) == true
BEAST_EXPECTS(f[jss::enabled].asBool(), name + " enabled");
}
else
{
BEAST_EXPECTS(
!f[jss::cfg_forced].asBool(), name + " cfg_forced");
// not forced and not on-ledger => not effectively enabled
BEAST_EXPECTS(
f[jss::enabled].asBool() == f[jss::ledger_enabled].asBool(),
name + " enabled==ledger_enabled");
}
}
BEAST_EXPECT(sawForced);
}
void
testServerFeatures(FeatureBitset features)
{
testNoParams(features);
testSomeEnabled(features);
testWithMajorities(features);
testConfigForced(features);
}
void

View File

@@ -22,6 +22,7 @@
#include <xrpld/app/main/Application.h>
#include <xrpld/app/misc/AmendmentTable.h>
#include <xrpld/app/misc/NetworkOPs.h>
#include <xrpld/core/Config.h>
#include <xrpld/rpc/detail/TransactionSign.h>
#include <xrpl/json/json_value.h>
#include <xrpl/json/json_writer.h>
@@ -545,6 +546,39 @@ doServerDefinitions(RPC::JsonContext& context)
features[to_string(h)][jss::majority] =
t.time_since_epoch().count();
// Amendment activation has two independent sources; surface both so a
// consumer isn't misled by a node that force-enables amendments:
// ledger_enabled : recorded in the on-ledger Amendments object
// (network-canonical; what the table reports as
// "enabled")
// cfg_forced : force-activated via the [features] config stanza
// (node-local; active in the Rules regardless of the
// ledger, casts no votes, never written on-ledger)
// enabled : effective for transaction processing on this
// server, i.e. ledger_enabled || cfg_forced
for (auto const& name : features.getMemberNames())
{
Json::Value& entry = features[name];
bool const ledgerEnabled = entry[jss::enabled].asBool();
entry[jss::ledger_enabled] = ledgerEnabled;
entry[jss::cfg_forced] = false;
// entry[jss::enabled] is left == ledgerEnabled here; only
// cfg_forced amendments below flip it.
}
for (auto const& h : context.app.config().features)
{
Json::Value& entry = features[to_string(h)];
if (!entry.isMember(jss::name))
{
if (auto const fname = featureToName(h); !fname.empty())
entry[jss::name] = fname;
}
if (!entry.isMember(jss::ledger_enabled))
entry[jss::ledger_enabled] = false;
entry[jss::cfg_forced] = true;
entry[jss::enabled] = true; // ledger_enabled || cfg_forced
}
lastFeatures = features;
{
const std::string out = Json::FastWriter().write(features);