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

@@ -2065,6 +2065,8 @@ public:
{
testcase("autofill fees");
test::jtx::Env env(*this);
auto const baseFee =
static_cast<int>(env.current()->fees().base.drops());
auto ledger = env.current();
auto const& feeTrack = env.app().getFeeTrack();
@@ -2084,7 +2086,7 @@ public:
BEAST_EXPECT(!RPC::contains_error(result));
BEAST_EXPECT(
req[jss::tx_json].isMember(jss::Fee) &&
req[jss::tx_json][jss::Fee] == 10);
req[jss::tx_json][jss::Fee] == baseFee);
}
{
@@ -2105,7 +2107,7 @@ public:
BEAST_EXPECT(!RPC::contains_error(result));
BEAST_EXPECT(
req[jss::tx_json].isMember(jss::Fee) &&
req[jss::tx_json][jss::Fee] == 10);
req[jss::tx_json][jss::Fee] == baseFee);
}
{
@@ -2584,20 +2586,24 @@ public:
{
testcase("sign/submit RPCs");
using namespace std::chrono_literals;
using namespace test::jtx;
// Use jtx to set up a ledger so the tests will do the right thing.
test::jtx::Account const a{"a"}; // rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA
test::jtx::Account const g{"g"}; // rLPwWB1itaUGMV8kbMLLysjGkEpTM2Soy4
Account const a{"a"}; // rnUy2SHTrB9DubsPmkJZUXTf5FcNDGrYEA
Account const g{"g"}; // rLPwWB1itaUGMV8kbMLLysjGkEpTM2Soy4
auto const USD = g["USD"];
// Account: rJrxi4Wxev4bnAGVNP9YCdKPdAoKfAmcsi
// seed: sh1yJfwoi98zCygwijUzuHmJDeVKd
test::jtx::Account const ed{"ed", KeyType::ed25519};
Account const ed{"ed", KeyType::ed25519};
// master is rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh.
// "b" (not in the ledger) is rDg53Haik2475DJx8bjMDSDPj4VX7htaMd.
// "c" (phantom signer) is rPcNzota6B8YBokhYtcTNqQVCngtbnWfux.
test::jtx::Env env(*this);
env.fund(test::jtx::XRP(100000), a, ed, g);
Env env(*this, envconfig([](std::unique_ptr<Config> cfg) {
cfg->FEES.reference_fee = 10;
return cfg;
}));
env.fund(XRP(100000), a, ed, g);
env.close();
env(trust(a, USD(1000)));