mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-27 15:28:03 +00:00
Review of the preceding commits found a clang-tidy failure and a convention break, both rooted in the same place: the enum-to-label helpers were put in ConsensusSpanNames.h, which pulled two domain headers into it. misc-include-cleaner rejected the new test: it used xrpl::LedgerCloseReason without directly including ConsensusTypes.h, relying on the transitive include. misc-* is enabled and this path is not in IgnoreHeaders, so it would have failed CI. ConsensusSpanNames.h had also become the only one of the eight *SpanNames.h headers to include anything beyond SpanNames.h. That cost is paid by every consumer: PeerImp.cpp, ConsensusReceiveTracing.h and RCLConsensus.cpp want only name and key constants, but were newly compiling ConsensusTypes.h and DisputedTx.h through it. Move both helpers to a new ConsensusSpanLabels.h, which owns the domain includes. ConsensusSpanNames.h is dependency-free again like its siblings, and the labels reach their only production caller, Consensus.h, directly. Also from the review: - phaseOpen() had grown to 81 lines, over the 80-line limit. Extract annotateOpenStart() and annotateOpenClose(), which also removes the repeated span guards. phaseOpen is 72 lines; startRoundInternal drops 103 to 93, still over the limit but it was 99 before this work began. - Note at the CLOG why the log text keeps the shouldCloseLedger name: existing consumers match on it. - whyCloseLedger's doc claimed "both log identically", implying the wrapper logs too. It delegates, so the logging happens once either way. - Cross-reference proposers_validated and proposers_finished, which sit eight lines apart and count different things: validators of the previous ledger versus those already past it. - The two static_asserts no longer sit inside TEST bodies with SUCCEED(); they fire at compile time regardless. Also "consteval-safe" was wrong; they are constexpr. - SpanGuardFactory.cpp claimed a libxrpl test cannot include the consensus span-name header. The new test in the same directory does exactly that, so the claim is corrected to name the real constraint: the rpc_* constants it needs live in an xrpld-level header.