Skip to content

Commit

Permalink
Remove undocumented experimental options from RPC sign (RIPD-1653):
Browse files Browse the repository at this point in the history
The `x_assume_tx` and `x_queue_okay` experimental options were
associated with the transaction queue that were not officially
supported.
  • Loading branch information
ximinez authored and nbougalis committed Nov 6, 2018
1 parent c587012 commit a96cb8f
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 134 deletions.
6 changes: 2 additions & 4 deletions src/ripple/app/misc/TxQ.h
Expand Up @@ -320,8 +320,7 @@ class TxQ
FeeEscalation amendment is not enabled.
*/
boost::optional<Metrics>
getMetrics(OpenView const& view,
std::uint32_t txCountPadding = 0) const;
getMetrics(OpenView const& view) const;

/** Returns information about the transactions currently
in the queue for the account.
Expand Down Expand Up @@ -452,8 +451,7 @@ class TxQ
*/
static
std::uint64_t
scaleFeeLevel(Snapshot const& snapshot, OpenView const& view,
std::uint32_t txCountPadding = 0);
scaleFeeLevel(Snapshot const& snapshot, OpenView const& view);

/**
Computes the total fee level for all transactions in a series.
Expand Down
9 changes: 4 additions & 5 deletions src/ripple/app/misc/impl/TxQ.cpp
Expand Up @@ -164,10 +164,10 @@ TxQ::FeeMetrics::update(Application& app,

std::uint64_t
TxQ::FeeMetrics::scaleFeeLevel(Snapshot const& snapshot,
OpenView const& view, std::uint32_t txCountPadding)
OpenView const& view)
{
// Transactions in the open ledger so far
auto const current = view.txCount() + txCountPadding;
auto const current = view.txCount();

auto const target = snapshot.txnsExpected;
auto const multiplier = snapshot.escalationMultiplier;
Expand Down Expand Up @@ -1375,7 +1375,7 @@ TxQ::accept(Application& app,
}

auto
TxQ::getMetrics(OpenView const& view, std::uint32_t txCountPadding) const
TxQ::getMetrics(OpenView const& view) const
-> boost::optional<Metrics>
{
auto const allowEscalation =
Expand All @@ -1397,8 +1397,7 @@ TxQ::getMetrics(OpenView const& view, std::uint32_t txCountPadding) const
result.minProcessingFeeLevel = isFull() ? byFee_.rbegin()->feeLevel + 1 :
baseLevel;
result.medFeeLevel = snapshot.escalationMultiplier;
result.openLedgerFeeLevel = FeeMetrics::scaleFeeLevel(snapshot, view,
txCountPadding);
result.openLedgerFeeLevel = FeeMetrics::scaleFeeLevel(snapshot, view);

return result;
}
Expand Down
12 changes: 1 addition & 11 deletions src/ripple/rpc/impl/TransactionSign.cpp
Expand Up @@ -699,10 +699,7 @@ Json::Value checkFee (
ledger->fees(), isUnlimited (role));
std::uint64_t fee = loadFee;
{
auto const assumeTx = request.isMember("x_assume_tx") &&
request["x_assume_tx"].isConvertibleTo(Json::uintValue) ?
request["x_assume_tx"].asUInt() : 0;
auto const metrics = txQ.getMetrics(*ledger, assumeTx);
auto const metrics = txQ.getMetrics(*ledger);
if(metrics)
{
auto const baseFee = ledger->fees().base;
Expand All @@ -729,13 +726,6 @@ Json::Value checkFee (
return result.second;
}();

if (fee > limit && fee != loadFee &&
request.isMember("x_queue_okay") &&
request["x_queue_okay"].isBool() &&
request["x_queue_okay"].asBool())
{
fee = std::max(loadFee, limit);
}
if (fee > limit)
{
std::stringstream ss;
Expand Down
43 changes: 15 additions & 28 deletions src/test/app/TxQ_test.cpp
Expand Up @@ -1830,27 +1830,23 @@ class TxQ_test : public beast::unit_test::suite
auto const bob = Account("bob");
env.fund(XRP(100000), alice, bob);

auto params = Json::Value(Json::objectValue);
// Max fee = 50k drops
params[jss::fee_mult_max] = 100;
params["x_queue_okay"] = true;

fillQueue(env, alice);
checkMetrics(env, 0, boost::none, 7, 6, 256);

// Queue up several transactions for alice sign-and-submit
auto const aliceSeq = env.seq(alice);
auto const lastLedgerSeq = env.current()->info().seq + 2;

auto submitParams = Json::Value(Json::objectValue);
for (int i = 0; i < 5; ++i)
{
if (i == 2)
envs(noop(alice), fee(none), seq(none),
envs(noop(alice), fee(1000), seq(none),
json(jss::LastLedgerSequence, lastLedgerSeq),
ter(terQUEUED))(params);
ter(terQUEUED))(submitParams);
else
envs(noop(alice), fee(none), seq(none),
ter(terQUEUED))(params);
envs(noop(alice), fee(1000), seq(none),
ter(terQUEUED))(submitParams);
}
checkMetrics(env, 5, boost::none, 7, 6, 256);
{
Expand Down Expand Up @@ -1920,7 +1916,7 @@ class TxQ_test : public beast::unit_test::suite
}
}
// Now, fill the gap.
envs(noop(alice), fee(none), seq(none), ter(terQUEUED))(params);
envs(noop(alice), fee(1000), seq(none), ter(terQUEUED))(submitParams);
checkMetrics(env, 5, 18, 10, 9, 256);
{
auto aliceStat = txQ.getAccountTxs(alice.id(), *env.current());
Expand Down Expand Up @@ -1970,11 +1966,6 @@ class TxQ_test : public beast::unit_test::suite
R"(", "queue": true, "ledger_index": 3 })";
BEAST_EXPECT(env.current()->info().seq > 3);

auto submitParams = Json::Value(Json::objectValue);
// Max fee = 100 drops
submitParams[jss::fee_mult_max] = 10;
submitParams["x_queue_okay"] = true;

{
// account_info without the "queue" argument.
auto const info = env.rpc("json", "account_info", withoutQueue);
Expand Down Expand Up @@ -2021,10 +2012,11 @@ class TxQ_test : public beast::unit_test::suite
BEAST_EXPECT(!queue_data.isMember(jss::transactions));
}

envs(noop(alice), fee(none), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(none), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(none), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(none), seq(none), ter(terQUEUED))(submitParams);
auto submitParams = Json::Value(Json::objectValue);
envs(noop(alice), fee(100), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(100), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(100), seq(none), ter(terQUEUED))(submitParams);
envs(noop(alice), fee(100), seq(none), ter(terQUEUED))(submitParams);
checkMetrics(env, 4, 6, 4, 3, 256);

{
Expand Down Expand Up @@ -2076,7 +2068,7 @@ class TxQ_test : public beast::unit_test::suite
}

// Queue up a blocker
envs(fset(alice, asfAccountTxnID), fee(none), seq(none),
envs(fset(alice, asfAccountTxnID), fee(100), seq(none),
json(jss::LastLedgerSequence, 10),
ter(terQUEUED))(submitParams);
checkMetrics(env, 5, 6, 4, 3, 256);
Expand Down Expand Up @@ -2131,7 +2123,7 @@ class TxQ_test : public beast::unit_test::suite
}
}

envs(noop(alice), fee(none), seq(none), ter(telCAN_NOT_QUEUE_BLOCKED))(submitParams);
envs(noop(alice), fee(100), seq(none), ter(telCAN_NOT_QUEUE_BLOCKED))(submitParams);
checkMetrics(env, 5, 6, 4, 3, 256);

{
Expand Down Expand Up @@ -2229,12 +2221,6 @@ class TxQ_test : public beast::unit_test::suite
env.fund(XRP(1000000), alice);
env.close();

auto submitParams = Json::Value(Json::objectValue);
// Max fee = 100 drops
submitParams[jss::fee_mult_max] = 10;
submitParams["x-queue-okay"] = true;
submitParams["x_queue_okay"] = true;

{
auto const server_info = env.rpc("server_info");
BEAST_EXPECT(server_info.isMember(jss::result) &&
Expand Down Expand Up @@ -2270,8 +2256,9 @@ class TxQ_test : public beast::unit_test::suite
checkMetrics(env, 0, 6, 4, 3, 256);

auto aliceSeq = env.seq(alice);
auto submitParams = Json::Value(Json::objectValue);
for (auto i = 0; i < 4; ++i)
envs(noop(alice), fee(none), seq(aliceSeq + i),
envs(noop(alice), fee(100), seq(aliceSeq + i),
ter(terQUEUED))(submitParams);
checkMetrics(env, 4, 6, 4, 3, 256);

Expand Down

0 comments on commit a96cb8f

Please sign in to comment.