test: enable unit tests to work with variable reference fee (#5145)

Fix remaining unit tests to be able to process reference fee values other than 10.
This commit is contained in:
Vlad
2025-03-25 14:31:25 +00:00
committed by GitHub
parent 67028d6ea6
commit 2bc5cb240f
37 changed files with 801 additions and 384 deletions

View File

@@ -189,6 +189,7 @@ public:
{
Env env(*this);
env.fund(n, "alice", "bob", gw);
env.close();
env(trust("alice", USD(100)), require(lines("alice", 1)));
}
@@ -199,6 +200,7 @@ public:
BEAST_EXPECT(env.balance(alice, USD) != 0);
BEAST_EXPECT(env.balance(alice, USD) == USD(0));
env.fund(n, alice, gw);
env.close();
BEAST_EXPECT(env.balance(alice) == n);
BEAST_EXPECT(env.balance(gw) == n);
env.trust(USD(1000), alice);
@@ -243,6 +245,7 @@ public:
env.require(balance("alice", none));
env.require(balance("alice", XRP(none)));
env.fund(XRP(10000), "alice", gw);
env.close();
env.require(balance("alice", USD(none)));
env.trust(USD(100), "alice");
env.require(balance("alice", XRP(10000))); // fee refunded
@@ -680,6 +683,7 @@ public:
auto const gw = Account("gw");
auto const USD = gw["USD"];
env.fund(XRP(10000), "alice", "bob");
env.close();
env.json(
pay("alice", "bob", USD(10)),
path(Account("alice")),
@@ -716,6 +720,8 @@ public:
Env env(*this);
Env_ss envs(env);
auto const baseFee = env.current()->fees().base;
auto const alice = Account("alice");
env.fund(XRP(10000), alice);
@@ -749,12 +755,16 @@ public:
// Force the factor low enough to fail
params[jss::fee_mult_max] = 1;
params[jss::fee_div_max] = 2;
auto const expectedErrorString = "Fee of " +
std::to_string(baseFee.drops()) +
" exceeds the requested tx limit of " +
std::to_string(baseFee.drops() / 2);
envs(
noop(alice),
fee(none),
seq(none),
rpc(rpcHIGH_FEE,
"Fee of 10 exceeds the requested tx limit of 5"))(params);
rpc(rpcHIGH_FEE, expectedErrorString))(params);
auto tx = env.tx();
BEAST_EXPECT(!tx);