mirror of
https://github.com/Xahau/xahaud.git
synced 2026-06-27 12:36:37 +00:00
Compare commits
3 Commits
json-tx
...
server-def
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3754109e4b | ||
|
|
9d125f4d19 | ||
|
|
bb244ef772 |
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user