mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Grow the open ledger expected transactions quickly (RIPD-1630):
* When increasing the expected ledger size, add on an extra 20%. * When decreasing the expected ledger size, take the minimum of the validated ledger size or the old expected size, and subract another 50%. * Update fee escalation documentation. * Refactor the FeeMetrics object to use values from Setup
This commit is contained in:
committed by
Nik Bougalis
parent
e14f913244
commit
7295cf979b
@@ -108,6 +108,7 @@ class TxQ_test : public beast::unit_test::suite
|
||||
section.set("max_ledger_counts_to_store", "100");
|
||||
section.set("retry_sequence_percent", "25");
|
||||
section.set("zero_basefee_transaction_feelevel", "100000000000");
|
||||
section.set("normal_consensus_increase_percent", "0");
|
||||
|
||||
for (auto const& value : extraTxQ)
|
||||
section.set(value.first, value.second);
|
||||
@@ -2811,6 +2812,141 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
testScaling()
|
||||
{
|
||||
using namespace jtx;
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
{
|
||||
Env env(*this,
|
||||
makeConfig({ { "minimum_txn_in_ledger_standalone", "3" },
|
||||
{ "normal_consensus_increase_percent", "25" },
|
||||
{ "slow_consensus_decrease_percent", "50" },
|
||||
{ "target_txn_in_ledger", "10" },
|
||||
{ "maximum_txn_per_account", "200" } }));
|
||||
auto alice = Account("alice");
|
||||
|
||||
checkMetrics(env, 0, boost::none, 0, 3, 256);
|
||||
env.fund(XRP(50000000), alice);
|
||||
|
||||
fillQueue(env, alice);
|
||||
checkMetrics(env, 0, boost::none, 4, 3, 256);
|
||||
auto seqAlice = env.seq(alice);
|
||||
auto txCount = 140;
|
||||
for (int i = 0; i < txCount; ++i)
|
||||
env(noop(alice), seq(seqAlice++), ter(terQUEUED));
|
||||
checkMetrics(env, txCount, boost::none, 4, 3, 256);
|
||||
|
||||
// Close a few ledgers successfully, so the limit grows
|
||||
|
||||
env.close();
|
||||
// 4 + 25% = 5
|
||||
txCount -= 6;
|
||||
checkMetrics(env, txCount, 10, 6, 5, 257);
|
||||
|
||||
env.close();
|
||||
// 6 + 25% = 7
|
||||
txCount -= 8;
|
||||
checkMetrics(env, txCount, 14, 8, 7, 257);
|
||||
|
||||
env.close();
|
||||
// 8 + 25% = 10
|
||||
txCount -= 11;
|
||||
checkMetrics(env, txCount, 20, 11, 10, 257);
|
||||
|
||||
env.close();
|
||||
// 11 + 25% = 13
|
||||
txCount -= 14;
|
||||
checkMetrics(env, txCount, 26, 14, 13, 257);
|
||||
|
||||
env.close();
|
||||
// 14 + 25% = 17
|
||||
txCount -= 18;
|
||||
checkMetrics(env, txCount, 34, 18, 17, 257);
|
||||
|
||||
env.close();
|
||||
// 18 + 25% = 22
|
||||
txCount -= 23;
|
||||
checkMetrics(env, txCount, 44, 23, 22, 257);
|
||||
|
||||
env.close();
|
||||
// 23 + 25% = 28
|
||||
txCount -= 29;
|
||||
checkMetrics(env, txCount, 56, 29, 28, 256);
|
||||
|
||||
// From 3 expected to 28 in 7 "fast" ledgers.
|
||||
|
||||
// Close the ledger with a delay.
|
||||
env.close(env.now() + 5s, 10000ms);
|
||||
txCount -= 15;
|
||||
checkMetrics(env, txCount, 56, 15, 14, 256);
|
||||
|
||||
// Close the ledger with a delay.
|
||||
env.close(env.now() + 5s, 10000ms);
|
||||
txCount -= 8;
|
||||
checkMetrics(env, txCount, 56, 8, 7, 256);
|
||||
|
||||
// Close the ledger with a delay.
|
||||
env.close(env.now() + 5s, 10000ms);
|
||||
txCount -= 4;
|
||||
checkMetrics(env, txCount, 56, 4, 3, 256);
|
||||
|
||||
// From 28 expected back down to 3 in 3 "slow" ledgers.
|
||||
|
||||
// Confirm the minimum sticks
|
||||
env.close(env.now() + 5s, 10000ms);
|
||||
txCount -= 4;
|
||||
checkMetrics(env, txCount, 56, 4, 3, 256);
|
||||
|
||||
BEAST_EXPECT(!txCount);
|
||||
}
|
||||
|
||||
{
|
||||
Env env(*this,
|
||||
makeConfig({ { "minimum_txn_in_ledger_standalone", "3" },
|
||||
{ "normal_consensus_increase_percent", "150" },
|
||||
{ "slow_consensus_decrease_percent", "150" },
|
||||
{ "target_txn_in_ledger", "10" },
|
||||
{ "maximum_txn_per_account", "200" } }));
|
||||
auto alice = Account("alice");
|
||||
|
||||
checkMetrics(env, 0, boost::none, 0, 3, 256);
|
||||
env.fund(XRP(50000000), alice);
|
||||
|
||||
fillQueue(env, alice);
|
||||
checkMetrics(env, 0, boost::none, 4, 3, 256);
|
||||
auto seqAlice = env.seq(alice);
|
||||
auto txCount = 43;
|
||||
for (int i = 0; i < txCount; ++i)
|
||||
env(noop(alice), seq(seqAlice++), ter(terQUEUED));
|
||||
checkMetrics(env, txCount, boost::none, 4, 3, 256);
|
||||
|
||||
// Close a few ledgers successfully, so the limit grows
|
||||
|
||||
env.close();
|
||||
// 4 + 150% = 10
|
||||
txCount -= 11;
|
||||
checkMetrics(env, txCount, 20, 11, 10, 257);
|
||||
|
||||
env.close();
|
||||
// 11 + 150% = 27
|
||||
txCount -= 28;
|
||||
checkMetrics(env, txCount, 54, 28, 27, 256);
|
||||
|
||||
// From 3 expected to 28 in 7 "fast" ledgers.
|
||||
|
||||
// Close the ledger with a delay.
|
||||
env.close(env.now() + 5s, 10000ms);
|
||||
txCount -= 4;
|
||||
checkMetrics(env, txCount, 54, 4, 3, 256);
|
||||
|
||||
// From 28 expected back down to 3 in 3 "slow" ledgers.
|
||||
|
||||
BEAST_EXPECT(!txCount);
|
||||
}
|
||||
}
|
||||
|
||||
void run() override
|
||||
{
|
||||
testQueue();
|
||||
@@ -2835,6 +2971,7 @@ public:
|
||||
testServerInfo();
|
||||
testServerSubscribe();
|
||||
testClearQueuedAccountTxs();
|
||||
testScaling();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user