From c6be7cf83a626ea3c0ae3272acb28c356969ebf1 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:17:58 +0100 Subject: [PATCH 1/4] fix(telemetry): resolve clang-tidy CI errors (include-cleaner, braces) Add missing include for std::uint32_t in Telemetry.h. Add braces around single-line if bodies in Telemetry.cpp. Co-Authored-By: Claude Opus 4.6 --- include/xrpl/telemetry/Telemetry.h | 1 + src/libxrpl/telemetry/Telemetry.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/xrpl/telemetry/Telemetry.h b/include/xrpl/telemetry/Telemetry.h index f6d2528795..3a2e5d8885 100644 --- a/include/xrpl/telemetry/Telemetry.h +++ b/include/xrpl/telemetry/Telemetry.h @@ -75,6 +75,7 @@ #include #include +#include #include #include #include diff --git a/src/libxrpl/telemetry/Telemetry.cpp b/src/libxrpl/telemetry/Telemetry.cpp index b23ac9e83b..aa6447c5bb 100644 --- a/src/libxrpl/telemetry/Telemetry.cpp +++ b/src/libxrpl/telemetry/Telemetry.cpp @@ -273,7 +273,9 @@ public: otlp_http::OtlpHttpExporterOptions exporterOpts; exporterOpts.url = setup_.exporterEndpoint; if (setup_.useTls) + { exporterOpts.ssl_ca_cert_path = setup_.tlsCertPath; + } auto exporter = otlp_http::OtlpHttpExporterFactory::Create(exporterOpts); @@ -392,7 +394,9 @@ public: getTracer(std::string_view name = kTracerName) override { if (!sdkProvider_) + { return trace_api::Provider::GetTracerProvider()->GetTracer(std::string(name)); + } return sdkProvider_->GetTracer(std::string(name)); } @@ -425,7 +429,9 @@ std::unique_ptr makeTelemetry(Telemetry::Setup const& setup, beast::Journal journal) { if (setup.enabled) + { return std::make_unique(setup, journal); + } return std::make_unique(setup); } From db38ba268feb4da2beb8c4ad5a232ebe3a5f5e10 Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:18:55 +0100 Subject: [PATCH 2/4] fix(telemetry): use std::ranges algorithms (modernize-use-ranges) Replace std::transform with std::ranges::transform in Redaction.cpp. Replace std::all_of with std::ranges::all_of in Redaction test. Co-Authored-By: Claude Opus 4.6 --- src/libxrpl/telemetry/Redaction.cpp | 6 +++--- src/tests/libxrpl/telemetry/Redaction.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libxrpl/telemetry/Redaction.cpp b/src/libxrpl/telemetry/Redaction.cpp index ee15b8812e..d6bfe52ec3 100644 --- a/src/libxrpl/telemetry/Redaction.cpp +++ b/src/libxrpl/telemetry/Redaction.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -23,9 +24,8 @@ redactAccount(std::string_view addr) // staying non-reversible — and lowercase them for a stable token. auto const digest = sha512Half(Slice(addr.data(), addr.size())); std::string token = to_string(digest).substr(0, 16); - std::transform(token.begin(), token.end(), token.begin(), [](unsigned char c) { - return static_cast(std::tolower(c)); - }); + std::ranges::transform( + token, token.begin(), [](unsigned char c) { return static_cast(std::tolower(c)); }); return token; } diff --git a/src/tests/libxrpl/telemetry/Redaction.cpp b/src/tests/libxrpl/telemetry/Redaction.cpp index 7f16c0f1dc..db1cc95135 100644 --- a/src/tests/libxrpl/telemetry/Redaction.cpp +++ b/src/tests/libxrpl/telemetry/Redaction.cpp @@ -4,6 +4,7 @@ #include #include +#include #include using namespace xrpl; @@ -28,7 +29,7 @@ TEST(Redaction, token_is_16_lowercase_hex_and_stable) { auto const token = redactAccount("rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh"); EXPECT_EQ(token.size(), 16u); - EXPECT_TRUE(std::all_of(token.begin(), token.end(), [](unsigned char c) { + EXPECT_TRUE(std::ranges::all_of(token, [](unsigned char c) { return std::isdigit(c) || (c >= 'a' && c <= 'f'); })); // Deterministic: hashing the same input twice yields the same token. From 6938614468e3560b85d4fc83623081c95cbcc30b Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:20:01 +0100 Subject: [PATCH 3/4] fix(telemetry): remove unused includes (misc-include-cleaner) Remove unused SpanNames.h from Transactor.cpp (transitively included via TxApplySpanNames.h). Remove unused from TraceContextValidation.h (std::ranges::any_of lives in ). Co-Authored-By: Claude Opus 4.6 --- include/xrpl/telemetry/TraceContextValidation.h | 1 - src/libxrpl/tx/Transactor.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/include/xrpl/telemetry/TraceContextValidation.h b/include/xrpl/telemetry/TraceContextValidation.h index c1039d1e53..1c1554acf0 100644 --- a/include/xrpl/telemetry/TraceContextValidation.h +++ b/include/xrpl/telemetry/TraceContextValidation.h @@ -46,7 +46,6 @@ #include #include -#include #include namespace xrpl::telemetry { diff --git a/src/libxrpl/tx/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp index e2752ba67b..daafb4c6e4 100644 --- a/src/libxrpl/tx/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include From 749535a3cabe5b3d7eaecb6214932b5237c7054c Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Wed, 8 Jul 2026 15:22:24 +0100 Subject: [PATCH 4/4] fix(telemetry): resolve clang-tidy CI errors in consensus tracing Add missing include in Consensus.h and RCLConsensus.h. Remove unused SHAMap.h include from RCLConsensus.h. Add braces around single-line if/else bodies in RCLConsensus.cpp. Co-Authored-By: Claude Opus 4.6 --- src/xrpld/app/consensus/RCLConsensus.cpp | 6 ++++++ src/xrpld/app/consensus/RCLConsensus.h | 2 +- src/xrpld/consensus/Consensus.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 978d9c9ee2..25abfb6d51 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -1269,11 +1269,15 @@ RCLConsensus::Adaptor::startRoundTracing(RCLCxLedger const& prevLgr) // TraceCategory-aware, so gate it explicitly to match the gating // of the hashSpan/span factories used below. if (link != nullptr && app_.getTelemetry().shouldTraceConsensus()) + { roundSpan_.emplace(telemetry::SpanGuard::linkedSpan(cs::round, *link)); + } else + { roundSpan_.emplace( telemetry::SpanGuard::span( telemetry::TraceCategory::Consensus, telemetry::seg::consensus, cs::op::round)); + } } else { @@ -1289,7 +1293,9 @@ RCLConsensus::Adaptor::startRoundTracing(RCLCxLedger const& prevLgr) } if (!*roundSpan_) + { return; + } roundSpan_->setAttribute(cs::attr::ledgerId, to_string(prevLgr.id()).c_str()); roundSpan_->setAttribute(cs::attr::ledgerSeq, static_cast(prevLgr.seq()) + 1); diff --git a/src/xrpld/app/consensus/RCLConsensus.h b/src/xrpld/app/consensus/RCLConsensus.h index 493acbef82..37b8724abc 100644 --- a/src/xrpld/app/consensus/RCLConsensus.h +++ b/src/xrpld/app/consensus/RCLConsensus.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include namespace xrpl { diff --git a/src/xrpld/consensus/Consensus.h b/src/xrpld/consensus/Consensus.h index 270f9f8771..240dd11560 100644 --- a/src/xrpld/consensus/Consensus.h +++ b/src/xrpld/consensus/Consensus.h @@ -26,6 +26,7 @@ #include #include #include +#include #include namespace xrpl {