refactor: Change config section and key string literals into constants (#7095)

Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
This commit is contained in:
Bart
2026-06-09 10:58:21 -04:00
committed by GitHub
parent c9769d1add
commit c552eb333f
83 changed files with 1262 additions and 1029 deletions

View File

@@ -13,6 +13,7 @@
#include <xrpl/basics/strHex.h>
#include <xrpl/beast/unit_test/suite.h>
#include <xrpl/beast/utility/Journal.h>
#include <xrpl/config/Constants.h>
#include <xrpl/protocol/HashPrefix.h>
#include <xrpl/protocol/KeyType.h>
#include <xrpl/protocol/PublicKey.h>
@@ -198,7 +199,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
BEAST_EXPECT(trustedKeys->quorum() == 1);
}
@@ -208,7 +209,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal,
minQuorum);
BEAST_EXPECT(trustedKeys->quorum() == minQuorum);
@@ -266,7 +267,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
// Correct (empty) configuration
@@ -292,7 +293,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
BEAST_EXPECT(trustedKeys->load({}, cfgKeys, emptyCfgPublishers));
@@ -327,7 +328,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const localSigningPublic =
@@ -347,7 +348,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const localSigningPublic = randomNode();
@@ -365,7 +366,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
@@ -385,7 +386,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
// load should reject invalid validator list signing keys
@@ -421,7 +422,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<PublicKey> const keys(
@@ -446,7 +447,7 @@ private:
valManifests,
pubManifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const pubRevokedSecret = randomSecretKey();
@@ -485,7 +486,7 @@ private:
valManifests,
pubManifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const pubRevokedSecret = randomSecretKey();
@@ -571,7 +572,7 @@ private:
manifests,
manifests,
env.app().getTimeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto expectTrusted = [this, &trustedKeys](std::vector<Validator> const& list) {
@@ -986,7 +987,7 @@ private:
manifests,
manifests,
env.app().getTimeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const publisherSecret = randomSecretKey();
@@ -1117,7 +1118,7 @@ private:
manifestsOuter,
manifestsOuter,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<std::string> const cfgPublishersOuter;
@@ -1283,7 +1284,7 @@ private:
manifestsOuter,
manifestsOuter,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const publisherSecret = randomSecretKey();
auto const publisherPublic = derivePublicKey(KeyType::Ed25519, publisherSecret);
@@ -1310,7 +1311,7 @@ private:
manifestsOuter,
manifestsOuter,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const masterPrivate = randomSecretKey();
auto const masterPublic = derivePublicKey(KeyType::Ed25519, masterPrivate);
@@ -1344,7 +1345,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal,
minQuorum);
@@ -1400,7 +1401,7 @@ private:
manifestsOuter,
manifestsOuter,
env.app().getTimeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<std::string> const emptyCfgKeys;
@@ -1499,7 +1500,7 @@ private:
manifestsOuter,
manifestsOuter,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<std::string> const cfgPublishers;
@@ -1535,7 +1536,7 @@ private:
manifestsOuter,
manifestsOuter,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
auto const localKey = randomNode();
@@ -1582,7 +1583,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
hash_set<NodeID> activeValidators;
@@ -1670,7 +1671,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
hash_set<NodeID> activeValidators;
@@ -1877,7 +1878,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
// Empty list has no expiration
@@ -1899,7 +1900,7 @@ private:
manifests,
manifests,
env.app().getTimeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<Validator> validators = {randomValidator()};
@@ -2040,7 +2041,7 @@ private:
manifests,
manifests,
env.timeKeeper(),
env.app().config().legacy("database_path"),
env.app().config().legacy(Sections::kDatabasePath),
env.journal,
minimumQuorum);
@@ -2636,7 +2637,7 @@ private:
valManifests,
pubManifests,
env.timeKeeper(),
app.config().legacy("database_path"),
app.config().legacy(Sections::kDatabasePath),
env.journal);
std::vector<std::string> cfgPublishers;