From dcde8c292f305de64e5955a04ae4fb208e6490e2 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 25 Oct 2023 19:23:44 -0400 Subject: [PATCH 1/3] Lower the log level of some manifest warnings on startup --- src/xrpld/app/misc/Manifest.h | 6 +++++- src/xrpld/app/misc/detail/Manifest.cpp | 21 ++++++++++++--------- src/xrpld/app/rdb/detail/Wallet.cpp | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/xrpld/app/misc/Manifest.h b/src/xrpld/app/misc/Manifest.h index 49b345d0952..08de2b28c29 100644 --- a/src/xrpld/app/misc/Manifest.h +++ b/src/xrpld/app/misc/Manifest.h @@ -326,6 +326,10 @@ class ManifestCache @param m Manifest to add + @param loading Indicate whether the manifest is being loaded from the + local database (at startup). Lowers the severity of some log + messages. + @return `ManifestDisposition::accepted` if successful, or `stale` or `invalid` otherwise @@ -334,7 +338,7 @@ class ManifestCache May be called concurrently */ ManifestDisposition - applyManifest(Manifest m); + applyManifest(Manifest m, bool loading = false); /** Populate manifest cache with manifests in database and config. diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index 68d91599db5..5fa8da53b50 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -361,7 +361,7 @@ ManifestCache::revoked(PublicKey const& pk) const } ManifestDisposition -ManifestCache::applyManifest(Manifest m) +ManifestCache::applyManifest(Manifest m, bool loading) { // Check the manifest against the conditions that do not require a // `unique_lock` (write lock) on the `mutex_`. Since the signature can be @@ -370,8 +370,10 @@ ManifestCache::applyManifest(Manifest m) // comment below), `checkSignature` only needs to be set to true on the // first run. auto prewriteCheck = - [this, &m](auto const& iter, bool checkSignature, auto const& lock) - -> std::optional { + [this, &m, &loading]( + auto const& iter, + bool checkSignature, + auto const& lock) -> std::optional { XRPL_ASSERT( lock.owns_lock(), "ripple::ManifestCache::applyManifest::prewriteCheck : locked"); @@ -409,7 +411,7 @@ ManifestCache::applyManifest(Manifest m) // one. bool const revoked = m.revoked(); - if (auto stream = j_.warn(); stream && revoked) + if (auto stream = loading ? j_.info() : j_.warn(); stream && revoked) logMftAct(stream, "Revoked", m.masterKey, m.sequence); // Sanity check: the master key of this manifest should not be used as @@ -417,9 +419,10 @@ ManifestCache::applyManifest(Manifest m) if (auto const x = signingToMasterKeys_.find(m.masterKey); x != signingToMasterKeys_.end()) { - JLOG(j_.warn()) << to_string(m) - << ": Master key already used as ephemeral key for " - << toBase58(TokenType::NodePublic, x->second); + JLOG((loading ? j_.info() : j_.warn())) + << to_string(m) + << ": Master key already used as ephemeral key for " + << toBase58(TokenType::NodePublic, x->second); return ManifestDisposition::badMasterKey; } @@ -440,7 +443,7 @@ ManifestCache::applyManifest(Manifest m) if (auto const x = signingToMasterKeys_.find(*m.signingKey); x != signingToMasterKeys_.end()) { - JLOG(j_.warn()) + JLOG((loading ? j_.info() : j_.warn())) << to_string(m) << ": Ephemeral key already used as ephemeral key for " << toBase58(TokenType::NodePublic, x->second); @@ -450,7 +453,7 @@ ManifestCache::applyManifest(Manifest m) if (auto const x = map_.find(*m.signingKey); x != map_.end()) { - JLOG(j_.warn()) + JLOG((loading ? j_.info() : j_.warn())) << to_string(m) << ": Ephemeral key used as master key for " << to_string(x->second); diff --git a/src/xrpld/app/rdb/detail/Wallet.cpp b/src/xrpld/app/rdb/detail/Wallet.cpp index 7dbaab6ef45..60a50749303 100644 --- a/src/xrpld/app/rdb/detail/Wallet.cpp +++ b/src/xrpld/app/rdb/detail/Wallet.cpp @@ -47,7 +47,7 @@ getManifests( continue; } - mCache.applyManifest(std::move(*mo)); + mCache.applyManifest(std::move(*mo), true); } else { From 269b8555b6b187d98da9c7a42707a470faeaa525 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Thu, 15 May 2025 16:01:40 +0100 Subject: [PATCH 2/3] Remove outdated log message when NOT saving untrusted manifests --- src/xrpld/app/rdb/detail/Wallet.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/xrpld/app/rdb/detail/Wallet.cpp b/src/xrpld/app/rdb/detail/Wallet.cpp index 60a50749303..3e8f38c1f5f 100644 --- a/src/xrpld/app/rdb/detail/Wallet.cpp +++ b/src/xrpld/app/rdb/detail/Wallet.cpp @@ -87,7 +87,6 @@ saveManifests( // but only save trusted non-revocation manifests. if (!v.second.revoked() && !isTrusted(v.second.masterKey)) { - JLOG(j.info()) << "Untrusted manifest in cache not saved to db"; continue; } From f8a5bef71dea44f02ff2b6a7a816910fa50cce5a Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Wed, 28 Jan 2026 20:26:14 -0500 Subject: [PATCH 3/3] Fix formatting --- src/xrpld/app/misc/detail/Manifest.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/xrpld/app/misc/detail/Manifest.cpp b/src/xrpld/app/misc/detail/Manifest.cpp index ae82c6d15fc..6fdadd13abd 100644 --- a/src/xrpld/app/misc/detail/Manifest.cpp +++ b/src/xrpld/app/misc/detail/Manifest.cpp @@ -351,12 +351,8 @@ ManifestCache::applyManifest(Manifest m, bool loading) // first run. auto prewriteCheck = [this, &m, &loading]( - auto const& iter, - bool checkSignature, - auto const& lock) -> std::optional { - XRPL_ASSERT( - lock.owns_lock(), - "xrpl::ManifestCache::applyManifest::prewriteCheck : locked"); + auto const& iter, bool checkSignature, auto const& lock) -> std::optional { + XRPL_ASSERT(lock.owns_lock(), "xrpl::ManifestCache::applyManifest::prewriteCheck : locked"); (void)lock; // not used. parameter is present to ensure the mutex is // locked when the lambda is called. if (iter != map_.end() && m.sequence <= iter->second.sequence) @@ -393,10 +389,8 @@ ManifestCache::applyManifest(Manifest m, bool loading) // the ephemeral key of another manifest: if (auto const x = signingToMasterKeys_.find(m.masterKey); x != signingToMasterKeys_.end()) { - JLOG((loading ? j_.info() : j_.warn())) - << to_string(m) - << ": Master key already used as ephemeral key for " - << toBase58(TokenType::NodePublic, x->second); + JLOG((loading ? j_.info() : j_.warn())) << to_string(m) << ": Master key already used as ephemeral key for " + << toBase58(TokenType::NodePublic, x->second); return ManifestDisposition::badMasterKey; } @@ -417,8 +411,7 @@ ManifestCache::applyManifest(Manifest m, bool loading) if (auto const x = signingToMasterKeys_.find(*m.signingKey); x != signingToMasterKeys_.end()) { JLOG((loading ? j_.info() : j_.warn())) - << to_string(m) - << ": Ephemeral key already used as ephemeral key for " + << to_string(m) << ": Ephemeral key already used as ephemeral key for " << toBase58(TokenType::NodePublic, x->second); return ManifestDisposition::badEphemeralKey; @@ -427,8 +420,7 @@ ManifestCache::applyManifest(Manifest m, bool loading) if (auto const x = map_.find(*m.signingKey); x != map_.end()) { JLOG((loading ? j_.info() : j_.warn())) - << to_string(m) << ": Ephemeral key used as master key for " - << to_string(x->second); + << to_string(m) << ": Ephemeral key used as master key for " << to_string(x->second); return ManifestDisposition::badEphemeralKey; }