Summary
While reading Quality.h I noticed a typo in the templated overload of Quality::ceilOut<TAmounts<In, Out>>: it calls ceil_TAmounts_helper(...), but the private helper is named ceilTAmountsHelper (no underscores). The three sibling templates (ceilIn, ceilInStrict, ceilOutStrict) all call the correctly spelled ceilTAmountsHelper.
Location
include/xrpl/protocol/Quality.h, line 355:
template <class In, class Out>
TAmounts<In, Out>
Quality::ceilOut(TAmounts<In, Out> const& amount, Out const& limit) const
{
// Construct a function pointer to the function we want to call.
static constexpr Amounts (Quality::*kCeilOutFnPtr)(Amounts const&, STAmount const&) const =
&Quality::ceilOut;
return ceil_TAmounts_helper(amount, limit, amount.out, kCeilOutFnPtr); // <-- typo
}
The correctly spelled helper is declared around line 222 and defined around line 307 (Quality::ceilTAmountsHelper).
Why the build is not broken today
This is latent dead code: the template is never instantiated anywhere in the codebase. The existing callers resolve to the non-template overload Quality::ceilOut(Amounts const&, STAmount const&):
src/test/protocol/Quality_test.cpp:65 - the test helper constructs Amounts (a pair of STAmount), so it picks the STAmount overload.
src/test/app/AMMCalc_test.cpp:234 - steps is std::vector<std::pair<Amounts, bool>> (line 49), so amts is again Amounts, not TAmounts<IOUAmount, IOUAmount>.
Since template code is only type-checked at instantiation, the misspelled name goes unnoticed until someone actually calls ceilOut with TAmounts<In, Out> arguments, at which point they get a confusing compile error about an undefined identifier.
Impact
None at runtime. This is purely a code quality issue. It removes a trap for future callers of the typed (IOUAmount / XRPAmount) ceilOut overload.
Suggested fix
One word rename:
- return ceil_TAmounts_helper(amount, limit, amount.out, kCeilOutFnPtr);
+ return ceilTAmountsHelper(amount, limit, amount.out, kCeilOutFnPtr);
Optionally, a small unit test that instantiates ceilOut<TAmounts<IOUAmount, IOUAmount>> (mirroring the existing ceilIn tests) would prevent this class of typo from regressing.
Summary
While reading
Quality.hI noticed a typo in the templated overload ofQuality::ceilOut<TAmounts<In, Out>>: it callsceil_TAmounts_helper(...), but the private helper is namedceilTAmountsHelper(no underscores). The three sibling templates (ceilIn,ceilInStrict,ceilOutStrict) all call the correctly spelledceilTAmountsHelper.Location
include/xrpl/protocol/Quality.h, line 355:The correctly spelled helper is declared around line 222 and defined around line 307 (
Quality::ceilTAmountsHelper).Why the build is not broken today
This is latent dead code: the template is never instantiated anywhere in the codebase. The existing callers resolve to the non-template overload
Quality::ceilOut(Amounts const&, STAmount const&):src/test/protocol/Quality_test.cpp:65- the test helper constructsAmounts(a pair ofSTAmount), so it picks the STAmount overload.src/test/app/AMMCalc_test.cpp:234-stepsisstd::vector<std::pair<Amounts, bool>>(line 49), soamtsis againAmounts, notTAmounts<IOUAmount, IOUAmount>.Since template code is only type-checked at instantiation, the misspelled name goes unnoticed until someone actually calls
ceilOutwithTAmounts<In, Out>arguments, at which point they get a confusing compile error about an undefined identifier.Impact
None at runtime. This is purely a code quality issue. It removes a trap for future callers of the typed (IOUAmount / XRPAmount)
ceilOutoverload.Suggested fix
One word rename:
Optionally, a small unit test that instantiates
ceilOut<TAmounts<IOUAmount, IOUAmount>>(mirroring the existingceilIntests) would prevent this class of typo from regressing.